Decompiled source of funy1 Modpack v1.2.0
plugins/GamblersMod.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GamblersMod.Patches; using GamblersMod.Player; using GamblersMod.RoundManagerCustomSpace; using GamblersMod.config; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("GamblersMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("GamblersMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4389dd08-eb54-4b6f-955c-5f772ecc6fc7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { } } namespace GamblersMod { public class GamblingMachineManager : MonoBehaviour { public List<GameObject> GamblingMachines; public static GamblingMachineManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } Plugin.mls.LogMessage((object)"Gambling machine manager has awoken!"); GamblingMachines = new List<GameObject>(); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } public void Spawn(Vector3 spawnPoint, Quaternion quaternion) { //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_0054: Unknown result type (might be due to invalid IL or missing references) Plugin.mls.LogMessage((object)$"Spawning gambling machine... #{GamblingMachines.Count}"); GameObject val = Object.Instantiate<GameObject>(Plugin.GamblingMachine, spawnPoint, quaternion); val.tag = "Untagged"; val.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); val.layer = LayerMask.NameToLayer("InteractableObject"); val.GetComponent<NetworkObject>().Spawn(false); if (GamblingMachines.Count >= 1) { val.GetComponent<AudioSource>().Pause(); } GamblingMachines.Add(val); } public void DespawnAll() { Plugin.mls.LogMessage((object)"Despwawning gambling machine..."); foreach (GameObject gamblingMachine in GamblingMachines) { gamblingMachine.GetComponent<NetworkObject>().Despawn(true); } Reset(); } public void Reset() { Plugin.mls.LogInfo((object)"Resetting gambling machine manager state..."); GamblingMachines.Clear(); } } [BepInPlugin("Junypai.GamblersMod", "Gamblers Mod", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "Junypai.GamblersMod"; public const string modName = "Gamblers Mod"; public const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Junypai.GamblersMod"); public static Plugin Instance; public static GameObject GamblingMachine; public static AudioClip GamblingJackpotScrapAudio; public static AudioClip GamblingHalveScrapAudio; public static AudioClip GamblingRemoveScrapAudio; public static AudioClip GamblingDoubleScrapAudio; public static AudioClip GamblingTripleScrapAudio; public static AudioClip GamblingDrumrollScrapAudio; public static GameObject GamblingATMMachine; public static AudioClip GamblingMachineMusicAudio; public static GameObject GamblingMachineResultCanvas; public static Font GamblingFont; public static GameObject GamblingHandIcon; public static GambleConfigSettingsSerializable UserConfigSnapshot; public static GambleConfigSettingsSerializable RecentHostConfig; public static GambleConfigSettingsSerializable CurrentUserConfig; public static ManualLogSource mls; private void Awake() { //IL_0177: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } NetcodeWeaver(); mls = Logger.CreateLogSource("Junypai.GamblersMod"); CurrentUserConfig = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); RecentHostConfig = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); UserConfigSnapshot = new GambleConfigSettingsSerializable(((BaseUnityPlugin)this).Config); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); mls.LogInfo((object)"Loading gambler bundle assets"); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "gamblingmachinebundle")); if (!Object.op_Implicit((Object)(object)val)) { mls.LogError((object)"Unable to load gambler bundle assets"); } else { mls.LogInfo((object)"Gamblers bundle assets successfully loaded"); } GamblingDrumrollScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "drumroll"); GamblingJackpotScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "holyshit"); GamblingHalveScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "cricket"); GamblingRemoveScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "womp"); GamblingMachineMusicAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "machineMusic"); GamblingDoubleScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "doublekill"); GamblingTripleScrapAudio = LoadAssetFromAssetBundleAndLogInfo<AudioClip>(val, "triplekill"); GamblingFont = LoadAssetFromAssetBundleAndLogInfo<Font>(val, "3270-Regular"); GamblingMachine = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "GamblingMachine"); GamblingHandIcon = LoadAssetFromAssetBundleAndLogInfo<GameObject>(val, "HandIconGO"); GamblingMachine.AddComponent<GamblingMachine>(); new GameObject().AddComponent<GamblingMachineManager>(); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); } private T LoadAssetFromAssetBundleAndLogInfo<T>(AssetBundle bundle, string assetName) where T : Object { T val = bundle.LoadAsset<T>(assetName); if (!Object.op_Implicit((Object)(object)val)) { mls.LogError((object)(assetName + " asset failed to load")); } else { mls.LogInfo((object)(assetName + " asset successfully loaded")); } return val; } private static void NetcodeWeaver() { 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); } } } } } public class StartOfRoundCustom : NetworkBehaviour { private void Awake() { } [ServerRpc] public void DespawnGamblingMachineServerRpc() { //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(1680317104u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1680317104u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GamblingMachineManager.Instance.DespawnAll(); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_StartOfRoundCustom() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1680317104u, new RpcReceiveHandler(__rpc_handler_1680317104)); } private static void __rpc_handler_1680317104(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; ((StartOfRoundCustom)(object)target).DespawnGamblingMachineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "StartOfRoundCustom"; } } } namespace GamblersMod.RoundManagerCustomSpace { internal class RoundManagerCustom : NetworkBehaviour { public RoundManager RoundManager; private List<Vector3> spawnPoints; private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references) RoundManager = ((Component)this).GetComponent<RoundManager>(); spawnPoints = new List<Vector3>(); spawnPoints.Add(new Vector3(-27.808f, -2.6256f, -9.7409f)); spawnPoints.Add(new Vector3(-27.808f, -2.6256f, -4.7409f)); spawnPoints.Add(new Vector3(-27.808f, -2.6256f, 0.7409f)); spawnPoints.Add(new Vector3(-27.808f, -2.6256f, 6.7409f)); } [ServerRpc] public void DespawnGamblingMachineServerRpc() { //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(3258984052u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3258984052u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GamblingMachineManager.Instance.DespawnAll(); } } [ServerRpc] public void SpawnGamblingMachineServerRpc() { //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 //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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 != 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(2764001088u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2764001088u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Plugin.mls.LogInfo((object)("Attempting to spawn gambling machine at " + ((Object)RoundManager.currentLevel).name)); for (int i = 0; i < Plugin.CurrentUserConfig.configNumberOfMachines && i < spawnPoints.Count; i++) { GamblingMachineManager.Instance.Spawn(spawnPoints[i], Quaternion.Euler(0f, 90f, 0f)); Plugin.mls.LogInfo((object)$"Spawned machine number: {i}"); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RoundManagerCustom() { //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 NetworkManager.__rpc_func_table.Add(3258984052u, new RpcReceiveHandler(__rpc_handler_3258984052)); NetworkManager.__rpc_func_table.Add(2764001088u, new RpcReceiveHandler(__rpc_handler_2764001088)); } private static void __rpc_handler_3258984052(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; ((RoundManagerCustom)(object)target).DespawnGamblingMachineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2764001088(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; ((RoundManagerCustom)(object)target).SpawnGamblingMachineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RoundManagerCustom"; } } } namespace GamblersMod.Player { internal class PlayerControllerCustom : NetworkBehaviour { private PlayerGamblingUIManager PlayerGamblingUIManager; private PlayerControllerB PlayerControllerOriginal; public bool isUsingGamblingMachine; private void Awake() { PlayerGamblingUIManager = ((Component)this).gameObject.AddComponent<PlayerGamblingUIManager>(); PlayerControllerOriginal = ((Component)this).gameObject.GetComponent<PlayerControllerB>(); } private void Update() { //IL_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) if (!((NetworkBehaviour)this).IsOwner) { return; } Camera gameplayCamera = PlayerControllerOriginal.gameplayCamera; Vector3 position = ((Component)gameplayCamera).transform.position; Vector3 forward = ((Component)gameplayCamera).transform.forward; Ray val = default(Ray); ((Ray)(ref val))..ctor(position, forward); float num = 5f; int num2 = 512; RaycastHit val2 = default(RaycastHit); bool flag = Physics.Raycast(val, ref val2, num, num2); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider)) { GameObject gameObject = ((Component)((RaycastHit)(ref val2)).transform).gameObject; if (((Object)gameObject).name.Contains("GamblingMachine")) { PlayerGamblingUIManager.ShowInteractionText(); GrabbableObject val3 = PlayerControllerOriginal.ItemSlots[PlayerControllerOriginal.currentItemSlot]; GamblingMachine component = gameObject.GetComponent<GamblingMachine>(); if (component.isInCooldownPhase()) { PlayerGamblingUIManager.SetInteractionText($"Cooling down... {component.gamblingMachineCurrentCooldown}"); } else if (component.numberOfUses <= 0) { PlayerGamblingUIManager.SetInteractionText("This machine is all used up"); } else { string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false), 0, (DisplayStringOptions)0); if (isUsingGamblingMachine) { PlayerGamblingUIManager.SetInteractionText("You're already using a machine"); } else { PlayerGamblingUIManager.SetInteractionText("Gamble: [" + bindingDisplayString + "]"); } } if (Object.op_Implicit((Object)(object)val3)) { PlayerGamblingUIManager.SetInteractionSubText($"Scrap value on hand: ■{val3.scrapValue}"); } else { PlayerGamblingUIManager.SetInteractionSubText("Please hold a scrap on your hand"); } } if (((Object)gameObject).name.Contains("GamblingMachine") && IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).triggered) { GamblingMachine component2 = gameObject.GetComponent<GamblingMachine>(); handleGamblingMachineInput(component2); } } else { PlayerGamblingUIManager.HideInteractionText(); } } public void ReleaseGamblingMachineLock() { Plugin.mls.LogInfo((object)$"Releasing gambling machine lock for: {((NetworkBehaviour)this).OwnerClientId}"); isUsingGamblingMachine = false; } public void LockGamblingMachine() { Plugin.mls.LogInfo((object)$"Locking gambling machine for: {((NetworkBehaviour)this).OwnerClientId}"); isUsingGamblingMachine = true; } private void handleGamblingMachineInput(GamblingMachine GamblingMachineHit) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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) GrabbableObject val = PlayerControllerOriginal.ItemSlots[PlayerControllerOriginal.currentItemSlot]; if (Object.op_Implicit((Object)(object)val) && !GamblingMachineHit.isInCooldownPhase() && GamblingMachineHit.numberOfUses > 0 && !isUsingGamblingMachine) { Plugin.mls.LogInfo((object)("Gambling machine was interacted with by: " + PlayerControllerOriginal.playerUsername)); GamblingMachineHit.SetCurrentGamblingCooldownToMaxCooldown(); Plugin.mls.LogMessage((object)$"Scrap value of {((Object)val).name} on hand: ▊{val.scrapValue}"); GamblingMachineHit.ActivateGamblingMachineServerRPC(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)this)); PlayerGamblingUIManager.SetInteractionText($"Cooling down... {GamblingMachineHit.gamblingMachineCurrentCooldown}"); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PlayerControllerCustom"; } } } namespace GamblersMod.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(GameNetworkManager __instance) { Plugin.mls.LogInfo((object)"Adding Gambling machine to network prefab"); NetworkManager.Singleton.AddNetworkPrefab(Plugin.GamblingMachine); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void StartDisconnectPatch() { Plugin.mls.LogInfo((object)"Player disconnected. Resetting the user's configuration settings."); Plugin.CurrentUserConfig = Plugin.UserConfigSnapshot; GamblingMachineManager.Instance.Reset(); } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(StartOfRound __instance) { Plugin.mls.LogInfo((object)"StartOfRoundPatch has awoken"); } } public class PlayerGamblingUIManager : NetworkBehaviour { private GameObject gamblingMachineInteractionTextCanvasObject; private Canvas gamblingMachineInteractionTextCanvas; private GameObject gamblingMachineInteractionTextObject; private GameObject gamblingMachineInteractionScrapInfoTextObject; private Text gamblingMachineInteractionScrapInfoText; private Text gamblingMachineInteractionText; private string interactionName; private string interactionText; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) gamblingMachineInteractionTextCanvasObject = new GameObject(); gamblingMachineInteractionTextCanvasObject.transform.parent = ((Component)this).transform; interactionName = "gamblingMachine"; ((Object)gamblingMachineInteractionTextCanvasObject).name = interactionName + "InteractionTextCanvasObject"; gamblingMachineInteractionTextCanvasObject.AddComponent<Canvas>(); gamblingMachineInteractionTextCanvasObject.SetActive(false); gamblingMachineInteractionTextCanvas = gamblingMachineInteractionTextCanvasObject.GetComponent<Canvas>(); gamblingMachineInteractionTextCanvas.renderMode = (RenderMode)0; gamblingMachineInteractionTextCanvasObject.AddComponent<CanvasScaler>(); gamblingMachineInteractionTextCanvasObject.AddComponent<GraphicRaycaster>(); gamblingMachineInteractionTextObject = new GameObject(); ((Object)gamblingMachineInteractionTextObject).name = interactionName + "InteractionTextObject"; gamblingMachineInteractionTextObject.AddComponent<Text>(); Transform transform = gamblingMachineInteractionTextObject.transform; Rect rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; float num = ((Rect)(ref rect)).width / 2f - 20f; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; transform.localPosition = new Vector3(num, ((Rect)(ref rect)).height / 2f - 50f, 0f); gamblingMachineInteractionText = gamblingMachineInteractionTextObject.GetComponent<Text>(); gamblingMachineInteractionText.text = interactionText; gamblingMachineInteractionText.alignment = (TextAnchor)4; gamblingMachineInteractionText.font = Plugin.GamblingFont; ((Graphic)gamblingMachineInteractionText).rectTransform.sizeDelta = new Vector2(500f, 400f); gamblingMachineInteractionText.fontSize = 26; ((Component)gamblingMachineInteractionText).transform.parent = gamblingMachineInteractionTextCanvasObject.transform; gamblingMachineInteractionScrapInfoTextObject = new GameObject(); ((Object)gamblingMachineInteractionScrapInfoTextObject).name = interactionName + "InteractionScrapInfoTextObject"; gamblingMachineInteractionScrapInfoTextObject.AddComponent<Text>(); Transform transform2 = gamblingMachineInteractionScrapInfoTextObject.transform; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; float num2 = ((Rect)(ref rect)).width / 2f - 20f; rect = ((Component)gamblingMachineInteractionTextCanvas).GetComponent<RectTransform>().rect; transform2.localPosition = new Vector3(num2, ((Rect)(ref rect)).height / 2f - 100f, 0f); gamblingMachineInteractionScrapInfoText = gamblingMachineInteractionScrapInfoTextObject.GetComponent<Text>(); gamblingMachineInteractionScrapInfoText.text = interactionText; gamblingMachineInteractionScrapInfoText.alignment = (TextAnchor)4; gamblingMachineInteractionScrapInfoText.font = Plugin.GamblingFont; ((Graphic)gamblingMachineInteractionScrapInfoText).rectTransform.sizeDelta = new Vector2(500f, 300f); gamblingMachineInteractionScrapInfoText.fontSize = 18; ((Graphic)gamblingMachineInteractionScrapInfoText).color = Color.green; ((Component)gamblingMachineInteractionScrapInfoText).transform.parent = gamblingMachineInteractionTextCanvasObject.transform; } public void SetInteractionText(string text) { gamblingMachineInteractionText.text = text; } public void SetInteractionSubText(string text) { gamblingMachineInteractionScrapInfoText.text = text; } public void ShowInteractionText() { gamblingMachineInteractionTextCanvasObject.SetActive(true); } public void HideInteractionText() { gamblingMachineInteractionTextCanvasObject.SetActive(false); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "PlayerGamblingUIManager"; } } internal class GamblingMachine : NetworkBehaviour { private int gamblingMachineMaxCooldown; public int gamblingMachineCurrentCooldown = 0; private float jackpotMultiplier; private float tripleMultiplier; private float doubleMultiplier; private float halvedMultiplier; private float zeroMultiplier; private int jackpotPercentage; private int triplePercentage; private int doublePercentage; private int halvedPercentage; private int removedPercentage; private bool isMusicEnabled = true; private float musicVolume = 0.35f; private int rollMinValue; private int rollMaxValue; private int currentRoll = 100; public float currentGamblingOutcomeMultiplier = 1f; public string currentGamblingOutcome = GambleConstants.GamblingOutcome.DEFAULT; private Coroutine CountdownCooldownCoroutineBeingRan; private bool lockGamblingMachineServer = false; public int numberOfUses; private void Awake() { Plugin.mls.LogInfo((object)"GamblingMachine has Awoken"); gamblingMachineMaxCooldown = Plugin.CurrentUserConfig.configMaxCooldown; numberOfUses = Plugin.CurrentUserConfig.configNumberOfUses; jackpotMultiplier = Plugin.CurrentUserConfig.configJackpotMultiplier; tripleMultiplier = Plugin.CurrentUserConfig.configTripleMultiplier; doubleMultiplier = Plugin.CurrentUserConfig.configDoubleMultiplier; halvedMultiplier = Plugin.CurrentUserConfig.configHalveMultiplier; zeroMultiplier = Plugin.CurrentUserConfig.configZeroMultiplier; jackpotPercentage = Plugin.CurrentUserConfig.configJackpotChance; triplePercentage = Plugin.CurrentUserConfig.configTripleChance; doublePercentage = Plugin.CurrentUserConfig.configDoubleChance; halvedPercentage = Plugin.CurrentUserConfig.configHalveChance; removedPercentage = Plugin.CurrentUserConfig.configZeroChance; isMusicEnabled = Plugin.CurrentUserConfig.configGamblingMusicEnabled; musicVolume = Plugin.CurrentUserConfig.configGamblingMusicVolume; Plugin.mls.LogInfo((object)$"GamblingMachine: gamblingMachineMaxCooldown loaded from config: {gamblingMachineMaxCooldown}"); Plugin.mls.LogInfo((object)$"GamblingMachine: jackpotMultiplier loaded from config: {jackpotMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: tripleMultiplier loaded from config: {tripleMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: doubleMultiplier loaded from config: {doubleMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: halvedMultiplier loaded from config: {halvedMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: zeroMultiplier loaded from config: {zeroMultiplier}"); Plugin.mls.LogInfo((object)$"GamblingMachine: jackpotPercentage loaded from config: {jackpotPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: triplePercentage loaded from config: {triplePercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: doublePercentage loaded from config: {doublePercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: halvedPercentage loaded from config: {halvedPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: removedPercentage loaded from config: {removedPercentage}"); Plugin.mls.LogInfo((object)$"GamblingMachine: gamblingMusicEnabled loaded from config: {isMusicEnabled}"); Plugin.mls.LogInfo((object)$"GamblingMachine: gamblingMusicVolume loaded from config: {musicVolume}"); InitAudioSource(); rollMinValue = 1; rollMaxValue = jackpotPercentage + triplePercentage + doublePercentage + halvedPercentage + removedPercentage; } private void Start() { Plugin.mls.LogInfo((object)"GamblingMachine has Started"); } public void GenerateGamblingOutcomeFromCurrentRoll() { bool flag = currentRoll >= rollMinValue && currentRoll <= jackpotPercentage; int num = jackpotPercentage; int num2 = jackpotPercentage + triplePercentage; bool flag2 = currentRoll > num && currentRoll <= num2; int num3 = num2; int num4 = num2 + doublePercentage; bool flag3 = currentRoll > num3 && currentRoll <= num4; int num5 = num4; int num6 = num4 + halvedPercentage; bool flag4 = currentRoll > num5 && currentRoll <= num6; if (flag) { Plugin.mls.LogMessage((object)"Rolled Jackpot"); currentGamblingOutcomeMultiplier = jackpotMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.JACKPOT; } else if (flag2) { Plugin.mls.LogMessage((object)"Rolled Triple"); currentGamblingOutcomeMultiplier = tripleMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.TRIPLE; } else if (flag3) { Plugin.mls.LogMessage((object)"Rolled Double"); currentGamblingOutcomeMultiplier = doubleMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.DOUBLE; } else if (flag4) { Plugin.mls.LogMessage((object)"Rolled Halved"); currentGamblingOutcomeMultiplier = halvedMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.HALVE; } else { Plugin.mls.LogMessage((object)"Rolled Remove"); currentGamblingOutcomeMultiplier = zeroMultiplier; currentGamblingOutcome = GambleConstants.GamblingOutcome.REMOVE; } } public void PlayGambleResultAudio(string outcome) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00dc: Unknown result type (might be due to invalid IL or missing references) if (outcome == GambleConstants.GamblingOutcome.JACKPOT) { AudioSource.PlayClipAtPoint(Plugin.GamblingJackpotScrapAudio, ((Component)this).transform.position, 0.6f); } else if (outcome == GambleConstants.GamblingOutcome.TRIPLE) { AudioSource.PlayClipAtPoint(Plugin.GamblingTripleScrapAudio, ((Component)this).transform.position, 0.6f); } else if (outcome == GambleConstants.GamblingOutcome.DOUBLE) { AudioSource.PlayClipAtPoint(Plugin.GamblingDoubleScrapAudio, ((Component)this).transform.position, 0.6f); } else if (outcome == GambleConstants.GamblingOutcome.HALVE) { AudioSource.PlayClipAtPoint(Plugin.GamblingHalveScrapAudio, ((Component)this).transform.position, 0.6f); } else if (outcome == GambleConstants.GamblingOutcome.REMOVE) { AudioSource.PlayClipAtPoint(Plugin.GamblingRemoveScrapAudio, ((Component)this).transform.position, 0.6f); } } public void PlayDrumRoll() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) AudioSource.PlayClipAtPoint(Plugin.GamblingDrumrollScrapAudio, ((Component)this).transform.position, 0.6f); } public void BeginGamblingMachineCooldown(Action onCountdownFinish) { SetCurrentGamblingCooldownToMaxCooldown(); if (CountdownCooldownCoroutineBeingRan != null) { ((MonoBehaviour)this).StopCoroutine(CountdownCooldownCoroutineBeingRan); } CountdownCooldownCoroutineBeingRan = ((MonoBehaviour)this).StartCoroutine(CountdownCooldownCoroutine(onCountdownFinish)); } public bool isInCooldownPhase() { return gamblingMachineCurrentCooldown > 0; } private IEnumerator CountdownCooldownCoroutine(Action onCountdownFinish) { Plugin.mls.LogInfo((object)"Start gambling machine cooldown"); while (gamblingMachineCurrentCooldown > 0) { yield return (object)new WaitForSeconds(1f); gamblingMachineCurrentCooldown--; Plugin.mls.LogMessage((object)$"Gambling machine cooldown: {gamblingMachineCurrentCooldown}"); } onCountdownFinish(); Plugin.mls.LogMessage((object)"End gambling machine cooldown"); } public void SetCurrentGamblingCooldownToMaxCooldown() { gamblingMachineCurrentCooldown = gamblingMachineMaxCooldown; } public void SetRoll(int newRoll) { currentRoll = newRoll; } public int RollDice() { int result = Random.Range(rollMinValue, rollMaxValue); Plugin.mls.LogMessage((object)$"rollMinValue: {rollMinValue}"); Plugin.mls.LogMessage((object)$"rollMaxValue: {rollMaxValue}"); Plugin.mls.LogMessage((object)$"Roll value: {currentRoll}"); return result; } public int GetScrapValueBasedOnGambledOutcome(GrabbableObject scrap) { return (int)Mathf.Floor((float)scrap.scrapValue * currentGamblingOutcomeMultiplier); } [ServerRpc(RequireOwnership = false)] public void ActivateGamblingMachineServerRPC(NetworkBehaviourReference scrapBeingGambledRef, NetworkBehaviourReference playerWhoGambledRef, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3977934568u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref playerWhoGambledRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3977934568u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || !((NetworkBehaviour)this).IsServer) { return; } if (numberOfUses <= 0) { Plugin.mls.LogWarning((object)"ActivateGamblingMachineServerRPC: Machine usage limit has been reached"); return; } if (lockGamblingMachineServer) { Plugin.mls.LogWarning((object)$"Gambling machine is already processing one client's request. Throwing away a request for... {serverRpcParams.Receive.SenderClientId}"); return; } lockGamblingMachineServer = true; numberOfUses--; Plugin.mls.LogInfo((object)$"ActivateGamblingMachineServerRPC: Number of uses left: {numberOfUses}"); GrabbableObject scrap = default(GrabbableObject); if (!((NetworkBehaviourReference)(ref scrapBeingGambledRef)).TryGet<GrabbableObject>(ref scrap, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineServerRPC: Failed to get scrap value on client side."); return; } BeginGamblingMachineCooldownClientRpc(); Plugin.mls.LogMessage((object)("ActivateGamblingMachineServerRPC: Starting gambling machine cooldown phase in the server invoked by: " + serverRpcParams.Receive.SenderClientId)); SetRoll(RollDice()); GenerateGamblingOutcomeFromCurrentRoll(); int scrapValueBasedOnGambledOutcome = GetScrapValueBasedOnGambledOutcome(scrap); ActivateGamblingMachineClientRPC(scrapBeingGambledRef, playerWhoGambledRef, serverRpcParams.Receive.SenderClientId, scrapValueBasedOnGambledOutcome, currentGamblingOutcome, numberOfUses); } [ClientRpc] private void ActivateGamblingMachineClientRPC(NetworkBehaviourReference scrapBeingGambledRef, NetworkBehaviourReference playerWhoGambledRef, ulong invokerId, int updatedScrapValue, string outcome, int numberOfUsesServer) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_00a7: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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(875756295u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerWhoGambledRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, invokerId); BytePacker.WriteValueBitPacked(val2, updatedScrapValue); bool flag = outcome != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(outcome, false); } BytePacker.WriteValueBitPacked(val2, numberOfUsesServer); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 875756295u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkBehaviourReference scrapBeingGambledRef2 = scrapBeingGambledRef; int updatedScrapValue2 = updatedScrapValue; string outcome2 = outcome; Plugin.mls.LogInfo((object)"ActivateGamblingMachineClientRPC: Activiating gambling machines on client..."); numberOfUses = numberOfUsesServer; Plugin.mls.LogInfo((object)$"ActivateGamblingMachineClientRPC: Number of uses left: {numberOfUses}"); PlayerControllerCustom playerWhoGambled = default(PlayerControllerCustom); if (!((NetworkBehaviourReference)(ref playerWhoGambledRef)).TryGet<PlayerControllerCustom>(ref playerWhoGambled, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineClientRPC: Failed to get player who gambled."); return; } playerWhoGambled.LockGamblingMachine(); PlayDrumRoll(); BeginGamblingMachineCooldown(delegate { GrabbableObject val3 = default(GrabbableObject); if (!((NetworkBehaviourReference)(ref scrapBeingGambledRef2)).TryGet<GrabbableObject>(ref val3, (NetworkManager)null)) { Plugin.mls.LogError((object)"ActivateGamblingMachineClientRPC: Failed to get scrap value on client side."); } else { Plugin.mls.LogInfo((object)$"Setting scrap value to: {updatedScrapValue2}"); val3.SetScrapValue(updatedScrapValue2); PlayGambleResultAudio(outcome2); playerWhoGambled.ReleaseGamblingMachineLock(); if (((NetworkBehaviour)this).IsServer) { Plugin.mls.LogMessage((object)"Unlocking gambling machine"); lockGamblingMachineServer = false; } } }); } [ClientRpc] private void BeginGamblingMachineCooldownClientRpc() { //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(1546410253u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1546410253u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Plugin.mls.LogInfo((object)"Setting machine cooldown to max"); SetCurrentGamblingCooldownToMaxCooldown(); } } } private void InitAudioSource() { if (!isMusicEnabled) { ((Component)this).GetComponent<AudioSource>().Pause(); } ((Component)this).GetComponent<AudioSource>().volume = musicVolume; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_GamblingMachine() { //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 NetworkManager.__rpc_func_table.Add(3977934568u, new RpcReceiveHandler(__rpc_handler_3977934568)); NetworkManager.__rpc_func_table.Add(875756295u, new RpcReceiveHandler(__rpc_handler_875756295)); NetworkManager.__rpc_func_table.Add(1546410253u, new RpcReceiveHandler(__rpc_handler_1546410253)); } private static void __rpc_handler_3977934568(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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference scrapBeingGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); NetworkBehaviourReference playerWhoGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerWhoGambledRef, default(ForNetworkSerializable)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((GamblingMachine)(object)target).ActivateGamblingMachineServerRPC(scrapBeingGambledRef, playerWhoGambledRef, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_875756295(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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference scrapBeingGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapBeingGambledRef, default(ForNetworkSerializable)); NetworkBehaviourReference playerWhoGambledRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerWhoGambledRef, default(ForNetworkSerializable)); ulong invokerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref invokerId); int updatedScrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref updatedScrapValue); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string outcome = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref outcome, false); } int numberOfUsesServer = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref numberOfUsesServer); target.__rpc_exec_stage = (__RpcExecStage)2; ((GamblingMachine)(object)target).ActivateGamblingMachineClientRPC(scrapBeingGambledRef, playerWhoGambledRef, invokerId, updatedScrapValue, outcome, numberOfUsesServer); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1546410253(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; ((GamblingMachine)(object)target).BeginGamblingMachineCooldownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "GamblingMachine"; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] public static void Awake(PlayerControllerB __instance) { ((Component)__instance).gameObject.AddComponent<PlayerControllerCustom>(); } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void ConnectClientToPlayerObjectPatch() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown Plugin.mls.LogInfo((object)"ConnectClientToPlayerObjectPatch"); if (NetworkManager.Singleton.IsHost) { Plugin.mls.LogInfo((object)("Registering host config message handler: Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST, new HandleNamedMessageDelegate(GambleConfigNetworkHelper.OnHostRecievesClientConfigRequest)); } else { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("Junypai.GamblersMod_" + GambleConstants.ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST, new HandleNamedMessageDelegate(GambleConfigNetworkHelper.OnClientRecievesHostConfigRequest)); GambleConfigNetworkHelper.StartClientRequestConfigFromHost(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { public static RoundManagerCustom RoundManagerCustom; [HarmonyPatch("Awake")] [HarmonyPostfix] public static void AwakePatch(RoundManager __instance) { Plugin.mls.LogInfo((object)"RoundManagerPatch has awoken"); RoundManagerCustom = ((Component)__instance).gameObject.AddComponent<RoundManagerCustom>(); } [HarmonyPatch("LoadNewLevelWait")] [HarmonyPrefix] public static void LoadNewLevelWaitPatch(RoundManager __instance) { Plugin.mls.LogInfo((object)"FinishGeneratingNewLevelServerRpcPatch was called"); if (__instance.currentLevel.levelID != 3) { Plugin.mls.LogInfo((object)"Despawning gambling machine..."); RoundManagerCustom.DespawnGamblingMachineServerRpc(); } if (__instance.currentLevel.levelID == 3) { Plugin.mls.LogInfo((object)"Spawning gambling machine..."); RoundManagerCustom.SpawnGamblingMachineServerRpc(); } } [HarmonyPatch("DespawnPropsAtEndOfRound")] [HarmonyPostfix] public static void DespawnPropsAtEndOfRoundPatch() { Plugin.mls.LogInfo((object)"End of round: despawning gambling machines"); RoundManagerCustom.DespawnGamblingMachineServerRpc(); } } } namespace GamblersMod.GrabbableObjectCustom { internal class GrabbableObjectCustom { } } namespace GamblersMod.config { public class GambleConfigNetworkHelper { public static void OnHostRecievesClientConfigRequest(ulong clientId, FastBufferReader _) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsHost) { return; } Plugin.mls.LogInfo((object)"Host recieved client config request."); Plugin.mls.LogInfo((object)"Serializing host config data..."); byte[] serializedSettings = SerializerHelper.GetSerializedSettings(Plugin.CurrentUserConfig); Plugin.mls.LogInfo((object)"Start writing host config data..."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(serializedSettings.Length + 4, (Allocator)2, -1); FastBufferWriter val2 = val; try { Plugin.mls.LogInfo((object)"Writing host config data"); int num = serializedSettings.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(serializedSettings, -1, 0); Plugin.mls.LogInfo((object)$"Sending host config data to client with id of {clientId}..."); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Junypai.GamblersMod_" + GambleConstants.ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST, clientId, val, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val2)).Dispose(); } } public static void StartClientRequestConfigFromHost() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.mls.LogInfo((object)"Client is requesting configuration from host"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("Junypai.GamblersMod_" + GambleConstants.ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST, 0uL, val, (NetworkDelivery)3); } } public static void OnClientRecievesHostConfigRequest(ulong _, FastBufferReader reader) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Plugin.mls.LogInfo((object)"Client recieved configuration message from host"); if (!((FastBufferReader)(ref reader)).TryBeginRead(4)) { Plugin.mls.LogError((object)"Could not sync client configuration with host. The stream sent by StartClientRequestConfigFromHost was invalid."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.mls.LogError((object)"Could not sync client configuration with host. Host could not serialize the data."); } byte[] settingsAsBytes = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref settingsAsBytes, num, 0); Plugin.RecentHostConfig = SerializerHelper.GetDeserializedSettings<GambleConfigSettingsSerializable>(settingsAsBytes); Plugin.CurrentUserConfig = Plugin.RecentHostConfig; Plugin.CurrentUserConfig.configGamblingMusicEnabled = Plugin.UserConfigSnapshot.configGamblingMusicEnabled; Plugin.CurrentUserConfig.configGamblingMusicVolume = Plugin.UserConfigSnapshot.configGamblingMusicVolume; ManualLogSource mls = Plugin.mls; mls.LogInfo((object)$"Cooldown value from config: {Plugin.CurrentUserConfig.configMaxCooldown}"); mls.LogInfo((object)$"Jackpot chance value from config: {Plugin.CurrentUserConfig.configJackpotChance}"); mls.LogInfo((object)$"Triple chance value from config: {Plugin.CurrentUserConfig.configTripleChance}"); mls.LogInfo((object)$"Double chance value from config: {Plugin.CurrentUserConfig.configDoubleChance}"); mls.LogInfo((object)$"Halve chance value from config: {Plugin.CurrentUserConfig.configHalveChance}"); mls.LogInfo((object)$"Zero chance value from config: {Plugin.CurrentUserConfig.configZeroChance}"); mls.LogInfo((object)$"Jackpot multiplier value from config: {Plugin.CurrentUserConfig.configJackpotMultiplier}"); mls.LogInfo((object)$"Triple multiplier value from config: {Plugin.CurrentUserConfig.configTripleMultiplier}"); mls.LogInfo((object)$"Double multiplier value from config: {Plugin.CurrentUserConfig.configDoubleMultiplier}"); mls.LogInfo((object)$"Halve multiplier value from config: {Plugin.CurrentUserConfig.configHalveMultiplier}"); mls.LogInfo((object)$"Zero multiplier value from config: {Plugin.CurrentUserConfig.configZeroMultiplier}"); mls.LogInfo((object)$"Audio enabled from config: {Plugin.CurrentUserConfig.configGamblingMusicEnabled}"); mls.LogInfo((object)$"Audio volume from config: {Plugin.CurrentUserConfig.configGamblingMusicVolume}"); mls.LogInfo((object)$"Number of uses from config: {Plugin.CurrentUserConfig.configNumberOfUses}"); mls.LogInfo((object)$"Number of machines from config: {Plugin.CurrentUserConfig.configNumberOfMachines}"); Plugin.mls.LogInfo((object)"Successfully synced a client with host configuration"); } } public class GambleConstants { [StructLayout(LayoutKind.Sequential, Size = 1)] public struct GamblingOutcome { public static string JACKPOT = "JACKPOT"; public static string TRIPLE = "TRIPLE"; public static string DOUBLE = "DOUBLE"; public static string HALVE = "HALVE"; public static string REMOVE = "REMOVE"; public static string DEFAULT = "DEFAULT"; } public static readonly string GAMBLING_GENERAL_SECTION_KEY = "General Machine Settings"; public static readonly string GAMBLING_CHANCE_SECTION_KEY = "Gambling Chances"; public static readonly string GAMBLING_MULTIPLIERS_SECTION_KEY = "Gambling Multipliers"; public static readonly string GAMBLING_AUDIO_SECTION_KEY = "Audio"; public static readonly string CONFIG_MAXCOOLDOWN = "gamblingMachineMaxCooldown"; public static readonly string CONFIG_NUMBER_OF_USES = "Number Of Uses"; public static readonly string CONFIG_NUMBER_OF_MACHINES = "Number Of Machines"; public static readonly string CONFIG_JACKPOT_CHANCE_KEY = "JackpotChance"; public static readonly string CONFIG_TRIPLE_CHANCE_KEY = "TripleChance"; public static readonly string CONFIG_DOUBLE_CHANCE_KEY = "DoubleChance"; public static readonly string CONFIG_HALVE_CHANCE_KEY = "HalveChance"; public static readonly string CONFIG_ZERO_CHANCE_KEY = "ZeroChance"; public static readonly string CONFIG_JACKPOT_MULTIPLIER = "JackpotMultiplier"; public static readonly string CONFIG_TRIPLE_MULTIPLIER = "TripleMultiplier"; public static readonly string CONFIG_DOUBLE_MULTIPLIER = "DoubleMultiplier"; public static readonly string CONFIG_HALVE_MULTIPLIER = "HalveMultiplier"; public static readonly string CONFIG_ZERO_MULTIPLIER = "ZeroMultiplier"; public static readonly string CONFIG_GAMBLING_MUSIC_ENABLED = "GambleMachineMusicEnabled"; public static readonly string CONFIG_GAMBLING_MUSIC_VOLUME = "GambleMachineMusicVolume"; public static readonly string ON_HOST_RECIEVES_CLIENT_CONFIG_REQUEST = "OnHostRecievesClientConfigRequest"; public static readonly string ON_CLIENT_RECIEVES_HOST_CONFIG_REQUEST = "OnClientRecievesHostConfigRequest"; } [Serializable] public class GambleConfigSettingsSerializable { public int configMaxCooldown; public int configNumberOfUses; public int configNumberOfMachines; public int configJackpotChance; public int configTripleChance; public int configDoubleChance; public int configHalveChance; public int configZeroChance; public float configJackpotMultiplier; public float configTripleMultiplier; public float configDoubleMultiplier; public float configHalveMultiplier; public float configZeroMultiplier; public bool configGamblingMusicEnabled; public float configGamblingMusicVolume; public GambleConfigSettingsSerializable(ConfigFile configFile) { configFile.Bind<int>(GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_MAXCOOLDOWN, 4, "Cooldown of the machine. Reducing this will cause the drumroll sound to not sync & may also cause latency issues"); configFile.Bind<int>(GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_NUMBER_OF_USES, 9999, "Number of times a gambling machine can be used"); configFile.Bind<int>(GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_NUMBER_OF_MACHINES, 3, "How many gambling machines will be spawned (max 4)"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_CHANCE_KEY, 3, "Chance to roll a jackpot. Ex. If set to 3, you have a 3% chance to get a jackpot. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_CHANCE_KEY, 11, "Chance to roll a triple. Ex. If set to 11, you have a 11% chance to get a triple. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_CHANCE_KEY, 27, "Chance to roll a double. Ex. If set to 27, you have a 27% chance to get a double. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_HALVE_CHANCE_KEY, 50, "Chance to roll a halve. Ex. If set to 47, you have a 47% chance to get a halve. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<int>(GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_ZERO_CHANCE_KEY, 9, "Chance to roll a zero. Ex. If set to 12, you have a 12% chance to get a zero. Make sure ALL your chance values add up to 100 or else the math won't make sense!"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_MULTIPLIER, 10f, "Jackpot multiplier"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_MULTIPLIER, 3f, "Triple multiplier"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_MULTIPLIER, 2f, "Double multiplier"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_HALVE_MULTIPLIER, 0.5f, "Halve multiplier"); configFile.Bind<float>(GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_ZERO_MULTIPLIER, 0f, "Zero multiplier"); configFile.Bind<bool>(GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_ENABLED, true, "Enable gambling machine music (CLIENT SIDE)"); configFile.Bind<float>(GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_VOLUME, 0.35f, "Gambling machine music volume (CLIENT SIDE)"); configMaxCooldown = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_MAXCOOLDOWN); configJackpotChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_CHANCE_KEY); configTripleChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_CHANCE_KEY); configDoubleChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_CHANCE_KEY); configHalveChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_HALVE_CHANCE_KEY); configZeroChance = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_CHANCE_SECTION_KEY, GambleConstants.CONFIG_ZERO_CHANCE_KEY); configJackpotMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_JACKPOT_MULTIPLIER); configTripleMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_TRIPLE_MULTIPLIER); configDoubleMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_DOUBLE_MULTIPLIER); configHalveMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_HALVE_MULTIPLIER); configZeroMultiplier = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_MULTIPLIERS_SECTION_KEY, GambleConstants.CONFIG_ZERO_MULTIPLIER); configGamblingMusicEnabled = GetConfigFileKeyValue<bool>(configFile, GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_ENABLED); configGamblingMusicVolume = GetConfigFileKeyValue<float>(configFile, GambleConstants.GAMBLING_AUDIO_SECTION_KEY, GambleConstants.CONFIG_GAMBLING_MUSIC_VOLUME); configNumberOfUses = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_NUMBER_OF_USES); configNumberOfMachines = GetConfigFileKeyValue<int>(configFile, GambleConstants.GAMBLING_GENERAL_SECTION_KEY, GambleConstants.CONFIG_NUMBER_OF_MACHINES); LogInitializedConfigsValues(); } private void LogInitializedConfigsValues() { ManualLogSource mls = Plugin.mls; mls.LogInfo((object)$"Cooldown value from config: {configMaxCooldown}"); mls.LogInfo((object)$"Jackpot chance value from config: {configJackpotChance}"); mls.LogInfo((object)$"Triple chance value from config: {configTripleChance}"); mls.LogInfo((object)$"Double chance value from config: {configDoubleChance}"); mls.LogInfo((object)$"Halve chance value from config: {configHalveChance}"); mls.LogInfo((object)$"Zero chance value from config: {configZeroChance}"); mls.LogInfo((object)$"Jackpot multiplier value from config: {configJackpotMultiplier}"); mls.LogInfo((object)$"Triple multiplier value from config: {configTripleMultiplier}"); mls.LogInfo((object)$"Double multiplier value from config: {configDoubleMultiplier}"); mls.LogInfo((object)$"Halve multiplier value from config: {configHalveMultiplier}"); mls.LogInfo((object)$"Zero multiplier value from config: {configZeroMultiplier}"); mls.LogInfo((object)$"Music enabled from config: {configGamblingMusicEnabled}"); mls.LogInfo((object)$"Music volume from config: {configGamblingMusicVolume}"); mls.LogInfo((object)$"Number of uses from config: {configNumberOfUses}"); mls.LogInfo((object)$"Number of machines from config: {configNumberOfMachines}"); } private T GetConfigFileKeyValue<T>(ConfigFile configFile, string section, string key) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(section, key); Plugin.mls.LogInfo((object)("Getting configuration entry: Section: " + section + " Key: " + key)); ConfigEntry<T> val2 = default(ConfigEntry<T>); if (!configFile.TryGetEntry<T>(val, ref val2)) { Plugin.mls.LogError((object)("Failed to get configuration value. Section: " + section + " Key: " + key)); } return val2.Value; } } internal class SerializerHelper { public static byte[] GetSerializedSettings<T>(T valToSerialize) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { binaryFormatter.Serialize(memoryStream, valToSerialize); } catch (SerializationException ex) { Plugin.mls.LogError((object)("Config serialization failed: " + ex.Message)); } byte[] result = memoryStream.ToArray(); memoryStream.Close(); return result; } public static T GetDeserializedSettings<T>(byte[] settingsAsBytes) { MemoryStream memoryStream = new MemoryStream(); memoryStream.Write(settingsAsBytes, 0, settingsAsBytes.Length); memoryStream.Seek(0L, SeekOrigin.Begin); BinaryFormatter binaryFormatter = new BinaryFormatter(); try { object obj = binaryFormatter.Deserialize(memoryStream); memoryStream.Close(); return (T)obj; } catch (SerializationException ex) { Plugin.mls.LogError((object)("Config deserialization failed: " + ex.Message)); } memoryStream.Close(); return default(T); } } }
pachers/BepInEx.MonoMod.HookGenPatcher/BepInEx.MonoMod.HookGenPatcher.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; using BepInEx.Configuration; using BepInEx.Logging; using Mono.Cecil; using MonoMod; using MonoMod.RuntimeDetour.HookGen; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Bepinex.Monomod.HookGenPatcher")] [assembly: AssemblyDescription("Runtime HookGen for BepInEx")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HarbingerOfMe")] [assembly: AssemblyProduct("Bepinex.Monomod.HookGenPatcher")] [assembly: AssemblyCopyright("HarbingerOfMe-2022")] [assembly: AssemblyTrademark("MIT")] [assembly: ComVisible(false)] [assembly: Guid("12032e45-9577-4195-8f4f-a729911b2f08")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: AssemblyVersion("1.2.1.0")] namespace BepInEx.MonoMod.HookGenPatcher; public static class HookGenPatcher { internal static ManualLogSource Logger = Logger.CreateLogSource("HookGenPatcher"); private const string CONFIG_FILE_NAME = "HookGenPatcher.cfg"; private static readonly ConfigFile Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "HookGenPatcher.cfg"), true); private const char EntrySeparator = ','; private static readonly ConfigEntry<string> AssemblyNamesToHookGenPatch = Config.Bind<string>("General", "MMHOOKAssemblyNames", "Assembly-CSharp.dll", $"Assembly names to make mmhooks for, separate entries with : {','} "); private static readonly ConfigEntry<bool> preciseHash = Config.Bind<bool>("General", "Preciser filehashing", false, "Hash file using contents instead of size. Minor perfomance impact."); private static bool skipHashing => !preciseHash.Value; public static IEnumerable<string> TargetDLLs { get; } = new string[0]; public static void Initialize() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown string[] array = AssemblyNamesToHookGenPatch.Value.Split(new char[1] { ',' }); string text = Path.Combine(Paths.PluginPath, "MMHOOK"); string[] array2 = array; foreach (string text2 in array2) { string text3 = "MMHOOK_" + text2; string text4 = Path.Combine(Paths.ManagedPath, text2); string text5 = Path.Combine(text, text3); bool flag = true; string[] files = Directory.GetFiles(Paths.PluginPath, text3, SearchOption.AllDirectories); foreach (string text6 in files) { if (Path.GetFileName(text6).Equals(text3)) { text5 = text6; Logger.LogInfo((object)"Previous MMHOOK location found. Using that location to save instead."); flag = false; break; } } if (flag) { Directory.CreateDirectory(text); } FileInfo fileInfo = new FileInfo(text4); long length = fileInfo.Length; long num = 0L; if (File.Exists(text5)) { try { AssemblyDefinition val = AssemblyDefinition.ReadAssembly(text5); try { if (val.MainModule.GetType("BepHookGen.size" + length) != null) { if (skipHashing) { Logger.LogInfo((object)"Already ran for this version, reusing that file."); continue; } num = fileInfo.makeHash(); if (val.MainModule.GetType("BepHookGen.content" + num) != null) { Logger.LogInfo((object)"Already ran for this version, reusing that file."); continue; } } } finally { ((IDisposable)val)?.Dispose(); } } catch (BadImageFormatException) { Logger.LogWarning((object)("Failed to read " + Path.GetFileName(text5) + ", probably corrupted, remaking one.")); } } Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE", "1"); Environment.SetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW", "0"); MonoModder val2 = new MonoModder { InputPath = text4, OutputPath = text5, ReadingMode = (ReadingMode)2 }; try { IAssemblyResolver assemblyResolver = val2.AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(Paths.BepInExAssemblyDirectory); } val2.Read(); val2.MapDependencies(); if (File.Exists(text5)) { Logger.LogDebug((object)("Clearing " + text5)); File.Delete(text5); } Logger.LogInfo((object)"Starting HookGenerator"); HookGenerator val3 = new HookGenerator(val2, Path.GetFileName(text5)); ModuleDefinition outputModule = val3.OutputModule; try { val3.Generate(); outputModule.Types.Add(new TypeDefinition("BepHookGen", "size" + length, (TypeAttributes)1, outputModule.TypeSystem.Object)); if (!skipHashing) { outputModule.Types.Add(new TypeDefinition("BepHookGen", "content" + ((num == 0L) ? fileInfo.makeHash() : num), (TypeAttributes)1, outputModule.TypeSystem.Object)); } outputModule.Write(text5); } finally { ((IDisposable)outputModule)?.Dispose(); } Logger.LogInfo((object)"Done."); } finally { ((IDisposable)val2)?.Dispose(); } } } public static void Patch(AssemblyDefinition _) { } private static long makeHash(this FileInfo fileInfo) { FileStream inputStream = fileInfo.OpenRead(); byte[] value = null; using (MD5 mD = new MD5CryptoServiceProvider()) { value = mD.ComputeHash(inputStream); } long num = BitConverter.ToInt64(value, 0); if (num == 0L) { return 1L; } return num; } }
pachers/BepInEx.MonoMod.HookGenPatcher/MonoMod.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Cecil.Mdb; using Mono.Cecil.Pdb; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.InlineRT; using MonoMod.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("0x0ade")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright 2021 0x0ade")] [assembly: AssemblyDescription("General purpose .NET assembly modding \"basework\". This package contains the core IL patcher and relinker.")] [assembly: AssemblyFileVersion("21.8.5.1")] [assembly: AssemblyInformationalVersion("21.08.05.01")] [assembly: AssemblyProduct("MonoMod")] [assembly: AssemblyTitle("MonoMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("21.8.5.1")] [module: UnverifiableCode] internal static class MultiTargetShims { private static readonly object[] _NoArgs = new object[0]; public static TypeReference GetConstraintType(this TypeReference type) { return type; } } namespace MonoMod { [MonoMod__SafeToCopy__] public class MonoModAdded : Attribute { } [MonoMod__SafeToCopy__] public class MonoModConstructor : Attribute { } [MonoMod__SafeToCopy__] public class MonoModCustomAttributeAttribute : Attribute { public MonoModCustomAttributeAttribute(string h) { } } [MonoMod__SafeToCopy__] public class MonoModCustomMethodAttributeAttribute : Attribute { public MonoModCustomMethodAttributeAttribute(string h) { } } [MonoMod__SafeToCopy__] public class MonoModEnumReplace : Attribute { } [MonoMod__SafeToCopy__] public class MonoModForceCall : Attribute { } [MonoMod__SafeToCopy__] public class MonoModForceCallvirt : Attribute { } [MonoMod__SafeToCopy__] [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] [Obsolete("Use MonoModLinkFrom or RuntimeDetour / HookGen instead.")] public class MonoModHook : Attribute { public string FindableID; public Type Type; public MonoModHook(string findableID) { FindableID = findableID; } public MonoModHook(Type type) { Type = type; FindableID = type.FullName; } } [MonoMod__SafeToCopy__] public class MonoModIfFlag : Attribute { public MonoModIfFlag(string key) { } public MonoModIfFlag(string key, bool fallback) { } } [MonoMod__SafeToCopy__] public class MonoModIgnore : Attribute { } [MonoMod__SafeToCopy__] [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] public class MonoModLinkFrom : Attribute { public string FindableID; public Type Type; public MonoModLinkFrom(string findableID) { FindableID = findableID; } public MonoModLinkFrom(Type type) { Type = type; FindableID = type.FullName; } } [MonoMod__SafeToCopy__] public class MonoModLinkTo : Attribute { public MonoModLinkTo(string t) { } public MonoModLinkTo(Type t) { } public MonoModLinkTo(string t, string n) { } public MonoModLinkTo(Type t, string n) { } } [MonoMod__SafeToCopy__] public class MonoModNoNew : Attribute { } [MonoMod__SafeToCopy__] public class MonoModOnPlatform : Attribute { public MonoModOnPlatform(params Platform[] p) { } } [MonoMod__SafeToCopy__] public class MonoModOriginal : Attribute { } [MonoMod__SafeToCopy__] public class MonoModOriginalName : Attribute { public MonoModOriginalName(string n) { } } [MonoMod__SafeToCopy__] public class MonoModPatch : Attribute { public MonoModPatch(string name) { } } [MonoMod__SafeToCopy__] public class MonoModPublic : Attribute { } [MonoMod__SafeToCopy__] public class MonoModRemove : Attribute { } [MonoMod__SafeToCopy__] public class MonoModReplace : Attribute { } [MonoMod__SafeToCopy__] public class MonoModTargetModule : Attribute { public MonoModTargetModule(string name) { } } [MonoMod__SafeToCopy__] internal class MonoMod__SafeToCopy__ : Attribute { } public delegate bool MethodParser(MonoModder modder, MethodBody body, Instruction instr, ref int instri); public delegate void MethodRewriter(MonoModder modder, MethodDefinition method); public delegate void MethodBodyRewriter(MonoModder modder, MethodBody body, Instruction instr, int instri); public delegate ModuleDefinition MissingDependencyResolver(MonoModder modder, ModuleDefinition main, string name, string fullName); public delegate void PostProcessor(MonoModder modder); public delegate void ModReadEventHandler(MonoModder modder, ModuleDefinition mod); public class RelinkMapEntry { public string Type; public string FindableID; public RelinkMapEntry() { } public RelinkMapEntry(string type, string findableID) { Type = type; FindableID = findableID; } } public enum DebugSymbolFormat { Auto, MDB, PDB } public class MonoModder : IDisposable { public static readonly bool IsMono = (object)Type.GetType("Mono.Runtime") != null; public static readonly Version Version = typeof(MonoModder).Assembly.GetName().Version; public Dictionary<string, object> SharedData = new Dictionary<string, object>(); public Dictionary<string, object> RelinkMap = new Dictionary<string, object>(); public Dictionary<string, ModuleDefinition> RelinkModuleMap = new Dictionary<string, ModuleDefinition>(); public HashSet<string> SkipList = new HashSet<string>(EqualityComparer<string>.Default); public Dictionary<string, IMetadataTokenProvider> RelinkMapCache = new Dictionary<string, IMetadataTokenProvider>(); public Dictionary<string, TypeReference> RelinkModuleMapCache = new Dictionary<string, TypeReference>(); public Dictionary<string, OpCode> ForceCallMap = new Dictionary<string, OpCode>(); public ModReadEventHandler OnReadMod; public PostProcessor PostProcessors; public Dictionary<string, Action<object, object[]>> CustomAttributeHandlers = new Dictionary<string, Action<object, object[]>> { { "MonoMod.MonoModPublic", delegate { } } }; public Dictionary<string, Action<object, object[]>> CustomMethodAttributeHandlers = new Dictionary<string, Action<object, object[]>>(); public MissingDependencyResolver MissingDependencyResolver; public MethodParser MethodParser; public MethodRewriter MethodRewriter; public MethodBodyRewriter MethodBodyRewriter; public Stream Input; public string InputPath; public Stream Output; public string OutputPath; public List<string> DependencyDirs = new List<string>(); public ModuleDefinition Module; public Dictionary<ModuleDefinition, List<ModuleDefinition>> DependencyMap = new Dictionary<ModuleDefinition, List<ModuleDefinition>>(); public Dictionary<string, ModuleDefinition> DependencyCache = new Dictionary<string, ModuleDefinition>(); public Func<ICustomAttributeProvider, TypeReference, bool> ShouldCleanupAttrib; public bool LogVerboseEnabled; public bool CleanupEnabled; public bool PublicEverything; public List<ModuleReference> Mods = new List<ModuleReference>(); public bool Strict; public bool MissingDependencyThrow; public bool RemovePatchReferences; public bool PreventInline; public bool? UpgradeMSCORLIB; public ReadingMode ReadingMode = (ReadingMode)1; public DebugSymbolFormat DebugSymbolOutputFormat; public int CurrentRID; protected IAssemblyResolver _assemblyResolver; protected ReaderParameters _readerParameters; protected WriterParameters _writerParameters; public bool GACEnabled; private string[] _GACPathsNone = new string[0]; protected string[] _GACPaths; protected MethodDefinition _mmOriginalCtor; protected MethodDefinition _mmOriginalNameCtor; protected MethodDefinition _mmAddedCtor; protected MethodDefinition _mmPatchCtor; public virtual IAssemblyResolver AssemblyResolver { get { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown if (_assemblyResolver == null) { DefaultAssemblyResolver val = new DefaultAssemblyResolver(); foreach (string dependencyDir in DependencyDirs) { ((BaseAssemblyResolver)val).AddSearchDirectory(dependencyDir); } _assemblyResolver = (IAssemblyResolver)(object)val; } return _assemblyResolver; } set { _assemblyResolver = value; } } public virtual ReaderParameters ReaderParameters { get { //IL_000a: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (_readerParameters == null) { _readerParameters = new ReaderParameters(ReadingMode) { AssemblyResolver = AssemblyResolver, ReadSymbols = true }; } return _readerParameters; } set { _readerParameters = value; } } public virtual WriterParameters WriterParameters { get { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0067: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (_writerParameters == null) { bool flag = DebugSymbolOutputFormat == DebugSymbolFormat.PDB; bool flag2 = DebugSymbolOutputFormat == DebugSymbolFormat.MDB; if (DebugSymbolOutputFormat == DebugSymbolFormat.Auto) { if ((PlatformHelper.Current & 0x25) == 37) { flag = true; } else { flag2 = true; } } WriterParameters val = new WriterParameters { WriteSymbols = true }; object symbolWriterProvider; if (!flag) { if (!flag2) { symbolWriterProvider = null; } else { ISymbolWriterProvider val2 = (ISymbolWriterProvider)new MdbWriterProvider(); symbolWriterProvider = val2; } } else { ISymbolWriterProvider val2 = (ISymbolWriterProvider)new NativePdbWriterProvider(); symbolWriterProvider = val2; } val.SymbolWriterProvider = (ISymbolWriterProvider)symbolWriterProvider; _writerParameters = val; } return _writerParameters; } set { _writerParameters = value; } } public string[] GACPaths { get { if (!GACEnabled) { return _GACPathsNone; } if (_GACPaths != null) { return _GACPaths; } if (!IsMono) { string environmentVariable = Environment.GetEnvironmentVariable("windir"); if (string.IsNullOrEmpty(environmentVariable)) { return _GACPaths = _GACPathsNone; } environmentVariable = Path.Combine(environmentVariable, "Microsoft.NET"); environmentVariable = Path.Combine(environmentVariable, "assembly"); _GACPaths = new string[3] { Path.Combine(environmentVariable, "GAC_32"), Path.Combine(environmentVariable, "GAC_64"), Path.Combine(environmentVariable, "GAC_MSIL") }; } else { List<string> list = new List<string>(); string text = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(typeof(object).Module.FullyQualifiedName)), "gac"); if (Directory.Exists(text)) { list.Add(text); } string environmentVariable2 = Environment.GetEnvironmentVariable("MONO_GAC_PREFIX"); if (!string.IsNullOrEmpty(environmentVariable2)) { string[] array = environmentVariable2.Split(new char[1] { Path.PathSeparator }); foreach (string text2 in array) { if (!string.IsNullOrEmpty(text2)) { string path = text2; path = Path.Combine(path, "lib"); path = Path.Combine(path, "mono"); path = Path.Combine(path, "gac"); if (Directory.Exists(path) && !list.Contains(path)) { list.Add(path); } } } } _GACPaths = list.ToArray(); } return _GACPaths; } set { GACEnabled = true; _GACPaths = value; } } public MonoModder() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) MethodParser = DefaultParser; MissingDependencyResolver = DefaultMissingDependencyResolver; PostProcessors = (PostProcessor)Delegate.Combine(PostProcessors, new PostProcessor(DefaultPostProcessor)); string environmentVariable = Environment.GetEnvironmentVariable("MONOMOD_DEPDIRS"); if (!string.IsNullOrEmpty(environmentVariable)) { foreach (string item in from dir in environmentVariable.Split(new char[1] { Path.PathSeparator }) select dir.Trim()) { IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(item); } DependencyDirs.Add(item); } } LogVerboseEnabled = Environment.GetEnvironmentVariable("MONOMOD_LOG_VERBOSE") == "1"; CleanupEnabled = Environment.GetEnvironmentVariable("MONOMOD_CLEANUP") != "0"; PublicEverything = Environment.GetEnvironmentVariable("MONOMOD_PUBLIC_EVERYTHING") == "1"; PreventInline = Environment.GetEnvironmentVariable("MONOMOD_PREVENTINLINE") == "1"; Strict = Environment.GetEnvironmentVariable("MONOMOD_STRICT") == "1"; MissingDependencyThrow = Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW") != "0"; RemovePatchReferences = Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_REMOVE_PATCH") != "0"; string environmentVariable2 = Environment.GetEnvironmentVariable("MONOMOD_DEBUG_FORMAT"); if (environmentVariable2 != null) { environmentVariable2 = environmentVariable2.ToLowerInvariant(); if (environmentVariable2 == "pdb") { DebugSymbolOutputFormat = DebugSymbolFormat.PDB; } else if (environmentVariable2 == "mdb") { DebugSymbolOutputFormat = DebugSymbolFormat.MDB; } } string environmentVariable3 = Environment.GetEnvironmentVariable("MONOMOD_MSCORLIB_UPGRADE"); UpgradeMSCORLIB = (string.IsNullOrEmpty(environmentVariable3) ? null : new bool?(environmentVariable3 != "0")); GACEnabled = Environment.GetEnvironmentVariable("MONOMOD_GAC_ENABLED") != "0"; MonoModRulesManager.Register(this); } public virtual void ClearCaches(bool all = false, bool shareable = false, bool moduleSpecific = false) { if (all || shareable) { foreach (KeyValuePair<string, ModuleDefinition> item in DependencyCache) { item.Value.Dispose(); } DependencyCache.Clear(); } if (all || moduleSpecific) { RelinkMapCache.Clear(); RelinkModuleMapCache.Clear(); } } public virtual void Dispose() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) ClearCaches(all: true); ModuleDefinition module = Module; if (module != null) { module.Dispose(); } Module = null; ((IDisposable)AssemblyResolver)?.Dispose(); AssemblyResolver = null; foreach (ModuleDefinition mod in Mods) { if ((int)mod != 0) { mod.Dispose(); } } foreach (List<ModuleDefinition> value in DependencyMap.Values) { foreach (ModuleDefinition item in value) { if (item != null) { item.Dispose(); } } } DependencyMap.Clear(); Input?.Dispose(); Output?.Dispose(); } public virtual void Log(object value) { Log(value.ToString()); } public virtual void Log(string text) { Console.Write("[MonoMod] "); Console.WriteLine(text); } public virtual void LogVerbose(object value) { if (LogVerboseEnabled) { Log(value); } } public virtual void LogVerbose(string text) { if (LogVerboseEnabled) { Log(text); } } private static ModuleDefinition _ReadModule(Stream input, ReaderParameters args) { if (args.ReadSymbols) { try { return ModuleDefinition.ReadModule(input, args); } catch { args.ReadSymbols = false; input.Seek(0L, SeekOrigin.Begin); } } return ModuleDefinition.ReadModule(input, args); } private static ModuleDefinition _ReadModule(string input, ReaderParameters args) { if (args.ReadSymbols) { try { return ModuleDefinition.ReadModule(input, args); } catch { args.ReadSymbols = false; } } return ModuleDefinition.ReadModule(input, args); } public virtual void Read() { if (Module != null) { return; } if (Input != null) { Log("Reading input stream into module."); Module = _ReadModule(Input, GenReaderParameters(mainModule: true)); } else if (InputPath != null) { Log("Reading input file into module."); IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(Path.GetDirectoryName(InputPath)); } DependencyDirs.Add(Path.GetDirectoryName(InputPath)); Module = _ReadModule(InputPath, GenReaderParameters(mainModule: true, InputPath)); } string environmentVariable = Environment.GetEnvironmentVariable("MONOMOD_MODS"); if (string.IsNullOrEmpty(environmentVariable)) { return; } foreach (string item in from path in environmentVariable.Split(new char[1] { Path.PathSeparator }) select path.Trim()) { ReadMod(item); } } public virtual void MapDependencies() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown foreach (ModuleDefinition mod in Mods) { ModuleDefinition main = mod; MapDependencies(main); } MapDependencies(Module); } public virtual void MapDependencies(ModuleDefinition main) { //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) if (DependencyMap.ContainsKey(main)) { return; } DependencyMap[main] = new List<ModuleDefinition>(); Enumerator<AssemblyNameReference> enumerator = main.AssemblyReferences.GetEnumerator(); try { while (enumerator.MoveNext()) { AssemblyNameReference current = enumerator.Current; MapDependency(main, current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void MapDependency(ModuleDefinition main, AssemblyNameReference depRef) { MapDependency(main, depRef.Name, depRef.FullName, depRef); } public virtual void MapDependency(ModuleDefinition main, string name, string fullName = null, AssemblyNameReference depRef = null) { if (!DependencyMap.TryGetValue(main, out var value)) { value = (DependencyMap[main] = new List<ModuleDefinition>()); } if (fullName != null && (DependencyCache.TryGetValue(fullName, out var value2) || DependencyCache.TryGetValue(fullName + " [RT:" + main.RuntimeVersion + "]", out value2))) { LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " ((" + fullName + "), (" + name + ")) from cache"); value.Add(value2); MapDependencies(value2); return; } if (DependencyCache.TryGetValue(name, out value2) || DependencyCache.TryGetValue(name + " [RT:" + main.RuntimeVersion + "]", out value2)) { LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " (" + name + ") from cache"); value.Add(value2); MapDependencies(value2); return; } string text = Path.GetExtension(name).ToLowerInvariant(); bool flag = text == "pdb" || text == "mdb"; string text2 = null; foreach (string dependencyDir in DependencyDirs) { text2 = Path.Combine(dependencyDir, name + ".dll"); if (!File.Exists(text2)) { text2 = Path.Combine(dependencyDir, name + ".exe"); } if (!File.Exists(text2) && !flag) { text2 = Path.Combine(dependencyDir, name); } if (File.Exists(text2)) { break; } text2 = null; } if (text2 == null && depRef != null) { try { AssemblyDefinition obj = AssemblyResolver.Resolve(depRef); value2 = ((obj != null) ? obj.MainModule : null); } catch { } if (value2 != null) { text2 = value2.FileName; } } if (text2 == null) { string[] gACPaths = GACPaths; for (int i = 0; i < gACPaths.Length; i++) { text2 = Path.Combine(gACPaths[i], name); if (Directory.Exists(text2)) { string[] directories = Directory.GetDirectories(text2); int num = 0; int num2 = 0; for (int j = 0; j < directories.Length; j++) { string text3 = directories[j]; if (text3.StartsWith(text2)) { text3 = text3.Substring(text2.Length + 1); } Match match = Regex.Match(text3, "\\d+"); if (match.Success) { int num3 = int.Parse(match.Value); if (num3 > num) { num = num3; num2 = j; } } } text2 = Path.Combine(directories[num2], name + ".dll"); break; } text2 = null; } } if (text2 == null) { try { AssemblyDefinition obj3 = AssemblyResolver.Resolve(AssemblyNameReference.Parse(fullName ?? name)); value2 = ((obj3 != null) ? obj3.MainModule : null); } catch { } if (value2 != null) { text2 = value2.FileName; } } if (value2 == null) { if (text2 != null && File.Exists(text2)) { value2 = _ReadModule(text2, GenReaderParameters(mainModule: false, text2)); } else if ((value2 = MissingDependencyResolver?.Invoke(this, main, name, fullName)) == null) { return; } } LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " ((" + fullName + "), (" + name + ")) loaded"); value.Add(value2); if (fullName == null) { fullName = value2.Assembly.FullName; } DependencyCache[fullName] = value2; DependencyCache[name] = value2; MapDependencies(value2); } public virtual ModuleDefinition DefaultMissingDependencyResolver(MonoModder mod, ModuleDefinition main, string name, string fullName) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (MissingDependencyThrow && Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW") == "0") { Log("[MissingDependencyResolver] [WARNING] Use MMILRT.Modder.MissingDependencyThrow instead of setting the env var MONOMOD_DEPENDENCY_MISSING_THROW"); MissingDependencyThrow = false; } if (MissingDependencyThrow || Strict) { throw new RelinkTargetNotFoundException("MonoMod cannot map dependency " + ((ModuleReference)main).Name + " -> ((" + fullName + "), (" + name + ")) - not found", (IMetadataTokenProvider)(object)main, (IMetadataTokenProvider)null); } return null; } public virtual void Write(Stream output = null, string outputPath = null) { output = output ?? Output; outputPath = outputPath ?? OutputPath; PatchRefsInType(PatchWasHere()); if (output != null) { Log("[Write] Writing modded module into output stream."); Module.Write(output, WriterParameters); } else { Log("[Write] Writing modded module into output file."); Module.Write(outputPath, WriterParameters); } } public virtual ReaderParameters GenReaderParameters(bool mainModule, string path = null) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown ReaderParameters readerParameters = ReaderParameters; ReaderParameters val = new ReaderParameters(readerParameters.ReadingMode); val.AssemblyResolver = readerParameters.AssemblyResolver; val.MetadataResolver = readerParameters.MetadataResolver; val.InMemory = readerParameters.InMemory; val.MetadataImporterProvider = readerParameters.MetadataImporterProvider; val.ReflectionImporterProvider = readerParameters.ReflectionImporterProvider; val.ThrowIfSymbolsAreNotMatching = readerParameters.ThrowIfSymbolsAreNotMatching; val.ApplyWindowsRuntimeProjections = readerParameters.ApplyWindowsRuntimeProjections; val.SymbolStream = readerParameters.SymbolStream; val.SymbolReaderProvider = readerParameters.SymbolReaderProvider; val.ReadSymbols = readerParameters.ReadSymbols; if (path != null && !File.Exists(path + ".mdb") && !File.Exists(Path.ChangeExtension(path, "pdb"))) { val.ReadSymbols = false; } return val; } public virtual void ReadMod(string path) { if (Directory.Exists(path)) { Log("[ReadMod] Loading mod dir: " + path); string text = ((ModuleReference)Module).Name.Substring(0, ((ModuleReference)Module).Name.Length - 3); string value = text.Replace(" ", ""); if (!DependencyDirs.Contains(path)) { IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(path); } DependencyDirs.Add(path); } string[] files = Directory.GetFiles(path); foreach (string text2 in files) { if ((Path.GetFileName(text2).StartsWith(text) || Path.GetFileName(text2).StartsWith(value)) && text2.ToLower().EndsWith(".mm.dll")) { ReadMod(text2); } } return; } Log("[ReadMod] Loading mod: " + path); ModuleDefinition val = _ReadModule(path, GenReaderParameters(mainModule: false, path)); string directoryName = Path.GetDirectoryName(path); if (!DependencyDirs.Contains(directoryName)) { IAssemblyResolver assemblyResolver2 = AssemblyResolver; IAssemblyResolver obj2 = ((assemblyResolver2 is BaseAssemblyResolver) ? assemblyResolver2 : null); if (obj2 != null) { ((BaseAssemblyResolver)obj2).AddSearchDirectory(directoryName); } DependencyDirs.Add(directoryName); } Mods.Add((ModuleReference)(object)val); OnReadMod?.Invoke(this, val); } public virtual void ReadMod(Stream stream) { Log($"[ReadMod] Loading mod: stream#{(uint)stream.GetHashCode()}"); ModuleDefinition val = _ReadModule(stream, GenReaderParameters(mainModule: false)); Mods.Add((ModuleReference)(object)val); OnReadMod?.Invoke(this, val); } public virtual void ParseRules(ModuleDefinition mod) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) TypeDefinition type = mod.GetType("MonoMod.MonoModRules"); Type rulesTypeMMILRT = null; if (type != null) { rulesTypeMMILRT = this.ExecuteRules(type); mod.Types.Remove(type); } Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; ParseRulesInType(current, rulesTypeMMILRT); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void ParseRulesInType(TypeDefinition type, Type rulesTypeMMILRT = null) { //IL_0035: 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) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) Extensions.GetPatchFullName((MemberReference)(object)type); if (!MatchingConditionals((ICustomAttributeProvider)(object)type, Module)) { return; } CustomAttribute customAttribute = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModCustomAttributeAttribute"); CustomAttributeArgument val; if (customAttribute != null) { val = customAttribute.ConstructorArguments[0]; MethodInfo method2 = rulesTypeMMILRT.GetMethod((string)((CustomAttributeArgument)(ref val)).Value); CustomAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { method2.Invoke(self, args); }; } customAttribute = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModCustomMethodAttributeAttribute"); if (customAttribute != null) { val = customAttribute.ConstructorArguments[0]; MethodInfo method = rulesTypeMMILRT.GetMethod((string)((CustomAttributeArgument)(ref val)).Value); ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 2 && Extensions.IsCompatible(parameters[0].ParameterType, typeof(ILContext))) { CustomMethodAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown ILContext il = new ILContext((MethodDefinition)args[0]); il.Invoke((Manipulator)delegate { method.Invoke(self, new object[2] { il, args[1] }); }); if (il.IsReadOnly) { il.Dispose(); } }; } else { CustomMethodAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { method.Invoke(self, args); }; } } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)type, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)type, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)type, val2); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) { return; } Enumerator<MethodDefinition> enumerator = type.Methods.GetEnumerator(); try { while (enumerator.MoveNext()) { MethodDefinition current = enumerator.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current, val2); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModForceCall")) { ForceCallMap[Extensions.GetID((MethodReference)(object)current, (string)null, (string)null, true, false)] = OpCodes.Call; } else if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModForceCallvirt")) { ForceCallMap[Extensions.GetID((MethodReference)(object)current, (string)null, (string)null, true, false)] = OpCodes.Callvirt; } } } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<FieldDefinition> enumerator2 = type.Fields.GetEnumerator(); try { while (enumerator2.MoveNext()) { FieldDefinition current2 = enumerator2.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current2, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current2, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current2, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current2, val2); } } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<PropertyDefinition> enumerator3 = type.Properties.GetEnumerator(); try { while (enumerator3.MoveNext()) { PropertyDefinition current3 = enumerator3.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current3, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current3, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current3, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current3, val2); } } } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<TypeDefinition> enumerator4 = type.NestedTypes.GetEnumerator(); try { while (enumerator4.MoveNext()) { TypeDefinition current4 = enumerator4.Current; ParseRulesInType(current4, rulesTypeMMILRT); } } finally { ((IDisposable)enumerator4).Dispose(); } } public virtual void ParseLinkFrom(MemberReference target, CustomAttribute hook) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) CustomAttributeArgument val = hook.ConstructorArguments[0]; string key = (string)((CustomAttributeArgument)(ref val)).Value; object value; if (target is TypeReference) { value = Extensions.GetPatchFullName((MemberReference)(TypeReference)target); } else if (target is MethodReference) { value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(MethodReference)target).DeclaringType), Extensions.GetID((MethodReference)target, (string)null, (string)null, false, false)); } else if (target is FieldReference) { value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(FieldReference)target).DeclaringType), ((MemberReference)(FieldReference)target).Name); } else { if (!(target is PropertyReference)) { return; } value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(PropertyReference)target).DeclaringType), ((MemberReference)(PropertyReference)target).Name); } RelinkMap[key] = value; } public virtual void ParseLinkTo(MemberReference from, CustomAttribute hook) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) MemberReference obj = ((from is MethodReference) ? from : null); string key = ((obj != null) ? Extensions.GetID((MethodReference)(object)obj, (string)null, (string)null, true, false) : null) ?? Extensions.GetPatchFullName(from); CustomAttributeArgument val; if (hook.ConstructorArguments.Count == 1) { Dictionary<string, object> relinkMap = RelinkMap; val = hook.ConstructorArguments[0]; relinkMap[key] = (string)((CustomAttributeArgument)(ref val)).Value; } else { Dictionary<string, object> relinkMap2 = RelinkMap; val = hook.ConstructorArguments[0]; string type = (string)((CustomAttributeArgument)(ref val)).Value; val = hook.ConstructorArguments[1]; relinkMap2[key] = new RelinkMapEntry(type, (string)((CustomAttributeArgument)(ref val)).Value); } } public virtual void RunCustomAttributeHandlers(ICustomAttributeProvider cap) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown if (!cap.HasCustomAttributes) { return; } CustomAttribute[] array = cap.CustomAttributes.ToArray(); foreach (CustomAttribute val in array) { if (CustomAttributeHandlers.TryGetValue(((MemberReference)val.AttributeType).FullName, out var value)) { value?.Invoke(null, new object[2] { cap, val }); } if (cap is MethodReference && CustomMethodAttributeHandlers.TryGetValue(((MemberReference)val.AttributeType).FullName, out value)) { value?.Invoke(null, new object[2] { (object)(MethodDefinition)cap, val }); } } } public virtual void AutoPatch() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Log("[AutoPatch] Parsing rules in loaded mods"); foreach (ModuleDefinition mod4 in Mods) { ModuleDefinition mod = mod4; ParseRules(mod); } Log("[AutoPatch] PrePatch pass"); foreach (ModuleDefinition mod5 in Mods) { ModuleDefinition mod2 = mod5; PrePatchModule(mod2); } Log("[AutoPatch] Patch pass"); foreach (ModuleDefinition mod6 in Mods) { ModuleDefinition mod3 = mod6; PatchModule(mod3); } Log("[AutoPatch] PatchRefs pass"); PatchRefs(); if (PostProcessors != null) { Delegate[] invocationList = PostProcessors.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Log($"[PostProcessor] PostProcessor pass #{i + 1}"); ((PostProcessor)invocationList[i])?.Invoke(this); } } } public virtual IMetadataTokenProvider Relinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { //IL_0027: 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) try { return PostRelinker(MainRelinker(mtp, context) ?? mtp, context) ?? throw new RelinkTargetNotFoundException(mtp, (IMetadataTokenProvider)(object)context); } catch (Exception ex) { throw new RelinkFailedException((string)null, ex, mtp, (IMetadataTokenProvider)(object)context); } } public virtual IMetadataTokenProvider MainRelinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) TypeReference val = (TypeReference)(object)((mtp is TypeReference) ? mtp : null); if (val != null) { if (((MemberReference)val).Module == Module) { return (IMetadataTokenProvider)(object)val; } if (((MemberReference)val).Module != null && !Mods.Contains((ModuleReference)(object)((MemberReference)val).Module)) { return (IMetadataTokenProvider)(object)Module.ImportReference(val); } val = (TypeReference)(((object)Extensions.SafeResolve(val)) ?? ((object)val)); TypeReference val2 = FindTypeDeep(Extensions.GetPatchFullName((MemberReference)(object)val)); if (val2 == null) { if (RelinkMap.ContainsKey(((MemberReference)val).FullName)) { return null; } throw new RelinkTargetNotFoundException(mtp, (IMetadataTokenProvider)(object)context); } return (IMetadataTokenProvider)(object)Module.ImportReference(val2); } if (mtp is FieldReference || mtp is MethodReference || mtp is PropertyReference || mtp is EventReference) { return Extensions.ImportReference(Module, mtp); } throw new InvalidOperationException($"MonoMod default relinker can't handle metadata token providers of the type {((object)mtp).GetType()}"); } public virtual IMetadataTokenProvider PostRelinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { return ResolveRelinkTarget(mtp) ?? mtp; } public virtual IMetadataTokenProvider ResolveRelinkTarget(IMetadataTokenProvider mtp, bool relink = true, bool relinkModule = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_004b: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_023c: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) string text = null; string text2; if (mtp is TypeReference) { text2 = ((MemberReference)(TypeReference)mtp).FullName; } else if (mtp is MethodReference) { text2 = Extensions.GetID((MethodReference)mtp, (string)null, (string)null, true, false); text = Extensions.GetID((MethodReference)mtp, (string)null, (string)null, true, true); } else if (mtp is FieldReference) { text2 = ((MemberReference)(FieldReference)mtp).FullName; } else { if (!(mtp is PropertyReference)) { return null; } text2 = ((MemberReference)(PropertyReference)mtp).FullName; } if (RelinkMapCache.TryGetValue(text2, out var value)) { return value; } if (relink && (RelinkMap.TryGetValue(text2, out var value2) || (text != null && RelinkMap.TryGetValue(text, out value2)))) { if (value2 is IMetadataTokenProvider) { return RelinkMapCache[text2] = Extensions.ImportReference(Module, (IMetadataTokenProvider)value2); } if (value2 is RelinkMapEntry) { string type = ((RelinkMapEntry)value2).Type; string findableID = ((RelinkMapEntry)value2).FindableID; TypeReference obj = FindTypeDeep(type); TypeDefinition val2 = ((obj != null) ? Extensions.SafeResolve(obj) : null); if (val2 == null) { return RelinkMapCache[text2] = ResolveRelinkTarget(mtp, relink: false, relinkModule); } value2 = Extensions.FindMethod(val2, findableID, true) ?? ((object)Extensions.FindField(val2, findableID)) ?? ((object)(Extensions.FindProperty(val2, findableID) ?? null)); if (value2 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} ({1}, {2}) (remap: {3})", "MonoMod relinker failed finding", type, findableID, mtp), mtp, (IMetadataTokenProvider)null); } return null; } return RelinkMapCache[text2] = Extensions.ImportReference(Module, (IMetadataTokenProvider)value2); } if (value2 is string && mtp is TypeReference) { IMetadataTokenProvider val5 = (IMetadataTokenProvider)(object)FindTypeDeep((string)value2); if (val5 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} {1} (remap: {2})", "MonoMod relinker failed finding", value2, mtp), mtp, (IMetadataTokenProvider)null); } return null; } value2 = Extensions.ImportReference(Module, ResolveRelinkTarget(val5, relink: false, relinkModule) ?? val5); } if (value2 is IMetadataTokenProvider) { Dictionary<string, IMetadataTokenProvider> relinkMapCache = RelinkMapCache; string key = text2; IMetadataTokenProvider val6 = (IMetadataTokenProvider)value2; IMetadataTokenProvider result = val6; relinkMapCache[key] = val6; return result; } throw new InvalidOperationException($"MonoMod doesn't support RelinkMap value of type {value2.GetType()} (remap: {mtp})"); } if (relinkModule && mtp is TypeReference) { if (RelinkModuleMapCache.TryGetValue(text2, out var value3)) { return (IMetadataTokenProvider)(object)value3; } value3 = (TypeReference)mtp; if (RelinkModuleMap.TryGetValue(value3.Scope.Name, out var value4)) { TypeReference type2 = (TypeReference)(object)value4.GetType(((MemberReference)value3).FullName); if (type2 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} {1} (remap: {2})", "MonoMod relinker failed finding", ((MemberReference)value3).FullName, mtp), mtp, (IMetadataTokenProvider)null); } return null; } return (IMetadataTokenProvider)(object)(RelinkModuleMapCache[text2] = Module.ImportReference(type2)); } return (IMetadataTokenProvider)(object)Module.ImportReference(value3); } return null; } public virtual bool DefaultParser(MonoModder mod, MethodBody body, Instruction instr, ref int instri) { return true; } public virtual TypeReference FindType(string name) { return FindType(Module, name, new Stack<ModuleDefinition>()) ?? Module.GetType(name, false); } public virtual TypeReference FindType(string name, bool runtimeName) { return FindType(Module, name, new Stack<ModuleDefinition>()) ?? Module.GetType(name, runtimeName); } protected virtual TypeReference FindType(ModuleDefinition main, string fullName, Stack<ModuleDefinition> crawled) { TypeReference type; if ((type = main.GetType(fullName, false)) != null) { return type; } if (fullName.StartsWith("<PrivateImplementationDetails>/")) { return null; } if (crawled.Contains(main)) { return null; } crawled.Push(main); foreach (ModuleDefinition item in DependencyMap[main]) { if ((!RemovePatchReferences || !((AssemblyNameReference)item.Assembly.Name).Name.EndsWith(".mm")) && (type = FindType(item, fullName, crawled)) != null) { return type; } } return null; } public virtual TypeReference FindTypeDeep(string name) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown TypeReference val = FindType(name, runtimeName: false); if (val != null) { return val; } Stack<ModuleDefinition> crawled = new Stack<ModuleDefinition>(); val = null; foreach (ModuleDefinition mod in Mods) { ModuleDefinition key = mod; foreach (ModuleDefinition item in DependencyMap[key]) { if ((val = FindType(item, name, crawled)) != null) { IMetadataScope scope = val.Scope; AssemblyNameReference dllRef = (AssemblyNameReference)(object)((scope is AssemblyNameReference) ? scope : null); if (dllRef != null && !((IEnumerable<AssemblyNameReference>)Module.AssemblyReferences).Any((AssemblyNameReference n) => n.Name == dllRef.Name)) { Module.AssemblyReferences.Add(dllRef); } return Module.ImportReference(val); } } } return null; } public virtual void PrePatchModule(ModuleDefinition mod) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PrePatchType(current); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<ModuleReference> enumerator2 = mod.ModuleReferences.GetEnumerator(); try { while (enumerator2.MoveNext()) { ModuleReference current2 = enumerator2.Current; if (!Module.ModuleReferences.Contains(current2)) { Module.ModuleReferences.Add(current2); } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<Resource> enumerator3 = mod.Resources.GetEnumerator(); try { while (enumerator3.MoveNext()) { Resource current3 = enumerator3.Current; if (current3 is EmbeddedResource) { Module.Resources.Add((Resource)new EmbeddedResource(current3.Name.StartsWith(((AssemblyNameReference)mod.Assembly.Name).Name) ? (((AssemblyNameReference)Module.Assembly.Name).Name + current3.Name.Substring(((AssemblyNameReference)mod.Assembly.Name).Name.Length)) : current3.Name, current3.Attributes, ((EmbeddedResource)current3).GetResourceData())); } } } finally { ((IDisposable)enumerator3).Dispose(); } } public virtual void PrePatchType(TypeDefinition type, bool forceAdd = false) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)type); if ((((TypeReference)type).Namespace != "MonoMod" && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) || SkipList.Contains(patchFullName) || !MatchingConditionals((ICustomAttributeProvider)(object)type, Module) || (((MemberReference)type).FullName == "MonoMod.MonoModRules" && !forceAdd)) { return; } TypeReference val = (forceAdd ? null : Module.GetType(patchFullName, false)); TypeDefinition val2 = ((val != null) ? Extensions.SafeResolve(val) : null); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModReplace") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModRemove")) { if (val2 != null) { if (val2.DeclaringType == null) { Module.Types.Remove(val2); } else { val2.DeclaringType.NestedTypes.Remove(val2); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModRemove")) { return; } } else if (val != null) { PrePatchNested(type); return; } LogVerbose("[PrePatchType] Adding " + patchFullName + " to the target module."); TypeDefinition val3 = new TypeDefinition(((TypeReference)type).Namespace, ((MemberReference)type).Name, type.Attributes, type.BaseType); Enumerator<GenericParameter> enumerator = ((TypeReference)type).GenericParameters.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericParameter current = enumerator.Current; ((TypeReference)val3).GenericParameters.Add(Extensions.Clone(current)); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<InterfaceImplementation> enumerator2 = type.Interfaces.GetEnumerator(); try { while (enumerator2.MoveNext()) { InterfaceImplementation current2 = enumerator2.Current; val3.Interfaces.Add(current2); } } finally { ((IDisposable)enumerator2).Dispose(); } val3.ClassSize = type.ClassSize; if (type.DeclaringType != null) { val3.DeclaringType = Extensions.Relink((TypeReference)(object)type.DeclaringType, new Relinker(Relinker), (IGenericParameterProvider)(object)val3).Resolve(); val3.DeclaringType.NestedTypes.Add(val3); } else { Module.Types.Add(val3); } val3.PackingSize = type.PackingSize; Extensions.AddRange<SecurityDeclaration>(val3.SecurityDeclarations, (IEnumerable<SecurityDeclaration>)type.SecurityDeclarations); val3.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val = (TypeReference)(object)val3; PrePatchNested(type); } protected virtual void PrePatchNested(TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { PrePatchType(type.NestedTypes[i]); } } public virtual void PatchModule(ModuleDefinition mod) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; if ((((TypeReference)current).Namespace == "MonoMod" || ((TypeReference)current).Namespace.StartsWith("MonoMod.")) && ((MemberReference)current.BaseType).FullName == "System.Attribute") { PatchType(current); } } } finally { ((IDisposable)enumerator).Dispose(); } enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current2 = enumerator.Current; if ((!(((TypeReference)current2).Namespace == "MonoMod") && !((TypeReference)current2).Namespace.StartsWith("MonoMod.")) || !(((MemberReference)current2.BaseType).FullName == "System.Attribute")) { PatchType(current2); } } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchType(TypeDefinition type) { //IL_0078: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)type); TypeReference type2 = Module.GetType(patchFullName, false); if (type2 == null) { return; } TypeDefinition val = ((type2 != null) ? Extensions.SafeResolve(type2) : null); Enumerator<CustomAttribute> enumerator; if ((((TypeReference)type).Namespace != "MonoMod" && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) || SkipList.Contains(patchFullName) || !MatchingConditionals((ICustomAttributeProvider)(object)type, Module)) { if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore") && val != null) { enumerator = type.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } PatchNested(type); return; } if (patchFullName == ((MemberReference)type).FullName) { LogVerbose("[PatchType] Patching type " + patchFullName); } else { LogVerbose("[PatchType] Patching type " + patchFullName + " (prefixed: " + ((MemberReference)type).FullName + ")"); } enumerator = type.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current2 = enumerator.Current; if (!Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)val, ((MemberReference)current2.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current2)); } } } finally { ((IDisposable)enumerator).Dispose(); } HashSet<MethodDefinition> hashSet = new HashSet<MethodDefinition>(); Enumerator<PropertyDefinition> enumerator2 = type.Properties.GetEnumerator(); try { while (enumerator2.MoveNext()) { PropertyDefinition current3 = enumerator2.Current; PatchProperty(val, current3, hashSet); } } finally { ((IDisposable)enumerator2).Dispose(); } HashSet<MethodDefinition> hashSet2 = new HashSet<MethodDefinition>(); Enumerator<EventDefinition> enumerator3 = type.Events.GetEnumerator(); try { while (enumerator3.MoveNext()) { EventDefinition current4 = enumerator3.Current; PatchEvent(val, current4, hashSet2); } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<MethodDefinition> enumerator4 = type.Methods.GetEnumerator(); try { while (enumerator4.MoveNext()) { MethodDefinition current5 = enumerator4.Current; if (!hashSet.Contains(current5) && !hashSet2.Contains(current5)) { PatchMethod(val, current5); } } } finally { ((IDisposable)enumerator4).Dispose(); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModEnumReplace")) { int num = 0; while (num < val.Fields.Count) { if (((MemberReference)val.Fields[num]).Name == "value__") { num++; } else { val.Fields.RemoveAt(num); } } } Enumerator<FieldDefinition> enumerator5 = type.Fields.GetEnumerator(); try { while (enumerator5.MoveNext()) { FieldDefinition current6 = enumerator5.Current; PatchField(val, current6); } } finally { ((IDisposable)enumerator5).Dispose(); } PatchNested(type); } protected virtual void PatchNested(TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { PatchType(type.NestedTypes[i]); } } public virtual void PatchProperty(TypeDefinition targetType, PropertyDefinition prop, HashSet<MethodDefinition> propMethods = null) { //IL_006e: 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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_022b: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_02b5: Expected O, but got Unknown //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) if (!MatchingConditionals((ICustomAttributeProvider)(object)prop, Module)) { return; } ((MemberReference)prop).Name = Extensions.GetPatchName((MemberReference)(object)prop); PropertyDefinition val = Extensions.FindProperty(targetType, ((MemberReference)prop).Name); string text = "<" + ((MemberReference)prop).Name + ">__BackingField"; FieldDefinition val2 = Extensions.FindField(prop.DeclaringType, text); FieldDefinition val3 = Extensions.FindField(targetType, text); Enumerator<CustomAttribute> enumerator; Enumerator<MethodDefinition> enumerator2; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModIgnore")) { if (val != null) { enumerator = prop.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 != null) { val2.DeclaringType.Fields.Remove(val2); } if (prop.GetMethod != null) { propMethods?.Add(prop.GetMethod); } if (prop.SetMethod != null) { propMethods?.Add(prop.SetMethod); } enumerator2 = prop.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current2 = enumerator2.Current; propMethods?.Add(current2); } return; } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModReplace")) { if (val != null) { targetType.Properties.Remove(val); if (val3 != null) { targetType.Fields.Remove(val3); } if (val.GetMethod != null) { targetType.Methods.Remove(val.GetMethod); } if (val.SetMethod != null) { targetType.Methods.Remove(val.SetMethod); } enumerator2 = val.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current3 = enumerator2.Current; targetType.Methods.Remove(current3); } } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModRemove")) { return; } } if (val == null) { PropertyDefinition val4 = new PropertyDefinition(((MemberReference)prop).Name, prop.Attributes, ((PropertyReference)prop).PropertyType); val = val4; PropertyDefinition val5 = val4; val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); Enumerator<ParameterDefinition> enumerator3 = ((PropertyReference)prop).Parameters.GetEnumerator(); try { while (enumerator3.MoveNext()) { ParameterDefinition current4 = enumerator3.Current; ((PropertyReference)val5).Parameters.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator3).Dispose(); } val5.DeclaringType = targetType; targetType.Properties.Add(val5); if (val2 != null) { FieldDefinition val6 = new FieldDefinition(text, val2.Attributes, ((FieldReference)val2).FieldType); val3 = val6; FieldDefinition val7 = val6; targetType.Fields.Add(val7); } } enumerator = prop.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current5 = enumerator.Current; val.CustomAttributes.Add(Extensions.Clone(current5)); } } finally { ((IDisposable)enumerator).Dispose(); } MethodDefinition getMethod = prop.GetMethod; MethodDefinition getMethod2; if (getMethod != null && (getMethod2 = PatchMethod(targetType, getMethod)) != null) { val.GetMethod = getMethod2; propMethods?.Add(getMethod); } MethodDefinition setMethod = prop.SetMethod; if (setMethod != null && (getMethod2 = PatchMethod(targetType, setMethod)) != null) { val.SetMethod = getMethod2; propMethods?.Add(setMethod); } enumerator2 = prop.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current6 = enumerator2.Current; if ((getMethod2 = PatchMethod(targetType, current6)) != null) { val.OtherMethods.Add(getMethod2); propMethods?.Add(current6); } } } finally { ((IDisposable)enumerator2).Dispose(); } } public virtual void PatchEvent(TypeDefinition targetType, EventDefinition srcEvent, HashSet<MethodDefinition> propMethods = null) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Expected O, but got Unknown //IL_0252: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) ((MemberReference)srcEvent).Name = Extensions.GetPatchName((MemberReference)(object)srcEvent); EventDefinition val = Extensions.FindEvent(targetType, ((MemberReference)srcEvent).Name); string text = "<" + ((MemberReference)srcEvent).Name + ">__BackingField"; FieldDefinition val2 = Extensions.FindField(srcEvent.DeclaringType, text); FieldDefinition val3 = Extensions.FindField(targetType, text); Enumerator<CustomAttribute> enumerator; Enumerator<MethodDefinition> enumerator2; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModIgnore")) { if (val != null) { enumerator = srcEvent.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 != null) { val2.DeclaringType.Fields.Remove(val2); } if (srcEvent.AddMethod != null) { propMethods?.Add(srcEvent.AddMethod); } if (srcEvent.RemoveMethod != null) { propMethods?.Add(srcEvent.RemoveMethod); } if (srcEvent.InvokeMethod != null) { propMethods?.Add(srcEvent.InvokeMethod); } enumerator2 = srcEvent.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current2 = enumerator2.Current; propMethods?.Add(current2); } return; } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModReplace")) { if (val != null) { targetType.Events.Remove(val); if (val3 != null) { targetType.Fields.Remove(val3); } if (val.AddMethod != null) { targetType.Methods.Remove(val.AddMethod); } if (val.RemoveMethod != null) { targetType.Methods.Remove(val.RemoveMethod); } if (val.InvokeMethod != null) { targetType.Methods.Remove(val.InvokeMethod); } if (val.OtherMethods != null) { enumerator2 = val.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current3 = enumerator2.Current; targetType.Methods.Remove(current3); } } finally { ((IDisposable)enumerator2).Dispose(); } } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModRemove")) { return; } } if (val == null) { EventDefinition val4 = new EventDefinition(((MemberReference)srcEvent).Name, srcEvent.Attributes, ((EventReference)srcEvent).EventType); val = val4; EventDefinition val5 = val4; val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val5.DeclaringType = targetType; targetType.Events.Add(val5); if (val2 != null) { FieldDefinition val6 = new FieldDefinition(text, val2.Attributes, ((FieldReference)val2).FieldType); targetType.Fields.Add(val6); } } enumerator = srcEvent.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current4 = enumerator.Current; val.CustomAttributes.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator).Dispose(); } MethodDefinition addMethod = srcEvent.AddMethod; MethodDefinition addMethod2; if (addMethod != null && (addMethod2 = PatchMethod(targetType, addMethod)) != null) { val.AddMethod = addMethod2; propMethods?.Add(addMethod); } MethodDefinition removeMethod = srcEvent.RemoveMethod; if (removeMethod != null && (addMethod2 = PatchMethod(targetType, removeMethod)) != null) { val.RemoveMethod = addMethod2; propMethods?.Add(removeMethod); } MethodDefinition invokeMethod = srcEvent.InvokeMethod; if (invokeMethod != null && (addMethod2 = PatchMethod(targetType, invokeMethod)) != null) { val.InvokeMethod = addMethod2; propMethods?.Add(invokeMethod); } enumerator2 = srcEvent.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current5 = enumerator2.Current; if ((addMethod2 = PatchMethod(targetType, current5)) != null) { val.OtherMethods.Add(addMethod2); propMethods?.Add(current5); } } } finally { ((IDisposable)enumerator2).Dispose(); } } public virtual void PatchField(TypeDefinition targetType, FieldDefinition field) { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)field.DeclaringType); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModNoNew") || SkipList.Contains(patchFullName + "::" + ((MemberReference)field).Name) || !MatchingConditionals((ICustomAttributeProvider)(object)field, Module)) { return; } ((MemberReference)field).Name = Extensions.GetPatchName((MemberReference)(object)field); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModReplace")) { FieldDefinition val = Extensions.FindField(targetType, ((MemberReference)field).Name); if (val != null) { targetType.Fields.Remove(val); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModRemove")) { return; } } FieldDefinition val2 = Extensions.FindField(targetType, ((MemberReference)field).Name); Enumerator<CustomAttribute> enumerator; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModIgnore") && val2 != null) { enumerator = field.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val2.CustomAttributes.Add(Extensions.Clone(current)); } } return; } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 == null) { val2 = new FieldDefinition(((MemberReference)field).Name, field.Attributes, ((FieldReference)field).FieldType); val2.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val2.InitialValue = field.InitialValue; if (field.HasConstant) { val2.Constant = field.Constant; } targetType.Fields.Add(val2); } enumerator = field.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current2 = enumerator.Current; val2.CustomAttributes.Add(Extensions.Clone(current2)); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual MethodDefinition PatchMethod(TypeDefinition targetType, MethodDefinition method) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Expected O, but got Unknown //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Expected O, but got Unknown //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown if (((MemberReference)method).Name.StartsWith("orig_") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModOriginal")) { return null; } if (!AllowedSpecialName(method, targetType) || !MatchingConditionals((ICustomAttributeProvider)(object)method, Module)) { return null; } string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)targetType); if (SkipList.Contains(Extensions.GetID((MethodReference)(object)method, (string)null, patchFullName, true, false))) { return null; } ((MemberReference)method).Name = Extensions.GetPatchName((MemberReference)(object)method); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModConstructor")) { if (!method.IsSpecialName && !Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModOriginalName")) { CustomAttribute val = new CustomAttribute(GetMonoModOriginalNameCtor()); val.ConstructorArguments.Add(new CustomAttributeArgument(Module.TypeSystem.String, (object)("orig_" + ((MemberReference)method).Name))); method.CustomAttributes.Add(val); } ((MemberReference)method).Name = (method.IsStatic ? ".cctor" : ".ctor"); method.IsSpecialName = true; method.IsRuntimeSpecialName = true; } MethodDefinition val2 = Extensions.FindMethod(targetType, Extensions.GetID((MethodReference)(object)method, (string)null, patchFullName, true, false), true); MethodDefinition obj = method; string text = patchFullName; MethodDefinition val3 = Extensions.FindMethod(targetType, Extensions.GetID((MethodReference)(object)obj, method.GetOriginalName(), text, true, false), true); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModIgnore")) { if (val2 != null) { Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName) || CustomMethodAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val2.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } return null; } if (val2 == null && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModNoNew")) { return null; } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModRemove")) { if (val2 != null) { targetType.Methods.Remove(val2); } return null; } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModReplace")) { if (val2 != null) { val2.CustomAttributes.Clear(); val2.Attributes = method.Attributes; val2.IsPInvokeImpl = method.IsPInvokeImpl; val2.ImplAttributes = method.ImplAttributes; } } else if (val2 != null && val3 == null) { val3 = Extensions.Clone(val2, (MethodDefinition)null); ((MemberReference)val3).Name = method.GetOriginalName(); val3.Attributes = (MethodAttributes)(val2.Attributes & 0xF7FF & 0xEFFF); ((MemberReference)val3).MetadataToken = GetMetadataToken((TokenType)100663296); val3.IsVirtual = false; val3.Overrides.Clear(); Enumerator<MethodReference> enumerator2 = method.Overrides.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodReference current2 = enumerator2.Current; val3.Overrides.Add(current2); } } finally { ((IDisposable)enumerator2).Dispose(); } val3.CustomAttributes.Add(new CustomAttribute(GetMonoModOriginalCtor())); MethodDefinition val4 = Extensions.FindMethod(method.DeclaringType, Extensions.GetID((MethodReference)(object)method, method.GetOriginalName(), (string)null, true, false), true); if (val4 != null) { Enumerator<CustomAttribute> enumerator = val4.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current3 = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current3.AttributeType).FullName) || CustomMethodAttributeHandlers.ContainsKey(((MemberReference)current3.AttributeType).FullName)) { val3.CustomAttributes.Add(Extensions.Clone(current3)); } } } finally { ((IDisposable)enumerator).Dispose(); } } targetType.Methods.Add(val3); } if (val3 != null && method.IsConstructor && method.IsStatic && method.HasBody && !Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModConstructor")) { Collection<Instruction> instructions = method.Body.Instructions; ILProcessor iLProcessor = method.Body.GetILProcessor(); iLProcessor.InsertBefore(instructions[instructions.Count - 1], iLProcessor.Create(OpCodes.Call, (MethodReference)(object)val3)); } if (val2 != null) { val2.Body = Extensions.Clone(method.Body, val2); val2.IsManaged = method.IsManaged; val2.IsIL = method.IsIL; val2.IsNative = method.IsNative; val2.PInvokeInfo = method.PInvokeInfo; val2.IsPreserveSig = method.IsPreserveSig; val2.IsInternalCall = method.IsInternalCall; val2.IsPInvokeImpl = method.IsPInvokeImpl; Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current4 = enumerator.Current; val2.CustomAttributes.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator).Dispose(); } method = val2; } else { MethodDefinition val5 = new MethodDefinition(((MemberReference)method).Name, method.Attributes, Module.TypeSystem.Void); ((MemberReference)val5).MetadataToken = GetMetadataToken((TokenType)100663296); ((MethodReference)val5).CallingConvention = ((MethodReference)method).CallingConvention; ((MethodReference)val5).ExplicitThis = ((MethodReference)method).ExplicitThis; ((MethodReference)val5).MethodReturnType = ((MethodReference)method).MethodReturnType; val5.Attributes = method.Attributes; val5.ImplAttributes = method.ImplAttributes; val5.SemanticsAttributes = method.SemanticsAttributes; val5.DeclaringType = targetType; ((MethodReference)val5).ReturnType = ((MethodReference)method).ReturnType; val5.Body = Extensions.Clone(method.Body, val5); val5.PInvokeInfo = method.PInvokeInfo; val5.IsPInvokeImpl = method.IsPInvokeImpl; Enumerator<GenericParameter> enumerator3 = ((MethodReference)method).GenericParameters.GetEnumerator(); try { while (enumerator3.MoveNext()) { GenericParameter current5 = enumerator3.Current; ((MethodReference)val5).GenericParameters.Add(Extensions.Clone(current5)); } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<ParameterDefinition> enumerator4 = ((MethodReference)method).Parameters.GetEnumerator(); try { while (enumerator4.MoveNext()) { ParameterDefinition current6 = enumerator4.Current; ((MethodReference)val5).Parameters.Add(Extensions.Clone(current6)); } } finally { ((IDisposable)enumerator4).Dispose(); } Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current7 = enumerator.Current; val5.CustomAttributes.Add(Extensions.Clone(current7)); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<MethodReference> enumerator2 = method.Overrides.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodReference current8 = enumerator2.Current; val5.Overrides.Add(current8); } } finally { ((IDisposable)enumerator2).Dispose(); } val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); targetType.Methods.Add(val5); method = val5; } if (val3 != null) { CustomAttribute val6 = new CustomAttribute(GetMonoModOriginalNameCtor()); val6.ConstructorArguments.Add(new CustomAttributeArgument(Module.TypeSystem.String, (object)((MemberReference)val3).Name)); method.CustomAttributes.Add(val6); } return method; } public virtual void PatchRefs() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) if (!UpgradeMSCORLIB.HasValue) { Version fckUnity = new Version(2, 0, 5, 0); UpgradeMSCORLIB = ((IEnumerable<AssemblyNameReference>)Module.AssemblyReferences).Any((AssemblyNameReference x) => x.Version == fckUnity); } if (UpgradeMSCORLIB.Value) { List<AssemblyNameReference> list = new List<AssemblyNameReference>(); for (int i = 0; i < Module.AssemblyReferences.Count; i++) { AssemblyNameReference val = Module.AssemblyReferences[i]; if (val.Name == "mscorlib") { list.Add(val); } } if (list.Count > 1) { AssemblyNameReference val2 = list.OrderByDescending((AssemblyNameReference x) => x.Version).First(); if (DependencyCache.TryGetValue(val2.FullName, out var value)) { for (int j = 0; j < Module.AssemblyReferences.Count; j++) { AssemblyNameReference val3 = Module.AssemblyReferences[j]; if (val3.Name == "mscorlib" && val2.Version > val3.Version) { LogVerbose("[PatchRefs] Removing and relinking duplicate mscorlib: " + val3.Version); RelinkModuleMap[val3.FullName] = value; Module.AssemblyReferences.RemoveAt(j); j--; } } } } } Enumerator<TypeDefinition> enumerator = Module.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PatchRefsInType(current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchRefs(ModuleDefinition mod) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PatchRefsInType(current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchRefsInType(TypeDefinition type) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown LogVerbose($"[VERBOSE] [PatchRefsInType] Patching refs in {type}"); if (type.BaseType != null) { type.BaseType = Extensions.Relink(type.BaseType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); } for (int i = 0; i < ((TypeReference)type).GenericParameters.Count; i++) { ((TypeReference)type).GenericParameters[i] = Extensions.Relink(((TypeReference)type).GenericParameters[i], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } for (int j = 0; j < type.Interfaces.Count; j++) { InterfaceImplementation obj = type.Interfaces[j]; InterfaceImplementation val = new InterfaceImplementation(Extensions.Relink(obj.InterfaceType, new Relinker(Relinker), (IGenericParameterProvider)(object)type)); Enumerator<CustomAttribute> enumerator = obj.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; val.CustomAttributes.Add(Extensions.Relink(current, new Relinker(Relinker), (IGenericParameterProvider)(object)type)); } } finally { ((IDisposable)enumerator).Dispose(); } type.Interfaces[j] = val; } for (int k = 0; k < type.CustomAttributes.Count; k++) { type.CustomAttributes[k] = Extensions.Relink(type.CustomAttributes[k], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } Enumerator<PropertyDefinition> enumerator2 = type.Properties.GetEnumerator(); try { while (enumerator2.MoveNext()) { PropertyDefinition current2 = enumerator2.Current; ((PropertyReference)current2).PropertyType = Extensions.Relink(((PropertyReference)current2).PropertyType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int l = 0; l < current2.CustomAttributes.Count; l++) { current2.CustomAttributes[l] = Extensions.Relink(current2.CustomAttributes[l], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<EventDefinition> enumerator3 = type.Events.GetEnumerator(); try { while (enumerator3.MoveNext()) { EventDefinition current3 = enumerator3.Current; ((EventReference)current3).EventType = Extensions.Relink(((EventReference)current3).EventType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int m = 0; m < current3.CustomAttributes.Count; m++) { current3.CustomAttributes[m] = Extensions.Relink(current3.CustomAttributes[m], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<MethodDefinition> enumerator4 = type.Methods.GetEnumerator(); try { while (enumerator4.MoveNext()) { MethodDefinition current4 = enumerator4.Current; PatchRefsInMethod(current4); } } finally { ((IDisposable)enumerator4).Dispose(); } Enumerator<FieldDefinition> enumerator5 = type.Fields.GetEnumerator(); try { while (enumerator5.MoveNext()) { FieldDefinition current5 = enumerator5.Current; ((FieldReference)current5).FieldType = Extensions.Relink(((FieldReference)current5).FieldType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int n = 0; n < current5.CustomAttributes.Count; n++) { current5.CustomAttributes[n] = Extensions.Relink(current5.CustomAttributes[n], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator5).Dispose(); } for (int num = 0; num < type.NestedTypes.Count; num++) { PatchRefsInType(type.NestedTypes[num]); } } public virtual void PatchRefsInMethod(MethodDefinition method) { //IL_0030: Unknown result t
pachers/BepInEx.MonoMod.HookGenPatcher/MonoMod.RuntimeDetour.HookGen.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("0x0ade")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright 2021 0x0ade")] [assembly: AssemblyDescription("Auto-generate hook helper .dlls, hook arbitrary methods via events: On.Namespace.Type.Method += YourHandlerHere;")] [assembly: AssemblyFileVersion("21.8.5.1")] [assembly: AssemblyInformationalVersion("21.08.05.01")] [assembly: AssemblyProduct("MonoMod.RuntimeDetour.HookGen")] [assembly: AssemblyTitle("MonoMod.RuntimeDetour.HookGen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("21.8.5.1")] [module: UnverifiableCode] internal static class MultiTargetShims { private static readonly object[] _NoArgs = new object[0]; public static TypeReference GetConstraintType(this TypeReference type) { return type; } } namespace MonoMod { internal static class MMDbgLog { public static readonly string Tag; public static TextWriter Writer; public static bool Debugging; static MMDbgLog() { Tag = typeof(MMDbgLog).Assembly.GetName().Name; if (Environment.GetEnvironmentVariable("MONOMOD_DBGLOG") == "1" || (Environment.GetEnvironmentVariable("MONOMOD_DBGLOG")?.ToLowerInvariant()?.Contains(Tag.ToLowerInvariant())).GetValueOrDefault()) { Start(); } } public static void WaitForDebugger() { if (!Debugging) { Debugging = true; Debugger.Launch(); Thread.Sleep(6000); Debugger.Break(); } } public static void Start() { if (Writer != null) { return; } string text = Environment.GetEnvironmentVariable("MONOMOD_DBGLOG_PATH"); if (text == "-") { Writer = Console.Out; return; } if (string.IsNullOrEmpty(text)) { text = "mmdbglog.txt"; } text = Path.GetFullPath(Path.GetFileNameWithoutExtension(text) + "-" + Tag + Path.GetExtension(text)); try { if (File.Exists(text)) { File.Delete(text); } } catch { } try { string directoryName = Path.GetDirectoryName(text); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } Writer = new StreamWriter(new FileStream(text, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete), Encoding.UTF8); } catch { } } public static void Log(string str) { TextWriter writer = Writer; if (writer != null) { writer.WriteLine(str); writer.Flush(); } } public static T Log<T>(string str, T value) { TextWriter writer = Writer; if (writer == null) { return value; } writer.WriteLine(string.Format(str, value)); writer.Flush(); return value; } } } namespace MonoMod.RuntimeDetour.HookGen { public class HookGenerator { private const string ObsoleteMessageBackCompat = "This method only exists for backwards-compatibility purposes."; private static readonly Regex NameVerifyRegex; private static readonly Dictionary<Type, string> ReflTypeNameMap; private static readonly Dictionary<string, string> TypeNameMap; public MonoModder Modder; public ModuleDefinition OutputModule; public string Namespace; public string NamespaceIL; public bool HookOrig; public bool HookPrivate; public string HookExtName; public ModuleDefinition module_RuntimeDetour; public ModuleDefinition module_Utils; public TypeReference t_MulticastDelegate; public TypeReference t_IAsyncResult; public TypeReference t_AsyncCallback; public TypeReference t_MethodBase; public TypeReference t_RuntimeMethodHandle; public TypeReference t_EditorBrowsableState; public MethodReference m_Object_ctor; public MethodReference m_ObsoleteAttribute_ctor; public MethodReference m_EditorBrowsableAttribute_ctor; public MethodReference m_GetMethodFromHandle; public MethodReference m_Add; public MethodReference m_Remove; public MethodReference m_Modify; public MethodReference m_Unmodify; public TypeReference t_ILManipulator; static HookGenerator() { NameVerifyRegex = new Regex("[^a-zA-Z]"); ReflTypeNameMap = new Dictionary<Type, string> { { typeof(string), "string" }, { typeof(object), "object" }, { typeof(bool), "bool" }, { typeof(byte), "byte" }, { typeof(char), "char" }, { typeof(decimal), "decimal" }, { typeof(double), "double" }, { typeof(short), "short" }, { typeof(int), "int" }, { typeof(long), "long" }, { typeof(sbyte), "sbyte" }, { typeof(float), "float" }, { typeof(ushort), "ushort" }, { typeof(uint), "uint" }, { typeof(ulong), "ulong" }, { typeof(void), "void" } }; TypeNameMap = new Dictionary<string, string>(); foreach (KeyValuePair<Type, string> item in ReflTypeNameMap) { TypeNameMap[item.Key.FullName] = item.Value; } } public HookGenerator(MonoModder modder, string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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) //IL_0025: 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_003d: 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_0053: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Expected O, but got Unknown //IL_0326: Expected O, but got Unknown Modder = modder; OutputModule = ModuleDefinition.CreateModule(name, new ModuleParameters { Architecture = modder.Module.Architecture, AssemblyResolver = modder.Module.AssemblyResolver, Kind = (ModuleKind)0, Runtime = modder.Module.Runtime }); modder.MapDependencies(); Extensions.AddRange<AssemblyNameReference>(OutputModule.AssemblyReferences, (IEnumerable<AssemblyNameReference>)modder.Module.AssemblyReferences); modder.DependencyMap[OutputModule] = new List<ModuleDefinition>(modder.DependencyMap[modder.Module]); Namespace = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE"); if (string.IsNullOrEmpty(Namespace)) { Namespace = "On"; } NamespaceIL = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE_IL"); if (string.IsNullOrEmpty(NamespaceIL)) { NamespaceIL = "IL"; } HookOrig = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_ORIG") == "1"; HookPrivate = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE") == "1"; modder.MapDependency(modder.Module, "MonoMod.RuntimeDetour", (string)null, (AssemblyNameReference)null); if (!modder.DependencyCache.TryGetValue("MonoMod.RuntimeDetour", out module_RuntimeDetour)) { throw new FileNotFoundException("MonoMod.RuntimeDetour not found!"); } modder.MapDependency(modder.Module, "MonoMod.Utils", (string)null, (AssemblyNameReference)null); if (!modder.DependencyCache.TryGetValue("MonoMod.Utils", out module_Utils)) { throw new FileNotFoundException("MonoMod.Utils not found!"); } t_MulticastDelegate = OutputModule.ImportReference(modder.FindType("System.MulticastDelegate")); t_IAsyncResult = OutputModule.ImportReference(modder.FindType("System.IAsyncResult")); t_AsyncCallback = OutputModule.ImportReference(modder.FindType("System.AsyncCallback")); t_MethodBase = OutputModule.ImportReference(modder.FindType("System.Reflection.MethodBase")); t_RuntimeMethodHandle = OutputModule.ImportReference(modder.FindType("System.RuntimeMethodHandle")); t_EditorBrowsableState = OutputModule.ImportReference(modder.FindType("System.ComponentModel.EditorBrowsableState")); TypeDefinition type = module_RuntimeDetour.GetType("MonoMod.RuntimeDetour.HookGen.HookEndpointManager"); t_ILManipulator = OutputModule.ImportReference((TypeReference)(object)module_Utils.GetType("MonoMod.Cil.ILContext/Manipulator")); m_Object_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.Object").Resolve(), "System.Void .ctor()", true)); m_ObsoleteAttribute_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.ObsoleteAttribute").Resolve(), "System.Void .ctor(System.String,System.Boolean)", true)); m_EditorBrowsableAttribute_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.ComponentModel.EditorBrowsableAttribute").Resolve(), "System.Void .ctor(System.ComponentModel.EditorBrowsableState)", true)); ModuleDefinition outputModule = OutputModule; MethodReference val = new MethodReference("GetMethodFromHandle", t_MethodBase, t_MethodBase); val.Parameters.Add(new ParameterDefinition(t_RuntimeMethodHandle)); m_GetMethodFromHandle = outputModule.ImportReference(val); m_Add = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Add", true)); m_Remove = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Remove", true)); m_Modify = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Modify", true)); m_Unmodify = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Unmodify", true)); } public void Generate() { //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) Enumerator<TypeDefinition> enumerator = Modder.Module.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; GenerateFor(current, out var hookType, out var hookILType); if (hookType != null && hookILType != null && !((TypeReference)hookType).IsNested) { OutputModule.Types.Add(hookType); OutputModule.Types.Add(hookILType); } } } finally { ((IDisposable)enumerator).Dispose(); } } public void GenerateFor(TypeDefinition type, out TypeDefinition hookType, out TypeDefinition hookILType) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0141: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) hookType = (hookILType = null); if (((TypeReference)type).HasGenericParameters || type.IsRuntimeSpecialName || ((MemberReference)type).Name.StartsWith("<") || (!HookPrivate && type.IsNotPublic)) { return; } Modder.LogVerbose("[HookGen] Generating for type " + ((MemberReference)type).FullName); hookType = new TypeDefinition(((TypeReference)type).IsNested ? null : (Namespace + (string.IsNullOrEmpty(((TypeReference)type).Namespace) ? "" : ("." + ((TypeReference)type).Namespace))), ((MemberReference)type).Name, (TypeAttributes)(((!((TypeReference)type).IsNested) ? 1 : 2) | 0x80 | 0x100 | 0), OutputModule.TypeSystem.Object); hookILType = new TypeDefinition(((TypeReference)type).IsNested ? null : (NamespaceIL + (string.IsNullOrEmpty(((TypeReference)type).Namespace) ? "" : ("." + ((TypeReference)type).Namespace))), ((MemberReference)type).Name, (TypeAttributes)(((!((TypeReference)type).IsNested) ? 1 : 2) | 0x80 | 0x100 | 0), OutputModule.TypeSystem.Object); bool flag = false; Enumerator<MethodDefinition> enumerator = type.Methods.GetEnumerator(); try { while (enumerator.MoveNext()) { MethodDefinition current = enumerator.Current; flag |= GenerateFor(hookType, hookILType, current); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<TypeDefinition> enumerator2 = type.NestedTypes.GetEnumerator(); try { while (enumerator2.MoveNext()) { TypeDefinition current2 = enumerator2.Current; GenerateFor(current2, out var hookType2, out var hookILType2); if (hookType2 != null && hookILType2 != null) { flag = true; hookType.NestedTypes.Add(hookType2); hookILType.NestedTypes.Add(hookILType2); } } } finally { ((IDisposable)enumerator2).Dispose(); } if (!flag) { hookType = (hookILType = null); } } public bool GenerateFor(TypeDefinition hookType, TypeDefinition hookILType, MethodDefinition method) { //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Expected O, but got Unknown //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Expected O, but got Unknown //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Expected O, but got Unknown //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Expected O, but got Unknown //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Expected O, but got Unknown //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Expected O, but got Unknown //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Expected O, but got Unknown //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Expected O, but got Unknown if (((MethodReference)method).HasGenericParameters || method.IsAbstract || (method.IsSpecialName && !method.IsConstructor)) { return false; } if (!HookOrig && ((MemberReference)method).Name.StartsWith("orig_")) { return false; } if (!HookPrivate && method.IsPrivate) { return false; } string name = GetFriendlyName((MethodReference)(object)method); bool flag = true; if (((MethodReference)method).Parameters.Count == 0) { flag = false; } IEnumerable<MethodDefinition> source = null; if (flag) { source = ((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Where((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name && other != method); if (source.Count() == 0) { flag = false; } } if (flag) { StringBuilder stringBuilder = new StringBuilder(); for (int parami = 0; parami < ((MethodReference)method).Parameters.Count; parami++) { ParameterDefinition param = ((MethodReference)method).Parameters[parami]; if (!TypeNameMap.TryGetValue(((MemberReference)((ParameterReference)param).ParameterType).FullName, out var typeName)) { typeName = GetFriendlyName(((ParameterReference)param).ParameterType, full: false); } if (source.Any(delegate(MethodDefinition other) { ParameterDefinition val11 = ((IEnumerable<ParameterDefinition>)((MethodReference)other).Parameters).ElementAtOrDefault(parami); return val11 != null && GetFriendlyName(((ParameterReference)val11).ParameterType, full: false) == typeName && ((ParameterReference)val11).ParameterType.Namespace != ((ParameterReference)param).ParameterType.Namespace; })) { typeName = GetFriendlyName(((ParameterReference)param).ParameterType, full: true); } stringBuilder.Append("_"); stringBuilder.Append(typeName.Replace(".", "").Replace("`", "")); } name += stringBuilder.ToString(); } if (Extensions.FindEvent(hookType, name) != null) { int num = 1; string text; while (Extensions.FindEvent(hookType, text = name + "_" + num) != null) { num++; } name = text; } TypeDefinition val = GenerateDelegateFor(method); ((MemberReference)val).Name = "orig_" + name; val.CustomAttributes.Add(GenerateEditorBrowsable(EditorBrowsableState.Never)); hookType.NestedTypes.Add(val); TypeDefinition val2 = GenerateDelegateFor(method); ((MemberReference)val2).Name = "hook_" + name; ((MethodReference)Extensions.FindMethod(val2, "Invoke", true)).Parameters.Insert(0, new ParameterDefinition("orig", (ParameterAttributes)0, (TypeReference)(object)val)); ((MethodReference)Extensions.FindMethod(val2, "BeginInvoke", true)).Parameters.Insert(0, new ParameterDefinition("orig", (ParameterAttributes)0, (TypeReference)(object)val)); val2.CustomAttributes.Add(GenerateEditorBrowsable(EditorBrowsableState.Never)); hookType.NestedTypes.Add(val2); MethodReference val3 = OutputModule.ImportReference((MethodReference)(object)method); MethodDefinition val4 = new MethodDefinition("add_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val4).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, (TypeReference)(object)val2)); val4.Body = new MethodBody(val4); ILProcessor iLProcessor = val4.Body.GetILProcessor(); iLProcessor.Emit(OpCodes.Ldtoken, val3); iLProcessor.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor.Emit(OpCodes.Ldarg_0); GenericInstanceMethod val5 = new GenericInstanceMethod(m_Add); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor.Emit(OpCodes.Ret); hookType.Methods.Add(val4); MethodDefinition val6 = new MethodDefinition("remove_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val6).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, (TypeReference)(object)val2)); val6.Body = new MethodBody(val6); ILProcessor iLProcessor2 = val6.Body.GetILProcessor(); iLProcessor2.Emit(OpCodes.Ldtoken, val3); iLProcessor2.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor2.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Remove); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor2.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor2.Emit(OpCodes.Ret); hookType.Methods.Add(val6); EventDefinition val7 = new EventDefinition(name, (EventAttributes)0, (TypeReference)(object)val2) { AddMethod = val4, RemoveMethod = val6 }; hookType.Events.Add(val7); MethodDefinition val8 = new MethodDefinition("add_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val8).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, t_ILManipulator)); val8.Body = new MethodBody(val8); ILProcessor iLProcessor3 = val8.Body.GetILProcessor(); iLProcessor3.Emit(OpCodes.Ldtoken, val3); iLProcessor3.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor3.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Modify); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor3.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor3.Emit(OpCodes.Ret); hookILType.Methods.Add(val8); MethodDefinition val9 = new MethodDefinition("remove_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val9).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, t_ILManipulator)); val9.Body = new MethodBody(val9); ILProcessor iLProcessor4 = val9.Body.GetILProcessor(); iLProcessor4.Emit(OpCodes.Ldtoken, val3); iLProcessor4.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor4.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Unmodify); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor4.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor4.Emit(OpCodes.Ret); hookILType.Methods.Add(val9); EventDefinition val10 = new EventDefinition(name, (EventAttributes)0, t_ILManipulator) { AddMethod = val8, RemoveMethod = val9 }; hookILType.Events.Add(val10); return true; } public TypeDefinition GenerateDelegateFor(MethodDefinition method) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Expected O, but got Unknown //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown string name = GetFriendlyName((MethodReference)(object)method); int num = ((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Where((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name).ToList().IndexOf(method); if (num != 0) { string suffix = num.ToString(); do { name = name + "_" + suffix; } while (((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Any((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name + suffix)); } name = "d_" + name; TypeDefinition val = new TypeDefinition((string)null, (string)null, (TypeAttributes)258, t_MulticastDelegate); MethodDefinition val2 = new MethodDefinition(".ctor", (MethodAttributes)6278, OutputModule.TypeSystem.Void) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; ((MethodReference)val2).Parameters.Add(new ParameterDefinition(OutputModule.TypeSystem.Object)); ((MethodReference)val2).Parameters.Add(new ParameterDefinition(OutputModule.TypeSystem.IntPtr)); val2.Body = new MethodBody(val2); val.Methods.Add(val2); MethodDefinition val3 = new MethodDefinition("Invoke", (MethodAttributes)454, ImportVisible(((MethodReference)method).ReturnType)) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; if (!method.IsStatic) { TypeReference val4 = ImportVisible((TypeReference)(object)method.DeclaringType); if (((TypeReference)method.DeclaringType).IsValueType) { val4 = (TypeReference)new ByReferenceType(val4); } ((MethodReference)val3).Parameters.Add(new ParameterDefinition("self", (ParameterAttributes)0, val4)); } Enumerator<ParameterDefinition> enumerator = ((MethodReference)method).Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current = enumerator.Current; ((MethodReference)val3).Parameters.Add(new ParameterDefinition(((ParameterReference)current).Name, (ParameterAttributes)(current.Attributes & 0xFFEF & 0xEFFF), ImportVisible(((ParameterReference)current).ParameterType))); } } finally { ((IDisposable)enumerator).Dispose(); } val3.Body = new MethodBody(val3); val.Methods.Add(val3); MethodDefinition val5 = new MethodDefinition("BeginInvoke", (MethodAttributes)454, t_IAsyncResult) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; enumerator = ((MethodReference)val3).Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current2 = enumerator.Current; ((MethodReference)val5).Parameters.Add(new ParameterDefinition(((ParameterReference)current2).Name, current2.Attributes, ((ParameterReference)current2).ParameterType)); } } finally { ((IDisposable)enumerator).Dispose(); } ((MethodReference)val5).Parameters.Add(new ParameterDefinition("callback", (ParameterAttributes)0, t_AsyncCallback)); ((MethodReference)val5).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, OutputModule.TypeSystem.Object)); val5.Body = new MethodBody(val5); val.Methods.Add(val5); MethodDefinition val6 = new MethodDefinition("EndInvoke", (MethodAttributes)454, OutputModule.TypeSystem.Object) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; ((MethodReference)val6).Parameters.Add(new ParameterDefinition("result", (ParameterAttributes)0, t_IAsyncResult)); val6.Body = new MethodBody(val6); val.Methods.Add(val6); return val; } private string GetFriendlyName(MethodReference method) { string text = ((MemberReference)method).Name; if (text.StartsWith(".")) { text = text.Substring(1); } return text.Replace('.', '_'); } private string GetFriendlyName(TypeReference type, bool full) { if (type is TypeSpecification) { StringBuilder stringBuilder = new StringBuilder(); BuildFriendlyName(stringBuilder, type, full); return stringBuilder.ToString(); } if (!full) { return ((MemberReference)type).Name; } return ((MemberReference)type).FullName; } private void BuildFriendlyName(StringBuilder builder, TypeReference type, bool full) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!(type is TypeSpecification)) { builder.Append((full ? ((MemberReference)type).FullName : ((MemberReference)type).Name).Replace("_", "")); return; } if (type.IsByReference) { builder.Append("ref"); } else if (type.IsPointer) { builder.Append("ptr"); } BuildFriendlyName(builder, ((TypeSpecification)type).ElementType, full); if (type.IsArray) { builder.Append("Array"); } } private bool IsPublic(TypeDefinition typeDef) { if (typeDef != null && (typeDef.IsNestedPublic || typeDef.IsPublic)) { return !typeDef.IsNotPublic; } return false; } private bool HasPublicArgs(GenericInstanceType typeGen) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Enumerator<TypeReference> enumerator = typeGen.GenericArguments.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeReference current = enumerator.Current; if (current.IsGenericParameter) { return false; } GenericInstanceType val = (GenericInstanceType)(object)((current is GenericInstanceType) ? current : null); if (val != null && !HasPublicArgs(val)) { return false; } if (!IsPublic(Extensions.SafeResolve(current))) { return false; } } } finally { ((IDisposable)enumerator).Dispose(); } return true; } private TypeReference ImportVisible(TypeReference typeRef) { for (TypeDefinition val = ((typeRef != null) ? Extensions.SafeResolve(typeRef) : null); val != null; val = ((typeRef != null) ? Extensions.SafeResolve(typeRef) : null)) { GenericInstanceType val2 = (GenericInstanceType)(object)((typeRef is GenericInstanceType) ? typeRef : null); if (val2 == null || HasPublicArgs(val2)) { TypeDefinition val3 = val; while (true) { if (val3 != null) { if (IsPublic(val3) && (val3 == val || !((TypeReference)val3).HasGenericParameters)) { val3 = val3.DeclaringType; continue; } if (!val.IsEnum) { break; } typeRef = ((FieldReference)Extensions.FindField(val, "value__")).FieldType; } try { return OutputModule.ImportReference(typeRef); } catch { return OutputModule.TypeSystem.Object; } } } typeRef = val.BaseType; } return OutputModule.TypeSystem.Object; } private CustomAttribute GenerateObsolete(string message, bool error) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown CustomAttribute val = new CustomAttribute(m_ObsoleteAttribute_ctor); val.ConstructorArguments.Add(new CustomAttributeArgument(OutputModule.TypeSystem.String, (object)message)); val.ConstructorArguments.Add(new CustomAttributeArgument(OutputModule.TypeSystem.Boolean, (object)error)); return val; } private CustomAttribute GenerateEditorBrowsable(EditorBrowsableState state) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown CustomAttribute val = new CustomAttribute(m_EditorBrowsableAttribute_ctor); val.ConstructorArguments.Add(new CustomAttributeArgument(t_EditorBrowsableState, (object)state)); return val; } } internal class Program { private static void Main(string[] args) { //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown Console.WriteLine("MonoMod.RuntimeDetour.HookGen " + typeof(Program).Assembly.GetName().Version); Console.WriteLine("using MonoMod " + typeof(MonoModder).Assembly.GetName().Version); Console.WriteLine("using MonoMod.RuntimeDetour " + typeof(Detour).Assembly.GetName().Version); if (args.Length == 0) { Console.WriteLine("No valid arguments (assembly path) passed."); if (Debugger.IsAttached) { Console.ReadKey(); } return; } int num = 0; for (int i = 0; i < args.Length; i++) { if (args[i] == "--namespace" && i + 2 < args.Length) { i++; Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE", args[i]); continue; } if (args[i] == "--namespace-il" && i + 2 < args.Length) { i++; Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE_IL", args[i]); continue; } if (args[i] == "--orig") { Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_ORIG", "1"); continue; } if (args[i] == "--private") { Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE", "1"); continue; } num = i; break; } if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW"))) { Environment.SetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW", "0"); } if (num >= args.Length) { Console.WriteLine("No assembly path passed."); if (Debugger.IsAttached) { Console.ReadKey(); } return; } string text = args[num]; string text2 = ((args.Length != 1 && num != args.Length - 1) ? args[^1] : null); text2 = text2 ?? Path.Combine(Path.GetDirectoryName(text), "MMHOOK_" + Path.ChangeExtension(Path.GetFileName(text), "dll")); MonoModder val = new MonoModder { InputPath = text, OutputPath = text2, ReadingMode = (ReadingMode)2 }; try { val.Read(); val.MapDependencies(); if (File.Exists(text2)) { val.Log("[HookGen] Clearing " + text2); File.Delete(text2); } val.Log("[HookGen] Starting HookGenerator"); HookGenerator hookGenerator = new HookGenerator(val, Path.GetFileName(text2)); ModuleDefinition outputModule = hookGenerator.OutputModule; try { hookGenerator.Generate(); outputModule.Write(text2); } finally { ((IDisposable)outputModule)?.Dispose(); } val.Log("[HookGen] Done."); } finally { ((IDisposable)val)?.Dispose(); } if (Debugger.IsAttached) { Console.ReadKey(); } } } }
plugins/backrooms/Backrooms.dll
Decompiled 9 months agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } [RequireComponent(typeof(SphereCollider))] public class KillBox : MonoBehaviour { private void OnTriggerEnter(Collider other) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { component.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0); } } } public class LightFlickerEffect : MonoBehaviour { [Tooltip("External light to flicker; you can leave this null if you attach script to a light")] public Light light; [Tooltip("Minimum random light intensity")] public float minIntensity; [Tooltip("Maximum random light intensity")] public float maxIntensity = 1f; [Tooltip("How much to smooth out the randomness; lower values = sparks, higher = lantern")] [Range(1f, 50f)] public int smoothing = 5; private Queue<float> smoothQueue; private float lastSum; public void Reset() { smoothQueue.Clear(); lastSum = 0f; } private void Start() { smoothQueue = new Queue<float>(smoothing); if ((Object)(object)light == (Object)null) { light = ((Component)this).GetComponent<Light>(); } } private void Update() { if (!((Object)(object)light == (Object)null)) { while (smoothQueue.Count >= smoothing) { lastSum -= smoothQueue.Dequeue(); } float num = Random.Range(minIntensity, maxIntensity); smoothQueue.Enqueue(num); lastSum += num; light.intensity = lastSum / (float)smoothQueue.Count; } } } public class LookAtPlayer : MonoBehaviour { private void Update() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.transform.LookAt(((Component)GameNetworkManager.Instance.localPlayerController).transform.position + Vector3.up); } } public class SpawnPosition : MonoBehaviour { private void Start() { } private void Update() { } } [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { MonoScriptData result = default(MonoScriptData); result.FilePathsData = new byte[506] { 0, 0, 0, 1, 0, 0, 0, 42, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 65, 114, 101, 89, 111, 117, 87, 97, 116, 99, 104, 101, 100, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 38, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 33, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 69, 120, 105, 116, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 33, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 72, 111, 111, 107, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 36, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 75, 105, 108, 108, 66, 111, 120, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 47, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 76, 105, 103, 104, 116, 70, 108, 105, 99, 107, 101, 114, 69, 102, 102, 101, 99, 116, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 35, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 76, 111, 97, 100, 101, 114, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 41, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 76, 111, 111, 107, 65, 116, 80, 108, 97, 121, 101, 114, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 36, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 83, 107, 105, 98, 105, 100, 105, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 35, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 83, 109, 105, 108, 101, 114, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 42, 92, 65, 115, 115, 101, 116, 115, 92, 66, 97, 99, 107, 114, 111, 111, 109, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 83, 112, 97, 119, 110, 80, 111, 115, 105, 116, 105, 111, 110, 46, 99, 115 }; result.TypesData = new byte[233] { 0, 0, 0, 0, 25, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 66, 97, 99, 107, 114, 111, 111, 109, 115, 72, 101, 108, 112, 101, 114, 0, 0, 0, 0, 19, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 66, 97, 99, 107, 114, 111, 111, 109, 115, 0, 0, 0, 0, 14, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 69, 120, 105, 116, 0, 0, 0, 0, 14, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 72, 111, 111, 107, 0, 0, 0, 0, 8, 124, 75, 105, 108, 108, 66, 111, 120, 0, 0, 0, 0, 19, 124, 76, 105, 103, 104, 116, 70, 108, 105, 99, 107, 101, 114, 69, 102, 102, 101, 99, 116, 0, 0, 0, 0, 16, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 76, 111, 97, 100, 101, 114, 0, 0, 0, 0, 13, 124, 76, 111, 111, 107, 65, 116, 80, 108, 97, 121, 101, 114, 0, 0, 0, 0, 20, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 83, 111, 117, 110, 100, 80, 97, 116, 99, 104, 0, 0, 0, 0, 16, 66, 97, 99, 107, 114, 111, 111, 109, 115, 124, 83, 109, 105, 108, 101, 114, 0, 0, 0, 0, 14, 124, 83, 112, 97, 119, 110, 80, 111, 115, 105, 116, 105, 111, 110 }; result.TotalFiles = 11; result.TotalTypes = 11; result.IsEditorOnly = false; return result; } } namespace Backrooms; public class BackroomsHelper : MonoBehaviour { public bool HasBeenInTheBackrooms; private void Start() { } private void Update() { } } public class Backrooms : NetworkBehaviour { public static Backrooms Instance; public GameObject Floor; public GameObject Wall; public GameObject Ceiling; public GameObject LightlessCeiling; public GameObject Pillar; public GameObject Room; public static float Offset = -500f; private int Width = 30; private int Height = 30; public List<Vector2> PossibleSpawnPoint; public List<PlayerControllerB> playerInBackrooms; public NetworkVariable<float> SharedOdds = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float initialValue; public DungeonFlow Flow; public GameObject Child; public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer) { initialValue = Loader.TeleportationOdds.Value; SharedOdds.Value = initialValue; ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback; return; } if (SharedOdds.Value != initialValue) { Debug.LogWarning((object)($"NetworkVariable was {SharedOdds.Value} upon being spawned" + $" when it should have been {initialValue}")); } else { Debug.Log((object)$"NetworkVariable is {SharedOdds.Value} when spawned."); } NetworkVariable<float> sharedOdds = SharedOdds; sharedOdds.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)sharedOdds.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnSomeValueChanged)); } private void NetworkManager_OnClientConnectedCallback(ulong obj) { StartChangingNetworkVariable(); } private void OnSomeValueChanged(float previous, float current) { Debug.Log((object)$"Detected NetworkVariable Change: Previous: {previous} | Current: {current}"); } private void StartChangingNetworkVariable() { ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback; } private void Awake() { PossibleSpawnPoint = new List<Vector2>(); playerInBackrooms = new List<PlayerControllerB>(); } private void Start() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } private IEnumerator Teleport() { yield return (object)new WaitForSeconds(10f); for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled) { TeleportToBackroomsClientRpc(i); } } } public void ServerGenerate() { int seed = Random.Range(0, 1000000); GenerateClientRpc(seed); } public void ServerClean() { Smiler[] array = Object.FindObjectsOfType<Smiler>(); for (int i = 0; i < array.Length; i++) { ((Component)array[i]).GetComponent<NetworkObject>().Despawn(true); } playerInBackrooms.Clear(); CleanBackroomsClientRpc(); } [ClientRpc] public void CleanBackroomsClientRpc() { //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) //IL_00cf: 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(2180494496u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2180494496u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } foreach (Transform item in ((Component)this).transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; for (int i = 0; i < allPlayerScripts.Length; i++) { ((Component)allPlayerScripts[i]).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms = false; } } [ServerRpc(RequireOwnership = false)] public void TeleportToBackroomsServerRpc(int client) { //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) 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(2541916904u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, client); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2541916904u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TeleportToBackroomsClientRpc(client); } } } [ClientRpc] public void TeleportToBackroomsClientRpc(int client) { //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_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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) 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(3078584200u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, client); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3078584200u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[client]; Random.InitState(client); Vector2 val4 = PossibleSpawnPoint[Random.Range(0, PossibleSpawnPoint.Count)]; val3.TeleportPlayer(new Vector3(val4.x, Offset, val4.y), false, 0f, false, true); val3.isInsideFactory = true; val3.ResetFallGravity(); ((Component)val3).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms = true; if (((NetworkBehaviour)this).IsServer) { playerInBackrooms.Add(val3); } } } [ClientRpc] public void TeleportOutOfBackroomsClientRpc(int client) { //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_00e1: 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(1623403188u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, client); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1623403188u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB obj = StartOfRound.Instance.allPlayerScripts[client]; obj.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true); obj.isInsideFactory = false; } } } [ClientRpc] public void GenerateClientRpc(int seed) { //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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042b: 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(890432861u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, seed); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 890432861u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PossibleSpawnPoint.Clear(); playerInBackrooms.Clear(); Random random = new Random(seed); Debug.Log((object)"Generate floor and ceiling"); for (int i = -Width / 2; i < Width / 2; i++) { for (int j = -Height / 2; j < Height / 2; j++) { Object.Instantiate<GameObject>(Floor, new Vector3((float)(i * 6), Offset, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); if (random.Next(100) < 85) { Object.Instantiate<GameObject>(LightlessCeiling, new Vector3((float)(i * 6), Offset + 5f, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); } else { Object.Instantiate<GameObject>(Ceiling, new Vector3((float)(i * 6), Offset + 5f, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); } } } Debug.Log((object)"Generate walls"); for (int k = -Width / 2; k < Width / 2; k++) { Object.Instantiate<GameObject>(Wall, new Vector3((float)(-Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); if (k != 0) { Object.Instantiate<GameObject>(Wall, new Vector3((float)(Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); continue; } Debug.Log((object)"Generate room"); Object.Instantiate<GameObject>(Room, new Vector3((float)(Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(0f, 90f, 0f), ((Component)this).transform); } Debug.Log((object)"Generate walls 2"); for (int l = -Width / 2; l < Width / 2; l++) { Object.Instantiate<GameObject>(Wall, new Vector3((float)(l * 6), Offset, (float)(-Height / 2 * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform); Object.Instantiate<GameObject>(Wall, new Vector3((float)(l * 6), Offset, (float)(Height / 2 * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform); } Debug.Log((object)"Generate inside 2"); for (int m = -Width / 2; m < Width / 2; m++) { for (int n = -Height / 2; n < Height / 2; n++) { if (m == 0 && n == 0) { continue; } int num = random.Next(20); if (num < 15) { if (random.Next(10) < 5) { Object.Instantiate<GameObject>(Wall, new Vector3((float)(m * 6 - 3), Offset, (float)(n * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); } else { Object.Instantiate<GameObject>(Wall, new Vector3((float)(m * 6), Offset, (float)(n * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform); } } else if (num == 16) { Object.Instantiate<GameObject>(Pillar, new Vector3((float)(m * 6), Offset, (float)(n * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform); } else { PossibleSpawnPoint.Add(new Vector2((float)(m * 6), (float)(n * 6))); } } } if (((NetworkBehaviour)this).IsServer) { ((Component)this).GetComponent<NavMeshSurface>().BuildNavMesh(); GameObject val3 = Loader.AssetBundle.LoadAsset<GameObject>("assets/backrooms/smile.prefab"); for (int num2 = 0; num2 < Loader.NumberOfSmilers.Value; num2++) { Vector2 val4 = PossibleSpawnPoint[Random.Range(0, PossibleSpawnPoint.Count)]; Object.Instantiate<GameObject>(val3, new Vector3(val4.x, Offset, val4.y), Quaternion.identity, ((Component)this).transform).GetComponent<NetworkObject>().Spawn(false); } } } [ServerRpc(RequireOwnership = false)] public void TeleportOutOfBackroomsServerRpc(ulong clientId) { //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) 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(3409688981u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3409688981u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { TeleportOutOfBackroomsClientRpc((int)clientId); } } } protected override void __initializeVariables() { if (SharedOdds == null) { throw new Exception("Backrooms.SharedOdds cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SharedOdds).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SharedOdds, "SharedOdds"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SharedOdds); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Backrooms() { //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 NetworkManager.__rpc_func_table.Add(2180494496u, new RpcReceiveHandler(__rpc_handler_2180494496)); NetworkManager.__rpc_func_table.Add(2541916904u, new RpcReceiveHandler(__rpc_handler_2541916904)); NetworkManager.__rpc_func_table.Add(3078584200u, new RpcReceiveHandler(__rpc_handler_3078584200)); NetworkManager.__rpc_func_table.Add(1623403188u, new RpcReceiveHandler(__rpc_handler_1623403188)); NetworkManager.__rpc_func_table.Add(890432861u, new RpcReceiveHandler(__rpc_handler_890432861)); NetworkManager.__rpc_func_table.Add(3409688981u, new RpcReceiveHandler(__rpc_handler_3409688981)); } private static void __rpc_handler_2180494496(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; ((Backrooms)(object)target).CleanBackroomsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2541916904(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 client = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref client); target.__rpc_exec_stage = (__RpcExecStage)1; ((Backrooms)(object)target).TeleportToBackroomsServerRpc(client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3078584200(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 client = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref client); target.__rpc_exec_stage = (__RpcExecStage)2; ((Backrooms)(object)target).TeleportToBackroomsClientRpc(client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1623403188(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 client = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref client); target.__rpc_exec_stage = (__RpcExecStage)2; ((Backrooms)(object)target).TeleportOutOfBackroomsClientRpc(client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_890432861(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 seed = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref seed); target.__rpc_exec_stage = (__RpcExecStage)2; ((Backrooms)(object)target).GenerateClientRpc(seed); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3409688981(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((Backrooms)(object)target).TeleportOutOfBackroomsServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Backrooms"; } } public class Exit : MonoBehaviour { private void Start() { } private IEnumerator Teleport(ulong playerClientId) { StartOfRound.Instance.allPlayerScripts[playerClientId].beamOutParticle.Play(); yield return (object)new WaitForSeconds(3f); Backrooms.Instance.TeleportOutOfBackroomsServerRpc(playerClientId); } private void OnTriggerEnter(Collider other) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviour)this).StartCoroutine(Teleport(component.playerClientId)); Backrooms.Instance.TeleportOutOfBackroomsServerRpc(component.playerClientId); } } } public static class Hook { [HarmonyPatch(typeof(KillLocalPlayer), "KillPlayer")] [HarmonyPrefix] private static bool BeforeKilling(PlayerControllerB playerWhoTriggered) { if (playerWhoTriggered.isPlayerDead || !playerWhoTriggered.AllowPlayerDeath()) { return true; } if (((Component)playerWhoTriggered).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms) { return true; } Debug.Log((object)$"Killzone {Backrooms.Instance.SharedOdds.Value}"); if ((float)Random.Range(0, 100) < Backrooms.Instance.SharedOdds.Value) { Backrooms.Instance.TeleportToBackroomsServerRpc((int)playerWhoTriggered.playerClientId); return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPrefix] private static bool BeforeDamage(PlayerControllerB __instance) { if (__instance.isPlayerDead || !__instance.AllowPlayerDeath()) { return true; } if (((Component)__instance).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms) { return true; } Debug.Log((object)$"Damage taken {Backrooms.Instance.SharedOdds.Value}"); if ((float)Random.Range(0, 100) < Backrooms.Instance.SharedOdds.Value) { Backrooms.Instance.TeleportToBackroomsServerRpc((int)__instance.playerClientId); return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void AddComponents(PlayerControllerB __instance) { ((Component)__instance).gameObject.AddComponent<BackroomsHelper>(); } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPostfix] private static void SpawnBackrooms(RoundManager __instance) { //IL_0031: 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) if (((NetworkBehaviour)__instance).IsServer) { Debug.Log((object)"Spawning backrooms"); Object.Instantiate<GameObject>(Loader.AssetBundle.LoadAsset<GameObject>("assets/backrooms/backrooms.prefab"), new Vector3(0f, Backrooms.Offset, 0f), Quaternion.identity).GetComponent<NetworkObject>().Spawn(false); } } [HarmonyPatch(typeof(RoundManager), "UnloadSceneObjectsEarly")] [HarmonyPostfix] public static void DeleteBackrooms(RoundManager __instance) { if (((NetworkBehaviour)__instance).IsServer) { Backrooms.Instance.ServerClean(); } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] public static void GenerateBackrooms(RoundManager __instance) { if (((NetworkBehaviour)__instance).IsServer) { Backrooms.Instance.ServerGenerate(); } } [HarmonyPatch(typeof(StartOfRound), "WritePlayerNotes")] [HarmonyPostfix] public static void BackroomsPlayerNote(StartOfRound __instance) { for (int i = 0; i < __instance.gameStats.allPlayerStats.Length; i++) { if (__instance.gameStats.allPlayerStats[i].isActivePlayer && ((Component)__instance.allPlayerScripts[i]).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms) { if (__instance.allPlayerScripts[i].isPlayerDead) { __instance.gameStats.allPlayerStats[i].playerNotes.Add("Should have been more careful in the Backrooms."); } else { __instance.gameStats.allPlayerStats[i].playerNotes.Add("Had a blast in the Backrooms."); } } } } [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPostfix] public static void NetworkManagerPatch(MenuManager __instance) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Select((NetworkPrefab pref) => ((Object)pref.Prefab).name).Contains("backrooms")) { Debug.Log((object)"Load prefabs to Network Manager"); string[] array = new string[2] { "assets/backrooms/backrooms.prefab", "assets/backrooms/smile.prefab" }; foreach (string text in array) { GameObject val = Loader.AssetBundle.LoadAsset<GameObject>(text); NetworkManager.Singleton.AddNetworkPrefab(val); } } } } [BepInPlugin("Neekhaulas.Backrooms", "Backrooms", "0.1.3")] public class Loader : BaseUnityPlugin { public static AssetBundle AssetBundle { get; private set; } public static ConfigEntry<float> TeleportationOdds { get; private set; } public static ConfigEntry<int> NumberOfSmilers { get; private set; } private void Awake() { TeleportationOdds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Teleportation odds", 3f, "Odds to be teleported (in %) - This settings has to be changed by the host"); NumberOfSmilers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Number of smilers", 1, "Number of smilers to spawn in the Backrooms - This settings has to be changed by the host"); AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "backrooms")); Harmony.CreateAndPatchAll(typeof(Hook), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Backrooms is loaded!"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } public class SoundPatch : MonoBehaviour { private void Start() { ((Component)this).gameObject.AddComponent<OccludeAudio>(); ((Component)this).GetComponent<AudioSource>().Play(); } } public class Smiler : NetworkBehaviour { private NavMeshAgent NavMeshAgent; private PlayerControllerB Target; private void Start() { NavMeshAgent = ((Component)this).GetComponent<NavMeshAgent>(); } private void Update() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } if ((Object)(object)Target != (Object)null && Target.isPlayerDead) { Target = null; NavMeshAgent.speed = 2f; } if (!NavMeshAgent.pathPending && NavMeshAgent.remainingDistance <= NavMeshAgent.stoppingDistance) { if (NavMeshAgent.hasPath) { Vector3 velocity = NavMeshAgent.velocity; if (((Vector3)(ref velocity)).sqrMagnitude != 0f) { goto IL_00f0; } } if ((Object)(object)Target != (Object)null) { NavMeshAgent.SetDestination(((Component)Target).transform.position); } else { int index = Random.Range(0, Backrooms.Instance.PossibleSpawnPoint.Count); NavMeshAgent.SetDestination(Vector2.op_Implicit(Backrooms.Instance.PossibleSpawnPoint[index])); } } goto IL_00f0; IL_00f0: for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (val.isPlayerControlled && !val.isPlayerDead) { if (val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up, 45f, 15, -1f)) { Target = val; NavMeshAgent.SetDestination(((Component)val).transform.position); NavMeshAgent.speed = 7f; break; } bool flag = false; if ((Object)(object)val.currentlyHeldObjectServer != (Object)null && ((object)val.currentlyHeldObjectServer).GetType() == typeof(FlashlightItem) && val.currentlyHeldObjectServer.isBeingUsed) { flag = true; } if ((Object)(object)val.pocketedFlashlight != (Object)null && ((object)val.pocketedFlashlight).GetType() == typeof(FlashlightItem) && val.pocketedFlashlight.isBeingUsed) { flag = true; } if (flag && val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up, 45f, 100, -1f)) { Target = val; NavMeshAgent.SetDestination(((Component)val).transform.position); NavMeshAgent.speed = 7f; } } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Smiler"; } }
plugins/BetterShotgunShells.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BuyableShells")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BuyableShells")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f1098099-7d96-4f78-bd10-8cf743e1f445")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BuyableShells; [BepInPlugin("SalakStudios.BetterShotgunShells", "BetterShotgunShells", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string modGUID = "SalakStudios.BetterShotgunShells"; private const string modName = "BetterShotgunShells"; private const string modVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("SalakStudios.BetterShotgunShells"); internal static Plugin Instance; public static ManualLogSource mls; public bool added; public static ConfigEntry<int> ShellPrice; public static ConfigEntry<int> ItemRarityRend; public static ConfigEntry<int> ItemRarityDine; public static ConfigEntry<int> ItemRarityTitan; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "GunAmmo")); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(typeof(Plugin)); mls = Logger.CreateLogSource("SalakStudios.BetterShotgunShells"); mls.LogInfo((object)"BetterShotgunShells Enabled"); SceneManager.sceneLoaded += OnSceneLoaded; ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 80, "How many credits the shotgun shell costs"); ItemRarityRend = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Rend", 2, "How rare the shell is to find on Rend (Lower = Rarer, Higher = More Common)"); ItemRarityDine = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Dine", 3, "How rare the shell is to find on Dine (Lower = Rarer, Higher = More Common)"); ItemRarityTitan = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Titan", 5, "How rare the shell is to find on Titan (Lower = Rarer, Higher = More Common)"); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!added && ((Scene)(ref scene)).name == "MainMenu") { added = true; ShotgunShell.itemName = "Shells"; ShotgunShell.creditsWorth = 0; Items.RegisterShopItem(ShotgunShell, ShellPrice.Value); Items.RegisterScrap(ShotgunShell, ItemRarityRend.Value, (LevelTypes)128); Items.RegisterScrap(ShotgunShell, ItemRarityDine.Value, (LevelTypes)256); Items.RegisterScrap(ShotgunShell, ItemRarityTitan.Value, (LevelTypes)512); } } }
plugins/BetterTeleporter.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BetterTeleporter.Config; using BetterTeleporter.Patches; 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BetterTeleporter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Better Teleporters for Lethal Company")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2")] [assembly: AssemblyProduct("BetterTeleporter")] [assembly: AssemblyTitle("BetterTeleporter")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.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 BetterTeleporter { [BepInPlugin("BetterTeleporter", "BetterTeleporter", "1.2.2")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("BetterTeleporter"); internal static ManualLogSource log; public static Plugin instance { get; private set; } private void Awake() { instance = this; log = ((BaseUnityPlugin)this).Logger; ConfigSettings.Bind(); harmony.PatchAll(typeof(ConfigSync)); harmony.PatchAll(typeof(ShipTeleporterPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); log.LogInfo((object)"Plugin BetterTeleporter is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterTeleporter"; public const string PLUGIN_NAME = "BetterTeleporter"; public const string PLUGIN_VERSION = "1.2.2"; } } namespace BetterTeleporter.Config { public static class ConfigSettings { public static int cooldownAmmount; public static int cooldownAmmountInverse; public static bool cooldownEnd; public static string[] keepListItems; public static string[] keepListItemsInverse; public static bool doDrainItems; public static float drainItemsPercent; public static ConfigEntry<int> cooldown; public static ConfigEntry<int> cooldownInverse; public static ConfigEntry<bool> cooldownEndDay; public static ConfigEntry<string> keepList; public static ConfigEntry<string> keepListInverse; public static ConfigEntry<bool> doDrain; public static ConfigEntry<float> drainPercent; public static void Bind() { cooldown = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("General", "Cooldown", 10, "Number of seconds between teleporter uses"); cooldownInverse = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("General", "CooldownInverse", 210, "Number of seconds between teleporter uses"); cooldownEndDay = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "CooldownEndsOnNewDay", true, "true/false if cooldown should end on new day"); keepList = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "KeepItemList", "KeyItem,FlashlightItem,WalkieTalkie", "Comma-seperated list of items to be kept when teleported"); keepListInverse = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "KeepItemListInverse", "KeyItem,FlashlightItem,WalkieTalkie,RadarBoosterItem", "Comma-seperated list of items to be kept when teleported with inverse teleporter"); doDrain = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "DrainItem", true, "true/false if items should drain battery charge"); drainPercent = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "DrainPercent", 0.5f, "The percentage (as float 0 to 1) of total charge that battery items lose when teleporting"); cooldownAmmount = cooldown.Value; cooldownAmmountInverse = cooldownInverse.Value; cooldownEnd = cooldownEndDay.Value; SetKeepList(keepList.Value); SetKeepList(keepListInverse.Value, inverse: true); doDrainItems = doDrain.Value; drainItemsPercent = drainPercent.Value; } public static void SetKeepList(string list, bool inverse = false) { if (inverse) { keepListItemsInverse = list.Split(','); for (int i = 0; i < keepListItemsInverse.Length; i++) { keepListItemsInverse[i] = keepListItemsInverse[i].Trim(); } } else { keepListItems = list.Split(','); for (int j = 0; j < keepListItems.Length; j++) { keepListItems[j] = keepListItems[j].Trim(); } } } } [HarmonyPatch(typeof(PlayerControllerB))] public class ConfigSync { [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] public static void InitializeLocalPlayer() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest)); return; } NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync_KeepList", new HandleNamedMessageDelegate(OnReceiveConfigSync_KeepList)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterTeleporterReceiveConfigSync_KeepListInverse", new HandleNamedMessageDelegate(OnReceiveConfigSync_KeepListInverse)); RequestConfigSync(); } public static void RequestConfigSync() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.log.LogInfo((object)"Sending config sync request to server."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(16, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterConfigSync", 0uL, val, (NetworkDelivery)3); } else { Plugin.log.LogWarning((object)"Failed to send config sync request."); } } public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader) { //IL_0051: 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_0071: 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_0091: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Plugin.log.LogInfo((object)("Receiving sync request from client with id: " + clientId + ". Sending config sync to client.")); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(14, (Allocator)2, -1); int value = ConfigSettings.cooldown.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref value, default(ForPrimitives)); value = ConfigSettings.cooldownInverse.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref value, default(ForPrimitives)); bool value2 = ConfigSettings.cooldownEndDay.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value2, default(ForPrimitives)); value2 = ConfigSettings.doDrain.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value2, default(ForPrimitives)); float value3 = ConfigSettings.drainPercent.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref value3, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync", clientId, val, (NetworkDelivery)3); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(ConfigSettings.keepList.Value.Length * 2, (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe(ConfigSettings.keepList.Value, true); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync_KeepList", clientId, val2, (NetworkDelivery)3); FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(ConfigSettings.keepListInverse.Value.Length * 2, (Allocator)2, -1); ((FastBufferWriter)(ref val3)).WriteValueSafe(ConfigSettings.keepListInverse.Value, true); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterTeleporterReceiveConfigSync_KeepListInverse", clientId, val3, (NetworkDelivery)3); } } public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0024: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) FastBufferReader val = reader; if (((FastBufferReader)(ref val)).TryBeginRead(4)) { Plugin.log.LogInfo((object)"Receiving sync from server."); val = reader; int num = default(int); ((FastBufferReader)(ref val)).ReadValueSafe<int>(ref num, default(ForPrimitives)); ConfigSettings.cooldownAmmount = num; Plugin.log.LogInfo((object)$"Recieved 'cooldownAmmount = {num}"); val = reader; int num2 = default(int); ((FastBufferReader)(ref val)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); ConfigSettings.cooldownAmmountInverse = num2; Plugin.log.LogInfo((object)$"Recieved 'cooldownAmmountInverse = {num2}"); val = reader; bool flag = default(bool); ((FastBufferReader)(ref val)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ConfigSettings.cooldownEnd = flag; Plugin.log.LogInfo((object)$"Recieved 'cooldownEnd = {flag}"); val = reader; bool flag2 = default(bool); ((FastBufferReader)(ref val)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); ConfigSettings.doDrainItems = flag2; Plugin.log.LogInfo((object)$"Recieved 'doDrainItems = {flag2}"); val = reader; float num3 = default(float); ((FastBufferReader)(ref val)).ReadValueSafe<float>(ref num3, default(ForPrimitives)); ConfigSettings.drainItemsPercent = num3; Plugin.log.LogInfo((object)$"Recieved 'drainItemsPercent = {num3}"); } else { Plugin.log.LogWarning((object)"Error receiving config sync from server."); } } public static void OnReceiveConfigSync_KeepList(ulong clientId, FastBufferReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) FastBufferReader val = reader; if (((FastBufferReader)(ref val)).TryBeginRead(4)) { Plugin.log.LogInfo((object)"Receiving sync from server."); val = reader; string text = default(string); ((FastBufferReader)(ref val)).ReadValueSafe(ref text, true); ConfigSettings.SetKeepList(text); Plugin.log.LogInfo((object)("Recieved 'keepList = " + text)); } else { Plugin.log.LogWarning((object)"Error receiving keepList config sync from server."); } } public static void OnReceiveConfigSync_KeepListInverse(ulong clientId, FastBufferReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) FastBufferReader val = reader; if (((FastBufferReader)(ref val)).TryBeginRead(4)) { Plugin.log.LogInfo((object)"Receiving sync from server."); val = reader; string text = default(string); ((FastBufferReader)(ref val)).ReadValueSafe(ref text, true); ConfigSettings.SetKeepList(text, inverse: true); Plugin.log.LogInfo((object)("Recieved 'keepListInverse = " + text)); } else { Plugin.log.LogWarning((object)"Error receiving keepListInverse config sync from server."); } } } } namespace BetterTeleporter.Patches { [HarmonyPatch(typeof(ShipTeleporter))] public class ShipTeleporterPatch { private static readonly CodeMatch[] inverseTeleporterPatchIlMatch = (CodeMatch[])(object)new CodeMatch[4] { new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdloc(i, (LocalBuilder)null)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 1L)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 0L)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, originalMethodInfo)), (string)null) }; private static readonly CodeMatch[] teleporterPatchIlMatch = (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.IsLdarg(i, (int?)0)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 1L)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsConstant(i, 0L)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, originalMethodInfo)), (string)null) }; private static readonly MethodInfo originalMethodInfo = typeof(PlayerControllerB).GetMethod("DropAllHeldItems", BindingFlags.Instance | BindingFlags.Public); private static readonly MethodInfo replaceMethodInfo = typeof(ShipTeleporterPatch).GetMethod("DropSomeItems", BindingFlags.Static | BindingFlags.NonPublic); [HarmonyTranspiler] [HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")] public static IEnumerable<CodeInstruction> InverseTeleporterDropAllButHeldItem(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.Start(); val.MatchForward(false, inverseTeleporterPatchIlMatch); val.Advance(1); val.RemoveInstructionsWithOffsets(0, 2); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_0, (object)1) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_1, (object)1) }); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Callvirt, (object)replaceMethodInfo) }); Plugin.log.LogInfo((object)"Patched 'ShipTeleporterPatch.TeleportPlayerOutWithInverseTeleporter'"); return val.Instructions(); } [HarmonyTranspiler] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static IEnumerable<CodeInstruction> TeleporterDropAllButHeldItem(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.End(); val.MatchBack(false, teleporterPatchIlMatch); val.Advance(2); val.RemoveInstructionsWithOffsets(0, 2); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_0, (object)0) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_1, (object)1) }); val.Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Callvirt, (object)replaceMethodInfo) }); Plugin.log.LogInfo((object)"Patched 'ShipTeleporterPatch.beamUpPlayer'"); return val.Instructions(); } [HarmonyPatch("Awake")] [HarmonyPrefix] private static void Awake(ref bool ___isInverseTeleporter, ref float ___cooldownAmount) { if (___isInverseTeleporter) { ___cooldownAmount = ConfigSettings.cooldownAmmountInverse; } else { ___cooldownAmount = ConfigSettings.cooldownAmmount; } } private static void DropSomeItems(PlayerControllerB player, bool inverse = false, bool itemsFall = true) { //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown MethodInfo method = ((object)player).GetType().GetMethod("SetSpecialGrabAnimationBool", BindingFlags.Instance | BindingFlags.NonPublic); string[] source = ConfigSettings.keepListItems; if (inverse) { source = ConfigSettings.keepListItemsInverse; } float num = 1f; bool twoHanded = false; for (int i = 0; i < player.ItemSlots.Length; i++) { GrabbableObject val = player.ItemSlots[i]; if ((Object)(object)val == (Object)null) { continue; } if (source.Contains(((object)val).GetType().ToString())) { if (val.insertedBattery != null && ConfigSettings.doDrainItems) { float num2 = val.insertedBattery.charge - val.insertedBattery.charge * ConfigSettings.drainItemsPercent; if (num2 < 0f) { num2 = 0f; } val.insertedBattery = new Battery(num2 != 0f, num2); val.SyncBatteryServerRpc((int)(num2 * 100f)); } num += Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f); continue; } if (itemsFall) { val.parentObject = null; val.heldByPlayerOnServer = false; if (player.isInElevator) { ((Component)val).transform.SetParent(player.playersManager.elevatorTransform, true); } else { ((Component)val).transform.SetParent(player.playersManager.propsContainer, true); } player.SetItemInElevator(player.isInHangarShipRoom, player.isInElevator, val); val.EnablePhysics(true); val.EnableItemMeshes(true); ((Component)val).transform.localScale = val.originalScale; val.isHeld = false; val.isPocketed = false; val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position); val.FallToGround(true); val.fallTime = Random.Range(-0.3f, 0.05f); if (((NetworkBehaviour)player).IsOwner) { val.DiscardItemOnClient(); } else if (!val.itemProperties.syncDiscardFunction) { val.playerHeldBy = null; } } if (((NetworkBehaviour)player).IsOwner) { ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false; ((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false; HUDManager.Instance.ClearControlTips(); player.activatingItem = false; } player.ItemSlots[i] = null; } GrabbableObject val2 = player.ItemSlots[player.currentItemSlot]; if ((Object)(object)val2 == (Object)null) { player.isHoldingObject = false; if ((Object)(object)player.currentlyHeldObjectServer != (Object)null) { method.Invoke(player, new object[2] { false, player.currentlyHeldObjectServer }); } player.playerBodyAnimator.SetBool("cancelHolding", true); player.playerBodyAnimator.SetTrigger("Throw"); } else { twoHanded = val2.itemProperties.twoHanded; } player.twoHanded = twoHanded; player.carryWeight = num; player.currentlyHeldObjectServer = val2; } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private static readonly FieldInfo cooldownProp = typeof(ShipTeleporter).GetField("cooldownTime", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("StartGame")] [HarmonyPostfix] private static void StartGame() { if (ConfigSettings.cooldownEnd) { ResetCooldown(); } } [HarmonyPatch("EndOfGame")] [HarmonyPostfix] private static void EndOfGame() { if (ConfigSettings.cooldownEnd) { ResetCooldown(); } } [HarmonyPatch("EndOfGameClientRpc")] [HarmonyPostfix] private static void EndOfGameClientRpc() { if (ConfigSettings.cooldownEnd) { ResetCooldown(); } } private static void ResetCooldown() { ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>(); ShipTeleporter[] array2 = array; foreach (ShipTeleporter obj in array2) { cooldownProp.SetValue(obj, 0f); } } } }
plugins/BuyableShotgun.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f4271793e57a966e00668122ac278845cc79146b")] [assembly: AssemblyProduct("BuyableShotgun")] [assembly: AssemblyTitle("BuyableShotgun")] [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 BuyableShotgun { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgun", "Buyable Shotgun", "1.0.4")] public class BuyableShotgun : BaseUnityPlugin { private const string modGUID = "MegaPiggy.BuyableShotgun"; private const string modName = "Buyable Shotgun"; private const string modVersion = "1.0.4"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgun"); private static BuyableShotgun Instance; private ConfigEntry<int> ShotgunPriceConfig; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item Shotgun => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("Shotgun"))); public Item ShotgunClone { get; private set; } public int ShotgunPrice => ShotgunPriceConfig.Value; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ShotgunPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunPrice", 700, "Credits needed to buy shotgun"); SceneManager.sceneLoaded += OnSceneLoaded; ShotgunClone = MakeNonScrap(ShotgunPrice); AddToShop(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun is loaded with version 1.0.4!"); } private Item MakeNonScrap(int price) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).name = "Error"; val.itemName = "Error"; val.itemId = 6624; val.isScrap = false; val.creditsWorth = price; val.canBeGrabbedBeforeGameStart = true; val.automaticallySetUsingPower = false; val.batteryUsage = 300f; val.canBeInspected = false; val.isDefensiveWeapon = true; val.saveItemVariable = true; val.syncGrabFunction = false; val.twoHandedAnimation = true; val.verticalOffset = 0.25f; GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("Cube"); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); val3.transform.SetParent(val2.transform, false); ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterial.shader = Shader.Find("HDRP/Lit"); val2.AddComponent<BoxCollider>().size = Vector3.one * 2f; val2.AddComponent<AudioSource>(); PhysicsProp val4 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).itemProperties = val; ((GrabbableObject)val4).grabbable = true; val.spawnPrefab = val2; val2.tag = "PhysicsProp"; val2.layer = LayerMask.NameToLayer("Props"); val3.layer = LayerMask.NameToLayer("Props"); try { GameObject val5 = Object.Instantiate<GameObject>(Items.scanNodePrefab, val2.transform); ((Object)val5).name = "ScanNode"; val5.transform.localPosition = new Vector3(0f, 0f, 0f); Transform transform = val5.transform; transform.localScale *= 2f; ScanNodeProperties component = val5.GetComponent<ScanNodeProperties>(); component.nodeType = 1; component.headerText = "Error"; component.subText = "A mod is incompatible with Buyable Shotgun"; } catch (Exception ex) { LoggerInstance.LogError((object)ex.ToString()); } val2.transform.localScale = Vector3.one / 2f; return val; } private void CloneNonScrap(Item original, Item clone, int price) { Object.DontDestroyOnLoad((Object)(object)original.spawnPrefab); CopyFields(original, clone); ((Object)clone).name = "Buyable" + ((Object)original).name; clone.creditsWorth = price; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); Object.DontDestroyOnLoad((Object)(object)val); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { LoggerInstance.LogInfo((object)("Scene \"" + ((Scene)(ref scene)).name + "\" loaded with " + ((object)(LoadSceneMode)(ref mode)).ToString() + " mode.")); if (!((Object)(object)Shotgun == (Object)null)) { CloneNonScrap(Shotgun, ShotgunClone, ShotgunPrice); } } private void AddToShop() { Item shotgunClone = ShotgunClone; int shotgunPrice = ShotgunPrice; Items.RegisterShopItem(shotgunClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Shotgun", "Nutcracker's shotgun. Can hold 2 shells. Recommended to keep safety on while not using or it might shoot randomly."), shotgunPrice); LoggerInstance.LogInfo((object)$"Shotgun added to Shop for {ShotgunPrice} credits"); } } }
plugins/ChillaxMods.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using ChillaxMods.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalLib; using LethalLib.Extras; using LethalLib.Modules; using LethalThings; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ChillaxMods")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Chillax Mods")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ChillaxMods")] [assembly: AssemblyTitle("ChillaxMods")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } 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 ChillaxMods { public static class PluginInfo { public const string PLUGIN_GUID = "ChillaxMods"; public const string PLUGIN_NAME = "ChillaxMods"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Chillax.Bastard.BogBog { public class Boink : NoisemakerProp { public override void ItemActivate(bool used, bool buttonDown = true) { //IL_001f: 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_002e: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; Vector3 val = -((Component)this).transform.forward + Vector3.up; playerHeldBy.externalForces = ((Vector3)(ref val)).normalized * 500f; ChillaxModPlugin.logger.LogInfo((object)"[CHILLAX] ACTIVATE BOINK!"); ((NoisemakerProp)this).ItemActivate(used, buttonDown); } } protected override void __initializeVariables() { ((NoisemakerProp)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Boink"; } } [BepInPlugin("chillax.bastard.mod", "Chillax Mods", "0.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ChillaxModPlugin : BaseUnityPlugin { public static ManualLogSource logger; public const string PluginGuid = "chillax.bastard.mod"; public const string PluginName = "Chillax Mods"; public const string PluginVersion = "0.6.0"; public static readonly Harmony harmony = new Harmony("chillax.bastard.mod"); public static ConfigFile config; public void Awake() { logger = ((BaseUnityPlugin)this).Logger; config = ((BaseUnityPlugin)this).Config; Config.Load(); Content.Load(); harmony.PatchAll(typeof(ChillaxModPlugin)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CHILLAX Plugin Loaded"); } } public class Config { public static ConfigEntry<int> boinkSpawnChance; public static ConfigEntry<int> cupNoodleSpawnChance; public static ConfigEntry<int> freddySpawnChance; public static ConfigEntry<int> nokiaSpawnChance; public static ConfigEntry<int> moaiSpawnChance; public static ConfigEntry<int> froggySpawnChance; public static ConfigEntry<int> eeveeSpawnChance; public static ConfigEntry<int> deathNoteSpawnChance; public static ConfigEntry<int> unoReverseSpawnChance; public static ConfigEntry<bool> canUseDeathNote; public static void Load() { boinkSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Boink", 25, "How much does this Item spawn, higher = more common"); cupNoodleSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "CupNoodle", 40, "How much does this Item spawn, higher = more common"); freddySpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Freddy", 15, "How much does this Item spawn, higher = more common"); nokiaSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Nokia", 25, "How much does this Item spawn, higher = more common"); moaiSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Moai", 20, "How much does this Item spawn, higher = more common"); froggySpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Froggy", 25, "How much does this Item spawn, higher = more common"); eeveeSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "Eevee", 25, "How much does this Item spawn, higher = more common"); deathNoteSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "DeathNote", 20, "How much does this Item spawn, higher = more common"); canUseDeathNote = ChillaxModPlugin.config.Bind<bool>("Death Note", "DeathNoteActive", true, "Can the Death Note be used, turn this off to avoid griefing"); unoReverseSpawnChance = ChillaxModPlugin.config.Bind<int>("Scrap", "UnoReverse", 20, "How much does this Item spawn, higher = more common"); } } public class Content { public class CustomItem { public string name = ""; public string itemPath = ""; public string infoPath = ""; public Action<Item> itemAction = delegate { }; public bool enabled = true; public CustomItem(string name, string itemPath, string infoPath, Action<Item> action = null) { this.name = name; this.itemPath = itemPath; this.infoPath = infoPath; if (action != null) { itemAction = action; } } public static CustomItem Add(string name, string itemPath, string infoPath = null, Action<Item> action = null) { return new CustomItem(name, itemPath, infoPath, action); } } public class CustomUnlockable { public string name = ""; public string unlockablePath = ""; public string infoPath = ""; public Action<UnlockableItem> unlockableAction = delegate { }; public bool enabled = true; public int unlockCost = -1; public CustomUnlockable(string name, string unlockablePath, string infoPath, Action<UnlockableItem> action = null, int unlockCost = -1) { this.name = name; this.unlockablePath = unlockablePath; this.infoPath = infoPath; if (action != null) { unlockableAction = action; } this.unlockCost = unlockCost; } public static CustomUnlockable Add(string name, string unlockablePath, string infoPath = null, Action<UnlockableItem> action = null, int unlockCost = -1, bool enabled = true) { return new CustomUnlockable(name, unlockablePath, infoPath, action, unlockCost) { enabled = enabled }; } } public class CustomShopItem : CustomItem { public int itemPrice; public CustomShopItem(string name, string itemPath, string infoPath = null, int itemPrice = 0, Action<Item> action = null) : base(name, itemPath, infoPath, action) { this.itemPrice = itemPrice; } public static CustomShopItem Add(string name, string itemPath, string infoPath = null, int itemPrice = 0, Action<Item> action = null, bool enabled = true) { CustomShopItem customShopItem = new CustomShopItem(name, itemPath, infoPath, itemPrice, action); customShopItem.enabled = enabled; return customShopItem; } } public class CustomScrap : CustomItem { public LevelTypes levelType = (LevelTypes)(-1); public int rarity; public CustomScrap(string name, string itemPath, LevelTypes levelType, int rarity, Action<Item> action = null) : base(name, itemPath, null, action) { //IL_0002: 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_0016: Unknown result type (might be due to invalid IL or missing references) this.levelType = levelType; this.rarity = rarity; } public static CustomScrap Add(string name, string itemPath, LevelTypes levelType, int rarity, Action<Item> action = null) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new CustomScrap(name, itemPath, levelType, rarity, action); } } public class CustomEnemy { public string name; public string enemyPath; public int rarity; public LevelTypes levelFlags; public SpawnType spawnType; public string infoKeyword; public string infoNode; public bool enabled = true; public CustomEnemy(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) this.name = name; this.enemyPath = enemyPath; this.rarity = rarity; this.levelFlags = levelFlags; this.spawnType = spawnType; this.infoKeyword = infoKeyword; this.infoNode = infoNode; } public static CustomEnemy Add(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode, bool enabled = true) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return new CustomEnemy(name, enemyPath, rarity, levelFlags, spawnType, infoKeyword, infoNode) { enabled = enabled }; } } public class CustomMapObject { public string name; public string objectPath; public LevelTypes levelFlags; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public bool enabled = true; public CustomMapObject(string name, string objectPath, LevelTypes levelFlags, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, bool enabled = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) this.name = name; this.objectPath = objectPath; this.levelFlags = levelFlags; this.spawnRateFunction = spawnRateFunction; this.enabled = enabled; } public static CustomMapObject Add(string name, string objectPath, LevelTypes levelFlags, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, bool enabled = false) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new CustomMapObject(name, objectPath, levelFlags, spawnRateFunction, enabled); } } public static AssetBundle MainAssets; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static List<CustomUnlockable> customUnlockables; public static List<CustomItem> customItems; public static List<CustomEnemy> customEnemies; public static List<CustomMapObject> customMapObjects; public static GameObject ConfigManagerPrefab; public static void TryLoadAssets() { if ((Object)(object)MainAssets == (Object)null) { MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "chillaxBundle")); Plugin.logger.LogInfo((object)"Loaded asset bundle"); } } public static void Load() { //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) TryLoadAssets(); customItems = new List<CustomItem> { CustomScrap.Add("Boink", "Assets/Chillax/ChillaxMods/Boink/Boink.asset", (LevelTypes)(-1), Config.boinkSpawnChance.Value), CustomScrap.Add("MamaMooSup", "Assets/Chillax/ChillaxMods/Cup Noodle/Cup Noodle.asset", (LevelTypes)(-1), Config.cupNoodleSpawnChance.Value), CustomScrap.Add("Freddy", "Assets/Chillax/ChillaxMods/FreddyFastBear/Freddy.asset", (LevelTypes)(-1), Config.freddySpawnChance.Value), CustomScrap.Add("Nokia", "Assets/Chillax/ChillaxMods/Nokia/Nokia.asset", (LevelTypes)(-1), Config.nokiaSpawnChance.Value), CustomScrap.Add("Moai", "Assets/Chillax/ChillaxMods/Moai/Moai.asset", (LevelTypes)(-1), Config.moaiSpawnChance.Value), CustomScrap.Add("Froggy", "Assets/Chillax/ChillaxMods/Froggy Chair/Froggy Chair.asset", (LevelTypes)(-1), Config.froggySpawnChance.Value), CustomScrap.Add("Eevee", "Assets/Chillax/ChillaxMods/Eevee Plush/Eevee.asset", (LevelTypes)(-1), Config.eeveeSpawnChance.Value), CustomScrap.Add("DeathNote", "Assets/Chillax/ChillaxMods/DeathNote/DeathNote.asset", (LevelTypes)(-1), Config.deathNoteSpawnChance.Value), CustomScrap.Add("UnoReverse", "Assets/Chillax/ChillaxMods/UnoReverse/UnoReverse.asset", (LevelTypes)(-1), Config.unoReverseSpawnChance.Value) }; customEnemies = new List<CustomEnemy>(); customUnlockables = new List<CustomUnlockable>(); customMapObjects = new List<CustomMapObject>(); foreach (CustomItem customItem in customItems) { if (customItem.enabled) { Item val = MainAssets.LoadAsset<Item>(customItem.itemPath); if ((Object)(object)val.spawnPrefab.GetComponent<NetworkTransform>() == (Object)null) { val.spawnPrefab.AddComponent<NetworkTransform>(); } Prefabs.Add(customItem.name, val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); customItem.itemAction(val); if (customItem is CustomShopItem) { TerminalNode val2 = MainAssets.LoadAsset<TerminalNode>(customItem.infoPath); Plugin.logger.LogInfo((object)$"Registering shop item {customItem.name} with price {((CustomShopItem)customItem).itemPrice}"); Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, ((CustomShopItem)customItem).itemPrice); } else if (customItem is CustomScrap customScrap) { ChillaxModPlugin.logger.LogInfo((object)$"[CHILLAX] Registering... {val.itemName} at rarity {customScrap.rarity}"); Items.RegisterScrap(val, customScrap.rarity, customScrap.levelType); } } } foreach (CustomUnlockable customUnlockable in customUnlockables) { if (customUnlockable.enabled) { UnlockableItem unlockable = MainAssets.LoadAsset<UnlockableItemDef>(customUnlockable.unlockablePath).unlockable; if ((Object)(object)unlockable.prefabObject != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(unlockable.prefabObject); } Prefabs.Add(customUnlockable.name, unlockable.prefabObject); TerminalNode val3 = null; if (customUnlockable.infoPath != null) { val3 = MainAssets.LoadAsset<TerminalNode>(customUnlockable.infoPath); } Unlockables.RegisterUnlockable(unlockable, (StoreType)2, (TerminalNode)null, (TerminalNode)null, val3, customUnlockable.unlockCost); } } foreach (CustomEnemy customEnemy in customEnemies) { if (customEnemy.enabled) { EnemyType val4 = MainAssets.LoadAsset<EnemyType>(customEnemy.enemyPath); TerminalNode val5 = MainAssets.LoadAsset<TerminalNode>(customEnemy.infoNode); TerminalKeyword val6 = null; if (customEnemy.infoKeyword != null) { val6 = MainAssets.LoadAsset<TerminalKeyword>(customEnemy.infoKeyword); } NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab); Prefabs.Add(customEnemy.name, val4.enemyPrefab); Enemies.RegisterEnemy(val4, customEnemy.rarity, customEnemy.levelFlags, customEnemy.spawnType, val5, val6); } } foreach (CustomMapObject customMapObject in customMapObjects) { if (customMapObject.enabled) { SpawnableMapObjectDef val7 = MainAssets.LoadAsset<SpawnableMapObjectDef>(customMapObject.objectPath); NetworkPrefabs.RegisterNetworkPrefab(val7.spawnableMapObject.prefabToSpawn); Prefabs.Add(customMapObject.name, val7.spawnableMapObject.prefabToSpawn); MapObjects.RegisterMapObject(val7, customMapObject.levelFlags, customMapObject.spawnRateFunction); } } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } Plugin.logger.LogInfo((object)"[CHILLAX] Custom content loaded!"); } } public class DeathNote : NoisemakerProp { private NetworkVariable<bool> canUseDeathNote = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [SerializeField] private AudioClip killSfx; [SerializeField] private GameObject canvasPrefab; private float _currentCooldown; [SerializeField] private float checkRate; [SerializeField] private Renderer deathNoteRenderer; [SerializeField] private Material[] materials; [SerializeField] private string[] textNodes; [SerializeField] private Sprite[] icons; [SerializeField] private ScanNodeProperties scanNodeProperties; private DeathNoteCanvas _temp; public List<PlayerControllerB> playerList; public List<EnemyAI> enemyList; private bool _opened; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); canUseDeathNote = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); playerList = new List<PlayerControllerB>(); enemyList = new List<EnemyAI>(); Item itemProperties = Object.Instantiate<Item>(((GrabbableObject)this).itemProperties); ((GrabbableObject)this).itemProperties = itemProperties; UpdateList(); _opened = false; ((MonoBehaviour)this).InvokeRepeating("ProcessCooldown", checkRate, checkRate); if (((NetworkBehaviour)this).IsHost) { canUseDeathNote.Value = Config.canUseDeathNote.Value; UpdateVisuals(0); UpdateVisualsClientRpc(0); } } [ClientRpc] private void UpdateVisualsClientRpc(int index) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(531245751u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 531245751u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { UpdateVisuals(index); } } } private void UpdateVisuals(int index) { if ((Object)(object)deathNoteRenderer.material != (Object)(object)materials[index]) { deathNoteRenderer.material = materials[index]; } scanNodeProperties.headerText = textNodes[index]; ((GrabbableObject)this).itemProperties.itemName = textNodes[index]; ((GrabbableObject)this).itemProperties.itemIcon = icons[index]; } [ServerRpc(RequireOwnership = false)] private void StartCooldownServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(246655775u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 246655775u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Random random = new Random(); StartCooldownClientRpc(_currentCooldown = random.Next(600, 1800)); } } } [ClientRpc] private void StartCooldownClientRpc(float cooldown) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(316831956u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref cooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 316831956u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _currentCooldown = cooldown; } } } private void ProcessCooldown() { if (_currentCooldown > 0f) { _currentCooldown -= checkRate; UpdateVisuals(1); } else { UpdateVisuals(0); } } private void UpdateList() { List<PlayerControllerB> list = Object.FindObjectsOfType<PlayerControllerB>().ToList(); List<PlayerControllerB> list2 = new List<PlayerControllerB>(list); foreach (PlayerControllerB item in list) { if (item.playerSteamId == 0) { list2.Remove(item); } } playerList = list2; enemyList = Object.FindObjectsOfType<EnemyAI>().ToList(); } private void OnDisable() { if ((Object)(object)_temp != (Object)null) { _temp.Close(); } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)_temp != (Object)null) { _temp.Close(); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)_temp != (Object)null) { _temp.Close(); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (canUseDeathNote.Value && !_opened && !(_currentCooldown > 0f)) { ((NoisemakerProp)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { UpdateList(); _temp = Object.Instantiate<GameObject>(canvasPrefab, ((Component)this).transform).GetComponent<DeathNoteCanvas>(); _temp.Initialize(this); _opened = true; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; DeathNoteCanvas temp = _temp; temp.onExit = (Action)Delegate.Combine(temp.onExit, new Action(OnExit)); } } } private void OnExit() { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; _opened = false; } public void ActivateDeathNote(GameObject objectToKill) { OnExit(); if (Object.op_Implicit((Object)(object)objectToKill.GetComponent<PlayerControllerB>())) { KillPlayer(objectToKill.GetComponent<PlayerControllerB>()); } if (Object.op_Implicit((Object)(object)objectToKill.GetComponent<EnemyAI>())) { KillEnemy(objectToKill.GetComponent<EnemyAI>()); } StartCooldownServerRpc(); } private void KillPlayer(PlayerControllerB controller) { if (!((Object)(object)controller == (Object)null)) { Debug.Log((object)("[CHILLAX] [DEATH NOTE] killing off player: " + controller.playerUsername)); DeathNoteServerRpc(controller.playerClientId, ((NetworkBehaviour)controller).OwnerClientId); } } private void KillEnemy(EnemyAI enemy) { if (!((Object)(object)enemy == (Object)null)) { Debug.Log((object)("[CHILLAX] [DEATH NOTE] killing off enemy: " + enemy.enemyType.enemyName)); enemy.KillEnemyServerRpc(false); } } [ServerRpc(RequireOwnership = false)] private void DeathNoteServerRpc(ulong playerID, ulong clientID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0131: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2937588739u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, clientID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2937588739u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerID].GetComponent<PlayerControllerB>(); Debug.Log((object)("[DEATH NOTE] Receive Server RPC, player to kill: " + component.playerUsername)); ClientRpcParams val3 = default(ClientRpcParams); val3.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientID } }; ClientRpcParams clientRpcParams = val3; DeathNoteClientRpc(component.playerClientId, clientRpcParams); } } } [ClientRpc] private void DeathNoteClientRpc(ulong playerID, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2281964886u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2281964886u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerID].GetComponent<PlayerControllerB>(); Debug.Log((object)("[DEATH NOTE] Receive Client RPC, player to kill: " + component.playerUsername)); Debug.Log((object)("[DEATH NOTE] Killing: " + component.playerUsername)); ((MonoBehaviour)this).StartCoroutine(KilLDelay(component)); } } } private IEnumerator KilLDelay(PlayerControllerB controller) { if (((NetworkBehaviour)controller).IsOwner) { AudioSource tempSource = ((Component)controller).gameObject.AddComponent<AudioSource>(); tempSource.PlayOneShot(killSfx); Object.Destroy((Object)(object)tempSource, 3f); } yield return (object)new WaitForSeconds(3f); controller.KillPlayer(Vector3.up * 10f, true, (CauseOfDeath)0, 0); } protected override void __initializeVariables() { if (canUseDeathNote == null) { throw new Exception("DeathNote.canUseDeathNote cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)canUseDeathNote).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)canUseDeathNote, "canUseDeathNote"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)canUseDeathNote); ((NoisemakerProp)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_DeathNote() { //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(531245751u, new RpcReceiveHandler(__rpc_handler_531245751)); NetworkManager.__rpc_func_table.Add(246655775u, new RpcReceiveHandler(__rpc_handler_246655775)); NetworkManager.__rpc_func_table.Add(316831956u, new RpcReceiveHandler(__rpc_handler_316831956)); NetworkManager.__rpc_func_table.Add(2937588739u, new RpcReceiveHandler(__rpc_handler_2937588739)); NetworkManager.__rpc_func_table.Add(2281964886u, new RpcReceiveHandler(__rpc_handler_2281964886)); } private static void __rpc_handler_531245751(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((DeathNote)(object)target).UpdateVisualsClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_246655775(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; ((DeathNote)(object)target).StartCooldownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_316831956(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) { float cooldown = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref cooldown, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((DeathNote)(object)target).StartCooldownClientRpc(cooldown); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2937588739(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); ulong clientID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientID); target.__rpc_exec_stage = (__RpcExecStage)1; ((DeathNote)(object)target).DeathNoteServerRpc(playerID, clientID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2281964886(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0040: 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) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((DeathNote)(object)target).DeathNoteClientRpc(playerID, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "DeathNote"; } } public class DeathNoteCanvas : MonoBehaviour { [SerializeField] private Button closeButton; [SerializeField] private GameObject namesPrefab; [SerializeField] private Transform contentContainer; private string _chosenName; private DeathNote _deathNote; public Action onExit; public void Initialize(DeathNote deathNote) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown foreach (Transform item in contentContainer) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } ((UnityEvent)closeButton.onClick).AddListener(new UnityAction(Close)); _deathNote = deathNote; onExit = (Action)Delegate.Combine(onExit, new Action(OnExit)); foreach (PlayerControllerB player in deathNote.playerList) { if (!player.isPlayerDead) { DeathNoteName component = Object.Instantiate<GameObject>(namesPrefab, contentContainer).GetComponent<DeathNoteName>(); component.Initialize(((Component)player).gameObject, _deathNote, this); } } foreach (EnemyAI enemy in deathNote.enemyList) { if (!enemy.isEnemyDead && enemy.enemyType.canDie) { DeathNoteName component2 = Object.Instantiate<GameObject>(namesPrefab, contentContainer).GetComponent<DeathNoteName>(); component2.Initialize(((Component)enemy).gameObject, _deathNote, this); } } } private void OnExit() { Object.Destroy((Object)(object)((Component)this).gameObject); } public void Close() { onExit?.Invoke(); } } public class DeathNoteName : MonoBehaviour { [SerializeField] private TMP_Text nameText; [SerializeField] private Button killButton; private GameObject _objectToKill; private DeathNote _deathNote; private DeathNoteCanvas _deathNoteCanvas; public void Initialize(GameObject objectToKill, DeathNote deathNote, DeathNoteCanvas deathNoteCanvas) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown _deathNote = deathNote; _objectToKill = objectToKill; _deathNoteCanvas = deathNoteCanvas; if (Object.op_Implicit((Object)(object)objectToKill.GetComponent<PlayerControllerB>())) { nameText.text = objectToKill.GetComponent<PlayerControllerB>().playerUsername; } else { nameText.text = ((object)objectToKill.GetComponent<EnemyAI>().enemyType).ToString(); } ((UnityEvent)killButton.onClick).AddListener(new UnityAction(Kill)); } private void Kill() { _deathNote.ActivateDeathNote(_objectToKill); _deathNoteCanvas.Close(); } } public class Food : NoisemakerProp { [SerializeField] private int healAmount; [SerializeField] private float refuelAmount; public override void ItemActivate(bool used, bool buttonDown = true) { if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { if (((GrabbableObject)this).playerHeldBy.sprintMeter + refuelAmount > 1f) { ((GrabbableObject)this).playerHeldBy.sprintMeter = 1f; } else { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.sprintMeter += refuelAmount; } if (((GrabbableObject)this).playerHeldBy.health + healAmount > 100) { ((GrabbableObject)this).playerHeldBy.health = 100; } else { PlayerControllerB playerHeldBy2 = ((GrabbableObject)this).playerHeldBy; playerHeldBy2.health += healAmount; } ((MonoBehaviour)this).StartCoroutine(DestroyDelay()); ChillaxModPlugin.logger.LogInfo((object)"[CHILLAX] EAT FOOD!!"); ((NoisemakerProp)this).ItemActivate(used, buttonDown); } } private IEnumerator DestroyDelay() { yield return (object)new WaitForSeconds(0.5f); ((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy); } protected override void __initializeVariables() { ((NoisemakerProp)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Food"; } } public class UnoReverse : NoisemakerProp { public AudioClip teleportClip; public List<PlayerControllerB> playerList; public List<EnemyAI> outsideEnemyList; public List<EnemyAI> insideEnemyList; private bool _isRed = false; [SerializeField] private Renderer renderer; [SerializeField] private Material blueUnoMat; [SerializeField] private Material redUnoMat; private bool _used; public override void OnNetworkSpawn() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); playerList = new List<PlayerControllerB>(); _used = false; if (((NetworkBehaviour)this).IsHost) { ReplicateBoolClientRpc(_isRed = Random.Range(0f, 100f) > 50f); } } private void FixedUpdate() { if ((Object)(object)renderer != (Object)null) { renderer.material = (_isRed ? redUnoMat : blueUnoMat); } } [ClientRpc(/*Could not decode attribute arguments.*/)] private void ReplicateBoolClientRpc(bool chance, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(223203488u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref chance, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 223203488u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { _isRed = chance; } } } private void UpdateList() { List<PlayerControllerB> list = Object.FindObjectsOfType<PlayerControllerB>().ToList(); List<PlayerControllerB> list2 = new List<PlayerControllerB>(list); foreach (PlayerControllerB item in list) { if (item.playerSteamId == 0) { list2.Remove(item); } } playerList = list2; outsideEnemyList = new List<EnemyAI>(); insideEnemyList = new List<EnemyAI>(); foreach (EnemyAI outsideEnemy in outsideEnemyList) { Debug.Log((object)("[UNO REVERSE CARD] Outside Enemy: " + outsideEnemy.enemyType.enemyName)); } foreach (EnemyAI outsideEnemy2 in outsideEnemyList) { Debug.Log((object)("[UNO REVERSE CARD] Inside Enemy: " + outsideEnemy2.enemyType.enemyName)); } outsideEnemyList.Clear(); insideEnemyList.Clear(); List<EnemyAI> list3 = Object.FindObjectsOfType<EnemyAI>().ToList(); foreach (EnemyAI item2 in list3) { if (item2.enemyType.isOutsideEnemy) { outsideEnemyList.Add(item2); } else { insideEnemyList.Add(item2); } } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner || _used) { return; } ((NoisemakerProp)this).ItemActivate(used, buttonDown); UpdateList(); int num = 0; if (_isRed) { if (((GrabbableObject)this).playerHeldBy.isInsideFactory) { num = Random.Range(0, insideEnemyList.Count); if (insideEnemyList.Count > 0) { foreach (EnemyAI insideEnemy in insideEnemyList) { Debug.Log((object)("[CHILLAX] [UNO REVERSE] Enemies in Game: " + insideEnemy.enemyType.enemyName)); } SwapEnemyServerRpc(num); ((MonoBehaviour)this).StartCoroutine(DestroyDelay()); return; } } else { num = Random.Range(0, outsideEnemyList.Count); if (outsideEnemyList.Count > 0) { foreach (EnemyAI outsideEnemy in outsideEnemyList) { Debug.Log((object)("[CHILLAX] [UNO REVERSE] Enemies in Game: " + outsideEnemy.enemyType.enemyName)); } SwapEnemyServerRpc(num, outside: true); ((MonoBehaviour)this).StartCoroutine(DestroyDelay()); return; } } } foreach (PlayerControllerB player in playerList) { Debug.Log((object)("[CHILLAX] [UNO REVERSE] Players in Game: " + player.playerUsername)); } playerList.Remove(((GrabbableObject)this).playerHeldBy); num = Random.Range(0, playerList.Count); if (playerList.Count <= 0) { Debug.LogWarning((object)"[CHILLAX] [UNO REVERSE] No players to swap with"); } foreach (PlayerControllerB player2 in playerList) { Debug.Log((object)("[CHILLAX] [UNO REVERSE] Potential Swappers: " + player2.playerUsername)); } PlayerControllerB val = playerList[num]; Vector3 position = GetPosition(((GrabbableObject)this).playerHeldBy); Vector3 position2 = GetPosition(val); Vector3 val2 = position2; string? text = ((object)(Vector3)(ref val2)).ToString(); val2 = position; Debug.Log((object)("Teleporting to: " + text + " From: " + ((object)(Vector3)(ref val2)).ToString())); _used = true; SwapServerRpc(position, position2, val.actualClientId, val.playerClientId); ((MonoBehaviour)this).StartCoroutine(DestroyDelay()); } private Vector3 GetPosition(PlayerControllerB player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)player).transform.position, RoundManager.Instance.navHit, 2.7f, -1); ((Vector3)(ref navMeshPosition))..ctor(((Component)player).transform.position.x, navMeshPosition.y, ((Component)player).transform.position.z); return navMeshPosition; } private Vector3 GetPosition(Vector3 pos) { //IL_0006: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(pos, RoundManager.Instance.navHit, 2.7f, -1); ((Vector3)(ref navMeshPosition))..ctor(pos.x, navMeshPosition.y, pos.z); return navMeshPosition; } [ServerRpc(RequireOwnership = false)] private void SwapServerRpc(Vector3 firstPosition, Vector3 secondPosition, ulong otherId, ulong otherPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_008b: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1017133487u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref firstPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref secondPosition); BytePacker.WriteValueBitPacked(val2, otherId); BytePacker.WriteValueBitPacked(val2, otherPlayerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1017133487u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _used = true; Debug.Log((object)"Teleporting... SERVER RPC"); Teleport(firstPosition, secondPosition, otherId, otherPlayerId); } } } [ServerRpc(RequireOwnership = false)] private void SwapEnemyServerRpc(int randIndex, bool outside = false) { //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_0071: 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) //IL_0090: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1470963546u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, randIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref outside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1470963546u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _used = true; EnemyAI val3 = (outside ? outsideEnemyList[randIndex] : insideEnemyList[randIndex]); ClientRpcParams val4 = default(ClientRpcParams); val4.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { ((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).OwnerClientId } }; ClientRpcParams clientRpcParams = val4; Vector3 position = GetPosition(((Component)((GrabbableObject)this).playerHeldBy).transform.position); Vector3 position2 = GetPosition(((Component)val3).transform.position); Utilities.TeleportPlayer((int)((GrabbableObject)this).playerHeldBy.playerClientId, position2); TeleportOnClientRpc(position2, ((GrabbableObject)this).playerHeldBy.isInElevator, ((GrabbableObject)this).playerHeldBy.isInHangarShipRoom, ((GrabbableObject)this).playerHeldBy.isInsideFactory, clientRpcParams); Utilities.TeleportEnemy(val3, position); TeleportEnemyClientRpc(randIndex, position, outside); } } } [ClientRpc] private void TeleportEnemyClientRpc(int randIndex, Vector3 playerPosition, bool outside = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: 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_00b1: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1745445435u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, randIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref outside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1745445435u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EnemyAI val3 = (outside ? outsideEnemyList[randIndex] : insideEnemyList[randIndex]); Utilities.TeleportEnemy(val3, playerPosition); } } } private void Teleport(Vector3 firstPosition, Vector3 secondPosition, ulong otherClientId, ulong otherPlayerId) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0030: 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_0037: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { ((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).OwnerClientId } }; ClientRpcParams clientRpcParams = val; val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { otherClientId } }; ClientRpcParams clientRpcParams2 = val; Utilities.TeleportPlayer((int)((GrabbableObject)this).playerHeldBy.playerClientId, secondPosition); Utilities.TeleportPlayer((int)otherPlayerId, firstPosition); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[((GrabbableObject)this).playerHeldBy.playerClientId]; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[otherPlayerId]; TeleportOnClientRpc(secondPosition, val3.isInElevator, val3.isInHangarShipRoom, val3.isInsideFactory, clientRpcParams); TeleportOnClientRpc(firstPosition, val2.isInElevator, val2.isInHangarShipRoom, val2.isInsideFactory, clientRpcParams2); bool isInElevator = ((GrabbableObject)this).playerHeldBy.isInElevator; bool isInHangarShipRoom = ((GrabbableObject)this).playerHeldBy.isInHangarShipRoom; bool isInsideFactory = ((GrabbableObject)this).playerHeldBy.isInsideFactory; val2.isInElevator = val3.isInElevator; val2.isInHangarShipRoom = val3.isInHangarShipRoom; val2.isInsideFactory = val3.isInsideFactory; val3.isInElevator = isInElevator; val3.isInHangarShipRoom = isInHangarShipRoom; val3.isInsideFactory = isInsideFactory; PlayExtraClipClientRpc(clientRpcParams2); } } [ClientRpc] private void TeleportOnClientRpc(Vector3 position, bool inElevator, bool inHangar, bool inFactory, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0152: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2006694156u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inElevator, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inHangar, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2006694156u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; localPlayerController.isInElevator = inElevator; localPlayerController.isInHangarShipRoom = inHangar; localPlayerController.isInsideFactory = inFactory; _used = true; Utilities.TeleportPlayer((int)StartOfRound.Instance.localPlayerController.playerClientId, position); } } } [ClientRpc] private void PlayExtraClipClientRpc(ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(457107265u, clientRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 457107265u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AudioSource val2 = ((Component)StartOfRound.Instance.localPlayerController).gameObject.AddComponent<AudioSource>(); if (!((Object)(object)teleportClip == (Object)null)) { val2.PlayOneShot(teleportClip); Object.Destroy((Object)(object)val2, 2f); } } } private IEnumerator DestroyDelay() { yield return (object)new WaitForSeconds(1f); ((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy); DestroyServerRpc(); } [ServerRpc(RequireOwnership = false)] private void DestroyServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3051293639u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3051293639u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy); DestroyClientRpc(); } } } [ClientRpc] private void DestroyClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1058296590u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1058296590u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy); } } } protected override void __initializeVariables() { ((NoisemakerProp)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_UnoReverse() { //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 NetworkManager.__rpc_func_table.Add(223203488u, new RpcReceiveHandler(__rpc_handler_223203488)); NetworkManager.__rpc_func_table.Add(1017133487u, new RpcReceiveHandler(__rpc_handler_1017133487)); NetworkManager.__rpc_func_table.Add(1470963546u, new RpcReceiveHandler(__rpc_handler_1470963546)); NetworkManager.__rpc_func_table.Add(1745445435u, new RpcReceiveHandler(__rpc_handler_1745445435)); NetworkManager.__rpc_func_table.Add(2006694156u, new RpcReceiveHandler(__rpc_handler_2006694156)); NetworkManager.__rpc_func_table.Add(457107265u, new RpcReceiveHandler(__rpc_handler_457107265)); NetworkManager.__rpc_func_table.Add(3051293639u, new RpcReceiveHandler(__rpc_handler_3051293639)); NetworkManager.__rpc_func_table.Add(1058296590u, new RpcReceiveHandler(__rpc_handler_1058296590)); } private static void __rpc_handler_223203488(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_003f: 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_004e: 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_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool chance = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref chance, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((UnoReverse)(object)target).ReplicateBoolClientRpc(chance, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1017133487(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003d: 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_005d: 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_006c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 firstPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref firstPosition); Vector3 secondPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref secondPosition); ulong otherId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref otherId); ulong otherPlayerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref otherPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((UnoReverse)(object)target).SwapServerRpc(firstPosition, secondPosition, otherId, otherPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1470963546(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int randIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref randIndex); bool outside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref outside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UnoReverse)(object)target).SwapEnemyServerRpc(randIndex, outside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1745445435(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int randIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref randIndex); Vector3 playerPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerPosition); bool outside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref outside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((UnoReverse)(object)target).TeleportEnemyClientRpc(randIndex, playerPosition, outside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2006694156(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0081: 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_0087: 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) //IL_009c: 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_00bb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool inElevator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref inElevator, default(ForPrimitives)); bool inHangar = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref inHangar, default(ForPrimitives)); bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref inFactory, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((UnoReverse)(object)target).TeleportOnClientRpc(position, inElevator, inHangar, inFactory, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_457107265(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((UnoReverse)(object)target).PlayExtraClipClientRpc(client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3051293639(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; ((UnoReverse)(object)target).DestroyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1058296590(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; ((UnoReverse)(object)target).DestroyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "UnoReverse"; } } public class Utilities { public static void TeleportPlayer(int playerObj, Vector3 teleportPos) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; val.averageVelocity = 0f; val.velocityLastFrame = Vector3.zero; StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true); StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play(); if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } } } namespace ChillaxMods.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/DiscountAlert.dll
Decompiled 9 months agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using DiscountAlert; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("DiscountAlert")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0.0")] [assembly: AssemblyProduct("DiscountAlert")] [assembly: AssemblyTitle("DiscountAlert")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(StartMatchLever))] public class StartMatchLever_Patches { private static string priceUpColor = Plugin.Instance.PRICE_UP_COLOR; private static string priceDownColor = Plugin.Instance.PRICE_DOWN_COLOR; private static string noDiscountColor = Plugin.Instance.NO_DISCOUNT_COLOR; private static string noDiscountText = Plugin.Instance.noDiscountText.Value; private static string titleColor = Plugin.Instance.TITLE_COLOR; private static string titleText = Plugin.Instance.titleText.Value; private static int delayAfterLeverIsPulled = Plugin.Instance.delayAfterLeverIsPulled.Value; private static bool colorsEnabled = Plugin.Instance.colorsEnabled.Value; private static bool alertEnabledWhenNoDiscounts = Plugin.Instance.alertEnabledWhenNoDiscounts.Value; public static bool playerAlerted = false; public static int counter = 0; [HarmonyPatch("PlayLeverPullEffectsClientRpc")] [HarmonyPostfix] public static void PlayLeverPullEffectsClientRpcPatch() { playerAlerted = false; counter++; if (StartOfRound.Instance.inShipPhase && !playerAlerted && counter == 1) { playerAlerted = true; ((MonoBehaviour)HUDManager.Instance).StartCoroutine(DisplayAlert()); } else if (counter > 1) { counter = 0; } } private static IEnumerator DisplayAlert() { yield return (object)new WaitForSeconds((float)delayAfterLeverIsPulled); Debug.Log((object)"Displaying alert"); StringBuilder discount_list = new StringBuilder(); for (int i = 0; i < HUDManager.Instance.terminalScript.buyableItemsList.Length; i++) { if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] != 100) { if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] < 0) { discount_list.Append("\n" + ((priceUpColor != null) ? ("<color=" + priceUpColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (1f - (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f)} " + string.Format("({0}% UP!){1}", Math.Abs(HUDManager.Instance.terminalScript.itemSalesPercentages[i]), (priceUpColor != null) ? "</color>" : "")); } else if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] > 0) { discount_list.Append("\n" + ((priceDownColor != null) ? ("<color=" + priceDownColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f} " + string.Format("({0}% OFF!){1}", 100 - HUDManager.Instance.terminalScript.itemSalesPercentages[i], (priceDownColor != null) ? "</color>" : "")); } } } if ((!(discount_list.ToString() == "") && discount_list != null) || alertEnabledWhenNoDiscounts) { if ((discount_list.ToString() == "" || discount_list == null) && alertEnabledWhenNoDiscounts) { discount_list.Append(((noDiscountColor != null) ? ("<color=" + noDiscountColor + "> ") : " ") + noDiscountText + ((noDiscountColor != null) ? "</color>" : "")); } HUDManager.Instance.DisplayTip(((titleColor != null) ? ("<color=" + titleColor + "> ") : " ") + titleText + ((titleColor != null) ? "</color>" : ""), discount_list.ToString(), false, false, "LC_Tip1"); } } } namespace DiscountAlert { [BepInPlugin("discount.alert", "DiscountAlert", "2.3.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "discount.alert"; private const string modName = "DiscountAlert"; private const string modVersion = "2.3.0.0"; public ConfigEntry<string> priceUpColor; public ConfigEntry<string> priceDownColor; public ConfigEntry<string> noDiscountColor; public ConfigEntry<string> noDiscountText; public ConfigEntry<string> titleColor; public ConfigEntry<string> titleText; public ConfigEntry<int> delayAfterLeverIsPulled; public ConfigEntry<bool> colorsEnabled; public ConfigEntry<bool> alertEnabledWhenNoDiscounts; public string PRICE_UP_COLOR; public string PRICE_DOWN_COLOR; public string NO_DISCOUNT_COLOR; public string TITLE_COLOR; private readonly Harmony harmony = new Harmony("discount.alert"); public static Plugin? Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } priceUpColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceUpColor", "#990000", "Text color when the price goes up (currently only possible with other mods)"); priceDownColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceDownColor", "#008000", "Text color when the price goes down"); delayAfterLeverIsPulled = ((BaseUnityPlugin)this).Config.Bind<int>("Alert", "DelayAfterLeverIsPulled", 4, "Number of seconds to wait after the \"Land ship\" or \"Start Game\" lever is pulled before showing the alert."); colorsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "ColorsEnabled", true, "Enable or disable text colors"); noDiscountColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "NoDiscountColor", "", "Text color when there are no discounts"); titleColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "TitleColor", "", "Text color for the alert's title"); titleText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "TitleText", "Today's discounts", "Alert title text"); noDiscountText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "NoDiscountText", "None :( \n Check back tomorrow!", "Alert text when there are no discounts"); alertEnabledWhenNoDiscounts = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "AlertEnabledWhenNoDiscounts", true, "Show alert when there are no discounts"); if (!IsValidHexCode(priceUpColor.Value)) { PRICE_UP_COLOR = null; } else { PRICE_UP_COLOR = priceUpColor.Value; } if (!IsValidHexCode(priceDownColor.Value)) { PRICE_DOWN_COLOR = null; } else { PRICE_DOWN_COLOR = priceDownColor.Value; } if (!IsValidHexCode(noDiscountColor.Value)) { NO_DISCOUNT_COLOR = null; } else { NO_DISCOUNT_COLOR = noDiscountColor.Value; } if (!IsValidHexCode(titleColor.Value)) { TITLE_COLOR = null; } else { TITLE_COLOR = titleColor.Value; } if (!colorsEnabled.Value) { PRICE_UP_COLOR = null; PRICE_DOWN_COLOR = null; NO_DISCOUNT_COLOR = null; TITLE_COLOR = null; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin discount.alert is loaded!"); harmony.PatchAll(); } public static bool IsValidHexCode(string hexCode) { string pattern = "^#?([0-9A-Fa-f]{3}){1,2}$"; return Regex.IsMatch(hexCode, pattern); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
plugins/hehe/BrackenPlush.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BrackenPlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BrackenPlush")] [assembly: AssemblyTitle("BrackenPlush")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace BrackenPlush { [BepInPlugin("scin.BrackenPlush", "Bracken Plushie", "1.0.3")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.BrackenPlush"; private const string NAME = "Bracken Plushie"; private const string VERSION = "1.0.3"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "brackenasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Bracken Plush/BrackenPlush.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 20, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Bracken Plushie"); } } }
plugins/hehe/BunkspidPlush.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BunkspidPlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BunkspidPlush")] [assembly: AssemblyTitle("BunkspidPlush")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace bunkspidPlushie { [BepInPlugin("scin.bunkspidPlushie", "Bunk Spider Plushie", "1.0.1")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.bunkspidPlushie"; private const string NAME = "Bunk Spider Plushie"; private const string VERSION = "1.0.1"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bunkspidasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Bunkspid/BunkspidItem.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 20, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Bunker Spider plushie"); } } }
plugins/hehe/CoilheadPlush.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CoilheadPlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CoilheadPlush")] [assembly: AssemblyTitle("CoilheadPlush")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace CoilheadPlushie { [BepInPlugin("scin.CoilheadPlushie", "Coil head Plushie", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.CoilheadPlushie"; private const string NAME = "Coil head Plushie"; private const string VERSION = "1.0.2"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "coilplushasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Coil head/CoilHeadPlush.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 20, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Coilhead Plushie"); } } }
plugins/hehe/Comedymask.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Comedymask")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Comedymask")] [assembly: AssemblyTitle("Comedymask")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace ComedyPlush { [BepInPlugin("scin.ComedymaskPlush", "Comedy mask Plushie", "1.0.1")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.ComedymaskPlush"; private const string NAME = "Comedy mask Plushie"; private const string VERSION = "1.0.1"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "comedyplush"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Masked/comedyplushitem.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 5, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Comedy mask Plushie"); } } }
plugins/hehe/Jesterplushie.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Jesterplushie")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Jesterplushie")] [assembly: AssemblyTitle("Jesterplushie")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace JesterPlushie { [BepInPlugin("scin.JesterPlushie", "Jester Plushie", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.JesterPlushie"; private const string NAME = "Jester Plushie"; private const string VERSION = "1.0.0"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "jesterplushasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Jester/jesterplushie.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 10, (LevelTypes)896); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Jester Plushie"); } } }
plugins/hehe/LootbugPlush.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LootbugPlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LootbugPlush")] [assembly: AssemblyTitle("LootbugPlush")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace HoardingBugPlush { [BepInPlugin("scin.Hoarding-BugPlushPlush", "Hoarding Bug Plushie", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.Hoarding-BugPlushPlush"; private const string NAME = "Hoarding Bug Plushie"; private const string VERSION = "1.0.2"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lootbugplushasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Lootbug/lootbugPlush.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 20, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Lootbug Plushie"); } } }
plugins/hehe/tragedyplush.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("tragedyplush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("tragedyplush")] [assembly: AssemblyTitle("tragedyplush")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace TragedymaskPlush { [BepInPlugin("scin.TragedymaskPlush", "Tragedy mask Plushie", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "scin.TragedymaskPlush"; private const string NAME = "Tragedy mask Plushie"; private const string VERSION = "1.0.2"; public static Plugin instance; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "tragedyasset"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/MY STUFF/Masked/Tragedyplushitem.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 5, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Tragedy mask Plushie"); } } }
plugins/JetpackFallFix.dll
Decompiled 9 months agousing System; using System.Diagnostics; 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.Logging; using GameNetcodeStuff; using IL.GameNetcodeStuff; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.GameNetcodeStuff; 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("JetpackFallFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A lethal company mod which fixes buggy jetpack fall damage logic.")] [assembly: AssemblyFileVersion("2.0.1.0")] [assembly: AssemblyInformationalVersion("2.0.1")] [assembly: AssemblyProduct("JetpackFallFix")] [assembly: AssemblyTitle("JetpackFallFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JetpackFallFix { internal class Patches { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__PlayerControllerB_Awake; public static Manipulator <1>__PlayerControllerB_Update; public static Manipulator <2>__PlayerControllerB_PlayerHitGroundEffects; public static hook_PlayerHitGroundEffects <3>__On_PlayerControllerB_PlayerHitGroundEffects; } private static void LogIfDebugBuild(string text) { } internal static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_Awake; if (obj == null) { hook_Awake val = PlayerControllerB_Awake; <>O.<0>__PlayerControllerB_Awake = val; obj = (object)val; } PlayerControllerB.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__PlayerControllerB_Update; if (obj2 == null) { Manipulator val2 = PlayerControllerB_Update; <>O.<1>__PlayerControllerB_Update = val2; obj2 = (object)val2; } PlayerControllerB.Update += (Manipulator)obj2; object obj3 = <>O.<2>__PlayerControllerB_PlayerHitGroundEffects; if (obj3 == null) { Manipulator val3 = PlayerControllerB_PlayerHitGroundEffects; <>O.<2>__PlayerControllerB_PlayerHitGroundEffects = val3; obj3 = (object)val3; } PlayerControllerB.PlayerHitGroundEffects += (Manipulator)obj3; object obj4 = <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects; if (obj4 == null) { hook_PlayerHitGroundEffects val4 = On_PlayerControllerB_PlayerHitGroundEffects; <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects = val4; obj4 = (object)val4; } PlayerControllerB.PlayerHitGroundEffects += (hook_PlayerHitGroundEffects)obj4; } private static void PlayerControllerB_Awake(orig_Awake orig, PlayerControllerB self) { orig.Invoke(self); self.velocityAverageCount = 21; } private static void PlayerControllerB_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_013a: 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) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[8] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "gameplayCamera"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f), (Instruction x) => ILPatternMatchingExt.MatchCall<StartOfRound>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<StartOfRound>(x, "collidersAndRoomMaskAndDefault"), (Instruction x) => ILPatternMatchingExt.MatchCall<Physics>(x, "CheckSphere") }); val.Index += 7; val.Remove(); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Call, (MethodBase)(from x in typeof(Physics).GetMethods() where x.Name == "CheckSphere" select x).FirstOrDefault()); } private static void On_PlayerControllerB_PlayerHitGroundEffects(orig_PlayerHitGroundEffects orig, PlayerControllerB self) { orig.Invoke(self); self.averageVelocity = 0f; } private static void PlayerControllerB_PlayerHitGroundEffects(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val5 = default(ILLabel); ILLabel val4 = default(ILLabel); ILLabel val3 = default(ILLabel); ILLabel val2 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[12] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "takingFallDamage"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val5), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "jetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "disablingJetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "isSpeedCheating"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2) }); val.Index += 4; val.RemoveRange(4); val.EmitDelegate<Func<PlayerControllerB, bool>>((Func<PlayerControllerB, bool>)delegate(PlayerControllerB self) { //IL_0022: 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) if (!self.jetpackControls && !self.disablingJetpackControls) { LogIfDebugBuild("Take normal fall damage."); return false; } if (self.thisController.velocity.y < -15f) { LogIfDebugBuild("Take fall damage with jetpack."); self.fallValueUncapped = self.thisController.velocity.y; return false; } LogIfDebugBuild("Prevented fall damage bug!"); self.takingFallDamage = false; return true; }); } } [BepInPlugin("JetpackFallFix", "JetpackFallFix", "2.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin JetpackFallFix is loaded!"); Patches.Init(); } } public static class PluginInfo { public const string PLUGIN_GUID = "JetpackFallFix"; public const string PLUGIN_NAME = "JetpackFallFix"; public const string PLUGIN_VERSION = "2.0.1"; } }
plugins/LC_LandminesForAll.dll
Decompiled 9 months agousing System; using System.Collections.Generic; 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.Logging; using HarmonyLib; using LC_LandminesForAll.Patches; using LC_LandminesForAll.Utils; using Microsoft.CodeAnalysis; 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("LC_LandminesForAll")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Templete")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+d2a1d9af8893c2a3098c4da244d009911438c0a4")] [assembly: AssemblyProduct("LC_LandminesForAll")] [assembly: AssemblyTitle("LC_LandminesForAll")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LC_LandminesForAll { public class MyPluginInfo { public const string PLUGIN_GUID = "sakura.lc.landminesforall"; public const string PLUGIN_NAME = "LandminesForAll"; public const string PLUGIN_VERSION = "1.0.1"; } [BepInPlugin("sakura.lc.landminesforall", "LandminesForAll", "1.0.1")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; internal static ManualLogSource Logger; public static string ThisPluginFolder => Path.Combine(Paths.PluginPath, "Sakura-LandminesForAll"); 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("sakura.lc.landminesforall"); _harmony.PatchAll(typeof(LandminePatch)); Logger.LogInfo((object)"Plugin sakura.lc.landminesforall is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LC_LandminesForAll"; public const string PLUGIN_NAME = "LC_LandminesForAll"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace LC_LandminesForAll.Utils { internal static class ReflectionUtils { public static void SetPrivateField<T>(this T instance, string fieldName, object value) { typeof(T).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(instance, value); } public static void SetPrivateProperty<T>(this T instance, string propertyName, object value) { typeof(T).GetProperty(propertyName, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(instance, value); } public static void SetPrivateStaticField<T>(string fieldName, object value) { typeof(T).GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, value); } public static void SetPrivateStaticProperty<T>(string propertyName, object value) { typeof(T).GetProperty(propertyName, BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, value); } public static T GetPrivateField<T>(this object instance, string fieldName) { return (T)instance.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(instance); } public static T GetPrivateProperty<T>(this object instance, string propertyName) { return (T)instance.GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(instance); } public static T GetPrivateStaticField<T>(string fieldName) { return (T)typeof(T).GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); } public static T GetPrivateStaticProperty<T>(string propertyName) { return (T)typeof(T).GetProperty(propertyName, BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); } public static void InvokePrivateMethod<T>(this T instance, string methodName, params object[] parameters) { instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, parameters); } public static void InvokePrivateStaticMethod<T>(string methodName, params object[] parameters) { typeof(T).GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, parameters); } public static T CreatePrivateInstance<T>(params object[] parameters) { return (T)Activator.CreateInstance(typeof(T), BindingFlags.Instance | BindingFlags.NonPublic, null, parameters, null); } public static T CreatePrivateStaticInstance<T>(params object[] parameters) { return (T)Activator.CreateInstance(typeof(T), BindingFlags.Static | BindingFlags.NonPublic, null, parameters, null); } } } namespace LC_LandminesForAll.Patches { [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { private const int LineOfSightLayer = 18; private const int EnemyLayer = 19; [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(Landmine __instance) { //IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) BoxCollider val = ((IEnumerable<BoxCollider>)((Component)__instance).GetComponents<BoxCollider>()).FirstOrDefault((Func<BoxCollider, bool>)((BoxCollider x) => ((Collider)x).isTrigger)); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)$"Could not find mine trigger collider on mine at {((Component)__instance).transform.position}"); return; } BoxCollider obj = ((Component)__instance).gameObject.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = true; obj.size = val.size * 2f; obj.center = val.center; ((Collider)obj).enabled = true; ((Collider)obj).includeLayers = LayerMask.op_Implicit(524288); } private static void TriggerDebounce(Landmine __instance) { //IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Transform closestEnemyForLogging = GetClosestEnemyForLogging(__instance); Plugin.Logger.LogDebug((object)$"Triggering debounce on mine at {((Component)__instance).transform.position} with closest enemy at {closestEnemyForLogging.position} at {Vector3.Distance(((Component)__instance).transform.position, ((Component)closestEnemyForLogging).transform.position)} units away."); __instance.SetPrivateField<Landmine>("pressMineDebounceTimer", 0.5f); __instance.PressMineServerRpc(); } private static void TriggerMineExplosion(Landmine __instance) { //IL_0017: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Transform closestEnemyForLogging = GetClosestEnemyForLogging(__instance); Plugin.Logger.LogDebug((object)$"Triggering debounce on mine at {((Component)__instance).transform.position} with closest enemy at {closestEnemyForLogging.position} at {Vector3.Distance(((Component)__instance).transform.position, ((Component)closestEnemyForLogging).transform.position)} units away."); __instance.InvokePrivateMethod<Landmine>("TriggerMineOnLocalClientByExiting", Array.Empty<object>()); } private static Transform GetClosestEnemyForLogging(Landmine __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) //IL_006d: Unknown result type (might be due to invalid IL or missing references) LayerMask val = LayerMask.op_Implicit(524288); RaycastHit[] array = Physics.SphereCastAll(((Component)__instance).transform.position, 10000f, Vector3.up, 0f, LayerMask.op_Implicit(val)); Transform result = null; float num = float.MaxValue; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (((Component)((RaycastHit)(ref val2)).collider).CompareTag("Enemy")) { float num2 = Vector3.Distance(((Component)__instance).transform.position, ((RaycastHit)(ref val2)).transform.position); if (num2 < num) { num = num2; result = ((RaycastHit)(ref val2)).transform; } } } return result; } [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] private static bool OnTriggerEnter(Landmine __instance, Collider other) { if (__instance.hasExploded || __instance.GetPrivateField<float>("pressMineDebounceTimer") > 0f) { return true; } if (((Component)other).CompareTag("Enemy")) { TriggerDebounce(__instance); return false; } return true; } [HarmonyPatch("OnTriggerExit")] [HarmonyPrefix] private static bool OnTriggerExit(Landmine __instance, Collider other) { if (__instance.hasExploded || __instance.GetPrivateField<float>("pressMineDebounceTimer") > 0f) { return true; } if (((Component)other).CompareTag("Enemy")) { TriggerMineExplosion(__instance); return false; } return true; } } }
plugins/LCOffice.dll
Decompiled 9 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LCOffice.Patches; using LethalLevelLoader; using LethalLib.Modules; using LethalNetworkAPI; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LcOffice")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LcOffice")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [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 LCOffice { [BepInPlugin("Piggy.LCOffice", "LCOffice", "1.0.3")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Piggy.LCOffice"; private const string modName = "LCOffice"; private const string modVersion = "1.0.3"; private readonly Harmony harmony = new Harmony("Piggy.LCOffice"); private static Plugin Instance; public static ManualLogSource mls; public static AssetBundle Bundle; public static AudioClip ElevatorOpen; public static AudioClip ElevatorClose; public static AudioClip ElevatorUp; public static AudioClip ElevatorDown; public static AudioClip stanleyVoiceline1; public static AudioClip bossaLullaby; public static AudioClip shopTheme; public static AudioClip saferoomTheme; public static AudioClip cootieTheme; public static AudioClip garageDoorSlam; public static AudioClip garageSlide; public static AudioClip floorOpen; public static AudioClip floorClose; public static AudioClip footstep1; public static AudioClip footstep2; public static AudioClip footstep3; public static AudioClip footstep4; public static AudioClip dogEatItem; public static AudioClip bigGrowl; public static AudioClip enragedScream; public static AudioClip dogSprint; public static AudioClip ripPlayerApart; public static AudioClip cry1; public static AudioClip dogHowl; public static AudioClip stomachGrowl; public static AudioClip eatenExplode; public static AudioClip dogSneeze; public static GameObject shrimpPrefab; public static GameObject storagePrefab; public static GameObject socketPrefab; public static GameObject socketInteractPrefab; public static EnemyType shrimpEnemy; public static ExtendedDungeonFlow officeExtendedDungeonFlow; public static DungeonFlow officeDungeonFlow; public static TerminalNode shrimpTerminalNode; public static TerminalKeyword shrimpTerminalKeyword; public static string PluginDirectory; private ConfigEntry<bool> configGuaranteedOffice; private ConfigEntry<int> configOfficeRarity; private ConfigEntry<string> configMoons; private ConfigEntry<string> shrimpSpawnWeight; private ConfigEntry<int> shrimpModdedSpawnWeight; public static bool setKorean; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } configOfficeRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "OfficeRarity", 50, new ConfigDescription("How rare it is for the office to be chosen. Higher values increases the chance of spawning the office.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>())); configGuaranteedOffice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OfficeGuaranteed", false, new ConfigDescription("If enabled, the office will be effectively guaranteed to spawn. Only recommended for debugging/sightseeing purposes.", (AcceptableValueBase)null, Array.Empty<object>())); configMoons = ((BaseUnityPlugin)this).Config.Bind<string>("General", "OfficeMoonsList", "free", new ConfigDescription("The moon(s) that the office can spawn on, in the form of a comma separated list of selectable level names (e.g. \"TitanLevel,RendLevel,DineLevel\")\nNOTE: These must be the internal data names of the levels (all vanilla moons are \"MoonnameLevel\", for modded moon support you will have to find their name if it doesn't follow the convention).\nThe following strings: \"all\", \"vanilla\", \"modded\", \"paid\", \"free\", \"none\" are dynamic presets which add the dungeon to that specified group (string must only contain one of these, or a manual moon name list).\nDefault dungeon generation size is balanced around the dungeon scale multiplier of Titan (2.35), moons with significantly different dungeon size multipliers (see Lethal Company wiki for values) may result in dungeons that are extremely small/large.", (AcceptableValueBase)null, Array.Empty<object>())); shrimpSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<string>("Spawn", "ShrimpSpawnWeight", "2,4,5,3,6,8,8,10", new ConfigDescription("Set the shrimp spawn weight for each moon. In this order:\n(experimentation, assurance, vow, march, offense, rend, dine, titan).", (AcceptableValueBase)null, Array.Empty<object>())); shrimpModdedSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "ShrimpModdedMoonSpawnWeight", 5, new ConfigDescription("Set the shrimp spawn weight for modded moon. ", (AcceptableValueBase)null, Array.Empty<object>())); setKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value; PluginDirectory = ((BaseUnityPlugin)this).Info.Location; mls = Logger.CreateLogSource("Piggy.LCOffice"); mls.LogInfo((object)"LC_Office is loaded!"); Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lcoffice")); officeDungeonFlow = Bundle.LoadAsset<DungeonFlow>("OfficeDungeonFlow.asset"); officeExtendedDungeonFlow = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); officeExtendedDungeonFlow.contentSourceName = "LC_Office"; officeExtendedDungeonFlow.dungeonFlow = officeDungeonFlow; officeExtendedDungeonFlow.dungeonDefaultRarity = 0; int num = (configGuaranteedOffice.Value ? 99999 : configOfficeRarity.Value); if (configMoons.Value.ToLower() == "all") { officeExtendedDungeonFlow.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num)); officeExtendedDungeonFlow.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num)); } else if (configMoons.Value.ToLower() == "vanilla") { officeExtendedDungeonFlow.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num)); } else if (configMoons.Value.ToLower() == "modded") { officeExtendedDungeonFlow.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num)); } else if (configMoons.Value.ToLower() == "paid") { officeExtendedDungeonFlow.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num)); } else if (configMoons.Value.ToLower() == "free") { officeExtendedDungeonFlow.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num)); } else if (!(configMoons.Value.ToLower() == "none")) { string[] array = configMoons.Value.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); StringWithRarity[] array2 = (StringWithRarity[])(object)new StringWithRarity[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = new StringWithRarity(array[i], num); } officeExtendedDungeonFlow.manualPlanetNameReferenceList = array2.ToList(); } officeExtendedDungeonFlow.dungeonSizeMax = 0.1f; officeExtendedDungeonFlow.dungeonSizeLerpPercentage = 0f; AssetBundleLoader.RegisterExtendedDungeonFlow(officeExtendedDungeonFlow); shrimpPrefab = Bundle.LoadAsset<GameObject>("Shrimp.prefab"); shrimpPrefab.AddComponent<ShrimpAI>(); shrimpEnemy = Bundle.LoadAsset<EnemyType>("ShrimpEnemy.asset"); storagePrefab = Bundle.LoadAsset<GameObject>("DepositPlace.prefab"); socketPrefab = Bundle.LoadAsset<GameObject>("ElevatorSocket.prefab"); socketInteractPrefab = Bundle.LoadAsset<GameObject>("LungPlacement.prefab"); GameObject val = Bundle.LoadAsset<GameObject>("OfficeStartRoom.prefab"); val.AddComponent<ElevatorSystem>(); bossaLullaby = Bundle.LoadAsset<AudioClip>("bossa_lullaby_refiltered.ogg"); shopTheme = Bundle.LoadAsset<AudioClip>("shop_refiltered.ogg"); saferoomTheme = Bundle.LoadAsset<AudioClip>("saferoom_refiltered.ogg"); ElevatorOpen = Bundle.LoadAsset<AudioClip>("ElevatorOpen.ogg"); ElevatorClose = Bundle.LoadAsset<AudioClip>("ElevatorClose.ogg"); ElevatorDown = Bundle.LoadAsset<AudioClip>("ElevatorDown.ogg"); ElevatorUp = Bundle.LoadAsset<AudioClip>("ElevatorUp.ogg"); garageDoorSlam = Bundle.LoadAsset<AudioClip>("GarageDoorSlam.ogg"); garageSlide = Bundle.LoadAsset<AudioClip>("GarageDoorSlide1.ogg"); floorOpen = Bundle.LoadAsset<AudioClip>("FloorOpen.ogg"); floorClose = Bundle.LoadAsset<AudioClip>("FloorClosed.ogg"); footstep1 = Bundle.LoadAsset<AudioClip>("Footstep1.ogg"); footstep2 = Bundle.LoadAsset<AudioClip>("Footstep2.ogg"); footstep3 = Bundle.LoadAsset<AudioClip>("Footstep3.ogg"); footstep4 = Bundle.LoadAsset<AudioClip>("Footstep4.ogg"); dogEatItem = Bundle.LoadAsset<AudioClip>("DogEatObject.ogg"); bigGrowl = Bundle.LoadAsset<AudioClip>("BigGrowl.ogg"); enragedScream = Bundle.LoadAsset<AudioClip>("DogRage.ogg"); dogSprint = Bundle.LoadAsset<AudioClip>("DogSprint.ogg"); ripPlayerApart = Bundle.LoadAsset<AudioClip>("RipPlayerApart.ogg"); cry1 = Bundle.LoadAsset<AudioClip>("Cry1.ogg"); dogHowl = Bundle.LoadAsset<AudioClip>("DogHowl.ogg"); stomachGrowl = Bundle.LoadAsset<AudioClip>("StomachGrowl.ogg"); eatenExplode = Bundle.LoadAsset<AudioClip>("eatenExplode.ogg"); dogSneeze = Bundle.LoadAsset<AudioClip>("Sneeze.ogg"); stanleyVoiceline1 = Bundle.LoadAsset<AudioClip>("stanley.ogg"); shrimpTerminalNode = Bundle.LoadAsset<TerminalNode>("ShrimpFile.asset"); shrimpTerminalKeyword = Bundle.LoadAsset<TerminalKeyword>("shrimpTK.asset"); if (!setKorean) { shrimpTerminalNode.displayText = "Shrimp\r\n\r\nSigurd’s Danger Level: 60%\r\n\r\n\nScientific name: Canispiritus-Artemus\r\n\r\nShrimps are dog-like creatures, known to be the first tenant of the Upturned Inn. For the most part, he is relatively friendly to humans, following them around, curiously stalking them. Unfortunately, their passive temperament comes with a dangerously vicious hunger.\r\nDue to the nature of their biology, he has a much more unique stomach organ than most other creatures. The stomach lining is flexible, yet hardy, allowing a Shrimp to digest and absorb the nutrients from anything, biological or not, so long as it isn’t too large.\r\n\r\nHowever, this evolutionary adaptation was most likely a result of their naturally rapid metabolism. He uses nutrients so quickly that he needs to eat multiple meals a day to survive. The time between these meals are inconsistent, as the rate of caloric consumption is variable. This can range from hours to even minutes and causes the shrimp to behave monstrously if he has not eaten for a while.\r\n\r\nKnown to live in abandoned buildings, shrimp can often be seen in large abandoned factories or offices scavenging for scrap metal, to eat. That isn’t to say he can’t be found elsewhere. He is usually a lone hunters and expert trackers out of necessity.\r\n\r\nSigurd’s Note:\r\nIf this guy spots you, you’ll want to drop something you’re holding and let him eat it. It’s either you or that piece of scrap on you.\r\n\r\nit’s best to avoid letting him spot you. I swear… it’s almost like his eyes are staring into your soul.\r\nI never want to see one of these guys behind me again.\r\n\r\n\r\nIK: <i>Sir, don't be sad! Shrimp didn't hate you.\r\nhe was just... hungry.</i>\r\n\r\n"; shrimpTerminalNode.creatureName = "Shrimp"; shrimpTerminalKeyword.word = "shrimp"; } else { shrimpTerminalNode.displayText = "쉬림프\r\n\r\n시구르드의 위험 수준: 60%\r\n\r\n\n학명: 카니스피리투스-아르테무스\r\n\r\n쉬림프는 개를 닮은 생명체로 Upturned Inn의 첫 번째 세입자로 알려져 있습니다. 평소에는 상대적으로 우호적이며, 호기심을 가지고 인간을 따라다닙니다. 불행하게도 그는 위험할 정도로 굉장한 식욕을 가지고 있습니다.\r\n생물학적 특성으로 인해, 그는 대부분의 다른 생물보다 훨씬 더 독특한 위장 기관을 가지고 있습니다. 위 내막은 유연하면서도 견고하기 때문에 어떤 물체라도 영양분을 소화하고 흡수할 수 있습니다.\r\n그러나 이러한 진화적 적응은 자연적으로 빠른 신진대사의 결과일 가능성이 높습니다. 그는 영양분을 너무 빨리 사용하기 때문에 생존하려면 하루에 여러 끼를 먹어야 합니다.\r\n칼로리 소비율이 다양하기 때문에 식사 사이의 시간이 일정하지 않습니다. 이는 몇 시간에서 몇 분까지 지속될 수 있으며, 쉬림프가 오랫동안 무언가를 먹지 않으면 매우 포악해지며 따라다니던 사람을 쫒습니다.\r\n\r\n버려진 건물에 사는 것으로 알려진 쉬림프는 버려진 공장이나 사무실에서 폐철물을 찾아다니는 것으로 발견할 수 있습니다. 그렇다고 다른 곳에서 그를 찾을 수 없다는 말은 아닙니다. 그는 일반적으로 고독한 사냥꾼이며, 때로는 전문적인 추적자가 되기도 합니다.\r\n\r\n시구르드의 노트: 이 녀석이 으르렁거리는 소리를 듣게 된다면, 먹이를 줄 수 있는 무언가를 가지고 있기를 바라세요. 아니면 당신이 이 녀석의 식사가 될 거예요.\r\n맹세컨대... 마치 당신의 영혼을 들여다보는 것 같아요. 다시는 내 뒤에서 이 녀석을 보고 싶지 않아요.\r\n\r\n\r\nIK: <i>손님, 슬퍼하지 마세요! 쉬림프는 당신을 싫어하지 않는답니다.\r\n걔는 그냥... 배고플 뿐이에요.</i>\r\n\r\n"; shrimpTerminalNode.creatureName = "쉬림프"; shrimpTerminalKeyword.word = "쉬림프"; } NetworkPrefabs.RegisterNetworkPrefab(shrimpPrefab); NetworkPrefabs.RegisterNetworkPrefab(storagePrefab); NetworkPrefabs.RegisterNetworkPrefab(socketInteractPrefab); int[] array3 = shrimpSpawnWeight.Value.Split(new char[1] { ',' }).Select(int.Parse).ToArray(); Enemies.RegisterEnemy(shrimpEnemy, array3[0], (LevelTypes)4, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in ExperimentationLevel: " + array3[0])); Enemies.RegisterEnemy(shrimpEnemy, array3[1], (LevelTypes)8, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in AssuranceLevel: " + array3[1])); Enemies.RegisterEnemy(shrimpEnemy, array3[2], (LevelTypes)16, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in VowLevel: " + array3[2])); Enemies.RegisterEnemy(shrimpEnemy, array3[3], (LevelTypes)64, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in MarchLevel: " + array3[3])); Enemies.RegisterEnemy(shrimpEnemy, array3[4], (LevelTypes)32, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in OffenseLevel: " + array3[4])); Enemies.RegisterEnemy(shrimpEnemy, array3[5], (LevelTypes)128, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in RendLevel: " + array3[5])); Enemies.RegisterEnemy(shrimpEnemy, array3[6], (LevelTypes)256, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in DineLevel: " + array3[6])); Enemies.RegisterEnemy(shrimpEnemy, array3[7], (LevelTypes)512, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in TitanLevel: " + array3[7])); Enemies.RegisterEnemy(shrimpEnemy, shrimpModdedSpawnWeight.Value, (LevelTypes)1024, (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword); mls.LogInfo((object)("Shrimp spawn chance in Modded Moons: " + shrimpModdedSpawnWeight.Value)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[LC_Office] Successfully loaded assets!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(PlaceLung)); socketInteractPrefab.AddComponent<PlaceLung>(); } } } namespace LCOffice.Patches { public class PlaceLung : NetworkBehaviour { public static LethalNetworkVariable<bool> lungPlacedThisFrame = new LethalNetworkVariable<bool>("lungPlacedThisFrame"); public static LethalNetworkVariable<bool> placeLungNetwork = new LethalNetworkVariable<bool>("placeLung"); public static LethalNetworkVariable<ulong> lungPlacer = new LethalNetworkVariable<ulong>("Installer"); [PublicNetworkVariable] public static LethalNetworkVariable<GameObject> placedLung = new LethalNetworkVariable<GameObject>("placedLung"); public LethalClientEvent onLungPlace = new LethalClientEvent("onLungPlace", (Action)null, (Action<ulong>)null); public LethalClientMessage<bool> onLungPlaced = new LethalClientMessage<bool>("onLungPlaced", (Action<bool>)null, (Action<bool, ulong>)null); public LethalClientMessage<bool> onLungRemoved = new LethalClientMessage<bool>("onLungRemoved", (Action<bool>)null, (Action<bool, ulong>)null); public bool isPlaceCalled; public bool isOtherClientPlaceChecked; public bool isOtherClientRemoveChecked; public static bool lungPlaced; public static bool lungPlacedLocalFrame; public static bool emergencyPowerRequires; public static bool emergencyCheck; public bool isSetupEnd; public static ElevatorSystem elevatorSystem; public static Animator socketLED; public static AudioSource socketAudioSource; public static InteractTrigger socketInteractTrigger; public static Transform lungPos; public static Transform lungSocket; public static Transform lungParent; public static Animator lungParentAnimator; public static AudioSource elevatorMusic; public static AudioSource elevatorSound; public static Animator elevatorAnimator; public static List<InteractTrigger> upButtons = new List<InteractTrigger>(); public static List<InteractTrigger> downButtons = new List<InteractTrigger>(); public LungProp lungComponent; public bool isForceMoving; public BoxCollider boxCollider; public List<Light> elevatorLights = new List<Light>(); private void Start() { lungPlacedThisFrame.Value = false; placeLungNetwork.Value = false; lungPlacer.Value = 0uL; placedLung.Value = null; } private void LateUpdate() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (!RoundMapSystem.Instance.isOffice) { return; } Setup(); ((Component)this).transform.position = lungPos.position; ((Component)this).transform.rotation = lungPos.rotation; if (emergencyCheck && !emergencyPowerRequires && !lungPlaced && !ElevatorSystem.isElevatorDowned.Value) { elevatorSystem.ElevatorDownTrigger(StartOfRound.Instance.localPlayerController); } if (emergencyCheck && !emergencyPowerRequires) { ElevatorSystem.isElevatorClosed.Value = false; elevatorMusic.pitch = Mathf.Lerp(elevatorMusic.pitch, 0f, Time.deltaTime * 2.5f); AnimatorStateInfo currentAnimatorStateInfo = elevatorSystem.doorAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 1f && elevatorSystem.doorAnimator.GetBool("closed")) { currentAnimatorStateInfo = elevatorSystem.animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 1f && elevatorSystem.animator.GetBool("goDown") && ((Component)elevatorAnimator).gameObject.transform.localPosition.y <= -9.6998f) { emergencyPowerRequires = true; emergencyCheck = false; } } } if (lungPlaced) { lungComponent = placedLung.Value.GetComponent<LungProp>(); boxCollider.size = new Vector3(0f, 0f, 0f); placedLung.Value.transform.SetParent(lungParent); placedLung.Value.transform.localPosition = new Vector3(0f, 0f, 0f); placedLung.Value.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); if (lungPlacedLocalFrame && emergencyPowerRequires) { foreach (InteractTrigger upButton in upButtons) { ((UnityEvent<PlayerControllerB>)(object)upButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorUpTrigger); } foreach (InteractTrigger downButton in downButtons) { ((UnityEvent<PlayerControllerB>)(object)downButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorDownTrigger); } lungPlacedLocalFrame = false; } } else { if (emergencyPowerRequires) { foreach (InteractTrigger upButton2 in upButtons) { ((UnityEventBase)upButton2.onInteract).RemoveAllListeners(); } foreach (InteractTrigger downButton2 in downButtons) { ((UnityEventBase)downButton2.onInteract).RemoveAllListeners(); } } lungPlacedLocalFrame = true; boxCollider.size = new Vector3(2f, 1.6f, 2f); lungComponent = null; } CheckPlayerHoldingLung(); if (lungPlaced) { RemoveLung(); } if (lungPlacedThisFrame.Value) { LungPlacement(); } if (isOtherClientPlaceChecked) { OnLungPlacedThisFrameOtherClient(); } if (isOtherClientRemoveChecked) { RemoveLungOtherClient(); } if (emergencyPowerRequires) { if (lungPlaced) { elevatorAnimator.SetFloat("speed", Mathf.Lerp(elevatorAnimator.GetFloat("speed"), 1f, Time.deltaTime * 3f)); elevatorSystem.doorAnimator.SetFloat("speed", elevatorAnimator.GetFloat("speed")); elevatorSound.pitch = Mathf.Lerp(elevatorMusic.pitch, 1f, Time.deltaTime * 3f); elevatorMusic.pitch = Mathf.Lerp(elevatorMusic.pitch, 1f, Time.deltaTime * 3.5f); } else { elevatorAnimator.SetFloat("speed", Mathf.Lerp(elevatorAnimator.GetFloat("speed"), 0f, Time.deltaTime * 3f)); elevatorSystem.doorAnimator.SetFloat("speed", elevatorAnimator.GetFloat("speed")); elevatorSound.pitch = Mathf.Lerp(elevatorMusic.pitch, 0f, Time.deltaTime * 3f); elevatorMusic.pitch = Mathf.Lerp(elevatorMusic.pitch, 0f, Time.deltaTime * 2.5f); } } else { elevatorAnimator.SetFloat("speed", Mathf.Lerp(elevatorAnimator.GetFloat("speed"), 1f, Time.deltaTime * 3f)); elevatorSystem.doorAnimator.SetFloat("speed", elevatorAnimator.GetFloat("speed")); elevatorSound.pitch = Mathf.Lerp(elevatorMusic.pitch, 1f, Time.deltaTime * 3f); elevatorMusic.pitch = Mathf.Lerp(elevatorMusic.pitch, 1f, Time.deltaTime * 3.5f); } } private void Setup() { if (isSetupEnd) { return; } elevatorSystem = Object.FindObjectOfType<ElevatorSystem>(); socketAudioSource = ((Component)this).GetComponent<AudioSource>(); socketInteractTrigger = ((Component)this).GetComponent<InteractTrigger>(); ((UnityEvent<PlayerControllerB>)(object)socketInteractTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)PlaceApparatus); socketLED = GameObject.Find("SocketLED").GetComponent<Animator>(); boxCollider = ((Component)this).GetComponent<BoxCollider>(); lungPos = GameObject.Find("LungPos").transform; lungSocket = GameObject.Find("LungSocket").transform; elevatorMusic = GameObject.Find("ElevatorMusic").GetComponent<AudioSource>(); elevatorSound = GameObject.Find("ElevatorSound").GetComponent<AudioSource>(); elevatorAnimator = Object.FindObjectOfType<ElevatorSystem>().animator; elevatorLights.Add(GameObject.Find("ElevatorLight1").GetComponent<Light>()); elevatorLights.Add(GameObject.Find("ElevatorLight2").GetComponent<Light>()); lungParent = GameObject.Find("LungParent").transform; lungParentAnimator = ((Component)lungParent).GetComponent<Animator>(); foreach (Animator panelAnimator in elevatorSystem.panelAnimators) { upButtons.Add(((Component)((Component)panelAnimator).transform.GetChild(1).GetChild(0)).GetComponent<InteractTrigger>()); downButtons.Add(((Component)((Component)panelAnimator).transform.GetChild(2).GetChild(0)).GetComponent<InteractTrigger>()); } lungPlacedThisFrame.Value = false; placeLungNetwork.Value = false; lungPlacer.Value = 0uL; placedLung.Value = null; isSetupEnd = true; } private void CheckPlayerHoldingLung() { if (StartOfRound.Instance.localPlayerController.isHoldingObject) { if ((Object)(object)((Component)StartOfRound.Instance.localPlayerController.currentlyGrabbingObject).GetComponent<LungProp>() != (Object)null) { socketInteractTrigger.interactable = true; } else { socketInteractTrigger.interactable = false; } } else { socketInteractTrigger.interactable = false; } } private void LungPlacement() { //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) onLungPlaced.OnReceivedFromClient += OnLungPlacedThisFrame; Plugin.mls.LogInfo((object)"lungPlacedThisFrame.Value is true"); if (isPlaceCalled) { return; } PlayerControllerB playerController = LethalNetworkExtensions.GetPlayerController(lungPlacer.Value); socketLED.SetBool("warning", false); Plugin.mls.LogInfo((object)"lungPlacedThisFrame is enabled"); placedLung.Value = ((Component)playerController.currentlyGrabbingObject).gameObject; socketAudioSource.PlayOneShot(((Component)playerController.currentlyGrabbingObject).GetComponent<LungProp>().connectSFX); if (emergencyPowerRequires) { foreach (Light elevatorLight in elevatorLights) { ((Behaviour)elevatorLight).enabled = true; } foreach (InteractTrigger upButton in upButtons) { ((UnityEvent<PlayerControllerB>)(object)upButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorUpTrigger); } foreach (InteractTrigger downButton in downButtons) { ((UnityEvent<PlayerControllerB>)(object)downButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorDownTrigger); } } playerController.DiscardHeldObject(true, ((NetworkBehaviour)this).NetworkObject, ((Component)this).transform.position, true); lungPlaced = true; lungComponent = placedLung.Value.GetComponent<LungProp>(); placedLung.Value.transform.SetParent(lungParent); placedLung.Value.transform.localPosition = new Vector3(0f, 0f, 0f); placedLung.Value.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); isPlaceCalled = true; lungParentAnimator.SetTrigger("LungPlaced"); if (!LethalNetworkExtensions.GetPlayerController(lungPlacer.Value).isCameraDisabled) { onLungPlaced.SendAllClients(true, false, false); } lungPlacedThisFrame.Value = false; } private void OnLungPlacedThisFrame(bool value, ulong id) { if (isOtherClientPlaceChecked != value) { isOtherClientPlaceChecked = value; } } private void OnLungPlacedThisFrameOtherClient() { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if (isPlaceCalled) { return; } PlayerControllerB playerController = LethalNetworkExtensions.GetPlayerController(lungPlacer.Value); socketLED.SetBool("warning", false); Plugin.mls.LogInfo((object)"lungPlacedThisFrame is enabled"); socketAudioSource.PlayOneShot(placedLung.Value.GetComponent<LungProp>().connectSFX); if (emergencyPowerRequires) { foreach (Light elevatorLight in elevatorLights) { ((Behaviour)elevatorLight).enabled = true; } foreach (InteractTrigger upButton in upButtons) { ((UnityEvent<PlayerControllerB>)(object)upButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorUpTrigger); } foreach (InteractTrigger downButton in downButtons) { ((UnityEvent<PlayerControllerB>)(object)downButton.onInteract).AddListener((UnityAction<PlayerControllerB>)elevatorSystem.ElevatorDownTrigger); } } lungPlaced = true; lungComponent = placedLung.Value.GetComponent<LungProp>(); placedLung.Value.transform.SetParent(lungParent); placedLung.Value.transform.localPosition = new Vector3(0f, 0f, 0f); placedLung.Value.transform.localRotation = Quaternion.Euler(0f, 90f, 0f); boxCollider.size = new Vector3(0f, 0f, 0f); lungPlacedThisFrame.Value = false; isPlaceCalled = true; lungParentAnimator.SetTrigger("LungPlaced"); isOtherClientPlaceChecked = false; } private void PlaceApparatus(PlayerControllerB playerControllerB) { Plugin.mls.LogInfo((object)("PlaceApparatus triggered by " + ((Object)((Component)playerControllerB).gameObject).name)); if ((Object)(object)((Component)playerControllerB.currentlyGrabbingObject).GetComponent<LungProp>() != (Object)null && playerControllerB.isHoldingObject) { Plugin.mls.LogInfo((object)(((Object)((Component)playerControllerB).gameObject).name + " is placed LungProp")); lungPlacedThisFrame.Value = true; lungPlacer.Value = playerControllerB.actualClientId; } } private void RemoveLung() { onLungRemoved.OnReceivedFromClient += OnLungRemovedThisFrame; if (!((GrabbableObject)lungComponent).isHeld) { return; } foreach (Light elevatorLight in elevatorLights) { ((Behaviour)elevatorLight).enabled = false; } socketLED.SetBool("warning", true); if (emergencyPowerRequires) { foreach (InteractTrigger upButton in upButtons) { ((UnityEventBase)upButton.onInteract).RemoveAllListeners(); } foreach (InteractTrigger downButton in downButtons) { ((UnityEventBase)downButton.onInteract).RemoveAllListeners(); } } socketAudioSource.PlayOneShot(placedLung.Value.GetComponent<LungProp>().disconnectSFX); lungPlaced = false; isPlaceCalled = false; onLungRemoved.SendAllClients(true, false, false); } private void OnLungRemovedThisFrame(bool value, ulong id) { if (isOtherClientRemoveChecked != value) { isOtherClientRemoveChecked = value; } } private void RemoveLungOtherClient() { if (!lungPlaced || !((GrabbableObject)lungComponent).isHeld) { return; } foreach (Light elevatorLight in elevatorLights) { ((Behaviour)elevatorLight).enabled = false; } socketLED.SetBool("warning", true); if (emergencyPowerRequires) { foreach (InteractTrigger upButton in upButtons) { ((UnityEventBase)upButton.onInteract).RemoveAllListeners(); } foreach (InteractTrigger downButton in downButtons) { ((UnityEventBase)downButton.onInteract).RemoveAllListeners(); } } socketAudioSource.PlayOneShot(placedLung.Value.GetComponent<LungProp>().disconnectSFX); lungPlaced = false; isPlaceCalled = false; } private IEnumerator LightFlickerOn() { using List<Light>.Enumerator enumerator = elevatorLights.GetEnumerator(); if (enumerator.MoveNext()) { Light elevatorLight = enumerator.Current; ((Behaviour)elevatorLight).enabled = true; yield return (object)new WaitForSeconds(0.05f); ((Behaviour)elevatorLight).enabled = false; yield return (object)new WaitForSeconds(0.05f); ((Behaviour)elevatorLight).enabled = true; yield return (object)new WaitForSeconds(0.05f); ((Behaviour)elevatorLight).enabled = false; yield return (object)new WaitForSeconds(0.05f); ((Behaviour)elevatorLight).enabled = true; yield return (object)new WaitForSeconds(2f); yield break; } } [HarmonyPatch(typeof(LungProp))] [HarmonyPrefix] [HarmonyPatch("EquipItem")] private static void EquipItem_Patch(ref bool ___isLungDocked) { if (!___isLungDocked || !RoundMapSystem.Instance.isOffice) { return; } Animator component = GameObject.Find("SocketLED").GetComponent<Animator>(); component.SetBool("on", true); ElevatorSystem elevatorSystem = Object.FindObjectOfType<ElevatorSystem>(); PlaceLung placeLung = Object.FindObjectOfType<PlaceLung>(); foreach (Animator panelAnimator in elevatorSystem.panelAnimators) { ((UnityEventBase)((Component)((Component)panelAnimator).transform.GetChild(1).GetChild(0)).GetComponent<InteractTrigger>().onInteract).RemoveAllListeners(); ((UnityEventBase)((Component)((Component)panelAnimator).transform.GetChild(2).GetChild(0)).GetComponent<InteractTrigger>().onInteract).RemoveAllListeners(); if (!lungPlaced) { ((Behaviour)GameObject.Find("ElevatorLight1").GetComponent<Light>()).enabled = false; ((Behaviour)GameObject.Find("ElevatorLight2").GetComponent<Light>()).enabled = false; } component.SetBool("warning", true); emergencyCheck = true; } } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch("Disconnect")] private static void Disconnect_Prefix() { } } public class RoundMapSystem : NetworkBehaviour { public bool isOffice; public bool isChecked; public bool isDungeonOfficeChecked; public static RoundMapSystem Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; return; } Object.Destroy((Object)(object)((Component)Instance).gameObject); Instance = this; } private void LateUpdate() { if (!isChecked && !StartOfRound.Instance.inShipPhase && (!((Object)(object)GameObject.Find("IndustrialFan") == (Object)null) || !((Object)(object)GameObject.Find("ManorStartRoom") == (Object)null))) { if ((Object)(object)GameObject.Find("IndustrialFan") != (Object)null && (Object)(object)GameObject.Find("ElevatorScreenDoor") != (Object)null) { isOffice = true; Plugin.mls.LogInfo((object)"isOffice true"); } else { isOffice = false; Plugin.mls.LogInfo((object)"isOffice false"); } if (!isDungeonOfficeChecked) { ((MonoBehaviour)this).StartCoroutine(CheckOfficeElevator()); } isDungeonOfficeChecked = true; } } private IEnumerator CheckOfficeElevator() { yield return (object)new WaitForSeconds(2f); isChecked = true; } } public class ShrimpCollider : MonoBehaviour, IHittable { public ShrimpAI shrimpAI; private void Start() { shrimpAI = ((Component)((Component)this).transform.parent).GetComponent<ShrimpAI>(); } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX = false) { if (ShrimpAI.hungerValue.Value < 55f && shrimpAI.scaredBackingAway <= 0f) { ShrimpAI.isHitted.Value = true; } return true; } } public class ShrimpAI : EnemyAI { public float networkPosDistance; public Vector3 prevPosition; public float stuckDetectionTimer; public float prevPositionDistance; public AISearchRoutine roamMap = new AISearchRoutine(); private Vector3 spawnPosition; public PlayerControllerB hittedPlayer; public static LethalNetworkVariable<bool> KillingPlayerBool = new LethalNetworkVariable<bool>("KillingPlayerBool"); public static LethalNetworkVariable<int> SelectNode = new LethalNetworkVariable<int>("SelectNode"); public static LethalNetworkVariable<float> shrimpVelocity = new LethalNetworkVariable<float>("shrimpVelocity"); public static LethalNetworkVariable<float> hungerValue = new LethalNetworkVariable<float>("hungerValue"); public static LethalNetworkVariable<bool> isHitted = new LethalNetworkVariable<bool>("isHitted"); public static LethalNetworkVariable<Vector3> networkPosition = new LethalNetworkVariable<Vector3>("networkPosition"); public static LethalNetworkVariable<Vector3> networkRotation = new LethalNetworkVariable<Vector3>("networkRotation"); public static LethalNetworkVariable<PlayerControllerB> networkTargetPlayer = new LethalNetworkVariable<PlayerControllerB>("networkTargetPlayer"); public bool isKillingPlayer; public bool isSeenPlayer; public bool isEnraging; public bool isAngered; public bool canBeMoved; public bool isRunning; public bool dogRandomWalk; public float footStepTime; public float randomVal; public bool isTargetAvailable; public float networkTargetPlayerDistance; public float nearestItemDistance; public bool isNearestItem; public List<GameObject> droppedItems = new List<GameObject>(); public GameObject nearestDroppedItem; public Transform dogHead; public Ray lookRay; public Transform lookTarget; public BoxCollider[] allBoxCollider; public Transform IdleTarget; public bool isIdleTargetAvailable; public bool forceChangeTarget; public Rig lookRig; public Light lungLight; public bool ateLung; public bool isSatisfied; public float satisfyValue; public Transform leftEye; public Transform rightEye; public Transform shrimpEye; public Transform mouth; public GameObject shrimpKillTrigger; public Transform bittenObjectHolder; public float searchingForObjectTimer; private Vector3 scaleOfEyesNormally; public AudioSource mainAudio; public AudioSource voiceAudio; public AudioSource voice2Audio; public AudioSource dogMusic; public AudioSource sprintAudio; public Vector3 originalMouthScale; public float scaredBackingAway; public Ray backAwayRay; private RaycastHit hitInfo; private RaycastHit hitInfoB; public float followTimer; public EnemyBehaviourState roamingState; public EnemyBehaviourState followingPlayer; public EnemyBehaviourState enragedState; public List<EnemyBehaviourState> tempEnemyBehaviourStates; public List<SkinnedMeshRenderer> skinnedMeshRendererList; public List<MeshRenderer> meshRendererList; private void Awake() { base.agent = ((Component)this).GetComponent<NavMeshAgent>(); } public override void Start() { //IL_00ad: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown KillingPlayerBool.Value = false; SelectNode.Value = 0; shrimpVelocity.Value = 0f; hungerValue.Value = 0f; isHitted.Value = false; networkTargetPlayer.Value = null; ((Component)((Component)this).transform.GetChild(0)).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)this; base.enemyType = Plugin.shrimpEnemy; base.skinnedMeshRenderers = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); base.meshRenderers = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>(); base.thisNetworkObject = ((Component)this).gameObject.GetComponentInChildren<NetworkObject>(); base.serverPosition = ((Component)this).transform.position; base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene; RoundManager instance = RoundManager.Instance; instance.numberOfEnemiesInScene++; base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); base.path1 = new NavMeshPath(); mouth = GameObject.Find("ShrimpMouth").transform; leftEye = GameObject.Find("ShrimpLeftEye").transform; rightEye = GameObject.Find("ShrimpRightEye").transform; shrimpKillTrigger = GameObject.Find("ShrimpKillTrigger"); base.creatureAnimator = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).gameObject.GetComponent<Animator>(); base.creatureAnimator.SetTrigger("Walk"); mainAudio = GameObject.Find("ShrimpMainAudio").GetComponent<AudioSource>(); voiceAudio = GameObject.Find("ShrimpGrowlAudio").GetComponent<AudioSource>(); voice2Audio = GameObject.Find("ShrimpAngerAudio").GetComponent<AudioSource>(); lookRig = GameObject.Find("ShrimpLookAtPlayer").GetComponent<Rig>(); lungLight = GameObject.Find("LungFlash").GetComponent<Light>(); lungLight.intensity = 0f; AudioSource[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<AudioSource>(); AudioSource[] array = componentsInChildren; foreach (AudioSource val in array) { val.outputAudioMixerGroup = GameObject.Find("StatusEffectAudio").GetComponent<AudioSource>().outputAudioMixerGroup; } lookTarget = GameObject.Find("Shrimp_Look_target").transform; dogHead = GameObject.Find("ShrimpLookPoint").transform; bittenObjectHolder = GameObject.Find("BittenObjectHolder").transform; shrimpEye = GameObject.Find("ShrimpEye").transform; scaleOfEyesNormally = leftEye.localScale; originalMouthScale = mouth.localScale; voice2Audio.clip = Plugin.dogSprint; voice2Audio.Play(); base.creatureVoice = voice2Audio; base.creatureSFX = voice2Audio; base.eye = shrimpEye; SetupBehaviour(); tempEnemyBehaviourStates.Add(roamingState); tempEnemyBehaviourStates.Add(followingPlayer); tempEnemyBehaviourStates.Add(enragedState); base.enemyBehaviourStates = tempEnemyBehaviourStates.ToArray(); spawnPosition = ((Component)this).transform.position; roamMap = new AISearchRoutine(); ItemElevatorCheck[] array2 = Object.FindObjectsOfType<ItemElevatorCheck>(); ItemElevatorCheck[] array3 = array2; foreach (ItemElevatorCheck itemElevatorCheck in array3) { itemElevatorCheck.shrimpAI = this; } if (Plugin.setKorean) { ((Component)((Component)this).transform.GetChild(1)).GetComponent<ScanNodeProperties>().headerText = "쉬림프"; } } public IEnumerator stunnedTimer(PlayerControllerB playerWhoHit) { isHitted.Value = false; hittedPlayer = playerWhoHit; base.agent.speed = 0f; base.creatureAnimator.SetTrigger("Recoil"); mainAudio.PlayOneShot(Plugin.cry1, 1f); yield return (object)new WaitForSeconds(0.5f); scaredBackingAway = 3f; yield return (object)new WaitForSeconds(2f); hittedPlayer = null; } private void StunTest() { //IL_0064: 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) if (scaredBackingAway > 0f) { if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { lookRig.weight = Mathf.Lerp(lookRig.weight, 0f, Time.deltaTime); base.agent.SetDestination(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false).position); } base.creatureAnimator.SetFloat("walkSpeed", -3.5f); scaredBackingAway -= Time.deltaTime; } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, false); if (hungerValue.Value < 60f && scaredBackingAway <= 0f) { isHitted.Value = true; } } public void FootStepSound() { randomVal = Random.Range(0, 20); if (randomVal < 5f) { mainAudio.PlayOneShot(Plugin.footstep1, Random.Range(0.8f, 1f)); } else if (randomVal < 10f) { mainAudio.PlayOneShot(Plugin.footstep2, Random.Range(0.8f, 1f)); } else if (randomVal < 15f) { mainAudio.PlayOneShot(Plugin.footstep3, Random.Range(0.8f, 1f)); } else if (randomVal < 20f) { mainAudio.PlayOneShot(Plugin.footstep4, Random.Range(0.8f, 1f)); } } private IEnumerator DogSatisfied() { yield return (object)new WaitForSeconds(2f); canBeMoved = true; networkTargetPlayer.Value = null; } public override void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_07c1: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) if (!isSatisfied) { CheckPlayer(); } if ((Object)(object)networkTargetPlayer.Value != (Object)null) { GameObject[] allPlayerObjects = StartOfRound.Instance.allPlayerObjects; foreach (GameObject val in allPlayerObjects) { float num = Vector3.Distance(((Component)this).transform.position, val.transform.position); if (num < float.PositiveInfinity && num > 80f) { networkTargetPlayer.Value = null; } } } base.targetPlayer = networkTargetPlayer.Value; SetByHunger(); EatItem(); CheckTargetAvailable(); if (isHitted.Value) { ((MonoBehaviour)this).StartCoroutine(stunnedTimer(base.targetPlayer)); } if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } else { ((EnemyAI)this).SetClientCalculatingAI(false); } if (ateLung) { lungLight.intensity = Mathf.Lerp(lungLight.intensity, 1500f, Time.deltaTime * 10f); } if (satisfyValue >= 21f && !isSatisfied) { canBeMoved = false; ((MonoBehaviour)this).StartCoroutine(DogSatisfied()); mainAudio.PlayOneShot(Plugin.dogSneeze); isSatisfied = true; } if (isSatisfied && satisfyValue > 0f) { satisfyValue -= Time.deltaTime; isSeenPlayer = false; } if (satisfyValue <= 0f && isSatisfied) { isSatisfied = false; satisfyValue = 0f; } if ((Object)(object)base.targetPlayer == (Object)null && !isNearestItem && (Object)(object)base.targetNode == (Object)null) { int num2 = Random.Range(1, base.allAINodes.Length); if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num2].transform.position) > 5f && SelectNode.Value != num2 && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsOwner) { SelectNode.Value = num2; } } if (stuckDetectionTimer > 3.5f) { int num3 = Random.Range(1, base.allAINodes.Length); if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f && SelectNode.Value != num3) { if (((NetworkBehaviour)this).IsOwner) { SelectNode.Value = num3; } stuckDetectionTimer = 0f; } else if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f) { stuckDetectionTimer = 0f; } } Vector3 velocity; if (((Object)(object)base.targetPlayer == (Object)null && !isNearestItem) || isSatisfied) { lookRig.weight = Mathf.Lerp(lookRig.weight, 0f, Time.deltaTime); if ((Object)(object)base.targetNode != (Object)null) { if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(base.targetNode.position); } if (shrimpVelocity.Value < 0.5f) { stuckDetectionTimer += Time.deltaTime; } else { stuckDetectionTimer = 0f; } float num4 = 30f; Vector3 val2 = ((Component)this).transform.position - prevPosition; velocity = base.agent.velocity; float num5 = Vector3.Angle(val2, ((Vector3)(ref velocity)).normalized); if (num5 > num4) { Plugin.mls.LogInfo((object)("각도 차이가 " + num5 + "이며, " + num4 + " 이상 차이납니다.")); } prevPosition = ((Component)this).transform.position; } } base.targetNode = base.allAINodes[SelectNode.Value].transform; if ((Object)(object)base.targetPlayer != (Object)null || isNearestItem) { dogRandomWalk = false; stuckDetectionTimer = 0f; } Quaternion rotation; if (((NetworkBehaviour)this).IsOwner) { networkPosition.Value = ((Component)this).transform.position; LethalNetworkVariable<Vector3> obj = networkRotation; rotation = ((Component)this).transform.rotation; obj.Value = ((Quaternion)(ref rotation)).eulerAngles; LethalNetworkVariable<float> obj2 = shrimpVelocity; velocity = base.agent.velocity; obj2.Value = ((Vector3)(ref velocity)).sqrMagnitude; } else { networkPosDistance = Vector3.Distance(((Component)this).transform.position, networkPosition.Value); if (networkPosDistance > 3f) { ((Component)this).transform.position = networkPosition.Value; Plugin.mls.LogWarning((object)"Force the shrimp to change position."); } else { ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, networkPosition.Value, Time.deltaTime * 10f); } Transform transform = ((Component)this).transform; rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(Vector3.Lerp(((Quaternion)(ref rotation)).eulerAngles, networkRotation.Value, Time.deltaTime * 10f)); if (networkPosDistance > 15f) { Plugin.mls.LogFatal((object)"Shrimp spawned successfully, but its current position is VERY different from the network position. This error is usually caused by low network quality or high traffic on the server."); } } if ((Object)(object)base.targetPlayer != (Object)null) { isTargetAvailable = true; } if ((Object)(object)base.targetPlayer != (Object)null) { if (hungerValue.Value < 55f) { leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); } else if (hungerValue.Value > 55f) { leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime); rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime); } } else { leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime); } base.creatureAnimator.SetBool("DogRandomWalk", dogRandomWalk); if (canBeMoved && !isRunning) { base.creatureAnimator.SetBool("Running", false); base.agent.speed = 5.5f; base.agent.acceleration = 7f; base.agent.angularSpeed = 150f; } else if (!canBeMoved && !isRunning) { base.creatureAnimator.SetBool("Running", false); base.agent.speed = 0f; base.agent.angularSpeed = 0f; } if (isRunning) { base.creatureAnimator.SetBool("Running", true); base.agent.speed = Mathf.Lerp(base.agent.speed, 15f, Time.deltaTime * 2f); base.agent.angularSpeed = 10000f; base.agent.acceleration = 50f; } StunTest(); } private IEnumerator SyncRotation() { Transform transform = ((Component)this).transform; Quaternion rotation = ((Component)this).transform.rotation; transform.rotation = Quaternion.Euler(Vector3.Lerp(((Quaternion)(ref rotation)).eulerAngles, networkRotation.Value, Time.deltaTime * 10f)); yield return (object)new WaitForSeconds(1f); } private float CalculateRotationDifference(Vector3 rotation1, Vector3 rotation2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_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_000f: 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) Quaternion val = Quaternion.Euler(rotation1); Quaternion val2 = Quaternion.Euler(rotation2); return Quaternion.Angle(val, val2); } private void CheckPlayer() { //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: 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) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(40f, 40, -1); if ((Object)(object)val != (Object)null && (Object)(object)base.targetPlayer == (Object)null && !isKillingPlayer) { if (!isSeenPlayer) { mainAudio.PlayOneShot(Plugin.dogHowl); base.creatureAnimator.SetTrigger("Walk"); isSeenPlayer = true; } networkTargetPlayer.Value = val; } if (droppedItems.Count > 0 && (Object)(object)nearestDroppedItem == (Object)null) { FindNearestItem(); } footStepTime += Time.deltaTime * shrimpVelocity.Value / 8f; if ((double)footStepTime > 0.5) { FootStepSound(); footStepTime = 0f; } base.creatureAnimator.SetFloat("walkSpeed", Mathf.Clamp(shrimpVelocity.Value / 5f, 0f, 3f)); base.creatureAnimator.SetFloat("runSpeed", Mathf.Clamp(shrimpVelocity.Value / 2.7f, 3f, 4f)); if ((Object)(object)base.targetPlayer != (Object)null) { if (!isNearestItem && scaredBackingAway <= 0f) { if (hungerValue.Value > 55f) { lookRay = new Ray(dogHead.position, ((Component)base.targetPlayer).transform.position - dogHead.position); lookTarget.position = Vector3.Lerp(lookTarget.position, ((Ray)(ref lookRay)).GetPoint(3f), 30f * Time.deltaTime); } else { lookTarget.position = Vector3.Lerp(lookTarget.position, ((Component)base.targetPlayer.lowerSpine).transform.position, 6f * Time.deltaTime); } } base.agent.autoBraking = true; lookRig.weight = Mathf.Lerp(lookRig.weight, 0.5f, Time.deltaTime); dogRandomWalk = false; if (!isSeenPlayer) { mainAudio.PlayOneShot(Plugin.dogHowl, 1f); } isSeenPlayer = true; } if (!isRunning && !isNearestItem) { base.agent.stoppingDistance = 4.5f; lookRig.weight = Mathf.Lerp(lookRig.weight, 0f, Time.deltaTime); } else { base.agent.stoppingDistance = 0.5f; } if (!isNearestItem) { } } private void SetByHunger() { //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) if (hungerValue.Value < 66f) { if (isSeenPlayer && !isTargetAvailable && ((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj = hungerValue; obj.Value += Time.deltaTime * 0.09f; } else if (isSeenPlayer && isTargetAvailable && ((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj2 = hungerValue; obj2.Value += Time.deltaTime; } } if (hungerValue.Value > 55f && hungerValue.Value < 60f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 1f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); voiceAudio.loop = true; voiceAudio.clip = Plugin.stomachGrowl; if (!voiceAudio.isPlaying) { voiceAudio.Play(); } } else if (hungerValue.Value < 63f && hungerValue.Value >= 60f && !isEnraging) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0.8f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); isEnraging = true; voiceAudio.clip = Plugin.bigGrowl; if (!voiceAudio.isPlaying) { voiceAudio.Play(); } } else if (hungerValue.Value < 63f && hungerValue.Value > 60f && isEnraging) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 1f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 1f, 125f * Time.deltaTime); if (!isNearestItem) { canBeMoved = false; } } else if (hungerValue.Value < 55f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0f, 45f * Time.deltaTime); voiceAudio.volume = Mathf.Lerp(voiceAudio.volume, 0f, 125f * Time.deltaTime); } else if (hungerValue.Value > 63f && !isAngered) { if (!isNearestItem && !isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } voiceAudio.clip = Plugin.enragedScream; voiceAudio.Play(); isEnraging = false; isAngered = true; } else if (hungerValue.Value > 65f) { base.openDoorSpeedMultiplier = 1.5f; isRunning = true; voice2Audio.volume = Mathf.Lerp(voice2Audio.volume, 1f, 125f * Time.deltaTime); } else if (hungerValue.Value > 63f) { voiceAudio.pitch = Mathf.Lerp(voiceAudio.pitch, 0.8f, 45f * Time.deltaTime); mouth.localScale = Vector3.Lerp(mouth.localScale, new Vector3(0.005590725f, 0.01034348f, 0.02495567f), 30f * Time.deltaTime); } if (hungerValue.Value < 60f) { isEnraging = false; isAngered = false; if (!isNearestItem && !isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } } if (hungerValue.Value < 66f) { isRunning = false; base.openDoorSpeedMultiplier = 0.3f; } if (hungerValue.Value < 63f) { mouth.localScale = Vector3.Lerp(mouth.localScale, originalMouthScale, 20f * Time.deltaTime); voice2Audio.volume = Mathf.Lerp(voice2Audio.volume, 0f, 125f * Time.deltaTime); isRunning = false; } if (hungerValue.Value > 64f && networkTargetPlayerDistance < 3.5f && !isKillingPlayer && (Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isCameraDisabled) { KillingPlayerBool.Value = true; } if (KillingPlayerBool.Value) { if (!base.targetPlayer.isCameraDisabled) { Plugin.mls.LogInfo((object)("Shrimp: (Owner) Killing " + ((Object)base.targetPlayer).name + "!")); ((MonoBehaviour)this).StartCoroutine(KillPlayer(base.targetPlayer)); KillingPlayerBool.Value = false; } else if (base.targetPlayer.isCameraDisabled) { Plugin.mls.LogInfo((object)("Shrimp: (Not Owner) Killing " + ((Object)base.targetPlayer).name + "!")); ((MonoBehaviour)this).StartCoroutine(KillPlayerInOtherClient(base.targetPlayer)); KillingPlayerBool.Value = false; } } if (isKillingPlayer) { canBeMoved = false; } } private void EatItem() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0073: 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_007d: 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_0093: 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) //IL_00b3: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)nearestDroppedItem != (Object)null) { if (isNearestItem && !nearestDroppedItem.GetComponent<GrabbableObject>().isHeld) { if (hungerValue.Value < 55f) { lookRay = new Ray(dogHead.position, nearestDroppedItem.transform.position - dogHead.position); lookTarget.position = Vector3.Lerp(lookTarget.position, ((Ray)(ref lookRay)).GetPoint(1.8f), 6f * Time.deltaTime); } else { lookTarget.position = Vector3.Lerp(lookTarget.position, nearestDroppedItem.transform.position, 6f * Time.deltaTime); } if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(nearestDroppedItem.transform.position); } nearestItemDistance = Vector3.Distance(((Component)this).transform.position, nearestDroppedItem.transform.position); if (nearestItemDistance < 1.35f) { canBeMoved = false; isRunning = false; nearestDroppedItem.transform.SetParent(((Component)this).transform, true); if ((Object)(object)nearestDroppedItem.GetComponent<LungProp>() != (Object)null) { satisfyValue += 30f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj = hungerValue; obj.Value -= 50f; } ateLung = true; ((Behaviour)nearestDroppedItem.GetComponentInChildren<Light>()).enabled = false; } else if ((Object)(object)nearestDroppedItem.GetComponent<StunGrenadeItem>() != (Object)null) { StunGrenadeItem component = nearestDroppedItem.GetComponent<StunGrenadeItem>(); component.hasExploded = true; ((MonoBehaviour)this).StartCoroutine(EatenFlashbang()); } base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); isNearestItem = false; nearestItemDistance = 500f; if (nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight > 1f) { satisfyValue += Mathf.Clamp(nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight - 1f, 0f, 100f) * 150f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj2 = hungerValue; obj2.Value -= Mathf.Clamp(nearestDroppedItem.GetComponent<GrabbableObject>().itemProperties.weight - 1f, 0f, 100f) * 230f; } } else { satisfyValue += 6f; if (((NetworkBehaviour)this).IsOwner) { LethalNetworkVariable<float> obj3 = hungerValue; obj3.Value -= 12f; } } GrabbableObject component2 = nearestDroppedItem.GetComponent<GrabbableObject>(); component2.grabbable = false; component2.grabbableToEnemies = false; component2.deactivated = true; if ((Object)(object)component2.radarIcon != (Object)null) { Object.Destroy((Object)(object)((Component)component2.radarIcon).gameObject); } MeshRenderer[] componentsInChildren = ((Component)component2).gameObject.GetComponentsInChildren<MeshRenderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } Collider[] componentsInChildren2 = ((Component)component2).gameObject.GetComponentsInChildren<Collider>(); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.Destroy((Object)(object)componentsInChildren2[j]); } droppedItems.Remove(nearestDroppedItem); nearestDroppedItem = null; } else if (!isKillingPlayer && base.stunNormalizedTimer <= 0f) { canBeMoved = true; } } else if ((Object)(object)base.targetPlayer != (Object)null && !isSatisfied) { nearestDroppedItem = null; nearestItemDistance = 3000f; isNearestItem = false; } } if (base.stunNormalizedTimer > 0f) { canBeMoved = false; base.creatureAnimator.SetBool("Stun", true); } else { base.creatureAnimator.SetBool("Stun", false); } } private void CheckTargetAvailable() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if ((networkTargetPlayerDistance <= 12f || Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(40f, 40, -1))) && !isNearestItem && !isKillingPlayer && scaredBackingAway <= 0f) { followTimer = 10f; canBeMoved = true; } if ((Object)(object)base.targetPlayer != (Object)null) { networkTargetPlayerDistance = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); } else { networkTargetPlayerDistance = 3000f; } if ((followTimer > 0f || networkTargetPlayerDistance < 10f) && !isSatisfied) { if (isTargetAvailable && scaredBackingAway <= 0f && !isNearestItem && ((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(((Component)base.targetPlayer).transform.position); } if ((Object)(object)nearestDroppedItem != (Object)null && nearestDroppedItem.GetComponent<GrabbableObject>().isHeld) { nearestDroppedItem.GetComponent<ItemElevatorCheck>().dogEatTimer = 5f; droppedItems.Remove(nearestDroppedItem); if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner) { base.agent.SetDestination(((Component)base.targetPlayer).transform.position); } nearestDroppedItem = null; nearestItemDistance = 3000f; isNearestItem = false; } } if ((((Object)(object)base.targetPlayer != (Object)null && networkTargetPlayerDistance > 12f) || !Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(40f, 30, -1))) && followTimer > 0f) { followTimer -= Time.deltaTime; } if ((Object)(object)base.targetPlayer == (Object)null) { followTimer = 10f; } if (followTimer <= 0f) { networkTargetPlayer.Value = null; base.targetPlayer = null; isTargetAvailable = false; } } private bool IsPlayerVisible(PlayerControllerB player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; float num = Vector3.Angle(((Component)this).transform.forward, val); if (num < 35f && Physics.Raycast(((Component)this).transform.position, val, 120f, LayerMask.NameToLayer("Player"))) { return true; } return false; } private void FindNearestItem() { //IL_001f: 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) foreach (GameObject droppedItem in droppedItems) { float num = Vector3.Distance(((Component)this).transform.position, droppedItem.transform.position); if (num < float.PositiveInfinity && num < 30f) { nearestDroppedItem = droppedItem; isNearestItem = true; return; } } isNearestItem = false; } private IEnumerator EatenFlashbang() { yield return (object)new WaitForSeconds(2f); mainAudio.PlayOneShot(Plugin.eatenExplode); } private void KillPlayerTrigger(PlayerControllerB killPlayer) { if (!killPlayer.isCameraDisabled) { ((MonoBehaviour)this).StartCoroutine(KillPlayer(killPlayer)); } else { ((MonoBehaviour)this).StartCoroutine(KillPlayerInOtherClient(killPlayer)); } } private IEnumerator KillPlayer(PlayerControllerB killPlayer) { hungerValue.Value = 0f; Plugin.mls.LogInfo((object)("Shrimp: Killing " + ((Object)killPlayer).name + "!")); yield return (object)new WaitForSeconds(0.05f); isKillingPlayer = true; base.creatureAnimator.SetTrigger("RipObject"); mainAudio.PlayOneShot(Plugin.ripPlayerApart); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)killPlayer) { killPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0); } yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)killPlayer.deadBody == (Object)null) { Debug.Log((object)"Shrimp: Player body was not spawned or found within 0.5 seconds."); killPlayer.inAnimationWithEnemy = null; isKillingPlayer = false; KillingPlayerBool.Value = false; } else { TakeBodyInMouth(killPlayer.deadBody); yield return (object)new WaitForSeconds(4.4f); base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); ((Component)killPlayer.deadBody).gameObject.SetActive(false); yield return (object)new WaitForSeconds(2f); isKillingPlayer = false; } } private IEnumerator KillPlayerInOtherClient(PlayerControllerB killPlayer) { Plugin.mls.LogInfo((object)("Shrimp: Killing " + ((Object)killPlayer).name + "!")); hungerValue.Value = 0f; yield return (object)new WaitForSeconds(0.05f); isKillingPlayer = true; base.creatureAnimator.SetTrigger("RipObject"); mainAudio.PlayOneShot(Plugin.ripPlayerApart); yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)killPlayer.deadBody == (Object)null) { Debug.Log((object)"Shrimp: Player body was not spawned or found within 0.5 seconds."); killPlayer.inAnimationWithEnemy = null; isKillingPlayer = false; KillingPlayerBool.Value = false; } else { TakeBodyInMouth(killPlayer.deadBody); yield return (object)new WaitForSeconds(4.4f); base.creatureAnimator.SetTrigger("eat"); mainAudio.PlayOneShot(Plugin.dogEatItem); ((Component)killPlayer.deadBody).gameObject.SetActive(false); yield return (object)new WaitForSeconds(2f); isKillingPlayer = false; } } private void TakeBodyInMouth(DeadBodyInfo body) { body.attachedTo = bittenObjectHolder; body.attachedLimb = body.bodyParts[5]; body.matchPositionExactly = true; } private void SetupBehaviour() { roamingState.name = "Roaming"; roamingState.boolValue = true; followingPlayer.name = "Following"; followingPlayer.boolValue = true; enragedState.name = "Enraged"; enragedState.boolValue = true; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(Terminal __instance, ref List<TerminalNode> ___enemyFiles) { ___enemyFiles.Add(Plugin.shrimpTerminalNode); TerminalKeyword defaultVerb = __instance.terminalNodes.allKeywords.First((TerminalKeyword x) => x.word == "info"); TerminalKeyword shrimpTerminalKeyword = Plugin.shrimpTerminalKeyword; shrimpTerminalKeyword.defaultVerb = defaultVerb; } } public class TrapRoomTrigger : NetworkBehaviour { public LethalClientMessage<bool> SendTrapFloorTrigger = new LethalClientMessage<bool>("SendTrapFloorTrigger", (Action<bool>)null, (Action<bool, ulong>)null); public LethalClientMessage<bool> SendTrapDeactivate = new LethalClientMessage<bool>("SendTrapDeactivate", (Action<bool>)null, (Action<bool, ulong>)null); public AudioSource floorAudioSource; public AudioSource floorAudioSource2; public AudioSource doorAudioSource; public Animator roomAnimator; public bool isPlayed; public bool isPlayedOnce; public bool isDeactivated; public PlayerControllerB[] players; public float Timer; private void SendTrapFloorTriggerSync(bool value, ulong id) { if (value && !isPlayed) { isPlayed = true; } else if (!value && isPlayed) { isPlayed = false; } } private void SendTrapDeactivateSync(bool value, ulong id) { if (value && !isDeactivated) { isDeactivated = true; } else if (!value && isDeactivated) { isDeactivated = false; } } private void Start() { SendTrapFloorTrigger.OnReceivedFromClient += SendTrapFloorTriggerSync; SendTrapDeactivate.OnReceivedFromClient += SendTrapDeactivateSync; roomAnimator = GameObject.Find("TrapDoorAnimator").GetComponent<Animator>(); floorAudioSource = GameObject.Find("Floor1").GetComponent<AudioSource>(); floorAudioSource2 = GameObject.Find("Floor2").GetComponent<AudioSource>(); doorAudioSource = GameObject.Find("DoorSlam").GetComponent<AudioSource>(); ((UnityEvent<PlayerControllerB>)(object)GameObject.Find("TrapTrigger").GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)TriggerTrap); ((UnityEvent<PlayerControllerB>)(object)GameObject.Find("IgnoreFallDamagePlayer").GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)IgnoreFallDamage); ((UnityEvent<PlayerControllerB>)(object)((Component)this).GetComponent<TerminalAccessibleObject>().terminalCodeEvent).AddListener((UnityAction<PlayerControllerB>)DeactivateTrap); } private void Update() { if (isPlayed && !isPlayedOnce && !isDeactivated) { ((MonoBehaviour)this).StartCoroutine(ActivateTrap()); isPlayed = false; isPlayedOnce = true; } if (!isPlayed && isDeactivated && isPlayedOnce) { ((MonoBehaviour)this).StartCoroutine(DeactivateTrapCoroutine()); isDeactivated = false; } } public void TriggerTrap(PlayerControllerB playerControllerB) { SendTrapFloorTrigger.SendAllClients(true, true, false); } public void IgnoreFallDamage(PlayerControllerB playerControllerB) { playerControllerB.fallValue -= 5f; } public void DeactivateTrap(PlayerControllerB playerControllerB) { SendTrapDeactivate.SendAllClients(true, true, false); } private IEnumerator ActivateTrap() { roomAnimator.SetBool("open", true); doorAudioSource.PlayOneShot(Plugin.garageDoorSlam); yield return (object)new WaitForSeconds(3f); doorAudioSource.PlayOneShot(Plugin.floorOpen); } private IEnumerator DeactivateTrapCoroutine() { roomAnimator.SetBool("unlock", true); doorAudioSource.PlayOneShot(Plugin.floorClose); yield return (object)new WaitForSeconds(1f); doorAudioSource.PlayOneShot(Plugin.garageSlide); } } public class StanleyTrigger : MonoBehaviour { public AudioSource audioSource; public bool isPlayed; private void Start() { ((UnityEvent<PlayerControllerB>)(object)GameObject.Find("Stanley").GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)TriggerStanley); audioSource = GameObject.Find("NarratorAudio").GetComponent<AudioSource>(); } public void TriggerStanley(PlayerControllerB playerControllerB) { if (!isPlayed) { ((MonoBehaviour)this).StartCoroutine(PlayVoice1()); isPlayed = true; } } private IEnumerator PlayVoice1() { yield return (object)new WaitForSeconds(3f); audioSource.PlayOneShot(Plugin.stanleyVoiceline1); } } public class ElevatorMusic : MonoBehaviour { public AudioSource audioSource; public int currentMusic; public float musicPlayTimer; private void Start() { audioSource = ((Component)this).GetComponent<AudioSource>(); audioSource.PlayOneShot(Plugin.bossaLullaby); musicPlayTimer = 0f; currentMusic = 1; } private void Update() { if (audioSource.isPlaying) { return; } musicPlayTimer += Time.deltaTime; if (musicPlayTimer > 0.5f) { if (currentMusic == 0) { audioSource.PlayOneShot(Plugin.bossaLullaby); musicPlayTimer = 0f; currentMusic++; } else if (currentMusic == 1) { audioSource.PlayOneShot(Plugin.shopTheme); musicPlayTimer = 0f; currentMusic++; } else if (currentMusic == 2) { audioSource.PlayOneShot(Plugin.saferoomTheme); musicPlayTimer = 0f; currentMusic = 0; } } } } public class ElevatorCollider : NetworkBehaviour { public Bounds checkBounds; public LethalClientMessage<bool> SendInElevator = new LethalClientMessage<bool>("SendInElevator", (Action<bool>)null, (Action<bool, ulong>)IsInElevatorSync); public List<GameObject> allPlayerColliders = new List<GameObject>(); public Transform storageParent; public Transform lungPlacement; public Vector3 tempTargetFloorPosition; public Vector3 tempStartFallingPosition; private static void IsInElevatorSync(bool value, ulong id) { if (value) { ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().wasInElevator = true; ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner = true; } else { ((Component)LethalNetworkExtensions.GetPlayerController(id)).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner = false; } } private void Start() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Bounds)(ref checkBounds)).size = new Vector3(4.9f, 17f, 4.9f); GameObject[] allPlayerObjects = StartOfRound.Instance.allPlayerObjects; foreach (GameObject item in allPlayerObjects) { allPlayerColliders.Add(item); } lungPlacement = ((Component)Object.FindObjectOfType<PlaceLung>()).transform; } private void Update() { //IL_0024: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (!RoundMapSystem.Instance.isOffice) { return; } ((Bounds)(ref checkBounds)).center = ((Component)this).transform.position; foreach (GameObject allPlayerCollider in allPlayerColliders) { if (!((Object)(object)allPlayerCollider.GetComponent<Collider>() != (Object)null)) { continue; } BoxCollider component = allPlayerCollider.GetComponent<BoxCollider>(); if (((Bounds)(ref checkBounds)).Intersects(((Collider)component).bounds)) { if (((Component)component).gameObject.tag == "Player") { PlayerControllerB component2 = ((Component)component).GetComponent<PlayerControllerB>(); PlayerElevatorCheck component3 = ((Component)component).GetComponent<PlayerElevatorCheck>(); if (!((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorB && !component2.isCameraDisabled) { ((Component)component).transform.SetParent(((Component)this).transform.parent); SendInElevator.SendAllClients(true, true, false); component3.wasInElevator = true; component3.isInElevatorB = true; } } else if (((Component)component).gameObject.tag == "PhysicsProp") { if ((Object)(object)((Component)component).GetComponent<GrabbableObject>().playerHeldBy != (Object)null && ((Component)((Component)component).GetComponent<GrabbableObject>().playerHeldBy).GetComponent<PlayerElevatorCheck>().isInElevatorB) { tempTargetFloorPosition = ((Component)((Component)component).GetComponent<GrabbableObject>().playerHeldBy).transform.localPosition; tempStartFallingPosition = ((Component)((Component)component).GetComponent<GrabbableObject>()).transform.localPosition; } if (!((Component)component).GetComponent<ItemElevatorCheck>().isInElevatorB && ((Object)(object)((Component)component).transform.parent != (Object)(object)storageParent || (Object)(object)((Component)component).transform.parent != (Object)(object)lungPlacement)) { ((Component)component).transform.parent = ((Component)this).transform.parent; ((Component)component).GetComponent<GrabbableObject>().targetFloorPosition = tempTargetFloorPosition; ((Component)component).GetComponent<GrabbableObject>().startFallingPosition = tempStartFallingPosition; ((Component)component).GetComponent<ItemElevatorCheck>().isInElevatorB = true; } } continue; } if (((Component)component).gameObject.tag == "Player") { if (((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorB) { ((Component)component).transform.SetParent(StartOfRound.Instance.playersContainer, true); SendInElevator.SendAllClients(false, true, false); ((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorB = false; } else if (((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorB && ((Component)component).GetComponent<PlayerControllerB>().isCameraDisabled && !((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorNotOwner) { ((Component)component).transform.SetParent((Transform)null, true); ((Component)component).GetComponent<PlayerElevatorCheck>().isInElevatorB = false; } } if ((Object)(object)allPlayerCollider.GetComponent<PlayerControllerB>() != (Object)null) { PlayerControllerB component4 = ((Component)component).GetComponent<PlayerControllerB>(); PlayerElevatorCheck component5 = ((Component)component).GetComponent<PlayerElevatorCheck>(); if (!component5.isInElevatorB && component4.isCameraDisabled && component5.isInElevatorNotOwner) { Plugin.mls.LogInfo((object)(component4.actualClientId + " is inside of elevator check!")); ((Component)component).transform.SetParent(((Component)this).transform.parent, true); component5.isInElevatorB = true; component5.wasInElevator = true; } else if (component5.isInElevatorB && component4.isCameraDisabled && !component5.isInElevatorNotOwner) { Plugin.mls.LogInfo((object)(component4.actualClientId + " is outside of elevator check!")); ((Component)component).transform.SetParent((Transform)null, true); component5.isInElevatorB = false; } } } } } public class ElevatorSystem : NetworkBehaviour { public static LethalNetworkVariable<bool> isElevatorDowned = new LethalNetworkVariable<bool>("isElevatorDowned"); public static LethalNetworkVariable<bool> isElevatorClosed = new LethalNetworkVariable<bool>("isElevatorClosed"); public float elevatorTimer; public static LethalNetworkVariable<bool> spawnShrimpBool = new LethalNetworkVariable<bool>("spawnShrimpBool"); public Animator doorAnimator; public Animator elevatorScreenDoorAnimator; public Animator animator; public AudioSource audioSource; public List<Animator> panelAnimators; public List<Animator> buttonLightAnimators; public bool performanceCheck; public GameObject storageObject; public bool isSetupEnd; private void Start() { isElevatorDowned.Value = false; isElevatorClosed.Value = false; spawnShrimpBool.Value = false; } private void LateUpdate() { //IL_00bd: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) if (!RoundMapSystem.Instance.isOffice) { return; } Setup(); AnimatorStateInfo currentAnimatorStateInfo; if (isElevatorClosed.Value) { if (doorAnimator.GetBool("closed")) { audioSource.PlayOneShot(Plugin.ElevatorClose); } elevatorScreenDoorAnimator.SetBool("open", false); doorAnimator.SetBool("closed", false); } else { if (!doorAnimator.GetBool("closed")) { audioSource.PlayOneShot(Plugin.ElevatorOpen); } if (!isElevatorDowned.Value) { currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.4f) { currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime < 1f) { elevatorScreenDoorAnimator.SetBool("open", true); } } } doorAnimator.SetBool("closed", true); } if (isElevatorDowned.Value && !animator.GetBool("goDown")) { elevatorTimer += Time.deltaTime; foreach (Animator buttonLightAnimator in buttonLightAnimators) { buttonLightAnimator.SetBool("up", false); } if (elevatorTimer > 0f) { if (!isElevatorClosed.Value) { isElevatorClosed.Value = true; } if (elevatorTimer > 3f) { audioSource.PlayOneShot(Plugin.ElevatorDown); animator.SetBool("goDown", true); if (!isElevatorDowned.Value) { isElevatorDowned.Value = true; } } } } if (!isElevatorDowned.Value && animator.GetBool("goDown")) { foreach (Animator buttonLightAnimator2 in buttonLightAnimators) { buttonLightAnimator2.SetBool("up", true); } elevatorTimer += Time.deltaTime; if (elevatorTimer > 0f) { isElevatorClosed.Value = true; if (elevatorTimer > 3f) { audioSource.PlayOneShot(Plugin.ElevatorUp); animator.SetBool("goDown", false); if (!isElevatorDowned.Value) { isElevatorDowned.Value = false; } } } } if (!isElevatorClosed.Value) { return; } currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (!(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime < 1f)) { return; } currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (!(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 0.98f)) { return; } foreach (Animator panelAnimator in panelAnimators) { if (Plugin.setKorean) { ((Component)((Component)panelAnimator).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "대기 중"; } else { ((Component)((Component)panelAnimator).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "Idle"; } } if (isElevatorClosed.Value) { isElevatorClosed.Value = false; elevatorTimer = 0f; } } private void Setup() { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if (isSetupEnd) { return; } animator = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Animator>(); audioSource = GameObject.Find("ElevatorSound").GetComponent<AudioSource>(); doorAnimator = GameObject.Find("DoorBone").GetComponent<Animator>(); elevatorScreenDoorAnimator = GameObject.Find("ElevatorScreenDoor").GetComponent<Animator>(); Animator[] array = Object.FindObjectsOfType<Animator>(); Animator[] array2 = array; foreach (Animator val in array2) { if (!(((Object)((Component)val).gameObject).name == "ElevatorPanel")) { continue; } ((UnityEvent<PlayerControllerB>)(object)((Component)((Component)val).transform.GetChild(1).GetChild(0)).GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)ElevatorUpTrigger); ((UnityEvent<PlayerControllerB>)(object)((Component)((Component)val).transform.GetChild(2).GetChild(0)).GetComponent<InteractTrigger>().onInteract).AddListener((UnityAction<PlayerControllerB>)ElevatorDownTrigger); ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>(); ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().font = GameObject.Find("doorHydraulics").GetComponent<TMP_Text>().font; ((Graphic)((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>()).material = ((Graphic)GameObject.Find("doorHydraulics").GetComponent<TMP_Text>()).material; ((Graphic)((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>()).color = new Color(1f, 0.3444f, 0f, 1f); if (!PlaceLung.emergencyPowerRequires || PlaceLung.lungPlaced) { if (Plugin.setKorean) { ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "대기 중"; } else { ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "Idle"; } } else if (PlaceLung.emergencyPowerRequires && !PlaceLung.lungPlaced) { if (Plugin.setKorean) { ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "전력 없음"; } else { ((Component)((Component)val).transform.GetChild(3).GetChild(1)).GetComponent<TMP_Text>().text = "No Power"; } } panelAnimators.Add(val); } Animator[] array3 = array; foreach (Animator val2 in array3) { if (((Object)((Component)val2).gameObject).name == "ButtonLights") { buttonLightAnimators.Add(val2); } } GameObject.Find("InsideCollider").gameObject.AddComponent<ElevatorCollider>(); GameObject.Find("ElevatorMusic").AddComponent<ElevatorMusic>(); ScanNodeProperties[] array4 = Object.FindObjectsOfType<ScanNodeProperties>(); if (Plugin.setKorean) { ScanNodeProperties[] array5 = array4; foreach (ScanNodeProperties val3 in array5) { if (val3.headerText == "Elevator Controller") { val3.headerText = "엘리베이터 제어기"; } if (val3.headerText == "Auxiliary power unit") { val3.headerText = "보조 동력 장치"; val3.subText = "긴급 전력 공급기"; } } } if (GameNetworkManager.Instance.isHostingGame) { GameObject val4 = Object.Instantiate<GameObject>(Plugin.socketInteractPrefab); val4.GetComponent<NetworkObject>().Spawn(false); } isElevatorDowned.Value = false; isElevatorClosed.Value = false; spawnShrimpBool.Value = false; isSetupEnd = true; } public void ElevatorUpTrigger(PlayerControllerB playerController) { //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) Plugin.mls.LogInfo((object)"pressed up button!"); if (!isElevatorDowned.Value) { return; } AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); if (!(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f)) { return; } foreach (Animator panelAnimator
plugins/LethalEscape/LethalEscape.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("LethalEscape")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalEscape")] [assembly: AssemblyTitle("LethalEscape")] [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 LethalEscape { internal class LETimerFunctions : MonoBehaviour { public static float MinuteEscapeTimerPuffer; public static float MinuteEscapeTimerBracken; public static float MinuteEscapeTimerHoardingBug; public static LETimerFunctions instance; private void Awake() { instance = this; } private void Update() { MinuteEscapeTimerBracken += Time.deltaTime; MinuteEscapeTimerHoardingBug += Time.deltaTime; MinuteEscapeTimerPuffer += Time.deltaTime; } } [BepInPlugin("xCeezy.LethalEscape", "Lethal Escape", "0.8.2")] public class Plugin : BaseUnityPlugin { public static GameObject ExtraValues; private const string modGUID = "xCeezy.LethalEscape"; private const string modName = "Lethal Escape"; private const string modVersion = "0.8.2"; private Harmony _harmony = new Harmony("LethalEscape"); public static ManualLogSource mls; public static float TimeStartTeleport; public static ConfigEntry<bool> CanThumperEscape; public static ConfigEntry<bool> CanBrackenEscape; public static ConfigEntry<bool> CanJesterEscape; public static ConfigEntry<bool> CanHoardingBugEscape; public static ConfigEntry<bool> CanCoilHeadEscape; public static ConfigEntry<bool> CanSpiderEscape; public static ConfigEntry<bool> CanNutCrackerEscape; public static ConfigEntry<bool> CanHygrodereEscape; public static ConfigEntry<bool> CanPufferEscape; public static float JesterSpeedWindup; public static ConfigEntry<float> BrackenChanceToEscapeEveryMinute; public static ConfigEntry<float> PufferChanceToEscapeEveryMinute; public static ConfigEntry<float> HoardingBugChanceToEscapeEveryMinute; public static ConfigEntry<float> HoardingBugChanceToNestNearShip; public static ConfigEntry<float> HoardingBugChanceToSpawnOutside; public static ConfigEntry<float> BrackenChanceToSpawnOutside; public static ConfigEntry<float> PufferChanceToSpawnOutside; public static ConfigEntry<float> JesterChanceToSpawnOutside; public static ConfigEntry<float> HygrodereChanceToSpawnOutside; public static ConfigEntry<float> NutCrackerChanceToSpawnOutside; public static ConfigEntry<float> ThumperChanceToSpawnOutside; public static ConfigEntry<float> SpiderChanceToSpawnOutside; public static ConfigEntry<float> JesterSpeedIncreasePerSecond; public static ConfigEntry<float> MaxJesterOutsideSpeed; public static ConfigEntry<float> BrackenEscapeDelay; public static ConfigEntry<float> ThumperEscapeDelay; public static ConfigEntry<int> SpiderMinWebsOutside; public static ConfigEntry<int> SpiderMaxWebsOutside; private void Awake() { //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Expected O, but got Unknown CanThumperEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "ThumperEscape", true, "Whether or not the Thumper can escape"); CanBrackenEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "BrackenEscape", true, "Whether or not the Bracken can escape"); CanJesterEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "JesterEscape", true, "Whether or not the Jester can escape"); CanHoardingBugEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HoardingBugEscape", true, "Whether or not the Hoarding Bugs can escape"); CanCoilHeadEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CoilHeadEscape", true, "Whether or not Coil Head can escape"); CanSpiderEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "SpiderEscape", true, "Whether or not the Spider can escape"); CanNutCrackerEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "NutCrackerEscape", true, "Whether or not the Nut Cracker can escape"); CanHygrodereEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HygrodereEscape", false, "Whether or not the Hygrodere/Slime can escape"); CanPufferEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CanPufferEscape", true, "Whether or not the Puffer/Spore Lizard can escape"); ThumperChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "ThumperSpawnOutsideChance", 5f, "The chance that the Thumper will spawn outside"); BrackenChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "BrackenSpawnOutsideChance", 10f, "The chance that the Bracken will spawn outside"); JesterChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "JesterSpawnOutsideChance", 0f, "The chance that the Jester will spawn outside"); HoardingBugChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HoardingBugSpawnOutsideChance", 30f, "The chance that the Hoarding Bug will spawn outside"); SpiderChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "SpiderSpawnOutsideChance", 5f, "The chance that the Spider will spawn outside"); NutCrackerChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "NutCrackerSpawnOutsideChance", 5f, "The chance that the NutCracker will spawn outside"); HygrodereChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HygrodereSpawnOutsideChance", 0f, "The chance that the Hygrodere will spawn outside"); PufferChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "PufferSpawnOutsideChance", 5f, "The chance that the Puffer will spawn outside"); PufferChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Puffer Escape Chance", 10f, "The chance that the Puffer/Spore Lizard will escape randomly every minute"); BrackenChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Chance", 10f, "The chance that the Bracken will escape randomly every minute"); HoardingBugChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBug Escape Chance", 15f, "The chance that the Hoarding Bug will escape randomly every minute"); HoardingBugChanceToNestNearShip = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBugShipNestChance", 50f, "The chance that the Hoarding Bug will make their nest at/near the ship"); BrackenEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Delay", 5f, "Time it takes for the Bracken to follow a player outside"); ThumperEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Thumper Escape Delay", -5f, "Time it takes for the Thumper to follow a player outside which is based on how long the player was seen minus this value (Might break when under -15 and will force thumper outside when it sees someone when above 0)"); SpiderMaxWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Max Spider Webs Outside", 28, "The maximum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 7 or 9 if update 47)"); SpiderMinWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Min Spider Webs Outside", 20, "The minimum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 4 or 6 if update 47)"); JesterSpeedIncreasePerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Speed Increase", 1.35f, "How much speed the jester gets per second"); MaxJesterOutsideSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Outside Speed", 10f, "The max speed the Jester moves while outside (5 is the speed its at while in the box and 18 is jesters max speed inside the facility)"); if ((Object)(object)ExtraValues == (Object)null) { ExtraValues = new GameObject(); Object.DontDestroyOnLoad((Object)(object)ExtraValues); ((Object)ExtraValues).hideFlags = (HideFlags)61; ExtraValues.AddComponent<LETimerFunctions>(); } mls = Logger.CreateLogSource("GameMaster"); mls.LogInfo((object)"Loaded xCeezy.LethalEscape. Patching."); _harmony.PatchAll(typeof(Plugin)); } [HarmonyPatch(typeof(CrawlerAI), "Update")] [HarmonyPrefix] private static void CrawlerLEPrefixAI(CrawlerAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanThumperEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if (((EnemyAI)__instance).currentBehaviourStateIndex != 0 && __instance.noticePlayerTimer < ThumperEscapeDelay.Value && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(CrawlerAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void ThumperAILEOutsideAttack(CrawlerAI __instance, ref Collider other) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.65) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0f; ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); component.DamagePlayer(40, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(40, Vector3.zero, -1); ((EnemyAI)__instance).agent.speed = 0f; __instance.HitPlayerServerRpc((int)component.playerClientId); component.JumpToFearLevel(1f, true); } } } [HarmonyPatch(typeof(CrawlerAI), "Start")] [HarmonyPostfix] private static void CrawlerAILEPostfixStart(CrawlerAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ThumperChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= ThumperChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPrefix] private static void JesterLEPrefixAI(JesterAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { JesterSpeedWindup = 0f; SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPostfix] private static void JesterLEPostfixAI(JesterAI __instance) { if (!CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost || !((EnemyAI)__instance).isOutside) { return; } if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } bool flag = false; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[i].isInsideFactory) { flag = true; } } if (flag) { ((EnemyAI)__instance).SwitchToBehaviourState(2); ((EnemyAI)__instance).agent.stoppingDistance = 0f; } JesterSpeedWindup = Mathf.Clamp(JesterSpeedWindup + Time.deltaTime * JesterSpeedIncreasePerSecond.Value, 0f, MaxJesterOutsideSpeed.Value); ((EnemyAI)__instance).agent.speed = JesterSpeedWindup; } [HarmonyPatch(typeof(JesterAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void JesterAILEOutsideAttack(JesterAI __instance, ref Collider other) { if (!((EnemyAI)__instance).isEnemyDead && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside) { if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && ((EnemyAI)__instance).currentBehaviourStateIndex == 2) { __instance.KillPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(JesterAI), "Start")] [HarmonyPostfix] private static void JesterAILEPostfixStart(JesterAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && JesterChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= JesterChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(FlowermanAI), "Update")] [HarmonyPrefix] private static void FlowermanAILEPrefixAI(FlowermanAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanBrackenEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && (((EnemyAI)__instance).currentBehaviourStateIndex == 1 || __instance.evadeStealthTimer > 0f) && Time.time - TimeStartTeleport >= BrackenEscapeDelay.Value + 5f) { TimeStartTeleport = Time.time; } if (Time.time - TimeStartTeleport > BrackenEscapeDelay.Value && Time.time - TimeStartTeleport < BrackenEscapeDelay.Value + 5f) { SendEnemyOutside((EnemyAI)(object)__instance); } else if (LETimerFunctions.MinuteEscapeTimerBracken >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { LETimerFunctions.MinuteEscapeTimerBracken = 0f; if (BrackenChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToEscapeEveryMinute.Value) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(FlowermanAI), "Update")] [HarmonyPostfix] private static void FlowermanAILEPostfixAI(FlowermanAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && CanBrackenEscape.Value && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(FlowermanAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void FlowerManAILEOutsideAttack(FlowermanAI __instance, ref Collider other, bool ___startingKillAnimationLocalClient) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.inKillAnimation && !___startingKillAnimationLocalClient) { __instance.KillPlayerAnimationServerRpc((int)component.playerClientId); ___startingKillAnimationLocalClient = true; } } } [HarmonyPatch(typeof(FlowermanAI), "Start")] [HarmonyPostfix] private static void FlowermanAILEPostfixStart(FlowermanAI __instance) { TimeStartTeleport = 0f; if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && BrackenChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(HoarderBugAI), "Update")] [HarmonyPrefix] private static void HoardingBugAILEPrefixAI(HoarderBugAI __instance) { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || !CanHoardingBugEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && __instance.searchForPlayer.inProgress) { SendEnemyOutside((EnemyAI)(object)__instance); } else { if (!(LETimerFunctions.MinuteEscapeTimerHoardingBug >= 60f) || !((Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null)) { return; } LETimerFunctions.MinuteEscapeTimerHoardingBug = 0f; if ((float)Random.Range(1, 100) <= HoardingBugChanceToEscapeEveryMinute.Value / (float)Object.FindObjectsOfType(typeof(HoarderBugAI)).Length) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); if (HoardingBugChanceToNestNearShip.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToNestNearShip.Value) { StartOfRound val = (StartOfRound)Object.FindObjectOfType(typeof(StartOfRound)); Transform val2 = ((EnemyAI)__instance).ChooseClosestNodeToPosition(val.elevatorTransform.position, false, 0); __instance.nestPosition = val2.position; } } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(HoarderBugAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void HoardingBugAILEOutsideAttack(HoarderBugAI __instance, ref Collider other) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.5) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && __instance.inChase) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(30, Vector3.zero, -1); __instance.HitPlayerServerRpc(); } } } [HarmonyPatch(typeof(HoarderBugAI), "Start")] [HarmonyPostfix] private static void HoardingBugAILEPostfixStart(HoarderBugAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HoardingBugChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(SpringManAI), "Update")] [HarmonyPrefix] private static void CoilHeadAILEPrefixAI(SpringManAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanCoilHeadEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(SpringManAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void CoilHeadAILEOutsideAttack(SpringManAI __instance, ref Collider other) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.stoppingMovement && ((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !(__instance.timeSinceHittingPlayer >= 0f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0.2f; component.DamagePlayer(90, true, true, (CauseOfDeath)6, 2, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1); component.JumpToFearLevel(1f, true); } } } [HarmonyPatch(typeof(SandSpiderAI), "Update")] [HarmonyPrefix] private static void SpiderAILEPrefixAI(SandSpiderAI __instance) { //IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || !CanSpiderEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); __instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition; __instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition; __instance.maxWebTrapsToPlace += Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(SandSpiderAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void SpiderAILEOutsideAttack(SandSpiderAI __instance, ref Collider other) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.onWall && !(__instance.timeSinceHittingPlayer <= 1f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(90, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1); __instance.HitPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(SandSpiderAI), "Start")] [HarmonyPostfix] private static void SpiderAILEPostfixStart(SandSpiderAI __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && SpiderChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= SpiderChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); __instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition; __instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition; __instance.maxWebTrapsToPlace = Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "Update")] [HarmonyPrefix] private static void NutCrackerAILEPrefixAI(NutcrackerEnemyAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanNutCrackerEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void NutCrackerAILEOutsideAttack(NutcrackerEnemyAI __instance, ref Collider other) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(((EnemyAI)__instance).stunNormalizedTimer >= 0f) && !(__instance.timeSinceHittingPlayer < 1f)) { __instance.timeSinceHittingPlayer = 0f; __instance.LegKickPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "Start")] [HarmonyPostfix] private static void NutCrackerAILEPostfixStart(NutcrackerEnemyAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && NutCrackerChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= NutCrackerChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(BlobAI), "Update")] [HarmonyPrefix] private static void BlobAILEPrefixAI(BlobAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanHygrodereEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); __instance.centerPoint = ((Component)__instance).transform; } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(BlobAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void BlobAILEOutsideAttack(BlobAI __instance, ref Collider other) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) if (((EnemyAI)__instance).isEnemyDead || !((EnemyAI)__instance).isOutside || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingLocalPlayer < 0.25f) && (!(__instance.tamedTimer > 0f) || !(__instance.angeredTimer < 0f))) { __instance.timeSinceHittingLocalPlayer = 0f; component.DamagePlayerFromOtherClientServerRpc(35, Vector3.zero, -1); component.DamagePlayer(35, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (component.isPlayerDead) { __instance.SlimeKillPlayerEffectServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(BlobAI), "Start")] [HarmonyPostfix] private static void HygrodereAILEPostfixStart(BlobAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HygrodereChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HygrodereChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); __instance.centerPoint = ((Component)__instance).transform; } } [HarmonyPatch(typeof(PufferAI), "Update")] [HarmonyPrefix] private static void PufferAILEPrefixAI(PufferAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanPufferEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } else if (LETimerFunctions.MinuteEscapeTimerPuffer >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { LETimerFunctions.MinuteEscapeTimerPuffer = 0f; if (PufferChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToEscapeEveryMinute.Value) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(PufferAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void PufferAILEOutsideAttack(PufferAI __instance, ref Collider other) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingPlayer <= 1f)) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(20, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(20, Vector3.zero, -1); __instance.BitePlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(PufferAI), "Start")] [HarmonyPostfix] private static void PufferAILEPostfixStart(PufferAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && PufferChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } public static void SendEnemyInside(EnemyAI __instance) { //IL_0069: 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_007d: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_004f: Unknown result type (might be due to invalid IL or missing references) __instance.isOutside = false; __instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); for (int i = 0; i < array.Length; i++) { if (array[i].entranceId == 0 && !array[i].isEntranceToBuilding) { __instance.serverPosition = array[i].entrancePoint.position; break; } } Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0); if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f) { __instance.serverPosition = val.position; ((Component)__instance).transform.position = __instance.serverPosition; } ((Component)__instance).transform.position = __instance.serverPosition; __instance.agent.Warp(__instance.serverPosition); __instance.SyncPositionToClients(); } public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true) { //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00ce: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) __instance.isOutside = true; __instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); float num = 999f; for (int i = 0; i < array.Length; i++) { if (!array[i].isEntranceToBuilding) { continue; } for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++) { if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory & (Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position) < num)) { num = Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position); __instance.serverPosition = array[i].entrancePoint.position; } } } if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { __instance.ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0); if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f || !SpawnOnDoor) { __instance.serverPosition = val.position; } ((Component)__instance).transform.position = __instance.serverPosition; __instance.agent.Warp(__instance.serverPosition); __instance.SyncPositionToClients(); if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { __instance.EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
plugins/LethalExpansion.dll
Decompiled 9 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.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Adapters; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalExpansion.Extenders; using LethalExpansion.Patches; using LethalExpansion.Patches.Monsters; using LethalExpansion.Utils; using LethalExpansion.Utils.HUD; using LethalSDK.Component; using LethalSDK.Editor; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using TMPro; using Unity.AI.Navigation; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.ProBuilder; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("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("Mono.Security")] [assembly: IgnoresAccessChecksTo("Newtonsoft.Json")] [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.AccessibilityModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ProfilerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityTestProtocolModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")] [assembly: AssemblyCompany("LethalExpansion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9c243378795bf6987d857b2670e725dcd40d631b")] [assembly: AssemblyProduct("LethalExpansion")] [assembly: AssemblyTitle("LethalExpansion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class AutoScrollText : MonoBehaviour { public TextMeshProUGUI textMeshPro; public float scrollSpeed = 15f; private Vector2 startPosition; private float textHeight; private bool startScrolling = false; private bool isWaitingToReset = false; private float displayHeight; private float fontSize; private void Start() { textMeshPro = ((Component)this).GetComponent<TextMeshProUGUI>(); InitializeScrolling(); } private void InitializeScrolling() { //IL_001e: 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_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textMeshPro != (Object)null) { startPosition = ((TMP_Text)textMeshPro).rectTransform.anchoredPosition; textHeight = ((TMP_Text)textMeshPro).preferredHeight; displayHeight = ((TMP_Text)textMeshPro).rectTransform.sizeDelta.y; fontSize = ((TMP_Text)textMeshPro).fontSize; } ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private IEnumerator WaitBeforeScrolling(float waitTime) { yield return (object)new WaitForSeconds(waitTime); startScrolling = true; } private IEnumerator WaitBeforeResetting(float waitTime) { isWaitingToReset = true; yield return (object)new WaitForSeconds(waitTime); ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; isWaitingToReset = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private void Update() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) if ((Object)(object)textMeshPro != (Object)null && startScrolling && !isWaitingToReset) { RectTransform rectTransform = ((TMP_Text)textMeshPro).rectTransform; rectTransform.anchoredPosition += new Vector2(0f, scrollSpeed * Time.deltaTime); if (((TMP_Text)textMeshPro).rectTransform.anchoredPosition.y >= startPosition.y + textHeight - displayHeight - fontSize) { startScrolling = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeResetting(5f)); } } } public void ResetScrolling() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)textMeshPro != (Object)null) { ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; } isWaitingToReset = false; InitializeScrolling(); } } public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private string description; private string netinfo; public static RectTransform ModSettingsToolTipPanel; public static TMP_Text ModSettingsToolTipPanelDescription; public static TMP_Text ModSettingsToolTipPanelNetInfo; public int index; private float delay = 0.5f; private bool isPointerOver = false; public void OnPointerEnter(PointerEventData eventData) { isPointerOver = true; ((MonoBehaviour)this).StartCoroutine(ShowTooltipAfterDelay()); } public void OnPointerExit(PointerEventData eventData) { isPointerOver = false; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(false); } private IEnumerator ShowTooltipAfterDelay() { yield return (object)new WaitForSeconds(delay); if (isPointerOver) { ModSettingsToolTipPanel.anchoredPosition = new Vector2(-30f, ((Component)this).GetComponent<RectTransform>().anchoredPosition.y + -80f); description = ConfigManager.Instance.FindDescription(index); (bool, bool) info = ConfigManager.Instance.FindNetInfo(index); netinfo = "Network synchronization: " + (info.Item1 ? "Yes" : "No") + "\nMod required by clients: " + (info.Item2 ? "No" : "Yes"); ModSettingsToolTipPanelDescription.text = description; ModSettingsToolTipPanelNetInfo.text = netinfo; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(true); } } } public class ConfigItem { public string Key { get; set; } public Type type { get; set; } public object Value { get; set; } public object DefaultValue { get; set; } public string Tab { get; set; } public string Description { get; set; } public object MinValue { get; set; } public object MaxValue { get; set; } public bool Sync { get; set; } public bool Hidden { get; set; } public bool Optional { get; set; } public bool RequireRestart { get; set; } public ConfigItem(string key, object defaultValue, string tab, string description, object minValue = null, object maxValue = null, bool sync = true, bool optional = false, bool hidden = false, bool requireRestart = false) { Key = key; DefaultValue = defaultValue; type = defaultValue.GetType(); Tab = tab; Description = description; if (minValue != null && maxValue != null) { if (minValue.GetType() == type && maxValue.GetType() == type) { MinValue = minValue; MaxValue = maxValue; } } else { MinValue = null; MaxValue = null; } Sync = sync; Optional = optional; Hidden = hidden; Value = DefaultValue; RequireRestart = requireRestart; } } namespace LethalExpansion { [BepInPlugin("LethalExpansion", "LethalExpansion", "1.3.41")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalExpansion : BaseUnityPlugin { private enum compatibility { unknown, perfect, good, medium, bad, critical } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<PluginInfo, bool> <>9__31_1; public static UnityAction <>9__31_0; public static Func<PluginInfo, bool> <>9__31_2; public static Func<PluginInfo, bool> <>9__31_3; public static Func<PluginInfo, bool> <>9__31_4; public static Func<AudioMixerGroup, bool> <>9__32_0; public static Func<GameObject, bool> <>9__32_1; public static Func<AudioMixerGroup, bool> <>9__32_2; public static Func<AudioMixerGroup, bool> <>9__32_3; public static Func<AudioMixerGroup, bool> <>9__32_4; public static Func<PluginInfo, bool> <>9__35_0; public static Func<PluginInfo, bool> <>9__35_1; public static Func<PluginInfo, bool> <>9__35_2; public static Func<PluginInfo, bool> <>9__35_3; public static Func<PluginInfo, bool> <>9__35_4; public static Func<PluginInfo, bool> <>9__35_5; internal bool <OnSceneLoaded>b__31_1(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } internal void <OnSceneLoaded>b__31_0() { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); } internal bool <OnSceneLoaded>b__31_2(PluginInfo p) { return p.Metadata.GUID == "imabatby.lethallevelloader"; } internal bool <OnSceneLoaded>b__31_3(PluginInfo p) { return p.Metadata.GUID == "imabatby.lethallevelloader"; } internal bool <OnSceneLoaded>b__31_4(PluginInfo p) { return p.Metadata.GUID == "SpaceSunShine"; } internal bool <LoadCustomMoon>b__32_0(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_1(GameObject o) { //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) Scene scene = o.scene; return ((Scene)(ref scene)).name != "InitSceneLaunchOptions"; } internal bool <LoadCustomMoon>b__32_2(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_3(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_4(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <waitForSession>b__35_0(PluginInfo p) { return p.Metadata.GUID == "BrutalCompanyPlus"; } internal bool <waitForSession>b__35_1(PluginInfo p) { return p.Metadata.GUID == "LethalAdjustments"; } internal bool <waitForSession>b__35_2(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } internal bool <waitForSession>b__35_3(PluginInfo p) { return p.Metadata.GUID == "299792458.MoreMoneyStart"; } internal bool <waitForSession>b__35_4(PluginInfo p) { return p.Metadata.GUID == "ExtraDaysToDeadline"; } internal bool <waitForSession>b__35_5(PluginInfo p) { return p.Metadata.GUID == "AdvancedCompany"; } } private const string PluginGUID = "LethalExpansion"; private const string PluginName = "LethalExpansion"; private const string VersionString = "1.3.41"; public static readonly Version ModVersion = new Version("1.3.41"); public static readonly int[] CompatibleGameVersions = new int[4] { 45, 47, 48, 49 }; private readonly Dictionary<string, compatibility> CompatibleMods = new Dictionary<string, compatibility> { { "com.sinai.unityexplorer", compatibility.medium }, { "HDLethalCompany", compatibility.good }, { "LC_API", compatibility.good }, { "me.swipez.melonloader.morecompany", compatibility.medium }, { "BrutalCompanyPlus", compatibility.medium }, { "MoonOfTheDay", compatibility.good }, { "Television_Controller", compatibility.bad }, { "beeisyou.LandmineFix", compatibility.perfect }, { "LethalAdjustments", compatibility.good }, { "CoomfyDungeon", compatibility.bad }, { "BiggerLobby", compatibility.good }, { "KoderTech.BoomboxController", compatibility.good }, { "299792458.MoreMoneyStart", compatibility.good }, { "ExtraDaysToDeadline", compatibility.good }, { "AdvancedCompany", compatibility.unknown }, { "SpaceSunShine", compatibility.good }, { "Nie_SpaceShipDoor", compatibility.good }, { "imabatby.lethallevelloader", compatibility.bad } }; public static List<PluginInfo> loadedPlugins = new List<PluginInfo>(); public static bool sessionWaiting = true; public static bool hostDataWaiting = true; public static bool ishost = false; public static bool alreadypatched = false; public static bool weathersReadyToShare = false; public static bool isInGame = false; public static bool dungeonGeneratorReady = false; public static int delayedLevelChange = -1; public static string lastKickReason = string.Empty; private static readonly Harmony Harmony = new Harmony("LethalExpansion"); public static ManualLogSource Log = new ManualLogSource("LethalExpansion"); public static ConfigFile config; public GameObject SpaceLight; public GameObject terrainfixer; public static Transform currentWaterSurface; private int width = 256; private int height = 256; private int depth = 20; private float scale = 20f; private void Awake() { //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Expected O, but got Unknown //IL_0d66: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Expected O, but got Unknown //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d85: Expected O, but got Unknown //IL_0dec: Unknown result type (might be due to invalid IL or missing references) //IL_0df9: Expected O, but got Unknown //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e0d: Expected O, but got Unknown //IL_0e2b: Unknown result type (might be due to invalid IL or missing references) //IL_0e30: Unknown result type (might be due to invalid IL or missing references) //IL_0e3c: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.41 is loading..."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Getting other plugins list"); loadedPlugins = GetLoadedPlugins(); foreach (PluginInfo loadedPlugin in loadedPlugins) { if (!(loadedPlugin.Metadata.GUID != "LethalExpansion")) { continue; } if (CompatibleMods.ContainsKey(loadedPlugin.Metadata.GUID)) { switch (CompatibleMods[loadedPlugin.Metadata.GUID]) { case compatibility.unknown: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.perfect: Console.BackgroundColor = ConsoleColor.Blue; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.good: Console.BackgroundColor = ConsoleColor.Green; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.medium: Console.BackgroundColor = ConsoleColor.Yellow; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.bad: Console.BackgroundColor = ConsoleColor.Red; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogError((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.critical: Console.BackgroundColor = ConsoleColor.Magenta; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogFatal((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; default: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } else { Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {compatibility.unknown}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } } config = ((BaseUnityPlugin)this).Config; ConfigManager.Instance.AddItem(new ConfigItem("GlobalTimeSpeedMultiplier", 1.4f, "Time", "Change the global time speed", 0.1f, 3f)); ConfigManager.Instance.AddItem(new ConfigItem("NumberOfHours", 18, "Time", "Max lenght of an Expedition in hours. (Begin at 6 AM | 18 = Midnight)", 6, 20)); ConfigManager.Instance.AddItem(new ConfigItem("DeadlineDaysAmount", 3, "Expeditions", "Change amount of days for the Quota.", 1, 9)); ConfigManager.Instance.AddItem(new ConfigItem("StartingCredits", 60, "Expeditions", "Change amount of starting Credit.", 0, 1000)); ConfigManager.Instance.AddItem(new ConfigItem("MoonsRoutePricesMultiplier", 1f, "Moons", "Change the Cost of the Moon Routes.", 0f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("StartingQuota", 130, "Expeditions", "Change the starting Quota.", 0, 1000, sync: true, optional: true)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapAmountMultiplier", 1f, "Dungeons", "Change the amount of Scraps in dungeons.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapValueMultiplier", 0.4f, "Dungeons", "Change the value of Scraps.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("MapSizeMultiplier", 1.5f, "Dungeons", "Change the size of the Dungeons. (Can crash when under 1.0)", 0.8f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("PreventMineToExplodeWithItems", false, "Dungeons", "Prevent Landmines to explode by dropping items on them")); ConfigManager.Instance.AddItem(new ConfigItem("MineActivationWeight", 0.15f, "Dungeons", "Set the minimal weight to prevent Landmine's explosion (0.15 = 16 lb, Player = 2.0)", 0.01f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("WeightUnit", 0, "HUD", "Change the carried Weight unit : 0 = Pounds (lb), 1 = Kilograms (kg) and 2 = Both", 0, 2, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ConvertPoundsToKilograms", true, "HUD", "Convert Pounds into Kilograms (16 lb = 7 kg) (Only effective if WeightUnit = 1)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("PreventScrapWipeWhenAllPlayersDie", false, "Expeditions", "Prevent the Scraps Wipe when all players die.")); ConfigManager.Instance.AddItem(new ConfigItem("24HoursClock", false, "HUD", "Display a 24h clock instead of 12h.", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ClockAlwaysVisible", false, "HUD", "Display clock while inside of the Ship.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadline", false, "Expeditions", "Automatically increase the Deadline depending of the required quota.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadlineStage", 300, "Expeditions", "Increase the quota deadline of one day each time the quota exceeds this value.", 100, 3000)); ConfigManager.Instance.AddItem(new ConfigItem("LoadModules", true, "Modules", "Load SDK Modules that add new content to the game. Disable it to play with Vanilla players. (RESTART REQUIRED)", null, null, sync: false, optional: false, hidden: false, requireRestart: true)); ConfigManager.Instance.AddItem(new ConfigItem("MaxItemsInShip", 45, "Expeditions", "Change the Items cap can be kept in the ship.", 10, 500)); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonWeatherInCatalogue", true, "HUD", "Display the current weather of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonRankInCatalogue", false, "HUD", "Display the rank of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonPriceInCatalogue", false, "HUD", "Display the route price of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("QuotaIncreaseSteepness", 16, "Expeditions", "Change the Quota Increase Steepness. (Highter = less steep exponential increase)", 0, 32)); ConfigManager.Instance.AddItem(new ConfigItem("QuotaBaseIncrease", 100, "Expeditions", "Change the Quota Base Increase.", 0, 300)); ConfigManager.Instance.AddItem(new ConfigItem("KickPlayerWithoutMod", false, "Lobby", "Kick the players without Lethal Expansion installer. (Will be kicked anyway if LoadModules is True)")); ConfigManager.Instance.AddItem(new ConfigItem("BrutalCompanyPlusCompatibility", false, "Compatibility", "Leave Brutal Company Plus control the Quota settings.")); ConfigManager.Instance.AddItem(new ConfigItem("LethalAdjustmentsCompatibility", false, "Compatibility", "Leave Lethal Adjustments control the Dungeon settings.")); ConfigManager.Instance.AddItem(new ConfigItem("CoomfyDungeonCompatibility", false, "Compatibility", "Let Coomfy Dungeons control the Dungeon size & scrap settings.")); ConfigManager.Instance.AddItem(new ConfigItem("MoreMoneyStartCompatibility", false, "Compatibility", "Let MoreMoneyStart control the Starting credits amount.")); ConfigManager.Instance.AddItem(new ConfigItem("SettingsDebug", false, "Debug", "Show an output of every settings in the Console. (The Console must listen Info messages)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("LegacyMoonLoading", false, "Modules", "Roll back to Synchronous moon loading. (Freeze the game longer and highter chance of crash)")); ConfigManager.Instance.AddItem(new ConfigItem("ExtraDaysToDeadline", false, "Compatibility", "Leave ExtraDaysToDeadline control the deadline days amount. (not effect automatic deadlines)")); ConfigManager.Instance.AddItem(new ConfigItem("HideModSettingsMenu", false, "HUD", "Hide the ModSettings menu from the Main Menu, you still can open the menu by pressing O in Main Menu. (Restart Required)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("AdvancedCompanyCompatibility", false, "Compatibility", "Let AdvancedCompany control some settings.")); ConfigManager.Instance.AddItem(new ConfigItem("HideVersionNumberInMainMenu", false, "HUD", "Hide the LE version number in the main menu. (Restart Required)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("DisableSpaceLightInOrbit", false, "Expeditions", "Disable the SpaceLight out of the ship. (Automatically apply if the SpaceSunShine mod is installed)", null, null, sync: false)); ConfigManager.Instance.ReadConfig(); ((BaseUnityPlugin)this).Config.SettingChanged += ConfigSettingChanged; AssetBundlesManager.Instance.LoadAllAssetBundles(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; Harmony.PatchAll(typeof(GameNetworkManager_Patch)); Harmony.PatchAll(typeof(Terminal_Patch)); Harmony.PatchAll(typeof(MenuManager_Patch)); Harmony.PatchAll(typeof(GrabbableObject_Patch)); Harmony.PatchAll(typeof(RoundManager_Patch)); Harmony.PatchAll(typeof(TimeOfDay_Patch)); Harmony.PatchAll(typeof(HUDManager_Patch)); Harmony.PatchAll(typeof(StartOfRound_Patch)); Harmony.PatchAll(typeof(EntranceTeleport_Patch)); Harmony.PatchAll(typeof(Landmine_Patch)); Harmony.PatchAll(typeof(AudioReverbTrigger_Patch)); Harmony.PatchAll(typeof(InteractTrigger_Patch)); Harmony.PatchAll(typeof(RuntimeDungeon)); Harmony val = new Harmony("LethalExpansion"); MethodInfo methodInfo = AccessTools.Method(typeof(BaboonBirdAI), "GrabScrap", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugAI), "GrabItem", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterGrabItem", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo4 = AccessTools.Method(typeof(HoarderBugAI), "DropItem", (Type[])null, (Type[])null); MethodInfo methodInfo5 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterDropItem_Patch", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(HoarderBugAI), "KillEnemy", (Type[])null, (Type[])null); MethodInfo methodInfo7 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "KillEnemy_Patch", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(methodInfo5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(methodInfo7), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; HDRenderPipelineAsset val2 = (HDRenderPipelineAsset)(object)((currentRenderPipeline is HDRenderPipelineAsset) ? currentRenderPipeline : null); if ((Object)(object)val2 != (Object)null) { RenderPipelineSettings currentPlatformRenderPipelineSettings = val2.currentPlatformRenderPipelineSettings; currentPlatformRenderPipelineSettings.supportWater = true; val2.currentPlatformRenderPipelineSettings = currentPlatformRenderPipelineSettings; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Water support applied to the HDRenderPipelineAsset."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"HDRenderPipelineAsset not found."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.41 is loaded."); } private List<PluginInfo> GetLoadedPlugins() { return Chainloader.PluginInfos.Values.ToList(); } private float[,] GenerateHeights() { float[,] array = new float[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { array[i, j] = CalculateHeight(i, j); } } return array; } private float CalculateHeight(int x, int y) { float num = (float)x / (float)width * scale; float num2 = (float)y / (float)height * scale; return Mathf.PerlinNoise(num, num2); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading scene: " + ((Scene)(ref scene)).name)); if (((Scene)(ref scene)).name == "MainMenu") { sessionWaiting = true; hostDataWaiting = true; ishost = false; alreadypatched = false; dungeonGeneratorReady = false; delayedLevelChange = -1; isInGame = false; AssetGather.Instance.AddAudioMixer(GameObject.Find("Canvas/MenuManager").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); SettingsMenu.Instance.InitSettingsMenu(); if (lastKickReason != null && lastKickReason.Length > 0) { PopupManager.Instance.InstantiatePopup(scene, "Kicked from Lobby", "You have been kicked\r\nReason: " + lastKickReason, "Ok", "Ignore"); } if (!ConfigManager.Instance.FindEntryValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")) { PopupManager instance = PopupManager.Instance; Scene sceneFocus = scene; object obj = <>c.<>9__31_0; if (obj == null) { UnityAction val = delegate { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); }; <>c.<>9__31_0 = val; obj = (object)val; } instance.InstantiatePopup(sceneFocus, "CoomfyDungeon mod found", "Warning: CoomfyDungeon is incompatible with LethalExpansion, Would you like to enable the compatibility mode? Otherwise dungeon generation Desync may occurs!", "Yes", "No", (UnityAction)obj, null, 20, 18); } if (loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "imabatby.lethallevelloader") && loadedPlugins.First((PluginInfo p) => p.Metadata.GUID == "imabatby.lethallevelloader").Metadata.Version.Minor == 1) { PopupManager.Instance.InstantiatePopup(scene, "LethalLevelLoader 1.1.X mod found", "Warning: LethalLevelLoader 1.1.X is incompatible with LethalExpansion, please use LethalLevelLoader 1.0.7 untill a patch is done.", "Ok", "Ignore", null, null, 20, 18); } } if (((Scene)(ref scene)).name == "CompanyBuilding") { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } dungeonGeneratorReady = true; } if (((Scene)(ref scene)).name == "SampleSceneRelay") { bool flag = true; if (ConfigManager.Instance.FindItemValue<bool>("DisableSpaceLightInOrbit") || loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "SpaceSunShine")) { flag = false; } if (flag) { SpaceLight = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/SpaceLight.prefab")); SceneManager.MoveGameObjectToScene(SpaceLight, scene); } Mesh mesh = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Meshes/MonitorWall.fbx").GetComponent<MeshFilter>().mesh; GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube"); val2.GetComponent<MeshFilter>().mesh = mesh; MeshRenderer component = val2.GetComponent<MeshRenderer>(); GameObject val3 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding")); Object.Destroy((Object)(object)val3.GetComponent<FloodWeather>()); ((Object)val3).name = "WaterSurface"; val3.transform.position = Vector3.zero; ((Component)val3.transform.Find("Water")).GetComponent<MeshFilter>().sharedMesh = null; SpawnPrefab.Instance.waterSurface = val3; ((Renderer)component).materials = (Material[])(object)new Material[9] { ((Renderer)component).materials[0], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[2] }; ((Component)StartOfRound.Instance.screenLevelDescription).gameObject.AddComponent<AutoScrollText>(); AssetGather.Instance.AddAudioMixer(GameObject.Find("Systems/Audios/DiageticBackground").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); terrainfixer = new GameObject(); ((Object)terrainfixer).name = "terrainfixer"; terrainfixer.transform.position = new Vector3(0f, -500f, 0f); Terrain val4 = terrainfixer.AddComponent<Terrain>(); TerrainData val5 = new TerrainData(); val5.heightmapResolution = width + 1; val5.size = new Vector3((float)width, (float)depth, (float)height); val5.SetHeights(0, 0, GenerateHeights()); val4.terrainData = val5; Terminal_Patch.ResetFireExitAmounts(); Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume)); for (int i = 0; i < array.Length; i++) { Object obj2 = array[i]; if ((Object)(object)((Volume)((obj2 is Volume) ? obj2 : null)).sharedProfile == (Object)null) { Object obj3 = array[i]; ((Volume)((obj3 is Volume) ? obj3 : null)).sharedProfile = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<VolumeProfile>("Assets/Mods/LethalExpansion/Sky and Fog Global Volume Profile.asset"); } } waitForSession().GetAwaiter(); isInGame = true; } if (((Scene)(ref scene)).name.StartsWith("Level")) { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } dungeonGeneratorReady = true; if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item.Key); Log.LogInfo(item.Value); Log.LogInfo(item.DefaultValue); Log.LogInfo((object)item.Sync); } } } if (!(((Scene)(ref scene)).name == "InitSceneLaunchOptions") || !isInGame) { return; } if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val6 in rootGameObjects) { val6.SetActive(false); } if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item2 in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item2.Key); Log.LogInfo(item2.Value); Log.LogInfo(item2.DefaultValue); Log.LogInfo((object)item2.Sync); } } if (ConfigManager.Instance.FindItemValue<bool>("LegacyMoonLoading")) { LoadCustomMoon(scene).RunSynchronously(); } else { LoadCustomMoon(scene).GetAwaiter(); } } private async Task LoadCustomMoon(Scene scene) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) await Task.Delay(400); try { if ((Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab != (Object)null && (Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform != (Object)null) { CheckRiskyComponents(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform, Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MoonName); GameObject mainPrefab = Object.Instantiate<GameObject>(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab); currentWaterSurface = mainPrefab.transform.Find("Environment/Water"); if ((Object)(object)mainPrefab != (Object)null) { SceneManager.MoveGameObjectToScene(mainPrefab, scene); Transform DiageticBackground = mainPrefab.transform.Find("Systems/Audio/DiageticBackground"); if ((Object)(object)DiageticBackground != (Object)null) { ((Component)DiageticBackground).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Terrain[] Terrains = mainPrefab.GetComponentsInChildren<Terrain>(); if (Terrains != null && Terrains.Length != 0) { Terrain[] array = Terrains; foreach (Terrain terrain in array) { terrain.drawInstanced = true; } } } } string[] _tmp = new string[5] { "MapPropsContainer", "OutsideAINode", "SpawnDenialPoint", "ItemShipLandingNode", "OutsideLevelNavMesh" }; string[] array2 = _tmp; foreach (string s in array2) { if ((Object)(object)GameObject.FindGameObjectWithTag(s) == (Object)null || GameObject.FindGameObjectsWithTag(s).Any(delegate(GameObject o) { //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) Scene scene2 = o.scene; return ((Scene)(ref scene2)).name != "InitSceneLaunchOptions"; })) { GameObject obj = new GameObject(); ((Object)obj).name = s; obj.tag = s; obj.transform.position = new Vector3(0f, -200f, 0f); SceneManager.MoveGameObjectToScene(obj, scene); } } await Task.Delay(200); GameObject DropShip = GameObject.Find("ItemShipAnimContainer"); if ((Object)(object)DropShip != (Object)null) { Transform ItemShip = DropShip.transform.Find("ItemShip"); if ((Object)(object)ItemShip != (Object)null) { ((Component)ItemShip).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicClose = DropShip.transform.Find("ItemShip/Music"); if ((Object)(object)ItemShipMusicClose != (Object)null) { ((Component)ItemShipMusicClose).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicFar = DropShip.transform.Find("ItemShip/Music/Music (1)"); if ((Object)(object)ItemShipMusicFar != (Object)null) { ((Component)ItemShipMusicFar).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } } await Task.Delay(200); RuntimeDungeon runtimeDungeon2 = Object.FindObjectOfType<RuntimeDungeon>(false); if ((Object)(object)runtimeDungeon2 == (Object)null) { GameObject dungeonGenerator = new GameObject(); ((Object)dungeonGenerator).name = "DungeonGenerator"; dungeonGenerator.tag = "DungeonGenerator"; dungeonGenerator.transform.position = new Vector3(0f, -200f, 0f); runtimeDungeon2 = dungeonGenerator.AddComponent<RuntimeDungeon>(); runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; runtimeDungeon2.Generator.LengthMultiplier = 0.8f; runtimeDungeon2.Generator.PauseBetweenRooms = 0.2f; runtimeDungeon2.GenerateOnStart = false; runtimeDungeon2.Root = dungeonGenerator; runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter dungeonNavMesh = dungeonGenerator.AddComponent<UnityNavMeshAdapter>(); dungeonNavMesh.BakeMode = (RuntimeNavMeshBakeMode)3; dungeonNavMesh.LayerMask = LayerMask.op_Implicit(35072); SceneManager.MoveGameObjectToScene(dungeonGenerator, scene); } else if ((Object)(object)runtimeDungeon2.Generator.DungeonFlow == (Object)null) { runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; } dungeonGeneratorReady = true; GameObject OutOfBounds = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)OutOfBounds).name = "OutOfBounds"; OutOfBounds.layer = 13; OutOfBounds.transform.position = new Vector3(0f, -300f, 0f); OutOfBounds.transform.localScale = new Vector3(1000f, 5f, 1000f); BoxCollider boxCollider = OutOfBounds.GetComponent<BoxCollider>(); ((Collider)boxCollider).isTrigger = true; OutOfBounds.AddComponent<OutOfBoundsTrigger>(); Rigidbody rigidbody = OutOfBounds.AddComponent<Rigidbody>(); rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.collisionDetectionMode = (CollisionDetectionMode)1; SceneManager.MoveGameObjectToScene(OutOfBounds, scene); await Task.Delay(200); } catch (Exception ex2) { Exception ex = ex2; Log.LogError((object)ex); } } private void CheckRiskyComponents(Transform root, string objname) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown try { Component[] components = ((Component)root).GetComponents<Component>(); Component[] array = components; foreach (Component component in array) { if (!ComponentWhitelists.mainWhitelist.Any((Type whitelistType) => ((object)component).GetType() == whitelistType)) { Log.LogWarning((object)(((object)component).GetType().Name + " component is not native of Unity or LethalSDK. It can contains malwares. From " + objname + ".")); } } foreach (Transform item in root) { Transform root2 = item; CheckRiskyComponents(root2, objname); } } catch (Exception ex) { Log.LogError((object)ex.Message); } } private void OnSceneUnloaded(Scene scene) { if (((Scene)(ref scene)).name.Length > 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Unloading scene: " + ((Scene)(ref scene)).name)); } if (((Scene)(ref scene)).name.StartsWith("Level") || ((Scene)(ref scene)).name == "CompanyBuilding" || (((Scene)(ref scene)).name == "InitSceneLaunchOptions" && isInGame)) { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(true); } if ((Object)(object)currentWaterSurface != (Object)null) { currentWaterSurface = null; } dungeonGeneratorReady = false; Terminal_Patch.ResetFireExitAmounts(); } } private async Task waitForSession() { while (sessionWaiting) { await Task.Delay(1000); } for (int i = 0; i < ConfigManager.Instance.GetAll().Count; i++) { if (ConfigManager.Instance.MustBeSync(i)) { ConfigManager.Instance.SetItemValue(i, ConfigManager.Instance.FindEntryValue(i)); } } bool patchGlobalTimeSpeedMultiplier = true; bool patchNumberOfHours = true; bool patchDeadlineDaysAmount = true; bool patchStartingQuota = true; bool patchStartingCredits = true; bool patchBaseIncrease = true; bool patchIncreaseSteepness = true; bool patchScrapValueMultiplier = true; bool patchScrapAmountMultiplier = true; bool patchMapSizeMultiplier = true; bool patchMaxShipItemCapacity = true; if (ConfigManager.Instance.FindItemValue<bool>("BrutalCompanyPlusCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BrutalCompanyPlus")) { patchDeadlineDaysAmount = false; patchStartingQuota = false; patchStartingCredits = false; patchBaseIncrease = false; patchIncreaseSteepness = false; } if (ConfigManager.Instance.FindItemValue<bool>("LethalAdjustmentsCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "LethalAdjustments")) { patchScrapValueMultiplier = false; patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (ConfigManager.Instance.FindItemValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")) { patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (ConfigManager.Instance.FindItemValue<bool>("MoreMoneyStartCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "299792458.MoreMoneyStart")) { patchStartingCredits = false; } if (ConfigManager.Instance.FindItemValue<bool>("ExtraDaysToDeadline") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "ExtraDaysToDeadline")) { patchDeadlineDaysAmount = false; } if (ConfigManager.Instance.FindItemValue<bool>("AdvancedCompanyCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "AdvancedCompany")) { patchGlobalTimeSpeedMultiplier = false; patchStartingCredits = false; patchScrapValueMultiplier = false; patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (patchGlobalTimeSpeedMultiplier) { TimeOfDay.Instance.globalTimeSpeedMultiplier = ConfigManager.Instance.FindItemValue<float>("GlobalTimeSpeedMultiplier"); } if (patchNumberOfHours) { TimeOfDay.Instance.numberOfHours = ConfigManager.Instance.FindItemValue<int>("NumberOfHours"); } if (patchDeadlineDaysAmount) { TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = ConfigManager.Instance.FindItemValue<int>("DeadlineDaysAmount"); } if (patchStartingQuota) { TimeOfDay.Instance.quotaVariables.startingQuota = ConfigManager.Instance.FindItemValue<int>("StartingQuota"); } if (patchStartingCredits) { TimeOfDay.Instance.quotaVariables.startingCredits = ConfigManager.Instance.FindItemValue<int>("StartingCredits"); } if (patchBaseIncrease) { TimeOfDay.Instance.quotaVariables.baseIncrease = ConfigManager.Instance.FindItemValue<int>("QuotaBaseIncrease"); } if (patchIncreaseSteepness) { TimeOfDay.Instance.quotaVariables.increaseSteepness = ConfigManager.Instance.FindItemValue<int>("QuotaIncreaseSteepness"); } if (patchScrapValueMultiplier) { RoundManager.Instance.scrapValueMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapValueMultiplier"); } if (patchScrapAmountMultiplier) { RoundManager.Instance.scrapAmountMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapAmountMultiplier"); } if (patchMapSizeMultiplier) { RoundManager.Instance.mapSizeMultiplier = ConfigManager.Instance.FindItemValue<float>("MapSizeMultiplier"); } if (patchMaxShipItemCapacity) { StartOfRound.Instance.maxShipItemCapacity = ConfigManager.Instance.FindItemValue<int>("MaxItemsInShip"); } if (!alreadypatched) { Terminal_Patch.MainPatch(GameObject.Find("TerminalScript").GetComponent<Terminal>()); alreadypatched = true; } if (!ishost) { while (!sessionWaiting && hostDataWaiting) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "hostconfig", string.Empty, 0L); await Task.Delay(3000); } Terminal_Patch.MainPatchPostConfig(GameObject.Find("TerminalScript").GetComponent<Terminal>()); } } private void ConfigSettingChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (val != null) { Log.LogInfo((object)$"{val.ChangedSetting.Definition.Key} Changed to {val.ChangedSetting.BoxedValue}"); } } } } namespace LethalExpansion.Utils { public class AssetBundlesManager { private static AssetBundlesManager _instance; public AssetBundle mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LethalExpansion.dll", "lethalexpansion.lem")); public Dictionary<string, (AssetBundle, ModManifest)> assetBundles = new Dictionary<string, (AssetBundle, ModManifest)>(); public readonly string[] forcedNative = new string[1] { "lethalexpansion" }; public DirectoryInfo modPath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location); public DirectoryInfo modDirectory; public DirectoryInfo pluginsDirectory; public static AssetBundlesManager Instance { get { if (_instance == null) { _instance = new AssetBundlesManager(); } return _instance; } } public (AssetBundle, ModManifest) Load(string name) { return assetBundles[name.ToLower()]; } public void LoadAllAssetBundles() { modDirectory = modPath.Parent; pluginsDirectory = modDirectory; while (pluginsDirectory != null && pluginsDirectory.Name != "plugins") { pluginsDirectory = pluginsDirectory.Parent; } if (pluginsDirectory != null) { LethalExpansion.Log.LogInfo((object)("Plugins folder found: " + pluginsDirectory.FullName)); LethalExpansion.Log.LogInfo((object)("Mod path is: " + modDirectory.FullName)); if (modDirectory.FullName == pluginsDirectory.FullName) { LethalExpansion.Log.LogWarning((object)("LethalExpansion is Rooting the Plugins folder, this is not recommended. " + modDirectory.FullName)); } string[] files = Directory.GetFiles(pluginsDirectory.FullName, "*.lem", SearchOption.AllDirectories); foreach (string text in files) { if (!LethalExpansion.loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "SpaceSunShine") || !(Path.GetFileNameWithoutExtension(text).ToLower() == "spacesunshine")) { LoadBundle(text); } else { LethalExpansion.Log.LogInfo((object)"SpaceSunShine mod is found, ignoring it's lem file."); } } } else { LethalExpansion.Log.LogWarning((object)"Mod is not in a plugins folder."); } } public void LoadBundle(string file) { if (forcedNative.Contains<string>(Path.GetFileNameWithoutExtension(file)) && !file.Contains(modDirectory.FullName)) { LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Asset Bundle name: " + Path.GetFileNameWithoutExtension(file) + " at: " + file + ".")); } else { if (!(Path.GetFileName(file) != "lethalexpansion.lem")) { return; } if (!assetBundles.ContainsKey(Path.GetFileNameWithoutExtension(file))) { Stopwatch stopwatch = new Stopwatch(); AssetBundle val = null; try { stopwatch.Start(); val = AssetBundle.LoadFromFile(file); stopwatch.Stop(); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); } if ((Object)(object)val != (Object)null) { string text = "Assets/Mods/" + Path.GetFileNameWithoutExtension(file) + "/ModManifest.asset"; ModManifest modManifest = val.LoadAsset<ModManifest>(text); if ((Object)(object)modManifest != (Object)null) { if (forcedNative.Contains(modManifest.modName.ToLower()) && !file.Contains(modDirectory.FullName)) { LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Mod name: " + modManifest.modName)); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } else if (!assetBundles.Any((KeyValuePair<string, (AssetBundle, ModManifest)> b) => b.Value.Item2.modName == modManifest.modName)) { LethalExpansion.Log.LogInfo((object)string.Format("Module found: {0} v{1} Loaded in {2}ms", modManifest.modName, (modManifest.GetVersion() != null) ? ((object)modManifest.GetVersion()).ToString() : "0.0.0.0", stopwatch.ElapsedMilliseconds)); if (modManifest.GetVersion() == null || ((object)modManifest.GetVersion()).ToString() == "0.0.0.0") { LethalExpansion.Log.LogWarning((object)("Module " + modManifest.modName + " have no version number, this is unsafe!")); } assetBundles.Add(Path.GetFileNameWithoutExtension(file).ToLower(), (val, modManifest)); } else { LethalExpansion.Log.LogWarning((object)("Another mod with same name is already loaded: " + modManifest.modName)); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle have no ModManifest: " + Path.GetFileName(file))); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("File is not an AssetBundle: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle with same name already loaded: " + Path.GetFileName(file))); } } } public bool BundleLoaded(string bundleName) { return assetBundles.ContainsKey(bundleName.ToLower()); } public bool BundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (!assetBundles.ContainsKey(text.ToLower())) { return false; } } return true; } public bool IncompatibleBundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (assetBundles.ContainsKey(text.ToLower())) { return true; } } return false; } } public class AssetGather { private static AssetGather _instance; public Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public Dictionary<string, GameObject> planetPrefabs = new Dictionary<string, GameObject>(); public Dictionary<string, GameObject> mapObjects = new Dictionary<string, GameObject>(); public Dictionary<string, SpawnableOutsideObject> outsideObjects = new Dictionary<string, SpawnableOutsideObject>(); public Dictionary<string, Item> scraps = new Dictionary<string, Item>(); public Dictionary<string, LevelAmbienceLibrary> levelAmbiances = new Dictionary<string, LevelAmbienceLibrary>(); public Dictionary<string, EnemyType> enemies = new Dictionary<string, EnemyType>(); public Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); public static AssetGather Instance { get { if (_instance == null) { _instance = new AssetGather(); } return _instance; } } public void GetList() { LethalExpansion.Log.LogInfo((object)"===Audio Clips==="); foreach (KeyValuePair<string, AudioClip> audioClip in audioClips) { LethalExpansion.Log.LogInfo((object)audioClip.Key); } LethalExpansion.Log.LogInfo((object)"===Audio Mixers==="); foreach (KeyValuePair<string, (AudioMixer, AudioMixerGroup[])> audioMixer in audioMixers) { LethalExpansion.Log.LogInfo((object)audioMixer.Key); } LethalExpansion.Log.LogInfo((object)"===Planet Prefabs==="); foreach (KeyValuePair<string, GameObject> planetPrefab in planetPrefabs) { LethalExpansion.Log.LogInfo((object)planetPrefab.Key); } LethalExpansion.Log.LogInfo((object)"===Map Objects==="); foreach (KeyValuePair<string, GameObject> mapObject in mapObjects) { LethalExpansion.Log.LogInfo((object)mapObject.Key); } LethalExpansion.Log.LogInfo((object)"===Outside Objects==="); foreach (KeyValuePair<string, SpawnableOutsideObject> outsideObject in outsideObjects) { LethalExpansion.Log.LogInfo((object)outsideObject.Key); } LethalExpansion.Log.LogInfo((object)"===Scraps==="); foreach (KeyValuePair<string, Item> scrap in scraps) { LethalExpansion.Log.LogInfo((object)scrap.Key); } LethalExpansion.Log.LogInfo((object)"===Level Ambiances==="); foreach (KeyValuePair<string, LevelAmbienceLibrary> levelAmbiance in levelAmbiances) { LethalExpansion.Log.LogInfo((object)levelAmbiance.Key); } LethalExpansion.Log.LogInfo((object)"===Enemies==="); foreach (KeyValuePair<string, EnemyType> enemy in enemies) { LethalExpansion.Log.LogInfo((object)enemy.Key); } LethalExpansion.Log.LogInfo((object)"===Sprites==="); foreach (KeyValuePair<string, Sprite> sprite in sprites) { LethalExpansion.Log.LogInfo((object)sprite.Key); } } public void AddAudioClip(AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(((Object)clip).name) && !audioClips.ContainsValue(clip)) { audioClips.Add(((Object)clip).name, clip); } } public void AddAudioClip(string name, AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(name) && !audioClips.ContainsValue(clip)) { audioClips.Add(name, clip); } } public void AddAudioClip(AudioClip[] clips) { foreach (AudioClip val in clips) { if ((Object)(object)val != (Object)null && !audioClips.ContainsKey(((Object)val).name) && !audioClips.ContainsValue(val)) { audioClips.Add(((Object)val).name, val); } } } public void AddAudioClip(string[] names, AudioClip[] clips) { for (int i = 0; i < clips.Length && i < names.Length; i++) { if ((Object)(object)clips[i] != (Object)null && !audioClips.ContainsKey(names[i]) && !audioClips.ContainsValue(clips[i])) { audioClips.Add(names[i], clips[i]); } } } public void AddAudioMixer(AudioMixer mixer) { if (!((Object)(object)mixer != (Object)null) || audioMixers.ContainsKey(((Object)mixer).name)) { return; } List<AudioMixerGroup> list = new List<AudioMixerGroup>(); AudioMixerGroup[] array = mixer.FindMatchingGroups(string.Empty); foreach (AudioMixerGroup val in array) { if ((Object)(object)val != (Object)null && !list.Contains(val)) { list.Add(val); } } audioMixers.Add(((Object)mixer).name, (mixer, list.ToArray())); } public void AddPlanetPrefabs(GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(((Object)prefab).name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(((Object)prefab).name, prefab); } } public void AddPlanetPrefabs(string name, GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(name, prefab); } } public void AddMapObjects(GameObject mapObject) { if ((Object)(object)mapObject != (Object)null && !mapObjects.ContainsKey(((Object)mapObject).name) && !mapObjects.ContainsValue(mapObject)) { mapObjects.Add(((Object)mapObject).name, mapObject); } } public void AddOutsideObject(SpawnableOutsideObject outsideObject) { if ((Object)(object)outsideObject != (Object)null && !outsideObjects.ContainsKey(((Object)outsideObject).name) && !outsideObjects.ContainsValue(outsideObject)) { outsideObjects.Add(((Object)outsideObject).name, outsideObject); } } public void AddScrap(Item scrap) { if ((Object)(object)scrap != (Object)null && !scraps.ContainsKey(((Object)scrap).name) && !scraps.ContainsValue(scrap)) { scraps.Add(((Object)scrap).name, scrap); } } public void AddLevelAmbiances(LevelAmbienceLibrary levelAmbiance) { if ((Object)(object)levelAmbiance != (Object)null && !levelAmbiances.ContainsKey(((Object)levelAmbiance).name) && !levelAmbiances.ContainsValue(levelAmbiance)) { levelAmbiances.Add(((Object)levelAmbiance).name, levelAmbiance); } } public void AddEnemies(EnemyType enemie) { if ((Object)(object)enemie != (Object)null && !enemies.ContainsKey(((Object)enemie).name) && !enemies.ContainsValue(enemie)) { enemies.Add(((Object)enemie).name, enemie); } } public void AddSprites(Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(((Object)sprite).name) && !sprites.ContainsValue(sprite)) { sprites.Add(((Object)sprite).name, sprite); } } public void AddSprites(string name, Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(name) && !sprites.ContainsValue(sprite)) { sprites.Add(name, sprite); } } } public class ChatMessageProcessor { public static bool ProcessMessage(string message) { if (Regex.IsMatch(message, "^\\[sync\\].*\\[sync\\]$")) { try { string value = Regex.Match(message, "^\\[sync\\](.*)\\[sync\\]$").Groups[1].Value; string[] array = value.Split('|'); if (array.Length == 3) { NetworkPacketManager.packetType packetType = (NetworkPacketManager.packetType)int.Parse(array[0]); string[] array2 = array[1].Split('>'); ulong num = ulong.Parse(array2[0]); long num2 = long.Parse(array2[1]); string[] array3 = array[2].Split('='); string header = array3[0]; string packet = array3[1]; if (num2 == -1 || num2 == (long)((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId) { if (num != 0) { NetworkPacketManager.Instance.CancelTimeout((long)num); } LethalExpansion.Log.LogInfo((object)message); switch (packetType) { case NetworkPacketManager.packetType.request: ProcessRequest(num, header, packet); break; case NetworkPacketManager.packetType.data: ProcessData(num, header, packet); break; case NetworkPacketManager.packetType.other: LethalExpansion.Log.LogInfo((object)"Unsupported type."); break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized type."); break; } } } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); return false; } } return false; } private static void ProcessRequest(ulong sender, string header, string packet) { try { switch (header) { case "clientinfo": { if (LethalExpansion.ishost || sender != 0) { break; } string text2 = LethalExpansion.ModVersion.ToString() + "$"; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text2 = text2 + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } if (text2.EndsWith('&')) { text2 = text2.Remove(text2.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "clientinfo", text2, 0L); break; } case "hostconfig": if (LethalExpansion.ishost && sender != 0) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "clientinfo", string.Empty, (long)sender); } break; case "hostweathers": if (LethalExpansion.ishost && sender != 0L && LethalExpansion.weathersReadyToShare) { string text3 = string.Empty; int[] currentWeathers = StartOfRound_Patch.currentWeathers; foreach (int num2 in currentWeathers) { text3 = text3 + num2 + "&"; } if (text3.EndsWith('&')) { text3 = text3.Remove(text3.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostweathers", text3, (long)sender, waitForAnswer: false); } break; case "networkobjectdata": { if (!LethalExpansion.ishost || sender == 0) { break; } string text = string.Empty; if (packet.Length > 0 && packet.Contains(',')) { try { ulong[] array = Array.ConvertAll(packet.Split(','), ulong.Parse); ulong[] array2 = array; foreach (ulong num in array2) { text += $"{num}${NetworkDataManager.NetworkData[num].serializedData}&"; } if (text.EndsWith('&')) { text = text.Remove(text.Length - 1); } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); text = "error"; } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "networkobjectdata", text, (long)sender, waitForAnswer: false); } else { LethalExpansion.Log.LogError((object)"networkobjectdata packet error"); text = "packet error"; } break; } default: LethalExpansion.Log.LogInfo((object)"Unrecognized command."); break; } } catch (Exception ex2) { LethalExpansion.Log.LogError((object)ex2); } } private static void ProcessData(ulong sender, string header, string packet) { //IL_050b: Unknown result type (might be due to invalid IL or missing references) try { switch (header) { case "clientinfo": { if (!LethalExpansion.ishost || sender == 0) { break; } string[] array2 = ((!packet.Contains('$')) ? new string[1] { packet } : packet.Split('$')); string text = string.Empty; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text = text + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } if (text.Length > 0 && text.EndsWith('&')) { text = text.Remove(text.Length - 1); } if (array2[0] != LethalExpansion.ModVersion.ToString()) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong version."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong version.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } if (array2.Length > 1 && array2[1] != text) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong bundles."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong bundles.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } string text2 = string.Empty; foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { switch (item.type.Name) { case "Int32": text2 = text2 + "i" + ((int)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Single": text2 = text2 + "f" + ((float)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Boolean": text2 = text2 + "b" + (bool)item.Value; break; case "String": text2 = text2 + "s" + item; break; } text2 += "&"; } if (text2.EndsWith('&')) { text2 = text2.Remove(text2.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostconfig", text2, (long)sender); break; } case "hostconfig": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array6 = packet.Split('&'); LethalExpansion.Log.LogInfo((object)("Received host config: " + packet)); for (int k = 0; k < array6.Length; k++) { if (k < ConfigManager.Instance.GetCount() && ConfigManager.Instance.MustBeSync(k)) { ConfigManager.Instance.SetItemValue(k, array6[k].Substring(1), array6[k][0]); } } LethalExpansion.hostDataWaiting = false; LethalExpansion.Log.LogInfo((object)"Updated config"); break; } case "hostweathers": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array = packet.Split('&'); LethalExpansion.Log.LogInfo((object)("Received host weathers: " + packet)); StartOfRound_Patch.currentWeathers = new int[array.Length]; for (int i = 0; i < array.Length; i++) { int result = 0; if (int.TryParse(array[i], out result)) { StartOfRound_Patch.currentWeathers[i] = result; StartOfRound.Instance.levels[i].currentWeather = (LevelWeatherType)result; } } break; } case "networkobjectdata": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array3 = ((!packet.Contains('&')) ? new string[1] { packet } : packet.Split('&')); try { string[] array4 = array3; foreach (string text3 in array4) { if (text3.Contains('$')) { string[] array5 = text3.Split('$'); ulong result2 = 0uL; if (array5.Length >= 2 && ulong.TryParse(array5[0], out result2) && array5[1].Contains(',')) { NetworkDataManager.NetworkData[result2].serializedData = array5[1]; LethalExpansion.Log.LogDebug((object)("networkobjectdata: " + array5[0] + " data received " + array5[1])); } else { LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet)); } } else { LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet)); } } break; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); break; } } case "kickreason": if (!LethalExpansion.ishost && sender == 0) { LethalExpansion.lastKickReason = packet; } break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized property."); break; } } catch (Exception ex2) { LethalExpansion.Log.LogError((object)ex2); } } } public class ComponentWhitelists { public static List<Type> mainWhitelist = new List<Type> { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkinnedMeshRenderer), typeof(MeshCollider), typeof(BoxCollider), typeof(SphereCollider), typeof(CapsuleCollider), typeof(TerrainCollider), typeof(WheelCollider), typeof(ArticulationBody), typeof(ConstantForce), typeof(ConfigurableJoint), typeof(FixedJoint), typeof(HingeJoint), typeof(Cloth), typeof(Rigidbody), typeof(NetworkObject), typeof(NetworkRigidbody), typeof(NetworkTransform), typeof(NetworkAnimator), typeof(Animator), typeof(Animation), typeof(Terrain), typeof(Tree), typeof(WindZone), typeof(DecalProjector), typeof(LODGroup), typeof(Light), typeof(HDAdditionalLightData), typeof(LightProbeGroup), typeof(LightProbeProxyVolume), typeof(LocalVolumetricFog), typeof(OcclusionArea), typeof(OcclusionPortal), typeof(ReflectionProbe), typeof(PlanarReflectionProbe), typeof(HDAdditionalReflectionData), typeof(Skybox), typeof(SortingGroup), typeof(SpriteRenderer), typeof(Volume), typeof(AudioSource), typeof(AudioReverbZone), typeof(AudioReverbFilter), typeof(AudioChorusFilter), typeof(AudioDistortionFilter), typeof(AudioEchoFilter), typeof(AudioHighPassFilter), typeof(AudioLowPassFilter), typeof(AudioListener), typeof(LensFlare), typeof(TrailRenderer), typeof(LineRenderer), typeof(ParticleSystem), typeof(ParticleSystemRenderer), typeof(ParticleSystemForceField), typeof(Projector), typeof(VideoPlayer), typeof(NavMeshSurface), typeof(NavMeshModifier), typeof(NavMeshModifierVolume), typeof(NavMeshLink), typeof(NavMeshObstacle), typeof(OffMeshLink), typeof(SI_AudioReverbPresets), typeof(SI_AudioReverbTrigger), typeof(SI_DungeonGenerator), typeof(SI_MatchLocalPlayerPosition), typeof(SI_AnimatedSun), typeof(SI_EntranceTeleport), typeof(SI_ScanNode), typeof(SI_DoorLock), typeof(SI_WaterSurface), typeof(SI_Ladder), typeof(SI_ItemDropship), typeof(SI_NetworkPrefabInstancier), typeof(SI_InteractTrigger), typeof(SI_DamagePlayer), typeof(SI_SoundYDistance), typeof(SI_AudioOutputInterface), typeof(SI_NetworkDataInterfacing), typeof(SI_NetworkData), typeof(TerrainChecker), typeof(PlayerShip) }; } public class ConfigManager { private static ConfigManager _instance; private List<ConfigItem> items = new List<ConfigItem>(); private List<ConfigEntryBase> entries = new List<ConfigEntryBase>(); public static ConfigManager Instance { get { if (_instance == null) { _instance = new ConfigManager(); } return _instance; } } public void AddItem(ConfigItem item) { try { items.Add(item); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public void ReadConfig() { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown items = (from item in items orderby item.Tab, item.Key select item).ToList(); try { for (int i = 0; i < items.Count; i++) { if (!items[i].Hidden) { string description = items[i].Description; description = description + "\nNetwork synchronization: " + (items[i].Sync ? "Yes" : "No"); description = description + "\nMod required by clients: " + (items[i].Optional ? "No" : "Yes"); switch (items[i].type.Name) { case "Int32": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<int>(items[i].Tab, items[i].Key, (int)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>((int)items[i].MinValue, (int)items[i].MaxValue), Array.Empty<object>()))); break; case "Single": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<float>(items[i].Tab, items[i].Key, (float)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>((float)items[i].MinValue, (float)items[i].MaxValue), Array.Empty<object>()))); break; case "Boolean": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<bool>(items[i].Tab, items[i].Key, (bool)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; case "String": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<string>(items[i].Tab, items[i].Key, (string)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; } if (!items[i].Sync) { items[i].Value = entries.Last().BoxedValue; } } else { entries.Add(null); } } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public object FindItemValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindItemValue(int index) { try { return items[index].Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(string key) { try { return entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(int index) { try { return entries[index].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool RequireRestart(string key) { try { return items.First((ConfigItem item) => item.Key == key).RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool RequireRestart(int index) { try { return items[index].RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public string FindDescription(string key) { try { return items.First((ConfigItem item) => item.Key == key).Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public string FindDescription(int index) { try { return items[index].Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public (bool, bool) FindNetInfo(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); return (configItem.Sync, configItem.Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public (bool, bool) FindNetInfo(int index) { try { return (items[index].Sync, items[index].Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public object FindDefaultValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindDefaultValue(int index) { try { return items[index].DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool MustBeSync(string key) { try { return items.First((ConfigItem item) => item.Key == key).Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool MustBeSync(int index) { try { return items[index].Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool SetItemValue(string key, object value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!items.First((ConfigItem item) => item.Key == key).RequireRestart) { try { configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(string key, object value) { try { entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue(int index, string value, char type) { if (!items[index].RequireRestart) { try { switch (type) { case 'i': items[index].Value = int.Parse(value, CultureInfo.InvariantCulture); break; case 'f': items[index].Value = float.Parse(value, CultureInfo.InvariantCulture); break; case 'b': items[index].Value = bool.Parse(value); break; case 's': items[index].Value = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(int index, string value, char type) { try { switch (type) { case 'i': entries[index].BoxedValue = int.Parse(value); break; case 'f': entries[index].BoxedValue = float.Parse(value); break; case 'b': entries[index].BoxedValue = bool.Parse(value); break; case 's': entries[index].BoxedValue = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (object, int) FindValueAndIndex(string key) { try { return (items.First((ConfigItem item) => item.Key == key).Value, items.FindIndex((ConfigItem item) => item.Key == key)); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (null, -1); } } public int FindIndex(string key) { try { return items.FindIndex((ConfigItem item) => item.Key == key); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public T FindItemValue<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindItemValue<T>(int index) { try { ConfigItem configItem = items[index]; if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(string key) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(int index) { try { ConfigEntryBase val = entries[index]; if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool SetItemValue<T>(string key, T value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!configItem.RequireRestart) { try { if (configItem == null || !(configItem.Value is T)) { LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(string key, T value) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { val.BoxedValue = value; return true; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue<T>(int index, T value) { if (!items[index].RequireRestart) { try { items[index].Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(int index, T value) { try { entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (T, int) FindValueAndIndex<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return ((T)configItem.Value, items.FindIndex((ConfigItem item) => item.Key == key)); } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (default(T), -1); } } public List<ConfigItem> GetAll() { try { return items; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public int GetCount() { try { return items.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public int GetEntriesCount() { try { return entries.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public object ReadConfigValue(string key) { try { return entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public T ReadConfigValue<T>(string key) { try { return (T)entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool WriteConfigValue(string key, object value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool WriteConfigValue<T>(string key, T value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } } public static class ModUtils { public static T[] RemoveElementFromArray<T>(T[] originalArray, int indexToRemove) { if (indexToRemove < 0 || indexToRemove >= originalArray.Length) { throw new ArgumentOutOfRangeException("indexToRemove"); } T[] array = new T[originalArray.Length - 1]; int i = 0; int num = 0; for (; i < originalArray.Length; i++) { if (i != indexToRemove) { array[num] = originalArray[i]; num++; } } return array; } } public class NetworkPacketManager { public enum packetType { request = 0, data = 1, other = -1 } private static NetworkPacketManager _instance; private ConcurrentDictionary<long, CancellationTokenSource> timeoutDictionary = new ConcurrentDictionary<long, CancellationTokenSource>(); public static NetworkPacketManager Instance { get { if (_instance == null) { _instance = new NetworkPacketManager(); } return _instance; } } private NetworkPacketManager() { } public void sendPacket(packetType type, string header, string packet, long destination = -1L, bool waitForAnswer = true) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{destination}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(destination); } } public void sendPacket(packetType type, string header, string packet, long[] destinations, bool waitForAnswer = true) { for (int i = 0; i < destinations.Length; i++) { int num = (int)destinations[i]; if (num != -1) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{num}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(num); } } } } public void StartTimeout(long id) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); if (!timeoutDictionary.TryAdd(id, cancellationTokenSource)) { return; } Task.Run(async delegate { try { await PacketTimeout(id, cancellationTokenSource.Token); } catch (OperationCanceledException) { } finally { timeoutDictionary.TryRemove(id, out var _); } }); } public void CancelTimeout(long id) { if (timeoutDictionary.TryRemove(id, out var value)) { value.Cancel(); } } private async Task PacketTimeout(long id, CancellationToken token) { await Task.Delay(5000, token); if (token.IsCancellationRequested) { } } } public class PopupManager { private static PopupManager _instance; private List<PopupObject> popups = new List<PopupObject>(); public static PopupManager Instance { get { if (_instance == null) { _instance = new PopupManager(); } return _instance; } } private PopupManager() { } public void InstantiatePopup(Scene sceneFocus, string title = "Popup", string content = "", string button1 = "Ok", string button2 = "Cancel", UnityAction button1Action = null, UnityAction button2Action = null, int titlesize = 24, int contentsize = 24, int button1size = 24, int button2size = 24) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) /
plugins/LethalLevelLoader.dll
Decompiled 9 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader.NetcodePatcher; using LethalLevelLoader.Tools; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("LethalLevelLoader")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A Custom API to support the manual and dynamic integration of custom levels and dungeons in Lethal Company.")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+99e1e0f233232ae52ea829f2f29e91ba47ab5680")] [assembly: AssemblyProduct("LethalLevelLoader")] [assembly: AssemblyTitle("LethalLevelLoader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public enum ContentType { Vanilla, Custom, Any } internal static class HookHelper { public class DisposableHookCollection { private List<ILHook> ilHooks = new List<ILHook>(); private List<Hook> hooks = new List<Hook>(); public void Clear() { foreach (Hook hook in hooks) { hook.Dispose(); } hooks.Clear(); foreach (ILHook ilHook in ilHooks) { ilHook.Dispose(); } ilHooks.Clear(); } public void ILHook<T>(string methodName, Manipulator to, Type[] parameters = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ilHooks.Add(new ILHook((MethodBase)EzGetMethod<T>(methodName, parameters), to)); } public void Hook<T>(string methodName, Delegate to, Type[] parameters = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown hooks.Add(new Hook((MethodBase)EzGetMethod<T>(methodName, parameters), to)); } } public static MethodInfo methodof(Delegate method) { return method.Method; } public static MethodInfo EzGetMethod(Type type, string name, Type[] parameters = null) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (parameters == null) { return type.GetMethod(name, bindingAttr); } return type.GetMethod(name, bindingAttr, null, parameters, null); } public static MethodInfo EzGetMethod<T>(string name, Type[] parameters = null) { return EzGetMethod(typeof(T), name, parameters); } } public static class NetworkScenePatcher { [CompilerGenerated] private static class <>O { public static Action<Action<NetworkSceneManager>, NetworkSceneManager> <0>__GenerateScenesInBuild_Hook; public static Func<Func<NetworkSceneManager, uint, string>, NetworkSceneManager, uint, string> <1>__SceneNameFromHash_Hook; public static Func<Func<NetworkSceneManager, int, string, LoadSceneMode, bool>, NetworkSceneManager, int, string, LoadSceneMode, bool> <2>__ValidateSceneBeforeLoading_Hook; public static Manipulator <3>__ReplaceBuildIndexByScenePath; public static Manipulator <4>__ReplaceScenePathByBuildIndex; public static Func<int, string> <5>__GetScenePathByBuildIndex; public static Func<string, int> <6>__GetBuildIndexByScenePath; } private static List<string> scenePaths = new List<string>(); private static Dictionary<string, int> scenePathToBuildIndex = new Dictionary<string, int>(); private static Dictionary<int, string> buildIndexToScenePath = new Dictionary<int, string>(); private static Dictionary<uint, string> sceneHashToScenePath = new Dictionary<uint, string>(); private static HookHelper.DisposableHookCollection hooks = new HookHelper.DisposableHookCollection(); internal static bool patched { get; private set; } public static void AddScenePath(string scenePath) { if (scenePaths.Contains(scenePath)) { Debug.LogError((object)("Can not add scene path " + scenePath + " to the network scene patcher! (already exists in scene paths list)")); } else { scenePaths.Add(scenePath); } } internal static void Patch() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_010c: 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) //IL_0117: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown if (!patched) { patched = true; hooks.Hook<NetworkSceneManager>("GenerateScenesInBuild", new Action<Action<NetworkSceneManager>, NetworkSceneManager>(GenerateScenesInBuild_Hook)); hooks.Hook<NetworkSceneManager>("SceneNameFromHash", new Func<Func<NetworkSceneManager, uint, string>, NetworkSceneManager, uint, string>(SceneNameFromHash_Hook)); hooks.Hook<NetworkSceneManager>("ValidateSceneBeforeLoading", new Func<Func<NetworkSceneManager, int, string, LoadSceneMode, bool>, NetworkSceneManager, int, string, LoadSceneMode, bool>(ValidateSceneBeforeLoading_Hook), new Type[3] { typeof(int), typeof(string), typeof(LoadSceneMode) }); HookHelper.DisposableHookCollection disposableHookCollection = hooks; object obj = <>O.<3>__ReplaceBuildIndexByScenePath; if (obj == null) { Manipulator val = ReplaceBuildIndexByScenePath; <>O.<3>__ReplaceBuildIndexByScenePath = val; obj = (object)val; } disposableHookCollection.ILHook<NetworkSceneManager>("SceneHashFromNameOrPath", (Manipulator)obj); HookHelper.DisposableHookCollection disposableHookCollection2 = hooks; object obj2 = <>O.<3>__ReplaceBuildIndexByScenePath; if (obj2 == null) { Manipulator val2 = ReplaceBuildIndexByScenePath; <>O.<3>__ReplaceBuildIndexByScenePath = val2; obj2 = (object)val2; } disposableHookCollection2.ILHook<NetworkSceneManager>("ValidateSceneEvent", (Manipulator)obj2); HookHelper.DisposableHookCollection disposableHookCollection3 = hooks; object obj3 = <>O.<4>__ReplaceScenePathByBuildIndex; if (obj3 == null) { Manipulator val3 = ReplaceScenePathByBuildIndex; <>O.<4>__ReplaceScenePathByBuildIndex = val3; obj3 = (object)val3; } disposableHookCollection3.ILHook<NetworkSceneManager>("ScenePathFromHash", (Manipulator)obj3); } } internal static void Unpatch() { if (patched) { patched = false; hooks.Clear(); } } private static void ReplaceScenePathByBuildIndex(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo methodInfo = HookHelper.methodof(new Func<int, string>(GetScenePathByBuildIndex)); while (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, typeof(SceneUtility), "GetScenePathByBuildIndex") })) { val.Remove(); val.Emit(OpCodes.Call, (MethodBase)methodInfo); } } private static void ReplaceBuildIndexByScenePath(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo methodInfo = HookHelper.methodof(new Func<string, int>(GetBuildIndexByScenePath)); while (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, typeof(SceneUtility), "GetBuildIndexByScenePath") })) { val.Remove(); val.Emit(OpCodes.Call, (MethodBase)methodInfo); } } private static string GetScenePathByBuildIndex(int buildIndex) { if (buildIndexToScenePath.ContainsKey(buildIndex)) { return buildIndexToScenePath[buildIndex]; } return SceneUtility.GetScenePathByBuildIndex(buildIndex); } private static int GetBuildIndexByScenePath(string scenePath) { int num = SceneUtility.GetBuildIndexByScenePath(scenePath); if (num == -1 && scenePathToBuildIndex.ContainsKey(scenePath)) { num = scenePathToBuildIndex[scenePath]; } return num; } private static void GenerateScenesInBuild_Hook(Action<NetworkSceneManager> orig, NetworkSceneManager self) { scenePathToBuildIndex.Clear(); buildIndexToScenePath.Clear(); sceneHashToScenePath.Clear(); orig(self); int sceneCountInBuildSettings = SceneManager.sceneCountInBuildSettings; for (int i = 0; i < scenePaths.Count; i++) { int num = sceneCountInBuildSettings + i; string text = scenePaths[i]; uint num2 = XXHash.Hash32(text); self.HashToBuildIndex.Add(num2, num); self.BuildIndexToHash.Add(num, num2); scenePathToBuildIndex.Add(text, num); buildIndexToScenePath.Add(num, text); sceneHashToScenePath.Add(num2, text); Debug.Log((object)("Added modded scene path: " + text)); } } private static string SceneNameFromHash_Hook(Func<NetworkSceneManager, uint, string> orig, NetworkSceneManager self, uint sceneHash) { if (sceneHash == 0) { return "No Scene"; } if (sceneHashToScenePath.ContainsKey(sceneHash)) { return sceneHashToScenePath[sceneHash]; } return orig(self, sceneHash); } private static bool ValidateSceneBeforeLoading_Hook(Func<NetworkSceneManager, int, string, LoadSceneMode, bool> orig, NetworkSceneManager self, int sceneIndex, string sceneName, LoadSceneMode loadSceneMode) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Debug.LogWarning((object)(orig(self, sceneIndex, sceneName, loadSceneMode) ? ("Validation check success for scene: " + sceneName) : ("Bypassed validation check for scene " + sceneName))); return true; } } namespace LethalLevelLoader { [CreateAssetMenu(menuName = "LethalLevelLoader/ExtendedDungeonFlow")] public class ExtendedDungeonFlow : ScriptableObject { [Header("Extended DungeonFlow Settings")] public string contentSourceName = string.Empty; [Space(5f)] public string dungeonDisplayName = string.Empty; [Space(5f)] public DungeonFlow dungeonFlow; [Space(5f)] public AudioClip dungeonFirstTimeAudio; [Space(10f)] [Header("Dynamic DungeonFlow Injections Settings")] public List<StringWithRarity> dynamicLevelTagsList = new List<StringWithRarity>(); [Space(5f)] public List<Vector2WithRarity> dynamicRoutePricesList = new List<Vector2WithRarity>(); [Space(5f)] public List<StringWithRarity> dynamicCurrentWeatherList = new List<StringWithRarity>(); [Space(5f)] public List<StringWithRarity> manualPlanetNameReferenceList = new List<StringWithRarity>(); [Space(5f)] public List<StringWithRarity> manualContentSourceNameReferenceList = new List<StringWithRarity>(); [Space(10f)] [Header("Dynamic Dungeon Size Multiplier Lerp Settings")] public bool enableDynamicDungeonSizeRestriction = false; public float dungeonSizeMin = 1f; public float dungeonSizeMax = 1f; [Range(0f, 1f)] public float dungeonSizeLerpPercentage = 1f; [Space(10f)] [Header("Dynamic DungeonFlow Modification Settings")] public List<GlobalPropCountOverride> globalPropCountOverridesList = new List<GlobalPropCountOverride>(); [Space(10f)] [Header("Misc. Settings")] public bool generateAutomaticConfigurationOptions = true; [Space(10f)] [Header("Experimental Settings (Currently Unused As Of LethalLevelLoader 1.1.0")] public GameObject mainEntrancePropPrefab; [Space(5f)] public GameObject fireExitPropPrefab; [Space(5f)] public Animator mainEntrancePropAnimator; [Space(5f)] public Animator fireExitPropAnimator; [HideInInspector] public ContentType dungeonType; [HideInInspector] public int dungeonID; [HideInInspector] public int dungeonDefaultRarity; [HideInInspector] public DungeonEvents dungeonEvents = new DungeonEvents(); internal static ExtendedDungeonFlow Create(DungeonFlow newDungeonFlow, AudioClip newFirstTimeDungeonAudio, string contentSourceName) { ExtendedDungeonFlow extendedDungeonFlow = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); extendedDungeonFlow.dungeonFlow = newDungeonFlow; extendedDungeonFlow.dungeonFirstTimeAudio = newFirstTimeDungeonAudio; extendedDungeonFlow.contentSourceName = contentSourceName; return extendedDungeonFlow; } internal void Initialize(ContentType newDungeonType) { dungeonType = newDungeonType; GetDungeonFlowID(); if (dungeonDisplayName == null || dungeonDisplayName == string.Empty) { dungeonDisplayName = ((Object)dungeonFlow).name; } ((Object)this).name = ((Object)dungeonFlow).name.Replace("Flow", "") + "ExtendedDungeonFlow"; if ((Object)(object)dungeonFirstTimeAudio == (Object)null) { DebugHelper.LogWarning("Custom Dungeon: " + dungeonDisplayName + " Is Missing A DungeonFirstTimeAudio Reference! Assigning Facility Audio To Prevent Errors."); dungeonFirstTimeAudio = RoundManager.Instance.firstTimeDungeonAudios[0]; } } private void GetDungeonFlowID() { if (dungeonType == ContentType.Custom) { dungeonID = PatchedContent.ExtendedDungeonFlows.Count; } if (dungeonType == ContentType.Vanilla) { dungeonID = RoundManager.Instance.dungeonFlowTypes.ToList().IndexOf(dungeonFlow); } } } [Serializable] public class StringWithRarity { [SerializeField] private string _name; [SerializeField] [Range(0f, 300f)] private int _rarity; [HideInInspector] public string Name { get { return _name; } set { _name = value; } } [HideInInspector] public int Rarity { get { return _rarity; } set { _rarity = value; } } [HideInInspector] public StringWithRarity(string newName, int newRarity) { _name = newName; _rarity = newRarity; } } [Serializable] public class Vector2WithRarity { [SerializeField] private Vector2 _minMax; [SerializeField] private int _rarity; [HideInInspector] public float Min { get { return _minMax.x; } set { _minMax.x = value; } } [HideInInspector] public float Max { get { return _minMax.y; } set { _minMax.y = value; } } [HideInInspector] public int Rarity { get { return _rarity; } set { _rarity = value; } } public Vector2WithRarity(Vector2 vector2, int newRarity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) _minMax.x = vector2.x; _minMax.y = vector2.y; _rarity = newRarity; } public Vector2WithRarity(float newMin, float newMax, int newRarity) { _minMax.x = newMin; _minMax.y = newMax; _rarity = newRarity; } } [Serializable] public class GlobalPropCountOverride { public int globalPropID; [Range(0f, 1f)] public float globalPropCountScaleRate = 0f; } [Serializable] public class DungeonEvents { public ExtendedEvent<RoundManager> onBeforeDungeonGenerate = new ExtendedEvent<RoundManager>(); public ExtendedEvent<List<GameObject>> onSpawnedSyncedObjects = new ExtendedEvent<List<GameObject>>(); public ExtendedEvent<List<GameObject>> onSpawnedMapObjects = new ExtendedEvent<List<GameObject>>(); public ExtendedEvent<List<GrabbableObject>> onSpawnedScrapObjects = new ExtendedEvent<List<GrabbableObject>>(); public ExtendedEvent<(EnemyVent, EnemyAI)> onEnemySpawnedFromVent = new ExtendedEvent<(EnemyVent, EnemyAI)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerEnterDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerExitDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<bool> onPowerSwitchToggle = new ExtendedEvent<bool>(); public ExtendedEvent<LungProp> onApparatusTaken = new ExtendedEvent<LungProp>(); } [CreateAssetMenu(menuName = "LethalLevelLoader/ExtendedLevel")] public class ExtendedLevel : ScriptableObject { [Header("Extended Level Settings")] [Space(5f)] public string contentSourceName = string.Empty; [Space(5f)] public SelectableLevel selectableLevel; [Space(5f)] [SerializeField] private int routePrice = 0; [Space(5f)] public bool isHidden = false; [Space(5f)] public bool isLocked = false; [Space(5f)] public string lockedNodeText = string.Empty; [Space(10f)] public List<StoryLogData> storyLogs = new List<StoryLogData>(); [Space(10f)] [Header("Dynamic DungeonFlow Injections Settings")] [Space(5f)] public ContentType allowedDungeonContentTypes = ContentType.Any; [Space(5f)] public List<string> levelTags = new List<string>(); [HideInInspector] public ContentType levelType; [SerializeField] [TextArea] public string infoNodeDescripton = string.Empty; [HideInInspector] public TerminalNode routeNode; [HideInInspector] public TerminalNode routeConfirmNode; [HideInInspector] public TerminalNode infoNode; [Space(10f)] [Header("Misc. Settings")] [Space(5f)] public bool generateAutomaticConfigurationOptions = true; [HideInInspector] public LevelEvents levelEvents = new LevelEvents(); internal bool isLethalExpansion = false; public int RoutePrice { get { if ((Object)(object)routeNode != (Object)null) { routePrice = routeNode.itemCost; routeConfirmNode.itemCost = routePrice; return routeNode.itemCost; } DebugHelper.LogWarning("routeNode Is Missing! Using internal value!"); return routePrice; } set { routeNode.itemCost = value; routeConfirmNode.itemCost = value; routePrice = value; } } [HideInInspector] public string NumberlessPlanetName => GetNumberlessPlanetName(selectableLevel); public bool IsLoaded { get { //IL_000b: 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) Scene sceneByName = SceneManager.GetSceneByName(selectableLevel.sceneName); return ((Scene)(ref sceneByName)).isLoaded; } } internal static ExtendedLevel Create(SelectableLevel newSelectableLevel, ContentType newContentType) { ExtendedLevel extendedLevel = ScriptableObject.CreateInstance<ExtendedLevel>(); extendedLevel.levelType = newContentType; extendedLevel.selectableLevel = newSelectableLevel; return extendedLevel; } internal void Initialize(string newContentSourceName, bool generateTerminalAssets) { if (levelType == ContentType.Vanilla && selectableLevel.levelID > 8) { DebugHelper.LogWarning("LethalExpansion SelectableLevel " + NumberlessPlanetName + " Found, Setting To LevelType: Custom."); levelType = ContentType.Custom; contentSourceName = "Lethal Expansion"; levelTags.Clear(); isLethalExpansion = true; } if (contentSourceName == string.Empty) { contentSourceName = newContentSourceName; } if (levelType == ContentType.Custom) { levelTags.Add("Custom"); } if (!isLethalExpansion) { SetLevelID(); } if (generateTerminalAssets) { TerminalManager.CreateLevelTerminalData(this, routePrice); } if (levelType == ContentType.Custom) { ((Object)this).name = NumberlessPlanetName.StripSpecialCharacters() + "ExtendedLevel"; ((Object)selectableLevel).name = NumberlessPlanetName.StripSpecialCharacters() + "Level"; } } internal static string GetNumberlessPlanetName(SelectableLevel selectableLevel) { if ((Object)(object)selectableLevel != (Object)null) { return new string(selectableLevel.PlanetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } return string.Empty; } internal void SetLevelID() { if (levelType == ContentType.Custom) { selectableLevel.levelID = PatchedContent.ExtendedLevels.IndexOf(this); if ((Object)(object)routeNode != (Object)null) { routeNode.displayPlanetInfo = selectableLevel.levelID; } if ((Object)(object)routeConfirmNode != (Object)null) { routeConfirmNode.buyRerouteToMoon = selectableLevel.levelID; } } } } [Serializable] public class LevelEvents { public ExtendedEvent onLevelLoaded = new ExtendedEvent(); public ExtendedEvent onNighttime = new ExtendedEvent(); public ExtendedEvent<EnemyAI> onDaytimeEnemySpawn = new ExtendedEvent<EnemyAI>(); public ExtendedEvent<EnemyAI> onNighttimeEnemySpawn = new ExtendedEvent<EnemyAI>(); public ExtendedEvent<StoryLog> onStoryLogCollected = new ExtendedEvent<StoryLog>(); public ExtendedEvent<LungProp> onApparatusTaken = new ExtendedEvent<LungProp>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerEnterDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerExitDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<bool> onPowerSwitchToggle = new ExtendedEvent<bool>(); } [Serializable] public class StoryLogData { public int storyLogID; public string terminalWord = string.Empty; public string storyLogTitle = string.Empty; [TextArea] public string storyLogDescription = string.Empty; [HideInInspector] internal int newStoryLogID; } public class MoonsCataloguePage { private List<ExtendedLevelGroup> extendedLevelGroups; public List<ExtendedLevelGroup> ExtendedLevelGroups => extendedLevelGroups; public List<ExtendedLevel> ExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevelGroup extendedLevelGroup in extendedLevelGroups) { foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList) { list.Add(extendedLevels); } } return list; } } public MoonsCataloguePage(List<ExtendedLevelGroup> newExtendedLevelGroupList) { extendedLevelGroups = new List<ExtendedLevelGroup>(); extendedLevelGroups.Clear(); foreach (ExtendedLevelGroup newExtendedLevelGroup in newExtendedLevelGroupList) { extendedLevelGroups.Add(new ExtendedLevelGroup(newExtendedLevelGroup.extendedLevelsList)); } } public void RebuildLevelGroups(List<ExtendedLevelGroup> newExtendedLevelGroups, int splitCount) { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevelGroup extendedLevelGroup in extendedLevelGroups) { foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList) { list.Add(extendedLevels); } } RebuildLevelGroups(list.ToArray(), splitCount); } public void RebuildLevelGroups(List<ExtendedLevel> newExtendedLevels, int splitCount) { RebuildLevelGroups(newExtendedLevels.ToArray(), splitCount); } public void RebuildLevelGroups(IOrderedEnumerable<ExtendedLevel> orderedExtendedLevels, int splitCount) { RebuildLevelGroups(orderedExtendedLevels.ToArray(), splitCount); } public void RebuildLevelGroups(ExtendedLevel[] newExtendedLevels, int splitCount) { List<ExtendedLevelGroup> list = new List<ExtendedLevelGroup>(); int num = 0; int num2 = 0; List<ExtendedLevel> list2 = new List<ExtendedLevel>(); foreach (ExtendedLevel item in new List<ExtendedLevel>(newExtendedLevels)) { list2.Add(item); num2++; num++; if (num == splitCount || num2 == newExtendedLevels.Length) { list.Add(new ExtendedLevelGroup(list2)); list2.Clear(); num = 0; } } extendedLevelGroups = list; } public void RefreshLevelGroups(List<ExtendedLevelGroup> newLevelGroups) { extendedLevelGroups.Clear(); foreach (ExtendedLevelGroup newLevelGroup in newLevelGroups) { if (newLevelGroup.extendedLevelsList.Count != 0) { extendedLevelGroups.Add(new ExtendedLevelGroup(newLevelGroup.extendedLevelsList)); } } } } [Serializable] public class ExtendedLevelGroup { public List<ExtendedLevel> extendedLevelsList; public ExtendedLevelGroup(List<ExtendedLevel> newExtendedLevelsList) { extendedLevelsList = new List<ExtendedLevel>(newExtendedLevelsList); } public ExtendedLevelGroup(List<SelectableLevel> newSelectableLevelsList) { extendedLevelsList = new List<ExtendedLevel>(); foreach (SelectableLevel newSelectableLevels in newSelectableLevelsList) { extendedLevelsList.Add(LevelManager.GetExtendedLevel(newSelectableLevels)); } } } public static class PatchedContent { public static List<ExtendedLevel> ExtendedLevels { get; internal set; } = new List<ExtendedLevel>(); public static List<ExtendedLevel> VanillaExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Vanilla) { list.Add(extendedLevel); } } return list; } } public static List<ExtendedLevel> CustomExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Custom) { list.Add(extendedLevel); } } return list; } } public static List<SelectableLevel> SeletectableLevels { get { List<SelectableLevel> list = new List<SelectableLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { list.Add(extendedLevel.selectableLevel); } return list; } } public static List<SelectableLevel> MoonsCatalogue { get { List<SelectableLevel> list = new List<SelectableLevel>(); foreach (SelectableLevel item in OriginalContent.MoonsCatalogue) { list.Add(item); } foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Custom) { list.Add(extendedLevel.selectableLevel); } } return list; } } public static List<ExtendedDungeonFlow> ExtendedDungeonFlows { get; internal set; } = new List<ExtendedDungeonFlow>(); public static List<ExtendedDungeonFlow> VanillaExtendedDungeonFlows { get { List<ExtendedDungeonFlow> list = new List<ExtendedDungeonFlow>(); foreach (ExtendedDungeonFlow extendedDungeonFlow in ExtendedDungeonFlows) { if (extendedDungeonFlow.dungeonType == ContentType.Vanilla) { list.Add(extendedDungeonFlow); } } return list; } } public static List<ExtendedDungeonFlow> CustomExtendedDungeonFlows { get { List<ExtendedDungeonFlow> list = new List<ExtendedDungeonFlow>(); foreach (ExtendedDungeonFlow extendedDungeonFlow in ExtendedDungeonFlows) { if (extendedDungeonFlow.dungeonType == ContentType.Custom) { list.Add(extendedDungeonFlow); } } return list; } } public static List<string> AllExtendedLevelTags { get { List<string> list = new List<string>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { foreach (string levelTag in extendedLevel.levelTags) { if (!list.Contains(levelTag)) { list.Add(levelTag); } } } return list; } } public static List<AudioMixer> AudioMixers { get; internal set; } = new List<AudioMixer>(); public static List<AudioMixerGroup> AudioMixerGroups { get; internal set; } = new List<AudioMixerGroup>(); public static List<AudioMixerSnapshot> AudioMixerSnapshots { get; internal set; } = new List<AudioMixerSnapshot>(); public static List<Item> Items { get; internal set; } = new List<Item>(); public static List<EnemyType> Enemies { get; internal set; } = new List<EnemyType>(); public static void RegisterExtendedDungeonFlow(ExtendedDungeonFlow extendedDungeonFlow) { AssetBundleLoader.obtainedExtendedDungeonFlowsList.Add(extendedDungeonFlow); } public static void RegisterExtendedLevel(ExtendedLevel extendedLevel) { AssetBundleLoader.obtainedExtendedLevelsList.Add(extendedLevel); } } public static class OriginalContent { public static List<SelectableLevel> SelectableLevels { get; internal set; } = new List<SelectableLevel>(); public static List<SelectableLevel> MoonsCatalogue { get; internal set; } = new List<SelectableLevel>(); public static List<DungeonFlow> DungeonFlows { get; internal set; } = new List<DungeonFlow>(); public static List<Item> Items { get; internal set; } = new List<Item>(); public static List<ItemGroup> ItemGroups { get; internal set; } = new List<ItemGroup>(); public static List<EnemyType> Enemies { get; internal set; } = new List<EnemyType>(); public static List<SpawnableOutsideObject> SpawnableOutsideObjects { get; internal set; } = new List<SpawnableOutsideObject>(); public static List<GameObject> SpawnableMapObjects { get; internal set; } = new List<GameObject>(); public static List<AudioMixer> AudioMixers { get; internal set; } = new List<AudioMixer>(); public static List<AudioMixerGroup> AudioMixerGroups { get; internal set; } = new List<AudioMixerGroup>(); public static List<AudioMixerSnapshot> AudioMixerSnapshots { get; internal set; } = new List<AudioMixerSnapshot>(); public static List<LevelAmbienceLibrary> LevelAmbienceLibraries { get; internal set; } = new List<LevelAmbienceLibrary>(); public static List<ReverbPreset> ReverbPresets { get; internal set; } = new List<ReverbPreset>(); public static List<TerminalKeyword> TerminalKeywords { get; internal set; } = new List<TerminalKeyword>(); public static List<TerminalNode> TerminalNodes { get; internal set; } = new List<TerminalNode>(); } internal class EventPatches { private static EnemyVent cachedSelectedVent; internal static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && LevelManager.CurrentExtendedLevel.IsLoaded) { LevelManager.CurrentExtendedLevel.levelEvents.onLevelLoaded.Invoke(); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(StoryLog), "CollectLog")] [HarmonyPrefix] internal static void StoryLogCollectLog_Prefix(StoryLog __instance) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer) { LevelManager.CurrentExtendedLevel.levelEvents.onStoryLogCollected.Invoke(__instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyPostfix] internal static void RoundManagerSpawnRandomDaytimeEnemy_Postfix(RoundManager __instance, GameObject __result) { EnemyAI param = default(EnemyAI); if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer && (Object)(object)__result != (Object)null && __result.TryGetComponent<EnemyAI>(ref param)) { LevelManager.CurrentExtendedLevel.levelEvents.onDaytimeEnemySpawn.Invoke(param); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")] [HarmonyPostfix] internal static void RoundManagerSpawnRandomOutsideEnemy_Postfix(RoundManager __instance, GameObject __result) { EnemyAI param = default(EnemyAI); if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer && (Object)(object)__result != (Object)null && __result.TryGetComponent<EnemyAI>(ref param)) { LevelManager.CurrentExtendedLevel.levelEvents.onNighttimeEnemySpawn.Invoke(param); } } [HarmonyPriority(201)] [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] internal static void DungeonGeneratorGenerate_Prefix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onBeforeDungeonGenerate.Invoke(RoundManager.Instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SwitchPower")] [HarmonyPrefix] internal static void RoundManagerSwitchPower_Prefix(bool on) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPowerSwitchToggle.Invoke(on); } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LevelManager.CurrentExtendedLevel.levelEvents.onPowerSwitchToggle.Invoke(on); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] internal static void RoundManagerSpawnScrapInLevel_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedScrapObjects.HasListeners) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedScrapObjects.Invoke(Object.FindObjectsOfType<GrabbableObject>().ToList()); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnSyncedProps")] [HarmonyPostfix] internal static void RoundManagerSpawnSyncedProps_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedSyncedObjects.HasListeners) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedSyncedObjects.Invoke(RoundManager.Instance.spawnedSyncedObjects); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")] [HarmonyPrefix] internal static void RoundManagerSpawnEventFromVent_Prefix(EnemyVent vent) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { cachedSelectedVent = vent; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnEnemyGameObject")] [HarmonyPostfix] internal static void RoundManagerSpawnEventFromVent_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && (Object)(object)cachedSelectedVent != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onEnemySpawnedFromVent.Invoke((cachedSelectedVent, RoundManager.Instance.SpawnedEnemies.Last())); cachedSelectedVent = null; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")] [HarmonyPostfix] internal static void RoundManagerSpawnMapObjects_Postfix() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null)) { return; } List<GameObject> list = new List<GameObject>(); Scene sceneByName = SceneManager.GetSceneByName(LevelManager.CurrentExtendedLevel.selectableLevel.sceneName); GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { SpawnableMapObject[] spawnableMapObjects = LevelManager.CurrentExtendedLevel.selectableLevel.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if (((Object)val).name.Sanitized().Contains(((Object)val2.prefabToSpawn).name.Sanitized())) { list.Add(val); } } } DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedMapObjects.Invoke(list); } [HarmonyPriority(200)] [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerServerRpc")] [HarmonyPrefix] internal static void EntranceTeleportTeleportPlayerServerRpc_Prefix(EntranceTeleport __instance) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (__instance.isEntranceToBuilding) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPlayerEnterDungeon.Invoke((__instance, localPlayerController)); } else { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPlayerExitDungeon.Invoke((__instance, localPlayerController)); } } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController; if (__instance.isEntranceToBuilding) { LevelManager.CurrentExtendedLevel.levelEvents.onPlayerEnterDungeon.Invoke((__instance, localPlayerController2)); } else { LevelManager.CurrentExtendedLevel.levelEvents.onPlayerExitDungeon.Invoke((__instance, localPlayerController2)); } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(LungProp), "EquipItem")] [HarmonyPrefix] internal static void LungPropEquipItem_Postfix(LungProp __instance) { if (((NetworkBehaviour)__instance).IsServer) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onApparatusTaken.Invoke(__instance); } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LevelManager.CurrentExtendedLevel.levelEvents.onApparatusTaken.Invoke(__instance); } } } } public class ExtendedEvent<T> { public delegate void ParameterEvent(T param); public bool HasListeners => Listeners != 0; public int Listeners { get; internal set; } private event ParameterEvent onParameterEvent; public void Invoke(T param) { this.onParameterEvent?.Invoke(param); } public void AddListener(ParameterEvent listener) { onParameterEvent += listener; Listeners++; } public void RemoveListener(ParameterEvent listener) { onParameterEvent -= listener; Listeners--; } } public class ExtendedEvent { public delegate void Event(); public bool HasListeners => Listeners != 0; public int Listeners { get; internal set; } private event Event onEvent; public void Invoke() { this.onEvent?.Invoke(); } public void AddListener(Event listener) { onEvent += listener; Listeners++; } public void RemoveListener(Event listener) { onEvent -= listener; Listeners--; } } public static class Extensions { public static List<Tile> GetTiles(this DungeonFlow dungeonFlow) { List<Tile> list = new List<Tile>(); foreach (GraphNode node in dungeonFlow.Nodes) { foreach (TileSet tileSet in node.TileSets) { list.AddRange(GetTilesInTileSet(tileSet)); } } foreach (GraphLine line in dungeonFlow.Lines) { foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { foreach (TileSet branchCapTileSet in dungeonArchetype.BranchCapTileSets) { list.AddRange(GetTilesInTileSet(branchCapTileSet)); } foreach (TileSet tileSet2 in dungeonArchetype.TileSets) { list.AddRange(GetTilesInTileSet(tileSet2)); } } } foreach (Tile item in new List<Tile>(list)) { if ((Object)(object)item == (Object)null) { list.Remove(item); } } return list; } public static List<Tile> GetTilesInTileSet(TileSet tileSet) { List<Tile> list = new List<Tile>(); if (tileSet.TileWeights != null && tileSet.TileWeights.Weights != null) { foreach (GameObjectChance weight in tileSet.TileWeights.Weights) { Tile[] componentsInChildren = weight.Value.GetComponentsInChildren<Tile>(); foreach (Tile item in componentsInChildren) { list.Add(item); } } } return list; } public static List<RandomMapObject> GetRandomMapObjects(this DungeonFlow dungeonFlow) { List<RandomMapObject> list = new List<RandomMapObject>(); foreach (Tile tile in dungeonFlow.GetTiles()) { RandomMapObject[] componentsInChildren = ((Component)tile).gameObject.GetComponentsInChildren<RandomMapObject>(); foreach (RandomMapObject item in componentsInChildren) { list.Add(item); } } return list; } public static List<SpawnSyncedObject> GetSpawnSyncedObjects(this DungeonFlow dungeonFlow) { List<SpawnSyncedObject> list = new List<SpawnSyncedObject>(); foreach (Tile tile in dungeonFlow.GetTiles()) { Doorway[] componentsInChildren = ((Component)tile).gameObject.GetComponentsInChildren<Doorway>(); foreach (Doorway val in componentsInChildren) { foreach (GameObjectWeight connectorPrefabWeight in val.ConnectorPrefabWeights) { SpawnSyncedObject[] componentsInChildren2 = connectorPrefabWeight.GameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item in componentsInChildren2) { list.Add(item); } } foreach (GameObjectWeight blockerPrefabWeight in val.BlockerPrefabWeights) { SpawnSyncedObject[] componentsInChildren3 = blockerPrefabWeight.GameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item2 in componentsInChildren3) { list.Add(item2); } } } SpawnSyncedObject[] componentsInChildren4 = ((Component)tile).gameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item3 in componentsInChildren4) { list.Add(item3); } } return list; } public static void AddReferences(this CompatibleNoun compatibleNoun, TerminalKeyword firstNoun, TerminalNode firstResult) { compatibleNoun.noun = firstNoun; compatibleNoun.result = firstResult; } public static void AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword newNoun, TerminalNode newResult) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[0]; } CompatibleNoun val = new CompatibleNoun(); val.noun = newNoun; val.result = newResult; terminalKeyword.compatibleNouns = CollectionExtensions.AddItem<CompatibleNoun>((IEnumerable<CompatibleNoun>)terminalKeyword.compatibleNouns, val).ToArray(); } public static void AddCompatibleNoun(this TerminalNode terminalNode, TerminalKeyword newNoun, TerminalNode newResult) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (terminalNode.terminalOptions == null) { terminalNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[0]; } CompatibleNoun val = new CompatibleNoun(); val.noun = newNoun; val.result = newResult; terminalNode.terminalOptions = CollectionExtensions.AddItem<CompatibleNoun>((IEnumerable<CompatibleNoun>)terminalNode.terminalOptions, val).ToArray(); } public static void Add(this IntWithRarity intWithRarity, int id, int rarity) { intWithRarity.id = id; intWithRarity.rarity = rarity; } public static string Sanitized(this string currentString) { return new string(currentString.SkipToLetters().RemoveWhitespace().ToLowerInvariant()); } public static string RemoveWhitespace(this string input) { return new string((from c in input.ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); } public static string SkipToLetters(this string input) { return new string(input.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } public static string StripSpecialCharacters(this string input) { string text = string.Empty; for (int i = 0; i < input.Length; i++) { char c = input[i]; if ((!".,?!@#$%^&*()_+-=';:'\"".ToCharArray().Contains(c) && char.IsLetterOrDigit(c)) || c.ToString() == " ") { text += c; } } return text; } } internal static class Patches { internal const int harmonyPriority = 200; internal static string delayedSceneLoadingName = string.Empty; internal static List<string> allSceneNamesCalledToLoad = new List<string>(); [HarmonyPriority(200)] [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] internal static void PreInitSceneScriptAwake_Prefix(PreInitSceneScript __instance) { if (!Plugin.hasVanillaBeenPatched) { AssetBundleLoader.CreateLoadingBundlesHeaderText(__instance); AudioSource val = default(AudioSource); if (((Component)__instance).TryGetComponent<AudioSource>(ref val)) { OriginalContent.AudioMixers.Add(val.outputAudioMixerGroup.audioMixer); } AssetBundleLoader.LoadBundles(__instance); AssetBundleLoader.onBundlesFinishedLoading += AssetBundleLoader.LoadContentInBundles; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(PreInitSceneScript), "ChooseLaunchOption")] [HarmonyPrefix] internal static bool PreInitSceneScriptChooseLaunchOption_Prefix() { return true; } [HarmonyPriority(200)] [HarmonyPatch(typeof(SceneManager), "LoadScene", new Type[] { typeof(string) })] [HarmonyPrefix] internal static bool SceneManagerLoadScene(string sceneName) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (allSceneNamesCalledToLoad.Count == 0) { List<string> list = allSceneNamesCalledToLoad; Scene activeScene = SceneManager.GetActiveScene(); list.Add(((Scene)(ref activeScene)).name); } SceneManager.GetSceneByName(sceneName); if (true) { allSceneNamesCalledToLoad.Add(sceneName); } if (sceneName == "MainMenu" && !allSceneNamesCalledToLoad.Contains("InitSceneLaunchOptions")) { DebugHelper.LogError("SceneManager has been told to load Main Menu without ever loading InitSceneLaunchOptions. This will break LethalLevelLoader. This is likely due to a \"Skip to Main Menu\" mod."); return false; } if (AssetBundleLoader.loadingStatus == AssetBundleLoader.LoadingStatus.Loading) { DebugHelper.LogWarning("SceneManager has attempted to load " + sceneName + " Scene before AssetBundles have finished loading. Pausing request until LethalLeveLoader is ready to proceed."); delayedSceneLoadingName = sceneName; AssetBundleLoader.onBundlesFinishedLoading -= LoadMainMenu; AssetBundleLoader.onBundlesFinishedLoading += LoadMainMenu; return false; } return true; } internal static void LoadMainMenu() { DebugHelper.LogWarning("Proceeding with the loading of " + delayedSceneLoadingName + " Scene as LethalLevelLoader has finished loading AssetBundles."); if (delayedSceneLoadingName != string.Empty) { SceneManager.LoadScene(delayedSceneLoadingName); } delayedSceneLoadingName = string.Empty; } [HarmonyPriority(200)] [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPrefix] internal static void GameNetworkManagerStart_Prefix(GameNetworkManager __instance) { if (Plugin.hasVanillaBeenPatched) { return; } foreach (NetworkPrefab prefab in ((Component)__instance).GetComponent<NetworkManager>().NetworkConfig.Prefabs.m_Prefabs) { if (((Object)prefab.Prefab).name.Contains("EntranceTeleport") && (Object)(object)prefab.Prefab.GetComponent<AudioSource>() != (Object)null) { OriginalContent.AudioMixers.Add(prefab.Prefab.GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); } } GameObject val = NetworkPrefabs.CreateNetworkPrefab("LethalLevelLoaderNetworkManagerTest"); val.AddComponent<LethalLevelLoaderNetworkManager>(); val.GetComponent<NetworkObject>().DontDestroyWithOwner = true; val.GetComponent<NetworkObject>().SceneMigrationSynchronization = true; val.GetComponent<NetworkObject>().DestroyWithScene = false; Object.DontDestroyOnLoad((Object)(object)val); LethalLevelLoaderNetworkManager.networkingManagerPrefab = val; AssetBundleLoader.RegisterCustomContent(((Component)__instance).GetComponent<NetworkManager>()); LethalLevelLoaderNetworkManager.RegisterPrefabs(((Component)__instance).GetComponent<NetworkManager>()); } [HarmonyPriority(200)] [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] internal static void StartOfRoundAwake_Prefix(StartOfRound __instance) { if (!Plugin.hasVanillaBeenPatched) { ContentExtractor.TryScrapeVanillaItems(__instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Awake")] [HarmonyPostfix] internal static void RoundManagerAwake_Postfix(RoundManager __instance) { if (((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().IsServer) { LethalLevelLoaderNetworkManager component = Object.Instantiate<GameObject>(LethalLevelLoaderNetworkManager.networkingManagerPrefab).GetComponent<LethalLevelLoaderNetworkManager>(); ((Component)component).GetComponent<NetworkObject>().Spawn(false); } RoundManager.Instance.firstTimeDungeonAudios = CollectionExtensions.AddItem<AudioClip>((IEnumerable<AudioClip>)RoundManager.Instance.firstTimeDungeonAudios.ToList(), RoundManager.Instance.firstTimeDungeonAudios[0]).ToArray(); if (Plugin.hasVanillaBeenPatched) { return; } ContentExtractor.TryScrapeVanillaContent(__instance); TerminalManager.CacheTerminalReferences(); AssetBundleLoader.CreateVanillaExtendedDungeonFlows(); AssetBundleLoader.CreateVanillaExtendedLevels(StartOfRound.Instance); AssetBundleLoader.InitializeBundles(); string text = "LethalLevelLoader Loaded The Following ExtendedLevels:\n"; foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { text = text + (PatchedContent.ExtendedLevels.IndexOf(extendedLevel) + 1) + ". " + extendedLevel.selectableLevel.PlanetName + " (" + extendedLevel.levelType.ToString() + ")\n"; } DebugHelper.Log(text); text = "LethalLevelLoader Loaded The Following ExtendedDungeonFlows:\n"; foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows) { text = text + (PatchedContent.ExtendedDungeonFlows.IndexOf(extendedDungeonFlow) + 1) + ". " + extendedDungeonFlow.dungeonDisplayName + " (" + ((Object)extendedDungeonFlow.dungeonFlow).name + ") (" + extendedDungeonFlow.dungeonType.ToString() + ")\n"; } DebugHelper.Log(text); } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] internal static void RoundManagerStart_Prefix() { if (!Plugin.hasVanillaBeenPatched) { foreach (ExtendedLevel customExtendedLevel in PatchedContent.CustomExtendedLevels) { ContentRestorer.RestoreVanillaLevelAssetReferences(customExtendedLevel); } foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { ContentRestorer.RestoreVanillaDungeonAssetReferences(customExtendedDungeonFlow); } TerminalManager.CreateMoonsFilterTerminalAssets(); ConfigLoader.BindConfigs(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneLoaded += EventPatches.OnSceneLoaded; } AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>(); foreach (AudioSource val in array) { val.spatialize = false; } LevelManager.ValidateLevelLists(); LevelManager.PatchVanillaLevelLists(); DungeonManager.PatchVanillaDungeonLists(); LevelManager.RefreshCustomExtendedLevelIDs(); TerminalManager.CreateExtendedLevelGroups(); if (LevelManager.invalidSaveLevelID != -1 && StartOfRound.Instance.levels.Length > LevelManager.invalidSaveLevelID) { DebugHelper.Log("Setting CurrentLevel to previously saved ID that was not loaded at the time of save loading."); DebugHelper.Log(LevelManager.invalidSaveLevelID + " / " + StartOfRound.Instance.levels.Length); StartOfRound.Instance.ChangeLevelServerRpc(LevelManager.invalidSaveLevelID, TerminalManager.Terminal.groupCredits); LevelManager.invalidSaveLevelID = -1; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPostfix] internal static void RoundManagerStart_Postfix() { if (!Plugin.hasVanillaBeenPatched) { ContentExtractor.TryScrapeCustomContent(); Plugin.hasVanillaBeenPatched = true; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(StartOfRound), "ChangeLevel")] [HarmonyPrefix] internal static void StartOfRoundChangeLevel_Prefix(ref int levelID) { if (levelID >= StartOfRound.Instance.levels.Length) { DebugHelper.LogWarning("Lethal Company attempted to load a saved current level that has not yet been loaded"); DebugHelper.LogWarning(levelID + " / " + StartOfRound.Instance.levels.Length); LevelManager.invalidSaveLevelID = levelID; levelID = 0; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] internal static void TerminalStart_Postfix() { LevelManager.RefreshLethalExpansionMoons(); } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "ParseWord")] [HarmonyPostfix] internal static void TerminalParseWord_Postfix(Terminal __instance, ref TerminalKeyword __result, string playerWord) { if ((Object)(object)__result != (Object)null) { TerminalKeyword val = TerminalManager.TryFindAlternativeNoun(__instance, __result, playerWord); if ((Object)(object)val != (Object)null) { __result = val; } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "RunTerminalEvents")] [HarmonyPrefix] internal static bool TerminalRunTerminalEvents_Prefix(TerminalNode node) { return TerminalManager.RunLethalLevelLoaderTerminalEvents(node); } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "LoadNewNode")] [HarmonyPrefix] internal static void TerminalLoadNewNode_Prefix(Terminal __instance, ref TerminalNode node) { if ((Object)(object)node == (Object)(object)TerminalManager.moonsKeyword.specialKeywordResult) { TerminalManager.RefreshExtendedLevelGroups(); node.displayText = TerminalManager.GetMoonsTerminalText(); } else { if (!((Object)(object)__instance.currentNode == (Object)(object)TerminalManager.moonsKeyword.specialKeywordResult)) { return; } foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if ((Object)(object)extendedLevel.routeNode == (Object)(object)node && extendedLevel.isLocked) { TerminalManager.SwapRouteNodeToLockedNode(extendedLevel, ref node); } } } } internal static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && LevelManager.CurrentExtendedLevel.IsLoaded && LevelManager.CurrentExtendedLevel.levelType == ContentType.Custom && !LevelManager.CurrentExtendedLevel.isLethalExpansion) { Scene sceneByName = SceneManager.GetSceneByName(LevelManager.CurrentExtendedLevel.selectableLevel.sceneName); GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { LevelLoader.UpdateStoryLogs(LevelManager.CurrentExtendedLevel, val); ContentRestorer.RestoreAudioAssetReferencesInParent(val); } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] internal static void DungeonGeneratorGenerate_Prefix(DungeonGenerator __instance) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { DungeonLoader.PrepareDungeon(); } LevelManager.LogDayHistory(); } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Generator_OnGenerationStatusChanged")] [HarmonyPrefix] internal static bool OnGenerationStatusChanged_Prefix(RoundManager __instance, GenerationStatus status) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown DebugHelper.Log(((object)(GenerationStatus)(ref status)).ToString()); if ((int)status == 6 && !__instance.dungeonCompletedGenerating) { __instance.FinishGeneratingLevel(); __instance.dungeonGenerator.Generator.OnGenerationStatusChanged -= new GenerationStatusDelegate(__instance.Generator_OnGenerationStatusChanged); Debug.Log((object)"Dungeon has finished generating on this client after multiple frames"); } return false; } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> GenerateNewLevelClientRpcTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instructions) => CodeInstructionExtensions.Calls(instructions, AccessTools.Method(typeof(RoundManager), "GenerateNewFloor", (Type[])null, (Type[])null)))).SetInstruction(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Patches), "InjectHostDungeonFlowSelection", (Type[])null, (Type[])null))).Advance(-1) .SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> GenerateNewFloorTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instructions) => CodeInstructionExtensions.Calls(instructions, AccessTools.Method(typeof(RuntimeDungeon), "Generate", (Type[])null, (Type[])null)))).SetInstruction(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Patches), "InjectHostDungeonSizeSelection", (Type[])null, (Type[])null))).Advance(-1) .SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)); return val.InstructionEnumeration(); } public static void InjectHostDungeonSizeSelection(RoundManager roundManager) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LethalLevelLoaderNetworkManager.Instance.GetDungeonFlowSizeServerRpc(); } else { roundManager.dungeonGenerator.Generate(); } } internal static void InjectHostDungeonFlowSelection() { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { DungeonManager.TryAddCurrentVanillaLevelDungeonFlow(RoundManager.Instance.dungeonGenerator.Generator, LevelManager.CurrentExtendedLevel); DungeonLoader.SelectDungeon(); } else { RoundManager.Instance.GenerateNewFloor(); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(Dungeon), "RoundManager_Start")] [HarmonyPrefix] internal static bool Dungeon_Start_Prefix(orig_Start orig, RoundManager self) { DebugHelper.LogWarning("Disabling LethalLib Dungeon.RoundManager_Start() Function To Prevent Conflicts"); orig.Invoke(self); return false; } [HarmonyPriority(200)] [HarmonyPatch(typeof(Dungeon), "RoundManager_GenerateNewFloor")] [HarmonyPrefix] internal static bool Dungeon_GenerateNewFloor_Prefix(orig_GenerateNewFloor orig, RoundManager self) { DebugHelper.LogWarning("Disabling LethalLib Dungeon.RoundManager_GenerateNewFloor() Function To Prevent Conflicts"); orig.Invoke(self); return false; } } public enum PreviewInfoType { Price, Difficulty, Weather, History, All, None, Vanilla, Override } public enum SortInfoType { Price, Difficulty, Tag, LastTraveled, None } public enum FilterInfoType { Price, Weather, Tag, TraveledThisQuota, TraveledThisRun, None } public enum SimulateInfoType { Percentage, Rarity } public static class Settings { public static PreviewInfoType levelPreviewInfoType = PreviewInfoType.Weather; public static SortInfoType levelPreviewSortType = SortInfoType.None; public static FilterInfoType levelPreviewFilterType = FilterInfoType.None; public static SimulateInfoType levelSimulateInfoType = SimulateInfoType.Percentage; public static bool allDungeonFlowsRequireMatching = false; public static string GetOverridePreviewInfo(ExtendedLevel extendedLevel) { return string.Empty; } } [Serializable] public class ExtendedDungeonFlowWithRarity { public ExtendedDungeonFlow extendedDungeonFlow; public int rarity; public ExtendedDungeonFlowWithRarity(ExtendedDungeonFlow newExtendedDungeonFlow, int newRarity) { extendedDungeonFlow = newExtendedDungeonFlow; rarity = newRarity; } public bool UpdateRarity(int newRarity) { if (newRarity > rarity) { rarity = newRarity; return true; } return false; } } public static class DungeonLoader { internal static void SelectDungeon() { RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow = null; if (((NetworkBehaviour)LethalLevelLoaderNetworkManager.Instance).IsServer) { LethalLevelLoaderNetworkManager.Instance.GetRandomExtendedDungeonFlowServerRpc(); } } internal static void PrepareDungeon() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) DungeonGenerator generator = RoundManager.Instance.dungeonGenerator.Generator; ExtendedLevel currentExtendedLevel = LevelManager.CurrentExtendedLevel; ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow; PatchFireEscapes(generator, currentExtendedLevel, SceneManager.GetSceneByName(currentExtendedLevel.selectableLevel.sceneName)); PatchDynamicGlobalProps(generator, currentExtendedDungeonFlow); } public static float GetClampedDungeonSize() { float num = LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier * RoundManager.Instance.mapSizeMultiplier; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.enableDynamicDungeonSizeRestriction) { ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow; ExtendedLevel currentExtendedLevel = LevelManager.CurrentExtendedLevel; if (currentExtendedLevel.selectableLevel.factorySizeMultiplier > currentExtendedDungeonFlow.dungeonSizeMax) { num = Mathf.Lerp(currentExtendedLevel.selectableLevel.factorySizeMultiplier, currentExtendedDungeonFlow.dungeonSizeMax, currentExtendedDungeonFlow.dungeonSizeLerpPercentage) * RoundManager.Instance.mapSizeMultiplier; } else if (currentExtendedLevel.selectableLevel.factorySizeMultiplier < currentExtendedDungeonFlow.dungeonSizeMin) { num = Mathf.Lerp(currentExtendedLevel.selectableLevel.factorySizeMultiplier, currentExtendedDungeonFlow.dungeonSizeMin, currentExtendedDungeonFlow.dungeonSizeLerpPercentage) * RoundManager.Instance.mapSizeMultiplier; } DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier + " | Overrriding DungeonSize To: " + num / RoundManager.Instance.mapSizeMultiplier + " (" + num + ")"); } else { DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier + " | Leaving DungeonSize As: " + num / RoundManager.Instance.mapSizeMultiplier + " (" + num + ")"); } return num; } internal static void PatchDungeonSize(DungeonGenerator dungeonGenerator, ExtendedLevel extendedLevel, ExtendedDungeonFlow extendedDungeonFlow) { } internal static List<EntranceTeleport> GetEntranceTeleports(Scene scene) { List<EntranceTeleport> list = new List<EntranceTeleport>(); GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { EntranceTeleport[] componentsInChildren = val.GetComponentsInChildren<EntranceTeleport>(); foreach (EntranceTeleport item in componentsInChildren) { list.Add(item); } } return list; } internal static void PatchFireEscapes(DungeonGenerator dungeonGenerator, ExtendedLevel extendedLevel, Scene scene) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown string text = "Fire Exit Patch Report, Details Below;\n\n"; if (!DungeonManager.TryGetExtendedDungeonFlow(dungeonGenerator.DungeonFlow, out var returnExtendedDungeonFlow)) { return; } List<EntranceTeleport> list = (from o in GetEntranceTeleports(scene) orderby o.entranceId select o).ToList(); foreach (EntranceTeleport item in list) { item.entranceId = list.IndexOf(item); item.dungeonFlowId = returnExtendedDungeonFlow.dungeonID; } text = text + "EntranceTeleport's Found, " + extendedLevel.NumberlessPlanetName + " Contains " + list.Count + " Entrances! ( " + (list.Count - 1) + " Fire Escapes) \n"; text = text + "Main Entrance: " + ((Object)((Component)list[0]).gameObject).name + " (Entrance ID: " + list[0].entranceId + ") (Dungeon ID: " + list[0].dungeonFlowId + ")\n"; foreach (EntranceTeleport item2 in list) { if (item2.entranceId != 0) { text = text + "Alternate Entrance: " + ((Object)((Component)item2).gameObject).name + " (Entrance ID: " + item2.entranceId + ") (Dungeon ID: " + item2.dungeonFlowId + ")\n"; } } foreach (GlobalPropSettings globalProp in dungeonGenerator.DungeonFlow.GlobalProps) { if (globalProp.ID == 1231) { text = text + "Found Fire Escape GlobalProp: (ID: 1231), Modifying Spawnrate Count From (" + globalProp.Count.Min + "," + globalProp.Count.Max + ") To (" + (list.Count - 1) + "," + (list.Count - 1) + ")\n"; globalProp.Count = new IntRange(list.Count - 1, list.Count - 1); break; } } DebugHelper.Log(text + "\n"); } public static void PatchDynamicGlobalProps(DungeonGenerator dungeonGenerator, ExtendedDungeonFlow extendedDungeonFlow) { foreach (GlobalPropCountOverride globalPropCountOverrides in extendedDungeonFlow.globalPropCountOverridesList) { foreach (GlobalPropSettings globalProp in dungeonGenerator.DungeonFlow.GlobalProps) { if (globalPropCountOverrides.globalPropID == globalProp.ID) { globalProp.Count.Min = globalProp.Count.Min * Mathf.RoundToInt(Mathf.Lerp(1f, dungeonGenerator.LengthMultiplier / RoundManager.Instance.mapSizeMultiplier, globalPropCountOverrides.globalPropCountScaleRate)); globalProp.Count.Max = globalProp.Count.Max * Mathf.RoundToInt(Mathf.Lerp(1f, dungeonGenerator.LengthMultiplier / RoundManager.Instance.mapSizeMultiplier, globalPropCountOverrides.globalPropCountScaleRate)); } } } } } public class LevelLoader { internal static List<MeshCollider> customLevelMeshCollidersList = new List<MeshCollider>(); internal static async void EnableMeshColliders() { List<MeshCollider> instansiatedCustomLevelMeshColliders = new List<MeshCollider>(); int counter = 0; MeshCollider[] array = Object.FindObjectsOfType<MeshCollider>(); foreach (MeshCollider meshCollider in array) { if (((Object)((Component)meshCollider).gameObject).name.Contains(" (LLL Tracked)")) { instansiatedCustomLevelMeshColliders.Add(meshCollider); } } Task[] meshColliderEnableTasks = new Task[instansiatedCustomLevelMeshColliders.Count]; foreach (MeshCollider meshCollider2 in instansiatedCustomLevelMeshColliders) { meshColliderEnableTasks[counter] = EnableMeshCollider(meshCollider2); counter++; } await Task.WhenAll(meshColliderEnableTasks); } internal static async Task EnableMeshCollider(MeshCollider meshCollider) { ((Collider)meshCollider).enabled = true; ((Object)((Component)meshCollider).gameObject).name.Replace(" (LLL Tracked)", ""); await Task.Yield(); } internal static void UpdateStoryLogs(ExtendedLevel extendedLevel, GameObject sceneRootObject) { StoryLog[] componentsInChildren = sceneRootObject.GetComponentsInChildren<StoryLog>(); foreach (StoryLog val in componentsInChildren) { foreach (StoryLogData storyLog in extendedLevel.storyLogs) { if (val.storyLogID == storyLog.storyLogID) { val.storyLogID = storyLog.newStoryLogID; } } } } } public class DungeonManager { public static ExtendedDungeonFlow CurrentExtendedDungeonFlow { get { ExtendedDungeonFlow result = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.dungeonGenerator != (Object)null && TryGetExtendedDungeonFlow(RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow, out var returnExtendedDungeonFlow)) { result = returnExtendedDungeonFlow; } return result; } } internal static void PatchVanillaDungeonLists() { foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { customExtendedDungeonFlow.dungeonID = RoundManager.Instance.dungeonFlowTypes.Length; RoundManager.Instance.dungeonFlowTypes = CollectionExtensions.AddItem<DungeonFlow>((IEnumerable<DungeonFlow>)RoundManager.Instance.dungeonFlowTypes, customExtendedDungeonFlow.dungeonFlow).ToArray(); if ((Object)(object)customExtendedDungeonFlow.dungeonFirstTimeAudio != (Object)null) { RoundManager.Instance.firstTimeDungeonAudios = CollectionExtensions.AddItem<AudioClip>((IEnumerable<AudioClip>)RoundManager.Instance.firstTimeDungeonAudios, customExtendedDungeonFlow.dungeonFirstTimeAudio).ToArray(); } } } internal static void AddExtendedDungeonFlow(ExtendedDungeonFlow extendedDungeonFlow) { PatchedContent.ExtendedDungeonFlows.Add(extendedDungeonFlow); } internal static void TryAddCurrentVanillaLevelDungeonFlow(DungeonGenerator dungeonGenerator, ExtendedLevel currentExtendedLevel) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if ((Object)(object)dungeonGenerator.DungeonFlow != (Object)null && !RoundManager.Instance.dungeonFlowTypes.ToList().Contains(dungeonGenerator.DungeonFlow)) { DebugHelper.Log("Level: " + currentExtendedLevel.selectableLevel.PlanetName + " Contains DungeonFlow: " + ((Object)dungeonGenerator.DungeonFlow).name + " In DungeonGenerator That Was Not Found In RoundManager, Adding!"); AssetBundleLoader.CreateVanillaExtendedDungeonFlow(dungeonGenerator.DungeonFlow); if (TryGetExtendedDungeonFlow(dungeonGenerator.DungeonFlow, out var returnExtendedDungeonFlow)) { IntWithRarity val = new IntWithRarity(); val.id = returnExtendedDungeonFlow.dungeonID; val.rarity = 300; currentExtendedLevel.selectableLevel.dungeonFlowTypes = CollectionExtensions.AddItem<IntWithRarity>((IEnumerable<IntWithRarity>)currentExtendedLevel.selectableLevel.dungeonFlowTypes, val).ToArray(); } } } internal static List<ExtendedDungeonFlowWithRarity> GetValidExtendedDungeonFlows(ExtendedLevel extendedLevel, bool debugResults) { string text = "Trying To Find All Matching DungeonFlows For Level: " + extendedLevel.NumberlessPlanetName + "\n"; List<ExtendedDungeonFlowWithRarity> list = new List<ExtendedDungeonFlowWithRarity>(); List<ExtendedDungeonFlowWithRarity> list2 = new List<ExtendedDungeonFlowWithRarity>(); if (extendedLevel.allowedDungeonContentTypes == ContentType.Vanilla || extendedLevel.allowedDungeonContentTypes == ContentType.Any) { IntWithRarity[] dungeonFlowTypes = extendedLevel.selectableLevel.dungeonFlowTypes; foreach (IntWithRarity val in dungeonFlowTypes) { if (TryGetExtendedDungeonFlow(RoundManager.Instance.dungeonFlowTypes[val.id], out var returnExtendedDungeonFlow)) { if (!Settings.allDungeonFlowsRequireMatching) { list.Add(new ExtendedDungeonFlowWithRarity(returnExtendedDungeonFlow, val.rarity)); } else { list2.Add(new ExtendedDungeonFlowWithRarity(returnExtendedDungeonFlow, val.rarity)); } } } } if (extendedLevel.allowedDungeonContentTypes == ContentType.Custom || extendedLevel.allowedDungeonContentTypes == ContentType.Any) { foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { list2.Add(new ExtendedDungeonFlowWithRarity(customExtendedDungeonFlow, 0)); } } text += "Potential DungeonFlows Collected, List Below: \n"; foreach (ExtendedDungeonFlowWithRarity item in list.Concat(list2)) { text = text + item.extendedDungeonFlow.dungeonDisplayName + " - " + item.rarity + ", "; } text = text + "\n\nSelectableLevel - " + extendedLevel.selectableLevel.PlanetName + " Level Tags: "; foreach (string levelTag in extendedLevel.levelTags) { text = text + levelTag + ", "; } text += "\n"; foreach (ExtendedDungeonFlowWithRarity item2 in list) { text = text + "\nDungeonFlow " + (list.IndexOf(item2) + 1) + ". : " + ((Object)item2.extendedDungeonFlow.dungeonFlow).name + " - Matched " + extendedLevel.NumberlessPlanetName + " With A Rarity Of: " + item2.rarity + " Based On The Levels DungeonFlowTypes!\n"; } foreach (ExtendedDungeonFlowWithRarity item3 in new List<ExtendedDungeonFlowWithRarity>(list2)) { string text2 = string.Empty; ExtendedDungeonFlow extendedDungeonFlow = item3.extendedDungeonFlow; if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(extendedLevel.contentSourceName, extendedDungeonFlow.manualContentSourceNameReferenceList))) { text2 = " Based On Content Source Name!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(extendedLevel.NumberlessPlanetName, extendedDungeonFlow.manualPlanetNameReferenceList))) { text2 = " Based On Planet Name!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingWithinRanges(extendedLevel.RoutePrice, extendedDungeonFlow.dynamicRoutePricesList))) { text2 = " Based On Route Price!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedStrings(extendedLevel.levelTags, extendedDungeonFlow.dynamicLevelTagsList))) { text2 = " Based On Level Tags!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(((object)(LevelWeatherType)(ref extendedLevel.selectableLevel.currentWeather)).ToString(), extendedDungeonFlow.dynamicCurrentWeatherList))) { text2 = " Based On Current Weather!"; } if (text2 != string.Empty) { text = text + "\nDungeonFlow " + (list2.IndexOf(item3) + 1) + ". : " + ((Object)extendedDungeonFlow.dungeonFlow).name + " - Matched " + extendedLevel.NumberlessPlanetName + " With A Rarity Of: " + item3.rarity + text2 + "\n"; } if (item3.rarity != 0) { list.Add(item3); } } if (debugResults) { DebugHelper.Log(text + "\nMatching DungeonFlows Collected, Count Is: " + list.Count + "\n\n"); } return list; } internal static void RefreshDungeonFlowIDs() { DebugHelper.Log("Re-Adjusting DungeonFlowTypes Array For Late Arriving Vanilla DungeonFlow"); List<DungeonFlow> list = new List<DungeonFlow>(); foreach (ExtendedDungeonFlow vanillaExtendedDungeonFlow in PatchedContent.VanillaExtendedDungeonFlows) { vanillaExtendedDungeonFlow.dungeonID = list.Count; list.Add(vanillaExtendedDungeonFlow.dungeonFlow); } foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { customExtendedDungeonFlow.dungeonID = list.Count; list.Add(customExtendedDungeonFlow.dungeonFlow); } RoundManager.Instance.dungeonFlowTypes = list.ToArray(); } internal static int GetHighestRarityViaMatchingWithinRanges(int comparingValue, List<Vector2WithRarity> matchingVectors) { int num = 0; foreach (Vector2WithRarity matchingVector in matchingVectors) { if (matchingVector.Rarity >= num && (float)comparingValue >= matchingVector.Min && (float)comparingValue <= matchingVector.Max) { num = matchingVector.Rarity; } } return num; } internal static int GetHighestRarityViaMatchingNormalizedString(string comparingString, List<StringWithRarity> matchingStrings) { return GetHighestRarityViaMatchingNormalizedStrings(new List<string> { comparingString }, matchingStrings); } internal static int GetHighestRarityViaMatchingNormalizedStrings(List<string> comparingStrings, List<StringWithRarity> matchingStrings) { int num = 0; foreach (StringWithRarity matchingString in matchingStrings) { foreach (string item in new List<string>(comparingStrings)) { if (matchingString.Rarity >= num && (matchingString.Name.Sanitized().Contains(item.Sanitized()) || item.Sanitized().Contains(matchingString.Name.Sanitized()))) { num = matchingString.Rarity; } } } return num; } internal static bool TryGetExtendedDungeonFlow(DungeonFlow dungeonFlow, out ExtendedDungeonFlow returnExtendedDungeonFlow, ContentType contentType = ContentType.Any) { returnExtendedDungeonFlow = null; List<ExtendedDungeonFlow> list = null; if ((Object)(object)dungeonFlow == (Object)null) { return false; } switch (contentType) { case ContentType.Any: list = PatchedContent.ExtendedDungeonFlows; break; case ContentType.Custom: list = PatchedContent.CustomExtendedDungeonFlows; break; case ContentType.Vanilla: list = PatchedContent.VanillaExtendedDungeonFlows; break; } foreach (ExtendedDungeonFlow item in list) { if ((Object)(object)item.dungeonFlow == (Object)(object)dungeonFlow) { returnExtendedDungeonFlow = item; } } return (Object)(object)returnExtendedDungeonFlow != (Object)null; } } public class LethalLevelLoaderNetworkManager : NetworkBehaviour { public static GameObject networkingManagerPrefab; private static LethalLevelLoaderNetworkManager _instance; private static List<GameObject> queuedNetworkPrefabs = new List<GameObject>(); public static bool networkHasStarted; public static LethalLevelLoaderNetworkManager Instance { get { if ((Object)(object)_instance == (Object)null) { _instance = Object.FindObjectOfType<LethalLevelLoaderNetworkManager>(); } if ((Object)(object)_instance == (Object)null) { DebugHelper.LogWarning("LethalLevelLoaderNetworkManager Could Not Be Found! Returning Null!"); } return _instance; } set { _instance = value; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ((Object)((Component)this).gameObject).name = "LethalLevelLoaderNetworkManager"; Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } [ServerRpc] public void GetRandomExtendedDungeonFlowServerRpc() { //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(12573863u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 12573863u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } DebugHelper.Log("Getting Random DungeonFlows!"); List<ExtendedDungeonFlowWithRarity> validExtendedDungeonFlows = DungeonManager.GetValidExtendedDungeonFlows(LevelManager.CurrentExtendedLevel, debugResults: true); List<int> list = new List<int>(); List<int> list2 = new List<int>(); if (validExtendedDungeonFlows.Count == 0) { DebugHelper.LogError("No ExtendedDungeonFlow's could be found! This should only happen if the Host's requireMatchesOnAllDungeonFlows is set to true!"); DebugHelper.LogError("Loading Facility DungeonFlow to prevent infinite loading!"); list.Add(0); list2.Add(300); } else { foreach (ExtendedDungeonFlowWithRarity item in validExtendedDungeonFlows) { list.Add(RoundManager.Instance.dungeonFlowTypes.ToList().IndexOf(item.extendedDungeonFlow.dungeonFlow)); list2.Add(item.rarity); } } SetRandomExtendedDungeonFlowClientRpc(list.ToArray(), list2.ToArray()); } [ClientRpc] public void SetRandomExtendedDungeonFlowClientRpc(int[] dungeonFlowIDs, int[] rarities) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0112: 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) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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(1934987400u, val, (RpcDelivery)0); bool flag = dungeonFlowIDs != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(dungeonFlowIDs, default(ForPrimitives)); } bool flag2 = rarities != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(rarities, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1934987400u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { DebugHelper.Log("Setting Random DungeonFlows!"); List<IntWithRarity> list = new List<IntWithRarity>(); List<IntWithRarity> list2 = new List<IntWithRarity>(); for (int i = 0; i < dungeonFlowIDs.Length; i++) { IntWithRarity val3 = new IntWithRarity(); val3.Add(dungeonFlowIDs[i], rarities[i]); list.Add(val3); } list2 = new List<IntWithRarity>(LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes.ToList()); LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes = list.ToArray(); RoundManager.Instance.GenerateNewFloor(); LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes = list2.ToArray(); } } [ServerRpc] public void GetDungeonFlowSizeServerRpc() { //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(1367970965u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1367970965u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetDungeonFlowSizeClientRpc(DungeonLoader.GetClampedDungeonSize()); } } [ClientRpc] public void SetDungeonFlowSizeClientRpc(float hostSize) { //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(1778200789u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref hostSize, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1778200789u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { RoundManager.Instance.dungeonGenerator.Generator.LengthMultiplier = hostSize; RoundManager.Instance.dungeonGenerator.Generate(); } } } public static void RegisterNetworkPrefab(GameObject prefab) { if (!networkHasStarted) { queuedNetworkPrefabs.Add(prefab); } else { DebugHelper.Log("Attempted To Register NetworkPrefab: " + ((object)prefab)?.ToString() + " After GameNetworkManager Has Started!"); } } internal static void RegisterPrefabs(NetworkManager networkManager) { List<GameObject> list = new List<GameObject>(); foreach (NetworkPrefab prefab in networkManager.NetworkConfig.Prefabs.m_Prefabs) { list.Add(prefab.Prefab); } int num = 0; foreach (GameObject queuedNetworkPrefab in queuedNetworkPrefabs) { if (!list.Contains(queuedNetworkPrefab)) { networkManager.AddNetworkPrefab(queuedNetworkPrefab); list.Add(queuedNetworkPrefab); } else { num++; } } DebugHelper.Log("Skipped Registering " + num + " NetworkObjects As They Were Already Registered."); networkHasStarted = true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LethalLevelLoaderNetworkManager() { //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 NetworkManager.__rpc_func_table.Add(12573863u, new RpcReceiveHandler(__rpc_handler_12573863)); NetworkManager.__rpc_func_table.Add(1934987400u, new RpcReceiveHandler(__rpc_handler_1934987400)); NetworkManager.__rpc_func_table.Add(1367970965u, new RpcReceiveHandler(__rpc_handler_1367970965)); NetworkManager.__rpc_func_table.Add(1778200789u, new RpcReceiveHandler(__rpc_handler_1778200789)); } private static void __rpc_handler_12573863(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; ((LethalLevelLoaderNetworkManager)(object)target).GetRandomExtendedDungeonFlowServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1934987400(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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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)); int[] dungeonFlowIDs = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref dungeonFlowIDs, default(ForPrimitives)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); int[] rarities = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref rarities, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalLevelLoaderNetworkManager)(object)target).SetRandomExtendedDungeonFlowClientRpc(dungeonFlowIDs, rarities); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1367970965(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; ((LethalLevelLoaderNetworkManager)(object)target).GetDungeonFlowSizeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1778200789(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) { float dungeonFlowSizeClientRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref dungeonFlowSizeClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalLevelLoaderNetworkManager)(object)target).SetDungeonFlowSizeClientRpc(dungeonFlowSizeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LethalLevelLoaderNetworkManager"; } } public class LevelManager { public static List<DayHistory> dayHistoryList = new List<DayHistory>(); public static int daysTotal; public static int quotasTotal; public static int invalidSaveLevelID = -1; public static ExtendedLevel CurrentExtendedLevel { get { ExtendedLevel result = null; if ((Object)(object)StartOfRound.Instance != (Object)null && TryGetExtendedLevel(StartOfRound.Instance.currentLevel, out var returnExtendedLevel)) { result = returnExtendedLevel; } return result; } } internal static void ValidateLevelLists() { List<SelectableLevel> list = new List<SelectableLevel>(OriginalContent.SelectableLevels); List<SelectableLevel> list2 = new List<SelectableLevel>(OriginalContent.MoonsCatalogue); List<SelectableLevel> list3 = new List<SelectableLevel>(StartOfRound.Instance.levels); foreach (SelectableLevel item in new List<SelectableLevel>(list)) { if (item.levelID > 8) { list.Remove(item); } } foreach (SelectableLevel item2 in new List<SelectableLevel>(list2)) { if (item2.levelID > 8) { list2.Remove(item2); } } foreach (SelectableLevel item3 in new List<SelectableLevel>(list3)) { if (item3.levelID > 8) { list3.Remove(item3); } } OriginalContent.SelectableLevels = list; OriginalContent.MoonsCatalogue = list2; PatchVanillaLevelLists(); } internal static void PatchVanillaLevelLists() { StartOfRound.Instance.levels = PatchedContent.SeletectableLevels.ToArray(); TerminalManager.Terminal.moonsCatalogueList = PatchedContent.MoonsCatalogue.ToArray(); } internal static void RefreshCustomExtendedLevelIDs() { foreach (ExtendedLevel item in new List<ExtendedLevel>(PatchedContent.CustomExtendedLevels)) { if (!item.isLethalExpansion) { item.SetLevelID(); } } } internal static void RefreshLethalExpansionMoons() { foreach (ExtendedLevel customExtendedLevel in PatchedContent.CustomExtendedLevels) { if (!customExtendedLevel.isLethalExpansion) { continue; } CompatibleNoun[] compatibleNouns = TerminalManager.routeKeyword.compatibleNouns; foreach (CompatibleNoun val in compatibleNouns) { if (((Object)val.noun).name.ToLower().Contains(customExtendedLevel.NumberlessPlanetName.ToLower())) { customExtendedLevel.routeNode = val.result; customExtendedLevel.routeConfirmNode = val.result.terminalOptions[1].result; customExtendedLevel.RoutePrice = customExtendedLevel.routeNode.itemCost; break; } } } RefreshCustomExtendedLevelIDs(); } public static bool TryGetExtendedLevel(SelectableLevel selectableLevel, out ExtendedLevel returnExtendedLevel, ContentType levelType = ContentType.Any) { returnExtendedLevel = null; List<ExtendedLevel> list = null; if ((Object)(object)selectableLevel == (Object)null) { return false; } switch (levelType) { case ContentType.Any: list = PatchedContent
plugins/LethalLib.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; 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.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using LethalLib.Extras; using LethalLib.Modules; using LethalLib.NetcodePatcher; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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: AssemblyCompany("Evaisa")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Content-addition API for Lethal Company")] [assembly: AssemblyFileVersion("0.14.2.0")] [assembly: AssemblyInformationalVersion("0.14.2+553a3b4022b798db3343e7463a3d6d5d90b37d0e")] [assembly: AssemblyProduct("LethalLib")] [assembly: AssemblyTitle("LethalLib")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EvaisaDev/LethalLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.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 LethalLib { [BepInPlugin("evaisa.lethallib", "LethalLib", "0.14.2")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "evaisa.lethallib"; public const string ModName = "LethalLib"; public const string ModVersion = "0.14.2"; public static AssetBundle MainAssets; public static ManualLogSource logger; public static ConfigFile config; public static Plugin Instance; public static ConfigEntry<bool> extendedLogging; private void Awake() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Instance = this; config = ((BaseUnityPlugin)this).Config; logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalLib loaded!!"); extendedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging"); MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lethallib")); new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook)); Enemies.Init(); Items.Init(); Unlockables.Init(); MapObjects.Init(); Dungeon.Init(); Weathers.Init(); Player.Init(); Utilities.Init(); NetworkPrefabs.Init(); } private void IlHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public)) }); val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } private static string GetLineOrIL(StackFrame instance) { int fileLineNumber = instance.GetFileLineNumber(); if (fileLineNumber == -1 || fileLineNumber == 0) { return "IL_" + instance.GetILOffset().ToString("X4"); } return fileLineNumber.ToString(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalLib"; public const string PLUGIN_NAME = "LethalLib"; public const string PLUGIN_VERSION = "0.14.2"; } } namespace LethalLib.Modules { public class ContentLoader { public class CustomContent { private string id = ""; public string ID => id; public CustomContent(string id) { this.id = id; } } public class CustomItem : CustomContent { public Action<Item> registryCallback = delegate { }; public string contentPath = ""; internal Item item; public Item Item => item; public CustomItem(string id, string contentPath, Action<Item> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } } } public class ShopItem : CustomItem { public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public void RemoveFromShop() { Items.RemoveShopItem(base.Item); } public void SetPrice(int price) { Items.UpdateShopItemPrice(base.Item, price); } public ShopItem(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; } } public class ScrapItem : CustomItem { public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public int Rarity => 0; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Items.RemoveScrapFromLevels(base.Item, levelFlags); } public ScrapItem(string id, string contentPath, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelFlags != Levels.LevelTypes.None) { levelRarities.Add(levelFlags, rarity); } else if (levelOverrides != null) { foreach (string key in levelOverrides) { customLevelRarities.Add(key, rarity); } } } public ScrapItem(string id, string contentPath, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } } } public class Unlockable : CustomContent { public Action<UnlockableItem> registryCallback = delegate { }; internal UnlockableItem unlockable; public string contentPath = ""; public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public StoreType storeType; public UnlockableItem UnlockableItem => unlockable; public void RemoveFromShop() { Unlockables.DisableUnlockable(UnlockableItem); } public void SetPrice(int price) { Unlockables.UpdateUnlockablePrice(UnlockableItem, price); } public Unlockable(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, StoreType storeType = StoreType.None, Action<UnlockableItem> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; this.storeType = storeType; } } public class CustomEnemy : CustomContent { public Action<EnemyType> registryCallback = delegate { }; public string contentPath = ""; internal EnemyType enemy; public string infoNodePath; public string infoKeywordPath; public int rarity; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1); public EnemyType Enemy => enemy; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Enemies.RemoveEnemyFromLevels(Enemy, levelFlags); } public CustomEnemy(string id, string contentPath, int rarity = 0, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1), string[] levelOverrides = null, string infoNodePath = null, string infoKeywordPath = null, Action<EnemyType> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } this.infoNodePath = infoNodePath; this.infoKeywordPath = infoKeywordPath; this.rarity = rarity; LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnType = spawnType; } } public class MapHazard : CustomContent { public Action<SpawnableMapObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableMapObjectDef hazard; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableMapObjectDef Hazard => hazard; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveMapObject(Hazard, levelFlags, levelOverrides); } public MapHazard(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableMapObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public class OutsideObject : CustomContent { public Action<SpawnableOutsideObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableOutsideObjectDef mapObject; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableOutsideObjectDef MapObject => mapObject; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveOutsideObject(MapObject, levelFlags, levelOverrides); } public OutsideObject(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableOutsideObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public PluginInfo modInfo; private AssetBundle modBundle; public Action<CustomContent, GameObject> prefabCallback = delegate { }; public Dictionary<string, CustomContent> LoadedContent { get; } = new Dictionary<string, CustomContent>(); public string modName => modInfo.Metadata.Name; public string modVersion => modInfo.Metadata.Version.ToString(); public string modGUID => modInfo.Metadata.GUID; public ContentLoader(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { this.modInfo = modInfo; this.modBundle = modBundle; if (prefabCallback != null) { this.prefabCallback = prefabCallback; } } public ContentLoader Create(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { return new ContentLoader(modInfo, modBundle, prefabCallback); } public void Register(CustomContent content) { if (LoadedContent.ContainsKey(content.ID)) { Debug.LogError((object)("[LethalLib] " + modName + " tried to register content with ID " + content.ID + " but it already exists!")); return; } if (content is CustomItem customItem) { Item val = (customItem.item = modBundle.LoadAsset<Item>(customItem.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); prefabCallback(customItem, val.spawnPrefab); customItem.registryCallback(val); if (content is ShopItem shopItem) { TerminalNode buyNode = null; TerminalNode buyNode2 = null; TerminalNode itemInfo = null; if (shopItem.buyNode1Path != null) { buyNode = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode1Path); } if (shopItem.buyNode2Path != null) { buyNode2 = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode2Path); } if (shopItem.itemInfoPath != null) { itemInfo = modBundle.LoadAsset<TerminalNode>(shopItem.itemInfoPath); } Items.RegisterShopItem(val, buyNode, buyNode2, itemInfo, shopItem.initPrice); } else if (content is ScrapItem scrapItem) { Items.RegisterScrap(val, scrapItem.levelRarities, scrapItem.customLevelRarities); } else { Items.RegisterItem(val); } } else if (content is Unlockable unlockable) { UnlockableItemDef unlockableItemDef = modBundle.LoadAsset<UnlockableItemDef>(unlockable.contentPath); if ((Object)(object)unlockableItemDef.unlockable.prefabObject != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(unlockableItemDef.unlockable.prefabObject); prefabCallback(content, unlockableItemDef.unlockable.prefabObject); Utilities.FixMixerGroups(unlockableItemDef.unlockable.prefabObject); } unlockable.unlockable = unlockableItemDef.unlockable; unlockable.registryCallback(unlockableItemDef.unlockable); TerminalNode buyNode3 = null; TerminalNode buyNode4 = null; TerminalNode itemInfo2 = null; if (unlockable.buyNode1Path != null) { buyNode3 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode1Path); } if (unlockable.buyNode2Path != null) { buyNode4 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode2Path); } if (unlockable.itemInfoPath != null) { itemInfo2 = modBundle.LoadAsset<TerminalNode>(unlockable.itemInfoPath); } Unlockables.RegisterUnlockable(unlockableItemDef, unlockable.storeType, buyNode3, buyNode4, itemInfo2, unlockable.initPrice); } else if (content is CustomEnemy customEnemy) { EnemyType val2 = modBundle.LoadAsset<EnemyType>(customEnemy.contentPath); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); Utilities.FixMixerGroups(val2.enemyPrefab); customEnemy.enemy = val2; prefabCallback(content, val2.enemyPrefab); customEnemy.registryCallback(val2); TerminalNode infoNode = null; TerminalKeyword infoKeyword = null; if (customEnemy.infoNodePath != null) { infoNode = modBundle.LoadAsset<TerminalNode>(customEnemy.infoNodePath); } if (customEnemy.infoKeywordPath != null) { infoKeyword = modBundle.LoadAsset<TerminalKeyword>(customEnemy.infoKeywordPath); } if (customEnemy.spawnType == (Enemies.SpawnType)(-1)) { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.levelOverrides, infoNode, infoKeyword); } else { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.spawnType, customEnemy.levelOverrides, infoNode, infoKeyword); } } else if (content is MapHazard mapHazard) { SpawnableMapObjectDef spawnableMapObjectDef = (mapHazard.hazard = modBundle.LoadAsset<SpawnableMapObjectDef>(mapHazard.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); prefabCallback(content, spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); mapHazard.registryCallback(spawnableMapObjectDef); MapObjects.RegisterMapObject(spawnableMapObjectDef, mapHazard.LevelTypes, mapHazard.levelOverrides, mapHazard.spawnRateFunction); } else if (content is OutsideObject outsideObject) { SpawnableOutsideObjectDef spawnableOutsideObjectDef = (outsideObject.mapObject = modBundle.LoadAsset<SpawnableOutsideObjectDef>(outsideObject.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); prefabCallback(content, spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); outsideObject.registryCallback(spawnableOutsideObjectDef); MapObjects.RegisterOutsideObject(spawnableOutsideObjectDef, outsideObject.LevelTypes, outsideObject.levelOverrides, outsideObject.spawnRateFunction); } LoadedContent.Add(content.ID, content); } public void RegisterAll(CustomContent[] content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Length} content items!"); foreach (CustomContent content2 in content) { Register(content2); } } public void RegisterAll(List<CustomContent> content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Count} content items!"); foreach (CustomContent item in content) { Register(item); } } } public class Dungeon { public class CustomDungeonArchetype { public DungeonArchetype archeType; public Levels.LevelTypes LevelTypes; public int lineIndex = -1; } public class CustomGraphLine { public GraphLine graphLine; public Levels.LevelTypes LevelTypes; } public class CustomDungeon { public int rarity; public DungeonFlow dungeonFlow; public Levels.LevelTypes LevelTypes; public string[] levelOverrides; public int dungeonIndex = -1; public AudioClip firstTimeDungeonAudio; } [CompilerGenerated] private static class <>O { public static hook_GenerateNewFloor <0>__RoundManager_GenerateNewFloor; public static hook_Start <1>__RoundManager_Start; } public static List<CustomDungeonArchetype> customDungeonArchetypes = new List<CustomDungeonArchetype>(); public static List<CustomGraphLine> customGraphLines = new List<CustomGraphLine>(); public static Dictionary<string, TileSet> extraTileSets = new Dictionary<string, TileSet>(); public static Dictionary<string, GameObjectChance> extraRooms = new Dictionary<string, GameObjectChance>(); public static List<CustomDungeon> customDungeons = new List<CustomDungeon>(); public static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__RoundManager_GenerateNewFloor; if (obj == null) { hook_GenerateNewFloor val = RoundManager_GenerateNewFloor; <>O.<0>__RoundManager_GenerateNewFloor = val; obj = (object)val; } RoundManager.GenerateNewFloor += (hook_GenerateNewFloor)obj; object obj2 = <>O.<1>__RoundManager_Start; if (obj2 == null) { hook_Start val2 = RoundManager_Start; <>O.<1>__RoundManager_Start = val2; obj2 = (object)val2; } RoundManager.Start += (hook_Start)obj2; } private static void RoundManager_Start(orig_Start orig, RoundManager self) { //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown foreach (CustomDungeon customDungeon in customDungeons) { if (self.dungeonFlowTypes.Contains(customDungeon.dungeonFlow)) { continue; } List<DungeonFlow> list = self.dungeonFlowTypes.ToList(); list.Add(customDungeon.dungeonFlow); self.dungeonFlowTypes = list.ToArray(); int dungeonIndex = self.dungeonFlowTypes.Length - 1; customDungeon.dungeonIndex = dungeonIndex; List<AudioClip> list2 = self.firstTimeDungeonAudios.ToList(); if (list2.Count != self.dungeonFlowTypes.Length - 1) { while (list2.Count < self.dungeonFlowTypes.Length - 1) { list2.Add(null); } } list2.Add(customDungeon.firstTimeDungeonAudio); self.firstTimeDungeonAudios = list2.ToArray(); } StartOfRound instance = StartOfRound.Instance; foreach (CustomDungeon dungeon in customDungeons) { SelectableLevel[] levels = instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = dungeon.LevelTypes.HasFlag(Levels.LevelTypes.All) || (dungeon.levelOverrides != null && dungeon.levelOverrides.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant())); if (dungeon.LevelTypes.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag) { Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if ((flag || dungeon.LevelTypes.HasFlag(levelTypes)) && !val.dungeonFlowTypes.Any((IntWithRarity rarityInt) => rarityInt.id == dungeon.dungeonIndex)) { List<IntWithRarity> list3 = val.dungeonFlowTypes.ToList(); list3.Add(new IntWithRarity { id = dungeon.dungeonIndex, rarity = dungeon.rarity }); val.dungeonFlowTypes = list3.ToArray(); } } } } orig.Invoke(self); } private static void RoundManager_GenerateNewFloor(orig_GenerateNewFloor orig, RoundManager self) { string name = ((Object)self.currentLevel).name; if (Enum.IsDefined(typeof(Levels.LevelTypes), name)) { Levels.LevelTypes levelEnum = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name); int index = 0; self.dungeonGenerator.Generator.DungeonFlow.Lines.ForEach(delegate(GraphLine line) { foreach (CustomDungeonArchetype customDungeonArchetype in customDungeonArchetypes) { if (customDungeonArchetype.LevelTypes.HasFlag(levelEnum) && !line.DungeonArchetypes.Contains(customDungeonArchetype.archeType) && (customDungeonArchetype.lineIndex == -1 || customDungeonArchetype.lineIndex == index)) { line.DungeonArchetypes.Add(customDungeonArchetype.archeType); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)customDungeonArchetype.archeType).name + " to " + name)); } } } foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { string name2 = ((Object)dungeonArchetype).name; if (extraTileSets.ContainsKey(name2)) { TileSet val4 = extraTileSets[name2]; if (!dungeonArchetype.TileSets.Contains(val4)) { dungeonArchetype.TileSets.Add(val4); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)val4).name + " to " + name)); } } } foreach (TileSet tileSet in dungeonArchetype.TileSets) { string name3 = ((Object)tileSet).name; if (extraRooms.ContainsKey(name3)) { GameObjectChance item = extraRooms[name3]; if (!tileSet.TileWeights.Weights.Contains(item)) { tileSet.TileWeights.Weights.Add(item); } } } } index++; }); foreach (CustomGraphLine customGraphLine in customGraphLines) { if (customGraphLine.LevelTypes.HasFlag(levelEnum) && !self.dungeonGenerator.Generator.DungeonFlow.Lines.Contains(customGraphLine.graphLine)) { self.dungeonGenerator.Generator.DungeonFlow.Lines.Add(customGraphLine.graphLine); } } } orig.Invoke(self); NetworkManager val = Object.FindObjectOfType<NetworkManager>(); RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val2 in array) { for (int j = 0; j < val2.spawnablePrefabs.Count; j++) { string prefabName = ((Object)val2.spawnablePrefabs[j]).name; NetworkPrefab val3 = ((IEnumerable<NetworkPrefab>)val.NetworkConfig.Prefabs.m_Prefabs).FirstOrDefault((Func<NetworkPrefab, bool>)((NetworkPrefab x) => ((Object)x.Prefab).name == prefabName)); if (val3 != null && (Object)(object)val3.Prefab != (Object)(object)val2.spawnablePrefabs[j]) { val2.spawnablePrefabs[j] = val3.Prefab; } else if (val3 == null) { Plugin.logger.LogError((object)("DungeonGeneration - Could not find network prefab (" + prefabName + ")! Make sure your assigned prefab is registered with the network manager, or named identically to the vanilla prefab you are referencing.")); } } } } public static void AddArchetype(DungeonArchetype archetype, Levels.LevelTypes levelFlags, int lineIndex = -1) { CustomDungeonArchetype customDungeonArchetype = new CustomDungeonArchetype(); customDungeonArchetype.archeType = archetype; customDungeonArchetype.LevelTypes = levelFlags; customDungeonArchetype.lineIndex = lineIndex; customDungeonArchetypes.Add(customDungeonArchetype); } public static void AddLine(GraphLine line, Levels.LevelTypes levelFlags) { CustomGraphLine customGraphLine = new CustomGraphLine(); customGraphLine.graphLine = line; customGraphLine.LevelTypes = levelFlags; customGraphLines.Add(customGraphLine); } public static void AddLine(DungeonGraphLineDef line, Levels.LevelTypes levelFlags) { AddLine(line.graphLine, levelFlags); } public static void AddTileSet(TileSet set, string archetypeName) { extraTileSets.Add(archetypeName, set); } public static void AddRoom(GameObjectChance room, string tileSetName) { extraRooms.Add(tileSetName, room); } public static void AddRoom(GameObjectChanceDef room, string tileSetName) { AddRoom(room.gameObjectChance, tileSetName); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags, string[] levelOverrides) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, levelOverrides, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio }); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, string[] levelOverrides = null, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio, levelOverrides = levelOverrides }); } } public class Enemies { public struct EnemyAssetInfo { public EnemyType EnemyAsset; public TerminalKeyword keyword; } public enum SpawnType { Default, Daytime, Outside } public class SpawnableEnemy { public EnemyType enemy; public SpawnType spawnType; public TerminalNode terminalNode; public TerminalKeyword infoKeyword; public string modName; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType, string[] spawnLevelOverrides = null) { this.enemy = enemy; this.spawnLevels = spawnLevels; this.spawnType = spawnType; if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { customLevelRarities.Add(key, rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public SpawnableEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { this.enemy = enemy; this.spawnType = spawnType; if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } } } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__RegisterLevelEnemies; public static hook_Start <1>__Terminal_Start; public static hook_Start <2>__QuickMenuManager_Start; } private static bool addedToDebug = false; public static Terminal terminal; public static List<EnemyAssetInfo> enemyAssetInfos = new List<EnemyAssetInfo>(); public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>(); public static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__RegisterLevelEnemies; if (obj == null) { hook_Awake val = RegisterLevelEnemies; <>O.<0>__RegisterLevelEnemies = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_Start; if (obj2 == null) { hook_Start val2 = Terminal_Start; <>O.<1>__Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; object obj3 = <>O.<2>__QuickMenuManager_Start; if (obj3 == null) { hook_Start val3 = QuickMenuManager_Start; <>O.<2>__QuickMenuManager_Start = val3; obj3 = (object)val3; } QuickMenuManager.Start += (hook_Start)obj3; } private static void QuickMenuManager_Start(orig_Start orig, QuickMenuManager self) { //IL_0066: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (addedToDebug) { orig.Invoke(self); return; } SelectableLevel testAllEnemiesLevel = self.testAllEnemiesLevel; List<SpawnableEnemyWithRarity> enemies = testAllEnemiesLevel.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = testAllEnemiesLevel.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = testAllEnemiesLevel.OutsideEnemies; foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { continue; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = spawnableEnemy.rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { enemies.Add(item); } break; case SpawnType.Daytime: if (!daytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { daytimeEnemies.Add(item); } break; case SpawnType.Outside: if (!outsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { outsideEnemies.Add(item); } break; } if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {spawnableEnemy.enemy.enemyName} to DebugList [{spawnableEnemy.spawnType}]"); } } addedToDebug = true; orig.Invoke(self); } private static void Terminal_Start(orig_Start orig, Terminal self) { //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown terminal = self; TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); List<string> list = new List<string>(); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (list.Contains(spawnableEnemy.enemy.enemyName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } if ((Object)(object)spawnableEnemy.terminalNode == (Object)null) { spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>(); spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n"; spawnableEnemy.terminalNode.clearPreviousText = true; spawnableEnemy.terminalNode.maxCharactersToType = 35; spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName; } if (self.enemyFiles.Any((TerminalNode x) => x.creatureName == spawnableEnemy.terminalNode.creatureName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } TerminalKeyword keyword2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val)); keyword2.defaultVerb = val; List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); if (!list2.Any((TerminalKeyword x) => x.word == keyword2.word)) { list2.Add(keyword2); self.terminalNodes.allKeywords = list2.ToArray(); } List<CompatibleNoun> list3 = val.compatibleNouns.ToList(); if (!list3.Any((CompatibleNoun x) => x.noun.word == keyword2.word)) { list3.Add(new CompatibleNoun { noun = keyword2, result = spawnableEnemy.terminalNode }); } val.compatibleNouns = list3.ToArray(); spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count; self.enemyFiles.Add(spawnableEnemy.terminalNode); spawnableEnemy.enemy.enemyPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = spawnableEnemy.terminalNode.creatureFileID; EnemyAssetInfo enemyAssetInfo = default(EnemyAssetInfo); enemyAssetInfo.EnemyAsset = spawnableEnemy.enemy; enemyAssetInfo.keyword = keyword2; EnemyAssetInfo item = enemyAssetInfo; enemyAssetInfos.Add(item); } orig.Invoke(self); } private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self) { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown orig.Invoke(self); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { SelectableLevel[] levels = self.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = spawnableEnemy.levelRarities.ContainsKey(Levels.LevelTypes.All) || (spawnableEnemy.customLevelRarities != null && spawnableEnemy.customLevelRarities.ContainsKey(name)); if (spawnableEnemy.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelEnum = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !spawnableEnemy.spawnLevels.HasFlag(levelEnum)) { continue; } int rarity = 0; if (spawnableEnemy.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { rarity = spawnableEnemy.levelRarities.First((KeyValuePair<Levels.LevelTypes, int> x) => x.Key.HasFlag(levelEnum)).Value; } else if (spawnableEnemy.customLevelRarities != null && spawnableEnemy.customLevelRarities.ContainsKey(name)) { rarity = spawnableEnemy.customLevelRarities[name]; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!val.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.Enemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Default]")); } } break; case SpawnType.Daytime: if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.DaytimeEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Daytime]")); } } break; case SpawnType.Outside: if (!val.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.OutsideEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Outside]")); } } break; } } } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelFlags != Levels.LevelTypes.None) { spawnableEnemy.levelRarities.Add(levelFlags, rarity); } if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { spawnableEnemy.customLevelRarities.Add(key, rarity); } } } else { spawnableEnemy = new SpawnableEnemy(enemy2, rarity, levelFlags, spawnType, spawnLevelOverrides); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; spawnableEnemies.Add(spawnableEnemy); } } public static void RegisterEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { spawnableEnemy.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { spawnableEnemy.customLevelRarities.Add(customLevelRarity.Key, customLevelRarity.Value); } return; } } spawnableEnemy = new SpawnableEnemy(enemy2, spawnType, levelRarities, customLevelRarities); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, spawnLevelOverrides, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, spawnType, levelRarities, customLevelRarities, infoNode, infoKeyword); } public static void RemoveEnemyFromLevels(EnemyType enemyType, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { EnemyType enemyType2 = enemyType; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { List<SpawnableEnemyWithRarity> enemies = val.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = val.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = val.OutsideEnemies; enemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); daytimeEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); outsideEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); } } } } public class Items { public struct ItemSaveOrderData { public int itemId; public string itemName; public string assetName; } public struct BuyableItemAssetInfo { public Item itemAsset; public TerminalKeyword keyword; } public class ScrapItem { public Item item; public Item origItem; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public string modName = "Unknown"; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.LevelTypes.None, string[] spawnLevelOverrides = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { customLevelRarities.Add(key, rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public ScrapItem(Item item, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } if (levelRarities != null) { this.levelRarities = levelRarities; } } } public class PlainItem { public Item item; public string modName; public PlainItem(Item item) { this.item = item; } } public class ShopItem { public Item item; public Item origItem; public TerminalNode buyNode1; public TerminalNode buyNode2; public TerminalNode itemInfo; public bool wasRemoved; public int price; public string modName; public ShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0) { origItem = item; this.item = item; this.price = price; if ((Object)(object)buyNode1 != (Object)null) { this.buyNode1 = buyNode1; } if ((Object)(object)buyNode2 != (Object)null) { this.buyNode2 = buyNode2; } if ((Object)(object)itemInfo != (Object)null) { this.itemInfo = itemInfo; } } } [CompilerGenerated] private static class <>O { public static hook_Start <0>__StartOfRound_Start; public static hook_Awake <1>__Terminal_Awake; public static hook_TextPostProcess <2>__Terminal_TextPostProcess; } public static ConfigEntry<bool> useSavedataFix; public static GameObject scanNodePrefab; public static List<Item> LethalLibItemList = new List<Item>(); public static List<BuyableItemAssetInfo> buyableItemAssetInfos = new List<BuyableItemAssetInfo>(); public static Terminal terminal; public static List<ScrapItem> scrapItems = new List<ScrapItem>(); public static List<ShopItem> shopItems = new List<ShopItem>(); public static List<PlainItem> plainItems = new List<PlainItem>(); public static void Init() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0083: 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: Expected O, but got Unknown useSavedataFix = Plugin.config.Bind<bool>("Items", "EnableItemSaveFix", false, "Allow for LethalLib to store/reorder the item list, which should fix issues where items get reshuffled when loading an old save. This is experimental and may cause save corruptions occasionally."); scanNodePrefab = Plugin.MainAssets.LoadAsset<GameObject>("Assets/Custom/ItemScanNode.prefab"); object obj = <>O.<0>__StartOfRound_Start; if (obj == null) { hook_Start val = StartOfRound_Start; <>O.<0>__StartOfRound_Start = val; obj = (object)val; } StartOfRound.Start += (hook_Start)obj; object obj2 = <>O.<1>__Terminal_Awake; if (obj2 == null) { hook_Awake val2 = Terminal_Awake; <>O.<1>__Terminal_Awake = val2; obj2 = (object)val2; } Terminal.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__Terminal_TextPostProcess; if (obj3 == null) { hook_TextPostProcess val3 = Terminal_TextPostProcess; <>O.<2>__Terminal_TextPostProcess = val3; obj3 = (object)val3; } Terminal.TextPostProcess += (hook_TextPostProcess)obj3; } private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node) { List<Item> list = self.buyableItemsList.ToList(); List<Item> list2 = self.buyableItemsList.ToList(); list2.RemoveAll((Item x) => shopItems.FirstOrDefault((ShopItem item) => (Object)(object)item.origItem == (Object)(object)x || (Object)(object)item.item == (Object)(object)x)?.wasRemoved ?? false); self.buyableItemsList = list2.ToArray(); string result = orig.Invoke(self, modifiedDisplayText, node); self.buyableItemsList = list.ToArray(); return result; } private static void StartOfRound_Start(orig_Start orig, StartOfRound self) { if (useSavedataFix.Value && ((NetworkBehaviour)self).IsHost) { Plugin.logger.LogInfo((object)"Fixing Item savedata!!"); List<ItemSaveOrderData> itemList = new List<ItemSaveOrderData>(); StartOfRound.Instance.allItemsList.itemsList.ForEach(delegate(Item item) { itemList.Add(new ItemSaveOrderData { itemId = item.itemId, itemName = item.itemName, assetName = ((Object)item).name }); }); if (ES3.KeyExists("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName)) { itemList = ES3.Load<List<ItemSaveOrderData>>("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName); } List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList; List<Item> list = new List<Item>(); foreach (ItemSaveOrderData item2 in itemList) { Item val = ((IEnumerable<Item>)itemsList).FirstOrDefault((Func<Item, bool>)((Item x) => x.itemId == item2.itemId && x.itemName == item2.itemName && item2.assetName == ((Object)x).name)); if ((Object)(object)val != (Object)null) { list.Add(val); } else { list.Add(ScriptableObject.CreateInstance<Item>()); } } foreach (Item item3 in itemsList) { if (!list.Contains(item3)) { list.Add(item3); } } StartOfRound.Instance.allItemsList.itemsList = list; ES3.Save<List<ItemSaveOrderData>>("LethalLibAllItemsList", itemList, GameNetworkManager.Instance.currentSaveFileName); } orig.Invoke(self); } private static void Terminal_Awake(orig_Awake orig, Terminal self) { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_088f: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Expected O, but got Unknown //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Expected O, but got Unknown //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Expected O, but got Unknown //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Expected O, but got Unknown StartOfRound instance = StartOfRound.Instance; foreach (ScrapItem scrapItem in scrapItems) { SelectableLevel[] levels = instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = scrapItem.levelRarities.ContainsKey(Levels.LevelTypes.All) || (scrapItem.customLevelRarities != null && scrapItem.customLevelRarities.ContainsKey(name)); if (scrapItem.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelEnum = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !scrapItem.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { continue; } int rarity = 0; if (scrapItem.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { rarity = scrapItem.levelRarities.First((KeyValuePair<Levels.LevelTypes, int> x) => x.Key.HasFlag(levelEnum)).Value; } else if (scrapItem.customLevelRarities != null && scrapItem.customLevelRarities.ContainsKey(name)) { rarity = scrapItem.customLevelRarities[name]; } SpawnableItemWithRarity item2 = new SpawnableItemWithRarity { spawnableItem = scrapItem.item, rarity = rarity }; if (!val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrapItem.item)) { val.spawnableScrap.Add(item2); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)scrapItem.item).name + " to " + name)); } } } } foreach (ScrapItem scrapItem2 in scrapItems) { if (instance.allItemsList.itemsList.Contains(scrapItem2.item)) { continue; } if (Plugin.extendedLogging.Value) { if (scrapItem2.modName != "LethalLib") { Plugin.logger.LogInfo((object)(scrapItem2.modName + " registered scrap item: " + scrapItem2.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered scrap item: " + scrapItem2.item.itemName)); } } LethalLibItemList.Add(scrapItem2.item); instance.allItemsList.itemsList.Add(scrapItem2.item); } foreach (ShopItem shopItem in shopItems) { if (instance.allItemsList.itemsList.Contains(shopItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (shopItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(shopItem.modName + " registered shop item: " + shopItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered shop item: " + shopItem.item.itemName)); } } LethalLibItemList.Add(shopItem.item); instance.allItemsList.itemsList.Add(shopItem.item); } foreach (PlainItem plainItem in plainItems) { if (instance.allItemsList.itemsList.Contains(plainItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (plainItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(plainItem.modName + " registered item: " + plainItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered item: " + plainItem.item.itemName)); } } LethalLibItemList.Add(plainItem.item); instance.allItemsList.itemsList.Add(plainItem.item); } terminal = self; List<Item> list = self.buyableItemsList.ToList(); TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); TerminalNode result = val2.compatibleNouns[0].result.terminalOptions[1].result; TerminalKeyword val3 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); Plugin.logger.LogInfo((object)$"Adding {shopItems.Count} items to terminal"); foreach (ShopItem item in shopItems) { if (list.Any((Item x) => x.itemName == item.item.itemName) && !item.wasRemoved) { Plugin.logger.LogInfo((object)("Item " + item.item.itemName + " already exists in terminal, skipping")); continue; } item.wasRemoved = false; if (item.price == -1) { item.price = item.item.creditsWorth; } else { item.item.creditsWorth = item.price; } int num = -1; if (!list.Any((Item x) => (Object)(object)x == (Object)(object)item.item)) { list.Add(item.item); } else { num = list.IndexOf(item.item); } int buyItemIndex = ((num == -1) ? (list.Count - 1) : num); string itemName = item.item.itemName; _ = itemName[itemName.Length - 1]; string text = itemName; TerminalNode val4 = item.buyNode2; if ((Object)(object)val4 == (Object)null) { val4 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val4).name = itemName.Replace(" ", "-") + "BuyNode2"; val4.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n"; val4.clearPreviousText = true; val4.maxCharactersToType = 15; } val4.buyItemIndex = buyItemIndex; val4.isConfirmationNode = false; val4.itemCost = item.price; val4.playSyncedClip = 0; TerminalNode val5 = item.buyNode1; if ((Object)(object)val5 == (Object)null) { val5 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val5).name = itemName.Replace(" ", "-") + "BuyNode1"; val5.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n"; val5.clearPreviousText = true; val5.maxCharactersToType = 35; } val5.buyItemIndex = buyItemIndex; val5.isConfirmationNode = true; val5.overrideOptions = true; val5.itemCost = item.price; val5.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"), result = val4 }, new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"), result = result } }; TerminalKeyword val6 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val2); List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); list2.Add(val6); self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list3 = val2.compatibleNouns.ToList(); list3.Add(new CompatibleNoun { noun = val6, result = val5 }); val2.compatibleNouns = list3.ToArray(); TerminalNode val7 = item.itemInfo; if ((Object)(object)val7 == (Object)null) { val7 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val7).name = itemName.Replace(" ", "-") + "InfoNode"; val7.displayText = "[No information about this object was found.]\n\n"; val7.clearPreviousText = true; val7.maxCharactersToType = 25; } self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list4 = val3.compatibleNouns.ToList(); list4.Add(new CompatibleNoun { noun = val6, result = val7 }); val3.compatibleNouns = list4.ToArray(); BuyableItemAssetInfo buyableItemAssetInfo = default(BuyableItemAssetInfo); buyableItemAssetInfo.itemAsset = item.item; buyableItemAssetInfo.keyword = val6; BuyableItemAssetInfo item3 = buyableItemAssetInfo; buyableItemAssetInfos.Add(item3); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {itemName} to terminal (Item price: {val5.itemCost}, Item Index: {val5.buyItemIndex}, Terminal keyword: {val6.word})"); } } self.buyableItemsList = list.ToArray(); orig.Invoke(self); } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } if (levelOverrides != null) { foreach (string key in levelOverrides) { scrapItem.customLevelRarities.Add(key, rarity); } } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags, levelOverrides); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { scrapItem.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { scrapItem.customLevelRarities.Add(customLevelRarity.Key, customLevelRarity.Value); } return; } } scrapItem = new ScrapItem(spawnableItem2, levelRarities, customLevelRarities); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } public static void RegisterShopItem(Item shopItem, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, buyNode1, buyNode2, itemInfo, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterShopItem(Item shopItem, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, null, null, null, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterItem(Item plainItem) { PlainItem plainItem2 = new PlainItem(plainItem); string name = Assembly.GetCallingAssembly().GetName().Name; plainItem2.modName = name; plainItems.Add(plainItem2); } public static void RemoveScrapFromLevels(Item scrapItem, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item scrapItem2 = scrapItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { ScrapItem actualItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)scrapItem2 || (Object)(object)x.item == (Object)(object)scrapItem2); SpawnableItemWithRarity val2 = ((IEnumerable<SpawnableItemWithRarity>)val.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)actualItem.item)); if (val2 != null) { val.spawnableScrap.Remove(val2); } } } } public static void RemoveShopItem(Item shopItem) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.wasRemoved = true; List<TerminalKeyword> list = terminal.terminalNodes.allKeywords.ToList(); TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); List<CompatibleNoun> list2 = val.compatibleNouns.ToList(); List<CompatibleNoun> list3 = obj.compatibleNouns.ToList(); if (buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); list.Remove(asset.keyword); list2.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); list3.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); } terminal.terminalNodes.allKeywords = list.ToArray(); val.compatibleNouns = list2.ToArray(); obj.compatibleNouns = list3.ToArray(); } public static void UpdateShopItemPrice(Item shopItem, int price) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.item.creditsWorth = price; TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); _ = obj.compatibleNouns[0].result.terminalOptions[1].result; List<CompatibleNoun> source = obj.compatibleNouns.ToList(); if (!buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { return; } BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); if (!source.Any((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword)) { return; } TerminalNode result = source.First((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword).result; result.itemCost = price; if (result.terminalOptions.Length == 0) { return; } CompatibleNoun[] terminalOptions = result.terminalOptions; foreach (CompatibleNoun val in terminalOptions) { if ((Object)(object)val.result != (Object)null && val.result.buyItemIndex != -1) { val.result.itemCost = price; } } } } public class Levels { [Flags] public enum LevelTypes { None = 1, ExperimentationLevel = 4, AssuranceLevel = 8, VowLevel = 0x10, OffenseLevel = 0x20, MarchLevel = 0x40, RendLevel = 0x80, DineLevel = 0x100, TitanLevel = 0x200, Vanilla = 0x3FC, Modded = 0x400, All = -1 } } public class MapObjects { public class RegisteredMapObject { public SpawnableMapObject mapObject; public SpawnableOutsideObjectWithRarity outsideObject; public Levels.LevelTypes levels; public string[] spawnLevelOverrides; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; public static hook_SpawnMapObjects <1>__RoundManager_SpawnMapObjects; } public static List<RegisteredMapObject> mapObjects = new List<RegisteredMapObject>(); public static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__RoundManager_SpawnMapObjects; if (obj2 == null) { hook_SpawnMapObjects val2 = RoundManager_SpawnMapObjects; <>O.<1>__RoundManager_SpawnMapObjects = val2; obj2 = (object)val2; } RoundManager.SpawnMapObjects += (hook_SpawnMapObjects)obj2; } private static void RoundManager_SpawnMapObjects(orig_SpawnMapObjects orig, RoundManager self) { RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val in array) { foreach (RegisteredMapObject mapObject in mapObjects) { if (mapObject.mapObject != null && !val.spawnablePrefabs.Any((GameObject prefab) => (Object)(object)prefab == (Object)(object)mapObject.mapObject.prefabToSpawn)) { val.spawnablePrefabs.Add(mapObject.mapObject.prefabToSpawn); } } } orig.Invoke(self); } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (RegisteredMapObject mapObject in mapObjects) { SelectableLevel[] levels = self.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = mapObject.levels.HasFlag(Levels.LevelTypes.All) || (mapObject.spawnLevelOverrides != null && mapObject.spawnLevelOverrides.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant())); if (mapObject.levels.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !mapObject.levels.HasFlag(levelTypes)) { continue; } if (mapObject.mapObject != null) { if (val.spawnableMapObjects.Any((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn)) { List<SpawnableMapObject> list = val.spawnableMapObjects.ToList(); list.RemoveAll((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn); val.spawnableMapObjects = list.ToArray(); } SpawnableMapObject mapObject2 = mapObject.mapObject; if (mapObject.spawnRateFunction != null) { mapObject2.numberToSpawn = mapObject.spawnRateFunction(val); } List<SpawnableMapObject> list2 = val.spawnableMapObjects.ToList(); list2.Add(mapObject2); val.spawnableMapObjects = list2.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)mapObject2.prefabToSpawn).name + " to " + name)); } } else { if (mapObject.outsideObject == null) { continue; } if (val.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn)) { List<SpawnableOutsideObjectWithRarity> list3 = val.spawnableOutsideObjects.ToList(); list3.RemoveAll((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn); val.spawnableOutsideObjects = list3.ToArray(); } SpawnableOutsideObjectWithRarity outsideObject = mapObject.outsideObject; if (mapObject.spawnRateFunction != null) { outsideObject.randomAmount = mapObject.spawnRateFunction(val); } List<SpawnableOutsideObjectWithRarity> list4 = val.spawnableOutsideObjects.ToList(); list4.Add(outsideObject); val.spawnableOutsideObjects = list4.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)outsideObject.spawnableObject.prefabToSpawn).name + " to " + name)); } } } } } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RemoveMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveMapObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableMapObject mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableMapObjects = val.spawnableMapObjects.Where((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn != (Object)(object)mapObject2.prefabToSpawn).ToArray(); } } } public static void RemoveOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveOutsideObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableOutsideObjectWithRarity mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableOutsideObjects = val.spawnableOutsideObjects.Where((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn != (Object)(object)mapObject2.spawnableObject.prefabToSpawn).ToArray(); } } } } public class NetworkPrefabs { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GameNetworkManager_Start; } private static List<GameObject> _networkPrefabs = new List<GameObject>(); internal static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_Start; if (obj == null) { hook_Start val = GameNetworkManager_Start; <>O.<0>__GameNetworkManager_Start = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; } public static void RegisterNetworkPrefab(GameObject prefab) { if (!_networkPrefabs.Contains(prefab)) { _networkPrefabs.Add(prefab); } } public static GameObject CreateNetworkPrefab(string name) { GameObject obj = PrefabUtils.CreatePrefab(name); obj.AddComponent<NetworkObject>(); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + name)); obj.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(obj); return obj; } public static GameObject CloneNetworkPrefab(GameObject prefabToClone, string newName = null) { GameObject val = PrefabUtils.ClonePrefab(prefabToClone, newName); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + ((Object)val).name)); val.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(val); return val; } private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); foreach (GameObject networkPrefab in _networkPrefabs) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkPrefab)) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } } } public class Player { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; } public static Dictionary<string, GameObject> ragdollRefs = new Dictionary<string, GameObject>(); public static Dictionary<string, int> ragdollIndexes = new Dictionary<string, int>(); public static void Init() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (KeyValuePair<string, GameObject> ragdollRef in ragdollRefs) { if (!self.playerRagdolls.Contains(ragdollRef.Value)) { self.playerRagdolls.Add(ragdollRef.Value); int value = self.playerRagdolls.Count - 1; if (ragdollIndexes.ContainsKey(ragdollRef.Key)) { ragdollIndexes[ragdollRef.Key] = value; } else { ragdollIndexes.Add(ragdollRef.Key, value); } } } } public static int GetRagdollIndex(string id) { return ragdollIndexes[id]; } public static GameObject GetRagdoll(string id) { return ragdollRefs[id]; } public static void RegisterPlayerRagdoll(string id, GameObject ragdoll) { Plugin.logger.LogInfo((object)("Registering player ragdoll " + id)); ragdollRefs.Add(id, ragdoll); } } public class PrefabUtils { internal static Lazy<GameObject> _prefabParent; internal static GameObject prefabParent => _prefabParent.Value; static PrefabUtils() { _prefabParent = new Lazy<GameObject>((Func<GameObject>)delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject("LethalLibGeneratedPrefabs") { hideFlags = (HideFlags)61 }; val.SetActive(false); return val; }); } public static GameObject ClonePrefab(GameObject prefabToClone, string newName = null) { GameObject val = Object.Instantiate<GameObject>(prefabToClone, prefabParent.transform); ((Object)val).hideFlags = (HideFlags)61; if (newName != null) { ((Object)val).name = newName; } else { ((Object)val).name = ((Object)prefabToClone).name; } return val; } public static GameObject CreatePrefab(string name) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameObject val = new GameObject(name) { hideFlags = (HideFlags)61 }; val.transform.SetParent(prefabParent.transform); return val; } } public class Shaders { public static void FixShaders(GameObject gameObject) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material val in materials) { if (((Object)val.shader).name.Contains("Standard")) { val.shader = Shader.Find("HDRP/Lit"); } } } } } public class TerminalUtils { public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false) { TerminalKeyword obj = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)obj).name = word; obj.word = word; obj.isVerb = isVerb; obj.compatibleNouns = compatibleNouns; obj.specialKeywordResult = specialKeywordResult; obj.defaultVerb = defaultVerb; obj.accessTerminalObjects = accessTerminalObjects; return obj; } } public enum StoreType { None, ShipUpgrade, Decor } public class Unlockables { public class RegisteredUnlockable { public UnlockableItem unlockable; public StoreType StoreType; public TerminalNode buyNode1; public TerminalNode buyNode2; public TerminalNode itemInfo; public int price; public string modName; public bool disabled; public bool wasAlwaysInStock; public RegisteredUnlockable(UnlockableItem unlockable, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1) { this.unlockable = unlockable; this.buyNode1 = buyNode1; this.buyNode2 = buyNode2; this.itemInfo = itemInfo; this.price = price; } } public struct BuyableUnlockableAssetInfo { public UnlockableItem itemAsset; public TerminalKeyword keyword; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__Terminal_Awake; public static hook_TextPostProcess <1>__Terminal_TextPostProcess; public static hook_RotateShipDecorSelection <2>__Terminal_RotateShipDecorSelection; } public static List<RegisteredUnlockable> registeredUnlockables = new List<RegisteredUnlockable>(); public static List<BuyableUnlockableAssetInfo> buyableUnlockableAssetInfos = new List<BuyableUnlockableAssetInfo>(); public static void Init() { //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_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown object obj = <>O.<0>__Terminal_Awake; if (obj == null) { hook_Awake val = Terminal_Awake; <>O.<0>__Terminal_Awake = val; obj = (object)val; } Terminal.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_TextPostProcess; if (obj2 == null) { hook_TextPostProcess val2 = Terminal_TextPostProcess; <>O.<1>__Terminal_TextPostProcess = val2; obj2 = (object)val2; } Terminal.TextPostProcess += (hook_TextPostProcess)obj2; object obj3 = <>O.<2>__Terminal_RotateShipDecorSelection; if (obj3 == null) { hook_RotateShipDecorSelection val3 = Terminal_RotateShipDecorSelection; <>O.<2>__Terminal_RotateShipDecorSelection = val3; obj3 = (object)val3; } Terminal.RotateShipDecorSelection += (hook_RotateShipDecorSelection)obj3; } private static void Terminal_RotateShipDecorSelection(orig_RotateShipDecorSelection orig, Terminal self) { foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables) { if (registeredUnlockable.StoreType == StoreType.Decor && registeredUnlockable.disabled) { registeredUnlockable.wasAlwaysInStock = registeredUnlockable.unlockable.alwaysInStock; registeredUnlockable.unlockable.alwaysInStock = true; } } orig.Invoke(self); foreach (RegisteredUnlockable registeredUnlockable2 in registeredUnlockables) { if (registeredUnlockable2.StoreType == StoreType.Decor && registeredUnlockable2.disabled) { registeredUnlockable2.unlockable.alwaysInStock = registeredUnlockable2.wasAlwaysInStock; } } } private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node) { if (modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]")) { int num = modifiedDisplayText.IndexOf(":"); foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables) { if (registeredUnlockable.StoreType == StoreType.ShipUpgrade && !registeredUnlockable.disabled) { string unlockableName = registeredUnlockable.unlockable.unlockableName; int price = registeredUnlockable.price; string value = $"\n* {unlockableName} // Price: ${price}"; modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value); } } } return orig.Invoke(self, modifiedDisplayText, node); } private static void Terminal_Awake(orig_Awake orig, Terminal self) { //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Expected O, but got Unknown //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Expected O, but got Unknown //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Expected O, but got Unknown StartOfR
plugins/LethalNetworkAPI/LethalNetworkAPI.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalNetworkAPI.NetcodePatcher; using LethalNetworkAPI.Networking; using LethalNetworkAPI.Serializable; using Microsoft.CodeAnalysis; using OdinSerializer; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RegisterFormatter(typeof(NetworkBehaviourReferenceFormatter), 0)] [assembly: RegisterFormatter(typeof(NetworkObjectReferenceFormatter), 0)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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: AssemblyCompany("Xilophor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Easily create networked mods.")] [assembly: AssemblyFileVersion("2.1.6.0")] [assembly: AssemblyInformationalVersion("2.1.6+2b8f80905fe30276fc377fd0534a4383a6ae9dc2")] [assembly: AssemblyProduct("LethalNetworkAPI")] [assembly: AssemblyTitle("LethalNetworkAPI")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Xilophor/LethalNetworkAPI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.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 LethalNetworkAPI { public sealed class LethalClientEvent : LNetworkEvent { public event Action? OnReceived; public event Action<ulong>? OnReceivedFromClient; public LethalClientEvent(string identifier, Action? onReceived = null, Action<ulong>? onReceivedFromClient = null) : base(identifier) { NetworkHandler.OnClientEvent += ReceiveClientEvent; NetworkHandler.OnSyncedClientEvent += ReceiveSyncedClientEvent; OnReceived += onReceived; OnReceivedFromClient += onReceivedFromClient; } public void InvokeServer() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull()) { NetworkHandler.Instance.EventServerRpc(Identifier); } } public void InvokeAllClients(bool includeLocalClient = true, bool waitForServerResponse = false) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull()) { NetworkHandler.Instance.EventServerRpc(Identifier, toOtherClients: true, includeLocalClient && waitForServerResponse); if (includeLocalClient && !waitForServerResponse) { this.OnReceivedFromClient?.Invoke(NetworkManager.Singleton.LocalClientId); } } } public void InvokeAllClientsSynced() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull()) { NetworkTime localTime = NetworkManager.Singleton.LocalTime; double time = ((NetworkTime)(ref localTime)).Time; NetworkHandler.Instance.SyncedEventServerRpc(Identifier, time); ReceiveClientEvent(Identifier, NetworkManager.Singleton.LocalClientId); } } private void ReceiveClientEvent(string identifier, ulong originatorClientId) { if (!(identifier != Identifier)) { if (originatorClientId == 99999) { this.OnReceived?.Invoke(); } else { this.OnReceivedFromClient?.Invoke(originatorClientId); } } } private void ReceiveSyncedClientEvent(string identifier, double time, ulong originatorClientId) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!(identifier != Identifier) && !((Object)(object)NetworkHandler.Instance == (Object)null)) { NetworkTime serverTime = NetworkManager.Singleton.ServerTime; double num = time - ((NetworkTime)(ref serverTime)).Time; ((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, originatorClientId)); } } private IEnumerator WaitAndInvokeEvent(float timeToWait, ulong originatorClientId) { if (timeToWait > 0f) { yield return (object)new WaitForSeconds(timeToWait); } ReceiveClientEvent(Identifier, originatorClientId); } } public sealed class LethalServerEvent : LNetworkEvent { public event Action<ulong>? OnReceived; public LethalServerEvent(string identifier, Action<ulong>? onReceived = null) : base(identifier) { NetworkHandler.OnServerEvent += ReceiveServerEvent; NetworkHandler.OnSyncedServerEvent += ReceiveSyncedServerEvent; OnReceived += onReceived; } public void InvokeClient(ulong clientId) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParams(clientId)); } } public void InvokeClients(IEnumerable<ulong> clientIds) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParams(clientIds)); } } public void InvokeAllClients(bool receiveOnHost = true) { //IL_0048: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { if (receiveOnHost) { NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL); } else { NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParamsExceptHost()); } } } private void ReceiveServerEvent(string identifier, ulong originClientId) { if (!(identifier != Identifier)) { this.OnReceived?.Invoke(originClientId); } } private void ReceiveSyncedServerEvent(string identifier, double time, ulong originatorClientId) { //IL_001e: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (!(identifier != Identifier) && !IsNetworkHandlerNull()) { NetworkTime serverTime = NetworkManager.Singleton.ServerTime; double num = time - ((NetworkTime)(ref serverTime)).Time; NetworkHandler.Instance.SyncedEventClientRpc(identifier, time, originatorClientId, GenerateClientParamsExcept(originatorClientId)); ((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, originatorClientId)); } } private IEnumerator WaitAndInvokeEvent(float timeToWait, ulong clientId) { if (timeToWait > 0f) { yield return (object)new WaitForSeconds(timeToWait); } this.OnReceived?.Invoke(clientId); } } public abstract class LNetworkEvent : LethalNetwork { protected LNetworkEvent(string identifier) : base("evt." + identifier, "Event") { } } public abstract class LethalNetwork { internal readonly string Identifier; private readonly string _networkType; protected LethalNetwork(string identifier, string networkType, int frameIndex = 3) { try { MethodBase method = new StackTrace().GetFrame(frameIndex).GetMethod(); Assembly assembly = method.ReflectedType.Assembly; Type type2 = AccessTools.GetTypesFromAssembly(assembly).First((Type type) => type.GetCustomAttributes(typeof(BepInPlugin), inherit: false).Any()); Identifier = MetadataHelper.GetMetadata(type2).GUID + "." + identifier; _networkType = networkType; } catch (Exception arg) { LethalNetworkAPIPlugin.Logger.LogError((object)$"Unable to find plugin info for calling mod for {_networkType.ToLower()} with identifier \"{Identifier}\". Are you using BepInEx? \n Stacktrace: {arg}"); } } protected bool IsNetworkHandlerNull(bool log = true) { if ((Object)(object)NetworkHandler.Instance != (Object)null) { return false; } if (log) { LethalNetworkAPIPlugin.Logger.LogError((object)string.Format("Unable to invoke the {1} with identifier \"{0}\". Is the player in a lobby?", _networkType.ToLower(), Identifier)); } return true; } protected bool IsHostOrServer(bool log = true) { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { return true; } if (log) { LethalNetworkAPIPlugin.Logger.LogError((object)$"The client {NetworkManager.Singleton.LocalClientId} cannot use server methods. {_networkType} Identifier: \"{Identifier}\""); } return false; } private bool DoClientsExist(IEnumerable<ulong> clientIds, bool log = true) { if (clientIds.Any()) { return true; } if (log) { LethalNetworkAPIPlugin.Logger.LogError((object)$"None of the specified clients {clientIds} are connected. {_networkType} Identifier: \"{Identifier}\""); } return false; } private ClientRpcParams GenerateClientParams(IEnumerable<ulong> clientIds, bool allExcept) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) ulong[] enumerable = (clientIds as ulong[]) ?? clientIds.ToArray(); NativeArray<ulong> val = default(NativeArray<ulong>); if (!enumerable.Any() && allExcept) { val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != 0).ToArray(), (Allocator)4); } else if (allExcept) { val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => enumerable.All((ulong j) => i != j)).ToArray(), (Allocator)4); } else { val..ctor(enumerable.Where((ulong i) => NetworkManager.Singleton.ConnectedClientsIds.Contains(i)).ToArray(), (Allocator)4); } if (!DoClientsExist((IEnumerable<ulong>)(object)val)) { return default(ClientRpcParams); } ClientRpcParams result = default(ClientRpcParams); result.Send = new ClientRpcSendParams { TargetClientIdsNativeArray = val }; return result; } protected ClientRpcParams GenerateClientParams(IEnumerable<ulong> clientIds) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return GenerateClientParams(clientIds, allExcept: false); } protected ClientRpcParams GenerateClientParams(ulong clientId) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return GenerateClientParams(new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId }), allExcept: false); } protected ClientRpcParams GenerateClientParamsExcept(IEnumerable<ulong> clientIds) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return GenerateClientParams(clientIds, allExcept: true); } protected ClientRpcParams GenerateClientParamsExcept(ulong clientId) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return GenerateClientParams(new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId }), allExcept: true); } protected ClientRpcParams GenerateClientParamsExceptHost() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return GenerateClientParams(Array.Empty<ulong>(), allExcept: true); } } [BepInPlugin("LethalNetworkAPI", "LethalNetworkAPI", "2.1.6")] public class LethalNetworkAPIPlugin : BaseUnityPlugin { public static LethalNetworkAPIPlugin Instance; private static Harmony _harmony; internal static ManualLogSource Logger { get; private set; } private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("LethalNetworkAPI"); NetcodePatcher(); _harmony.PatchAll(typeof(NetworkObjectManager)); Logger.LogInfo((object)"LethalNetworkAPI v2.1.6 has Loaded."); } private static void NetcodePatcher() { 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); } } } } } public static class LethalNetworkExtensions { public static PlayerControllerB? GetPlayerController(this ulong clientId) { return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientId]]; } [Obsolete("GetPlayerFromId is deprecated, please use GetPlayerController instead.")] public static PlayerControllerB? GetPlayerFromId(this ulong clientId) { return clientId.GetPlayerController(); } public static ulong GetClientId(this PlayerControllerB player) { return player.actualClientId; } public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkBehaviour networkBehaviour, string identifier, bool serverOwned = false) { return ((Component)networkBehaviour).gameObject.NetworkVariable<TData>(identifier, serverOwned); } public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkObject networkObject, string identifier, bool serverOwned = false) { return ((Component)networkObject).gameObject.NetworkVariable<TData>(identifier, serverOwned); } public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this GameObject gameObject, string identifier, bool serverOwned = false) { return gameObject.NetworkVariable<TData>(identifier, serverOwned); } private static LethalNetworkVariable<TData>? NetworkVariable<TData>(this GameObject gameObject, string identifier, bool serverOwned) { string identifier2 = identifier; NetworkObject networkObjectComp = default(NetworkObject); if (!gameObject.TryGetComponent<NetworkObject>(ref networkObjectComp)) { LethalNetworkAPIPlugin.Logger.LogError((object)$"Unable to find the network object component. Are you adding variable \"{identifier2}\" to a network object?"); return null; } LethalNetworkVariable<TData> lethalNetworkVariable = (LethalNetworkVariable<TData>)NetworkHandler.Instance.ObjectNetworkVariableList.FirstOrDefault((ILethalNetVar i) => ((LethalNetworkVariable<TData>)i).Identifier == $"{identifier2}.{networkObjectComp.GlobalObjectIdHash}"); if (lethalNetworkVariable != null) { return lethalNetworkVariable; } lethalNetworkVariable = new LethalNetworkVariable<TData>($"{identifier2}.{networkObjectComp.GlobalObjectIdHash}", networkObjectComp, serverOwned, 3); NetworkHandler.Instance.ObjectNetworkVariableList.Add(lethalNetworkVariable); return lethalNetworkVariable; } } public sealed class LethalClientMessage<TData> : LNetworkMessage { public event Action<TData>? OnReceived; public event Action<TData, ulong>? OnReceivedFromClient; public LethalClientMessage(string identifier, Action<TData>? onReceived = null, Action<TData, ulong>? onReceivedFromClient = null) : base(identifier) { NetworkHandler.OnClientMessage += ReceiveMessage; OnReceived += onReceived; OnReceivedFromClient += onReceivedFromClient; } public void SendServer(TData data) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull()) { NetworkHandler.Instance.MessageServerRpc(Identifier, LethalNetworkSerializer.Serialize(data)); } } public void SendAllClients(TData data, bool includeLocalClient = true, bool waitForServerResponse = false) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull()) { NetworkHandler.Instance.MessageServerRpc(Identifier, LethalNetworkSerializer.Serialize(data), toOtherClients: true, includeLocalClient && waitForServerResponse); if (includeLocalClient && !waitForServerResponse) { this.OnReceivedFromClient?.Invoke(data, NetworkManager.Singleton.LocalClientId); } } } private void ReceiveMessage(string identifier, byte[] data, ulong originatorClient) { if (!(identifier != Identifier)) { if (originatorClient == 99999) { this.OnReceived?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data)); } else { this.OnReceivedFromClient?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data), originatorClient); } } } } public class LethalServerMessage<TData> : LNetworkMessage { public event Action<TData, ulong>? OnReceived; public LethalServerMessage(string identifier, Action<TData, ulong>? onReceived = null) : base(identifier) { NetworkHandler.OnServerMessage += ReceiveServerMessage; OnReceived += onReceived; } public void SendClient(TData data, ulong clientId) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParams(clientId)); } } public void SendClients(TData data, IEnumerable<ulong> clientIds) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParams(clientIds)); } } public void SendAllClients(TData data, bool receiveOnHost = true) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //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) if (!IsNetworkHandlerNull() && IsHostOrServer()) { if (receiveOnHost) { NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL); } else { NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParamsExceptHost()); } } } private void ReceiveServerMessage(string identifier, byte[] data, ulong originClientId) { if (!(identifier != Identifier)) { this.OnReceived?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data), originClientId); } } } public abstract class LNetworkMessage : LethalNetwork { protected LNetworkMessage(string identifier) : base("msg." + identifier, "Message") { } } internal static class TextDefinitions { internal const string NotInLobbyMessage = "Unable to send the {0} with identifier \"{1}\" and data {{{2}}}. Is the player in a lobby?"; internal const string UnableToFindGuid = "Unable to find plugin info for calling mod for {0} with identifier \"{1}\". Are you using BepInEx? \n Stacktrace: {2}"; internal const string NotServerInfo = "The client {0} cannot use server methods. {1} Identifier: \"{2}\""; internal const string NotInLobbyEvent = "Unable to invoke the {1} with identifier \"{0}\". Is the player in a lobby?"; internal const string NetworkHandlerDoesNotExist = "The NetworkHandler does not exist. This shouldn't occur!"; internal const string TargetClientNotConnected = "The specified client {0} is not connected. {1} Identifier: \"{2}\""; internal const string TargetClientsNotConnected = "None of the specified clients {0} are connected. {1} Identifier: \"{2}\""; internal const string UnableToLocateNetworkObjectComponent = "Unable to find the network object component. Are you adding variable \"{0}\" to a network object?"; } internal interface ILethalNetVar { } public sealed class LethalNetworkVariable<TData> : LethalNetwork, ILethalNetVar { private readonly bool _public; private readonly NetworkObject? _ownerObject; private bool _isDirty; private TData _value; public TData Value { get { return _value; } set { if (IsOwner && (value != null || _value != null) && (value == null || !value.Equals(_value))) { _value = value; _isDirty = true; this.OnValueChanged?.Invoke(_value); } } } private bool IsOwner { get { if (_public) { return true; } if ((Object)(object)NetworkManager.Singleton == (Object)null) { return true; } if (_ownerObject == null && NetworkManager.Singleton.IsServer) { return true; } if (_ownerObject != null) { return _ownerObject.OwnerClientId == NetworkManager.Singleton.LocalClientId; } return false; } } public event Action<TData>? OnValueChanged; public LethalNetworkVariable(string identifier) : this(identifier, (NetworkObject?)null, serverOwned: true, 2) { } internal LethalNetworkVariable(string identifier, NetworkObject? owner, bool serverOwned, int frameIndex) : base(identifier, "Variable", frameIndex + 1) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) _ownerObject = ((!serverOwned) ? owner : null); NetworkHandler.OnVariableUpdate += ReceiveUpdate; NetworkHandler.NetworkTick += OnNetworkTick; NetworkHandler.NetworkSpawn += delegate { if (!IsNetworkHandlerNull() && IsHostOrServer(log: false)) { NetworkHandler.OnPlayerJoin += OnPlayerJoin; NetworkHandler.NetworkDespawn += ClearSubscriptions; } }; NetworkHandler.GetVariableValue += delegate(string id, ulong clientId) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!(id != Identifier) && !IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.UpdateVariableClientRpc(Identifier, LethalNetworkSerializer.Serialize(_value), GenerateClientParams(clientId)); } }; if (typeof(LethalNetworkVariable<TData>).GetCustomAttributes(typeof(PublicNetworkVariableAttribute), inherit: true).Any()) { _public = true; } if (!IsNetworkHandlerNull(log: false)) { if (IsHostOrServer()) { NetworkHandler.OnPlayerJoin += OnPlayerJoin; } else { NetworkHandler.Instance.GetVariableValueServerRpc(Identifier); } } } private void OnPlayerJoin(ulong clientId) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsHostOrServer()) { NetworkHandler.Instance.UpdateVariableClientRpc(Identifier, LethalNetworkSerializer.Serialize(_value), GenerateClientParams(clientId)); } } private void ClearSubscriptions() { NetworkHandler.OnPlayerJoin -= OnPlayerJoin; NetworkHandler.NetworkDespawn -= ClearSubscriptions; } private void SendUpdate() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (!IsNetworkHandlerNull() && IsOwner) { NetworkHandler.Instance.UpdateVariableServerRpc(Identifier, LethalNetworkSerializer.Serialize(_value)); } } private void ReceiveUpdate(string identifier, byte[] data) { if (!(identifier != Identifier)) { TData val = LethalNetworkSerializer.Deserialize<TData>(data); if (val != null) { _value = val; this.OnValueChanged?.Invoke(val); } } } private void OnNetworkTick() { if (_isDirty && _value != null) { SendUpdate(); _isDirty = false; } } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public class PublicNetworkVariableAttribute : Attribute { } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalNetworkAPI"; public const string PLUGIN_NAME = "LethalNetworkAPI"; public const string PLUGIN_VERSION = "2.1.6"; } } namespace LethalNetworkAPI.Serializable { internal static class LethalNetworkSerializer { internal static byte[] Serialize<T>(T value) { //IL_003e: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (value == null) { return Array.Empty<byte>(); } object obj = value; GameObject val = (GameObject)((obj is GameObject) ? obj : null); if (val != null) { return SerializationUtility.SerializeValue<NetworkObjectReference>(NetworkObjectReference.op_Implicit(val), (DataFormat)0, (SerializationContext)null); } object obj2 = value; NetworkObject val2 = (NetworkObject)((obj2 is NetworkObject) ? obj2 : null); if (val2 != null) { return SerializationUtility.SerializeValue<NetworkObjectReference>(NetworkObjectReference.op_Implicit(val2), (DataFormat)0, (SerializationContext)null); } object obj3 = value; NetworkBehaviour val3 = (NetworkBehaviour)((obj3 is NetworkBehaviour) ? obj3 : null); if (val3 != null) { return SerializationUtility.SerializeValue<NetworkBehaviourReference>(NetworkBehaviourReference.op_Implicit(val3), (DataFormat)0, (SerializationContext)null); } return SerializationUtility.SerializeValue<T>(value, (DataFormat)0, (SerializationContext)null); } internal static T Deserialize<T>(byte[] data) { //IL_0042: 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_006c: Unknown result type (might be due to invalid IL or missing references) if (data.Length == 0) { return default(T); } T val = default(T); if (!(val is GameObject)) { if (!(val is NetworkObject)) { if (val is NetworkBehaviour) { return (T)(object)NetworkBehaviourReference.op_Implicit(SerializationUtility.DeserializeValue<NetworkBehaviourReference>(data, (DataFormat)0, (DeserializationContext)null)); } return SerializationUtility.DeserializeValue<T>(data, (DataFormat)0, (DeserializationContext)null); } return (T)(object)NetworkObjectReference.op_Implicit(SerializationUtility.DeserializeValue<NetworkObjectReference>(data, (DataFormat)0, (DeserializationContext)null)); } return (T)(object)NetworkObjectReference.op_Implicit(SerializationUtility.DeserializeValue<NetworkObjectReference>(data, (DataFormat)0, (DeserializationContext)null)); } } public class NetworkBehaviourReferenceFormatter : MinimalBaseFormatter<NetworkBehaviourReference> { private static readonly Serializer<ushort> UInt16Serializer = Serializer.Get<ushort>(); private static readonly Serializer<NetworkObjectReference> NetworkObjectReferenceSerializer = Serializer.Get<NetworkObjectReference>(); protected override void Read(ref NetworkBehaviourReference value, IDataReader reader) { //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) value.m_NetworkObjectReference = NetworkObjectReferenceSerializer.ReadValue(reader); value.m_NetworkBehaviourId = UInt16Serializer.ReadValue(reader); } protected override void Write(ref NetworkBehaviourReference value, IDataWriter writer) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) NetworkObjectReferenceSerializer.WriteValue(value.m_NetworkObjectReference, writer); UInt16Serializer.WriteValue(value.m_NetworkBehaviourId, writer); } } internal class NetworkObjectReferenceFormatter : MinimalBaseFormatter<NetworkObjectReference> { private static readonly Serializer<ulong> UInt64Serializer = Serializer.Get<ulong>(); protected override void Read(ref NetworkObjectReference value, IDataReader reader) { ((NetworkObjectReference)(ref value)).NetworkObjectId = UInt64Serializer.ReadValue(reader); } protected override void Write(ref NetworkObjectReference value, IDataWriter writer) { UInt64Serializer.WriteValue(((NetworkObjectReference)(ref value)).NetworkObjectId, writer); } } } namespace LethalNetworkAPI.Networking { internal class NetworkHandler : NetworkBehaviour { internal readonly List<ILethalNetVar> ObjectNetworkVariableList = new List<ILethalNetVar>(); internal static NetworkHandler? Instance { get; private set; } internal static event Action? NetworkSpawn; internal static event Action? NetworkDespawn; internal static event Action? NetworkTick; internal static event Action<ulong>? OnPlayerJoin; internal static event Action<string, byte[], ulong>? OnServerMessage; internal static event Action<string, byte[], ulong>? OnClientMessage; internal static event Action<string, byte[]>? OnVariableUpdate; internal static event Action<string, ulong>? GetVariableValue; internal static event Action<string, ulong>? OnServerEvent; internal static event Action<string, ulong>? OnClientEvent; internal static event Action<string, double, ulong>? OnSyncedServerEvent; internal static event Action<string, double, ulong>? OnSyncedClientEvent; public override void OnNetworkSpawn() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)this); return; } Instance = this; NetworkHandler.NetworkSpawn?.Invoke(); ((NetworkBehaviour)this).NetworkManager.NetworkTickSystem.Tick += NetworkHandler.NetworkTick; NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnectedCallback; } internal void Clean() { NetworkHandler.NetworkDespawn?.Invoke(); NetworkHandler.OnPlayerJoin = null; NetworkHandler.NetworkDespawn = null; Instance = null; } private void OnClientConnectedCallback(ulong client) { NetworkHandler.OnPlayerJoin?.Invoke(client); } [ServerRpc(RequireOwnership = false)] internal void MessageServerRpc(string identifier, byte[] data, bool toOtherClients = false, bool sendToOriginator = false, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3629803754u, serverRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } bool flag2 = data != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref toOtherClients, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref sendToOriginator, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3629803754u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ServerRpcParams serverRpcParams2 = serverRpcParams; if (!toOtherClients) { NetworkHandler.OnServerMessage?.Invoke(identifier, data, serverRpcParams2.Receive.SenderClientId); } else if (!sendToOriginator) { NativeArray<ulong> val2 = default(NativeArray<ulong>); val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4); if (((IEnumerable<ulong>)(object)val2).Any()) { MessageClientRpc(identifier, data, serverRpcParams2.Receive.SenderClientId, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIdsNativeArray = val2 } }); } } else { MessageClientRpc(identifier, data, serverRpcParams2.Receive.SenderClientId); } } [ClientRpc] internal void MessageClientRpc(string identifier, byte[] data, ulong originatorClient = 99999uL, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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) //IL_00ea: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3740138170u, clientRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } bool flag2 = data != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives)); } BytePacker.WriteValueBitPacked(val, originatorClient); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3740138170u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkHandler.OnClientMessage?.Invoke(identifier, data, originatorClient); clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose(); } } [ServerRpc(RequireOwnership = false)] internal void EventServerRpc(string identifier, bool toOtherClients = false, bool sendToOriginator = false, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1959733556u, serverRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref toOtherClients, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref sendToOriginator, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1959733556u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ServerRpcParams serverRpcParams2 = serverRpcParams; if (!toOtherClients) { NetworkHandler.OnServerEvent?.Invoke(identifier, serverRpcParams2.Receive.SenderClientId); } else if (!sendToOriginator) { NativeArray<ulong> val2 = default(NativeArray<ulong>); val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4); if (((IEnumerable<ulong>)(object)val2).Any()) { EventClientRpc(identifier, serverRpcParams2.Receive.SenderClientId, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIdsNativeArray = val2 } }); } } else { EventClientRpc(identifier, serverRpcParams2.Receive.SenderClientId); } } [ClientRpc] internal void EventClientRpc(string identifier, ulong originatorClient = 99999uL, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(53735464u, clientRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } BytePacker.WriteValueBitPacked(val, originatorClient); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 53735464u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkHandler.OnClientEvent?.Invoke(identifier, originatorClient); clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose(); } } [ServerRpc(RequireOwnership = false)] internal void SyncedEventServerRpc(string identifier, double time, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2669215490u, serverRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2669215490u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { NetworkHandler.OnSyncedServerEvent?.Invoke(identifier, time, serverRpcParams.Receive.SenderClientId); } } [ClientRpc] internal void SyncedEventClientRpc(string identifier, double time, ulong originatorClient, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(899832842u, clientRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } ((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, originatorClient); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 899832842u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkHandler.OnSyncedClientEvent?.Invoke(identifier, time, originatorClient); clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose(); } } [ServerRpc(RequireOwnership = false)] internal void UpdateVariableServerRpc(string identifier, byte[] data, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1359429614u, serverRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } bool flag2 = data != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1359429614u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ServerRpcParams serverRpcParams2 = serverRpcParams; if (serverRpcParams2.Receive.SenderClientId != 0L) { NetworkHandler.OnVariableUpdate?.Invoke(identifier, data); } NativeArray<ulong> val2 = default(NativeArray<ulong>); val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4); if (((IEnumerable<ulong>)(object)val2).Any()) { UpdateVariableClientRpc(identifier, data, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIdsNativeArray = val2 } }); } } } [ClientRpc] internal void UpdateVariableClientRpc(string identifier, byte[] data, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1641402893u, clientRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } bool flag2 = data != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1641402893u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkHandler.OnVariableUpdate?.Invoke(identifier, data); clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose(); } } [ServerRpc(RequireOwnership = false)] internal void GetVariableValueServerRpc(string identifier, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2442151635u, serverRpcParams, (RpcDelivery)0); bool flag = identifier != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2442151635u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { NetworkHandler.GetVariableValue?.Invoke(identifier, serverRpcParams.Receive.SenderClientId); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NetworkHandler() { //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 NetworkManager.__rpc_func_table.Add(3629803754u, new RpcReceiveHandler(__rpc_handler_3629803754)); NetworkManager.__rpc_func_table.Add(3740138170u, new RpcReceiveHandler(__rpc_handler_3740138170)); NetworkManager.__rpc_func_table.Add(1959733556u, new RpcReceiveHandler(__rpc_handler_1959733556)); NetworkManager.__rpc_func_table.Add(53735464u, new RpcReceiveHandler(__rpc_handler_53735464)); NetworkManager.__rpc_func_table.Add(2669215490u, new RpcReceiveHandler(__rpc_handler_2669215490)); NetworkManager.__rpc_func_table.Add(899832842u, new RpcReceiveHandler(__rpc_handler_899832842)); NetworkManager.__rpc_func_table.Add(1359429614u, new RpcReceiveHandler(__rpc_handler_1359429614)); NetworkManager.__rpc_func_table.Add(1641402893u, new RpcReceiveHandler(__rpc_handler_1641402893)); NetworkManager.__rpc_func_table.Add(2442151635u, new RpcReceiveHandler(__rpc_handler_2442151635)); } private static void __rpc_handler_3629803754(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_0067: 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_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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] data = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives)); } bool toOtherClients = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toOtherClients, default(ForPrimitives)); bool sendToOriginator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sendToOriginator, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).MessageServerRpc(identifier, data, toOtherClients, sendToOriginator, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3740138170(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_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] data = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives)); } ulong originatorClient = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).MessageClientRpc(identifier, data, originatorClient, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1959733556(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_0067: 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_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } bool toOtherClients = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toOtherClients, default(ForPrimitives)); bool sendToOriginator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sendToOriginator, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).EventServerRpc(identifier, toOtherClients, sendToOriginator, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_53735464(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_005b: 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_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } ulong originatorClient = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).EventClientRpc(identifier, originatorClient, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2669215490(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_0067: 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_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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } double time = default(double); ((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SyncedEventServerRpc(identifier, time, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_899832842(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_0067: 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_0076: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } double time = default(double); ((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives)); ulong originatorClient = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).SyncedEventClientRpc(identifier, time, originatorClient, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1359429614(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_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] data = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives)); } ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).UpdateVariableServerRpc(identifier, data, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1641402893(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_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); byte[] data = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((NetworkHandler)(object)target).UpdateVariableClientRpc(identifier, data, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2442151635(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_005b: 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_0061: 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_007a: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string identifier = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false); } ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).GetVariableValueServerRpc(identifier, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "NetworkHandler"; } } [HarmonyPatch] [HarmonyPriority(800)] [HarmonyWrapSafe] internal class NetworkObjectManager { private static GameObject _networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void Init() { //IL_0013: 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_0021: Expected O, but got Unknown if (!((Object)(object)_networkPrefab != (Object)null)) { GameObject val = new GameObject("NetworkAPIContainer") { hideFlags = (HideFlags)61 }; val.SetActive(false); _networkPrefab = MakePrefab<NetworkHandler>("LethalNetworkAPI.Handler", val, 889887688u); } } private static GameObject MakePrefab<T>(string name, GameObject parent, uint overrideGuid = 0u) where T : NetworkBehaviour { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent.transform); val.AddComponent<NetworkObject>(); val.AddComponent<T>(); ((Object)val).hideFlags = (HideFlags)61; if (overrideGuid != 0) { val.GetComponent<NetworkObject>().GlobalObjectIdHash = overrideGuid; } else { uint globalObjectIdHash = BitConverter.ToUInt32(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetExecutingAssembly().GetName().Name + name)), 0); val.GetComponent<NetworkObject>().GlobalObjectIdHash = globalObjectIdHash; } NetworkManager.Singleton.AddNetworkPrefab(val); return val; } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] private static void SpawnNetworkHandler() { //IL_001e: 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) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(_networkPrefab, Vector3.zero, Quaternion.identity, ((Component)StartOfRound.Instance).transform); val.GetComponent<NetworkObject>().Spawn(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnDisable")] private static void OnDisconnect() { NetworkHandler.Instance.Clean(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace LethalNetworkAPI.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/LethalPresents.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; 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.Logging; using Microsoft.CodeAnalysis; using On; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalPresents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("LethalPresents mod")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4")] [assembly: AssemblyProduct("LethalPresents")] [assembly: AssemblyTitle("LethalPresents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.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 LethalPresents { [BepInPlugin("LethalPresents", "LethalPresents", "1.0.4")] public class LethalPresentsPlugin : BaseUnityPlugin { public static ManualLogSource mls; private static int spawnChance = 5; private static string[] disabledEnemies = new string[0]; private static bool IsAllowlist = false; private static bool ShouldSpawnMines = false; private static bool ShouldSpawnTurrets = false; private static bool ShouldSpawnBees = false; private static bool isHost => ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; private static SelectableLevel currentLevel => RoundManager.Instance.currentLevel; internal static T GetPrivateField<T>(object instance, string fieldName) { FieldInfo field = instance.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic); return (T)field.GetValue(instance); } private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown mls = Logger.CreateLogSource("LethalPresents"); mls.LogInfo((object)"Plugin LethalPresents is loaded!"); loadConfig(); RoundManager.AdvanceHourAndSpawnNewBatchOfEnemies += new hook_AdvanceHourAndSpawnNewBatchOfEnemies(updateCurrentLevelInfo); GiftBoxItem.OpenGiftBoxServerRpc += new hook_OpenGiftBoxServerRpc(spawnRandomEntity); } private void updateCurrentLevelInfo(orig_AdvanceHourAndSpawnNewBatchOfEnemies orig, RoundManager self) { orig.Invoke(self); mls.LogInfo((object)"List of spawnable enemies (inside):"); currentLevel.Enemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); mls.LogInfo((object)"List of spawnable enemies (outside):"); currentLevel.OutsideEnemies.ForEach(delegate(SpawnableEnemyWithRarity e) { mls.LogInfo((object)((Object)e.enemyType).name); }); } private void loadConfig() { spawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnChance", 5, "Chance of spawning an enemy when opening a present [0-100]").Value; disabledEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("General", "EnemyBlocklist", "", "Enemy blocklist separated by , and without whitespaces").Value.Split(","); IsAllowlist = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IsAllowlist", false, "Turns blocklist into allowlist, blocklist must contain at least one inside and one outside enemy, use at your own risk").Value; ShouldSpawnMines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnMines", true, "Add mines to the spawn pool").Value; ShouldSpawnTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnTurrets", true, "Add turrets to the spawn pool").Value; if (IsAllowlist) { mls.LogInfo((object)"Only following enemies can spawn from the gift:"); } else { mls.LogInfo((object)"Following enemies wont be spawned from the gift:"); } string[] array = disabledEnemies; foreach (string text in array) { mls.LogInfo((object)text); } } private void spawnRandomEntity(orig_OpenGiftBoxServerRpc orig, GiftBoxItem self) { //IL_00fe: 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) NetworkManager networkManager = ((NetworkBehaviour)self).NetworkManager; if (networkManager == null || !networkManager.IsListening) { orig.Invoke(self); return; } int privateField = GetPrivateField<int>(self, "__rpc_exec_stage"); mls.LogInfo((object)("IsServer:" + networkManager.IsServer + " IsHost:" + networkManager.IsHost + " __rpc_exec_stage:" + privateField)); if (privateField != 1 || !isHost) { orig.Invoke(self); return; } int num = Random.Range(1, 100); mls.LogInfo((object)("Player's fortune:" + num)); if (num >= spawnChance) { orig.Invoke(self); return; } chooseAndSpawnEnemy(((GrabbableObject)self).isInFactory, ((Component)self).transform.position, ((Component)self.previousPlayerHeldBy).transform.position); orig.Invoke(self); } private static void chooseAndSpawnEnemy(bool inside, Vector3 pos, Vector3 player_pos) { //IL_000b: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource obj = mls; Vector3 val = player_pos; obj.LogInfo((object)("Player pos " + ((object)(Vector3)(ref val)).ToString())); List<SpawnableEnemyWithRarity> list = currentLevel.Enemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(((Object)e.enemyType).name) ? IsAllowlist : (!IsAllowlist)).ToList(); List<SpawnableEnemyWithRarity> list2 = currentLevel.OutsideEnemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(((Object)e.enemyType).name) ? IsAllowlist : (!IsAllowlist)).ToList(); int num = Random.Range(1, 2 + (list2.Count + list.Count) / 2); if (num == 2 && !ShouldSpawnMines) { num = 1; } if (num == 1 && !ShouldSpawnTurrets) { num = 2; } if (num == 2 && !ShouldSpawnMines) { num = 3; } switch (num) { case 1: { SpawnableMapObject[] spawnableMapObjects2 = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val4 in spawnableMapObjects2) { if (!((Object)(object)val4.prefabToSpawn.GetComponentInChildren<Turret>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val5 = Object.Instantiate<GameObject>(val4.prefabToSpawn, pos, Quaternion.identity); val5.transform.position = pos; Transform transform = val5.transform; val = player_pos - pos; transform.forward = ((Vector3)(ref val)).normalized; val5.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj3 = mls; val = pos; obj3.LogInfo((object)("Tried spawning a turret at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } case 2: { SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if (!((Object)(object)val2.prefabToSpawn.GetComponentInChildren<Landmine>() == (Object)null)) { pos -= Vector3.up * 1.8f; GameObject val3 = Object.Instantiate<GameObject>(val2.prefabToSpawn, pos, Quaternion.identity); val3.transform.position = pos; val3.transform.forward = new Vector3(1f, 0f, 0f); val3.GetComponent<NetworkObject>().Spawn(true); ManualLogSource obj2 = mls; val = pos; obj2.LogInfo((object)("Tried spawning a mine at " + ((object)(Vector3)(ref val)).ToString())); break; } } return; } } SpawnableEnemyWithRarity val6; if (inside) { if (list.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list[Random.Range(0, list.Count - 1)]; } else { if (list2.Count < 1) { mls.LogInfo((object)"Cant spawn enemy - no other enemies present to copy from"); return; } val6 = list2[Random.Range(0, list2.Count - 1)]; } pos += Vector3.up * 0.25f; ManualLogSource obj4 = mls; string enemyName = val6.enemyType.enemyName; val = pos; obj4.LogInfo((object)("Spawning " + enemyName + " at " + ((object)(Vector3)(ref val)).ToString())); SpawnEnemy(val6, pos, 0f); } private static void SpawnEnemy(SpawnableEnemyWithRarity enemy, Vector3 pos, float rot) { //IL_0006: 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) RoundManager.Instance.SpawnEnemyGameObject(pos, rot, -1, enemy.enemyType); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalPresents"; public const string PLUGIN_NAME = "LethalPresents"; public const string PLUGIN_VERSION = "1.0.4"; } }
plugins/LethalProgression.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; 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 HarmonyLib; using LethalProgression.Config; using LethalProgression.GUI; using LethalProgression.Patches; using LethalProgression.Skills; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalProgression")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Progression Mod")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3dc7eef442dce452b17ebbe7d003936b2d4276a3")] [assembly: AssemblyProduct("LethalProgression")] [assembly: AssemblyTitle("LethalProgression")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } 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 LethalProgression { [HarmonyPatch] internal class LP_NetworkManager { public static GameObject xpNetworkObject; public static XP xpInstance; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (!((Object)(object)xpNetworkObject != (Object)null)) { xpNetworkObject = (GameObject)LethalPlugin.skillBundle.LoadAsset("LP_XPHandler"); xpNetworkObject.AddComponent<XP>(); NetworkManager.Singleton.AddNetworkPrefab(xpNetworkObject); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //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) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate<GameObject>(xpNetworkObject, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); xpInstance = val.GetComponent<XP>(); LethalPlugin.Log.LogInfo((object)"XPHandler Initialized."); } } } [BepInPlugin("Stoneman.LethalProgression", "Lethal Progression", "1.3.2")] internal class LethalPlugin : BaseUnityPlugin { private const string modGUID = "Stoneman.LethalProgression"; private const string modName = "Lethal Progression"; private const string modVersion = "1.3.2"; private const string modAuthor = "Stoneman"; public static AssetBundle skillBundle; internal static ManualLogSource Log; internal static bool ReservedSlots; public static LethalPlugin Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("Stoneman.LethalProgression"); val.PatchAll(Assembly.GetExecutingAssembly()); skillBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "skillmenu")); Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Lethal Progression loaded."); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Value.Metadata.GUID.IndexOf("ReservedItem") >= 0) { ReservedSlots = true; } if (pluginInfo.Value.Metadata.GUID.IndexOf("mikestweaks") < 0) { continue; } ConfigEntryBase[] configEntries = pluginInfo.Value.Instance.Config.GetConfigEntries(); ConfigEntryBase[] array = configEntries; foreach (ConfigEntryBase val2 in array) { if (val2.Definition.Key == "ExtraItemSlots") { if (int.Parse(val2.GetSerializedValue()) > 0) { ReservedSlots = true; } break; } } } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array2 = types; foreach (Type type in array2) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array3 = methods; foreach (MethodInfo methodInfo in array3) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } SkillConfig.InitConfig(); } public void BindConfig<T>(string section, string key, T defaultValue, string description = "") { ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description); } public IDictionary<string, string> GetAllConfigEntries() { return ((BaseUnityPlugin)this).Config.GetConfigEntries().ToDictionary((ConfigEntryBase entry) => entry.Definition.Key, (ConfigEntryBase entry) => entry.GetSerializedValue()); } } internal class XP : NetworkBehaviour { public NetworkVariable<int> xpPoints = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> xpLevel = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> profit = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> xpReq = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<float> teamLootValue = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public int skillPoints; public SkillList skillList; public SkillsGUI guiObj; public bool Initialized = false; public void Start() { LethalPlugin.Log.LogInfo((object)"XP Network Behavior Made!"); PlayerConnect_ServerRpc(); } public void LoadSaveData() { int num = GameNetworkManager.Instance.saveFileNum + 1; string path = Application.persistentDataPath + "/lethalprogression/save" + num + ".txt"; if (!File.Exists(path)) { Directory.CreateDirectory(Application.persistentDataPath + "/lethalprogression"); File.WriteAllText(path, ""); string text = ""; text += "0\n"; text += "0\n"; text += "0\n"; File.WriteAllText(path, text); } string[] array = File.ReadAllLines(path); LethalPlugin.Log.LogError((object)"Loading XP!"); xpLevel.Value = int.Parse(array[0]); xpPoints.Value = int.Parse(array[1]); profit.Value = int.Parse(array[2]); xpReq.Value = GetXPRequirement(); LethalPlugin.Log.LogInfo((object)GetXPRequirement().ToString()); } public int GetXPRequirement() { int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; int num = int.Parse(SkillConfig.hostConfig["XP Minimum"]); int num2 = int.Parse(SkillConfig.hostConfig["XP Maximum"]); int num3 = int.Parse(SkillConfig.hostConfig["Person Multiplier"]); int num4 = connectedPlayersAmount * num3; int num5 = num + num4; int num6 = int.Parse(SkillConfig.hostConfig["Quota Multiplier"]); int num7 = timesFulfilledQuota * num6; num5 += (int)((float)num5 * ((float)num7 / 100f)); if (num5 > num2) { num5 = num2; } LethalPlugin.Log.LogInfo((object)$"{connectedPlayersAmount} players, {timesFulfilledQuota} quotas, {num} initial cost, {num4} person value, {num7} quota value, {num5} total cost."); return num5; } public int GetXP() { return xpPoints.Value; } public int GetLevel() { return xpLevel.Value; } public int GetProfit() { return profit.Value; } public int GetSkillPoints() { return skillPoints; } public void SetSkillPoints(int num) { skillPoints = num; } public void AddSkillPoint() { skillPoints++; } [ServerRpc(RequireOwnership = false)] public void ChangeXPRequirement_ServerRpc() { //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(3672466612u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3672466612u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(XPRequirementCoroutine()); } } } public IEnumerator XPRequirementCoroutine() { yield return (object)new WaitForSeconds(0.5f); xpReq.Value = GetXPRequirement(); } [ServerRpc(RequireOwnership = false)] public void AddXPServerRPC(int xp) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3074971930u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, xp); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3074971930u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } int xP = GetXP(); NetworkVariable<int> obj = xpPoints; obj.Value += xp; NetworkVariable<int> obj2 = profit; obj2.Value += xp; int num = GetXP(); XPHUDUpdate_ClientRPC(xP, num, xp); if (num >= xpReq.Value) { int num2 = 0; while (num >= xpReq.Value) { num2++; num -= xpReq.Value; Givepoint_ClientRPC(); } xpPoints.Value = num; NetworkVariable<int> obj3 = xpLevel; obj3.Value += num2; LevelUp_ClientRPC(); } } [ClientRpc] public void XPHUDUpdate_ClientRPC(int oldXP, int newXP, int xpGained) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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 = ((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(3462423043u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, oldXP); BytePacker.WriteValueBitPacked(val2, newXP); BytePacker.WriteValueBitPacked(val2, xpGained); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3462423043u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManagerPatch.ShowXPUpdate(oldXP, newXP, newXP - oldXP); } } } [ClientRpc] public void LevelUp_ClientRPC() { //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(820724324u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 820724324u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManagerPatch.ShowLevelUp(); } } } [ClientRpc] public void Givepoint_ClientRPC() { //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(179361894u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 179361894u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { skillPoints++; } } } public void TeamLootValueUpdate(float update, int newValue) { TeamLootValueUpdate_ServerRpc(update); } [ServerRpc(RequireOwnership = false)] public void TeamLootValueUpdate_ServerRpc(float updatedValue) { //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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3281224843u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref updatedValue, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3281224843u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { float multiplier = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Value].GetMultiplier(); float num = updatedValue * multiplier; NetworkVariable<float> obj = teamLootValue; obj.Value += num; LethalPlugin.Log.LogInfo((object)$"Changed team loot value by {updatedValue * multiplier} turning into {teamLootValue.Value}."); } } } [ServerRpc(RequireOwnership = false)] public void ServerHandSlots_ServerRpc(ulong playerID, int newSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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(2696007838u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, newSlots); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2696007838u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !LethalPlugin.ReservedSlots) { SetPlayerHandslots_ClientRpc(playerID, newSlots); } } } [ClientRpc] public void SetPlayerHandslots_ClientRpc(ulong playerID, int newSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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(2549144616u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, newSlots); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2549144616u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetHandSlot(playerID, newSlots); } } } public void SetHandSlot(ulong playerID, int newSlots) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId != playerID) { continue; } int num = 4 + newSlots; List<GrabbableObject> list = new List<GrabbableObject>(val.ItemSlots); val.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[num]; for (int j = 0; j < num; j++) { if (list.Count >= num) { val.ItemSlots[j] = list[j]; } } LethalPlugin.Log.LogInfo((object)$"Player {playerID} has {val.ItemSlots.Length} slots after setting."); break; } } [ServerRpc(RequireOwnership = false)] public void GetEveryoneHandSlots_ServerRpc() { //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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2063608820u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2063608820u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || LethalPlugin.ReservedSlots || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HandSlot)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (((Component)val3).gameObject.activeSelf) { ulong playerClientId = val3.playerClientId; int handSlots = val3.ItemSlots.Length - 4; SendEveryoneHandSlots_ClientRpc(playerClientId, handSlots); } } } [ClientRpc] public void SendEveryoneHandSlots_ClientRpc(ulong playerID, int handSlots) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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(4146414765u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, handSlots); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4146414765u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetHandSlot(playerID, handSlots); } } } [ServerRpc(RequireOwnership = false)] public void PlayerConnect_ServerRpc() { //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(2203520695u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2203520695u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { IDictionary<string, string> allConfigEntries = LethalPlugin.Instance.GetAllConfigEntries(); string serializedConfig = JsonConvert.SerializeObject((object)allConfigEntries); SendEveryoneConfigs_ClientRpc(serializedConfig); } } } [ClientRpc] public void SendEveryoneConfigs_ClientRpc(string serializedConfig) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ba: 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(2502216668u, val, (RpcDelivery)0); bool flag = serializedConfig != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(serializedConfig, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2502216668u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } IDictionary<string, string> dictionary = JsonConvert.DeserializeObject<IDictionary<string, string>>(serializedConfig); foreach (KeyValuePair<string, string> item in dictionary) { SkillConfig.hostConfig[item.Key] = item.Value; LethalPlugin.Log.LogInfo((object)("Loaded host config: " + item.Key + " = " + item.Value)); } if (!Initialized) { Initialized = true; LP_NetworkManager.xpInstance = this; skillList = new SkillList(); skillList.InitializeSkills(); guiObj = new SkillsGUI(); NetworkVariable<float> obj = teamLootValue; obj.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(guiObj.TeamLootHudUpdate)); if (GameNetworkManager.Instance.isHostingGame) { LoadSaveData(); } skillPoints = xpLevel.Value + 5; GetEveryoneHandSlots_ServerRpc(); ChangeXPRequirement_ServerRpc(); } } protected override void __initializeVariables() { if (xpPoints == null) { throw new Exception("XP.xpPoints cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpPoints).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpPoints, "xpPoints"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpPoints); if (xpLevel == null) { throw new Exception("XP.xpLevel cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpLevel).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpLevel, "xpLevel"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpLevel); if (profit == null) { throw new Exception("XP.profit cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)profit).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)profit, "profit"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)profit); if (xpReq == null) { throw new Exception("XP.xpReq cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)xpReq).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)xpReq, "xpReq"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)xpReq); if (teamLootValue == null) { throw new Exception("XP.teamLootValue cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)teamLootValue).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)teamLootValue, "teamLootValue"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)teamLootValue); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_XP() { //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(3672466612u, new RpcReceiveHandler(__rpc_handler_3672466612)); NetworkManager.__rpc_func_table.Add(3074971930u, new RpcReceiveHandler(__rpc_handler_3074971930)); NetworkManager.__rpc_func_table.Add(3462423043u, new RpcReceiveHandler(__rpc_handler_3462423043)); NetworkManager.__rpc_func_table.Add(820724324u, new RpcReceiveHandler(__rpc_handler_820724324)); NetworkManager.__rpc_func_table.Add(179361894u, new RpcReceiveHandler(__rpc_handler_179361894)); NetworkManager.__rpc_func_table.Add(3281224843u, new RpcReceiveHandler(__rpc_handler_3281224843)); NetworkManager.__rpc_func_table.Add(2696007838u, new RpcReceiveHandler(__rpc_handler_2696007838)); NetworkManager.__rpc_func_table.Add(2549144616u, new RpcReceiveHandler(__rpc_handler_2549144616)); NetworkManager.__rpc_func_table.Add(2063608820u, new RpcReceiveHandler(__rpc_handler_2063608820)); NetworkManager.__rpc_func_table.Add(4146414765u, new RpcReceiveHandler(__rpc_handler_4146414765)); NetworkManager.__rpc_func_table.Add(2203520695u, new RpcReceiveHandler(__rpc_handler_2203520695)); NetworkManager.__rpc_func_table.Add(2502216668u, new RpcReceiveHandler(__rpc_handler_2502216668)); } private static void __rpc_handler_3672466612(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; ((XP)(object)target).ChangeXPRequirement_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3074971930(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 xp = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref xp); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).AddXPServerRPC(xp); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3462423043(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int oldXP = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref oldXP); int newXP = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newXP); int xpGained = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref xpGained); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).XPHUDUpdate_ClientRPC(oldXP, newXP, xpGained); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_820724324(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; ((XP)(object)target).LevelUp_ClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_179361894(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; ((XP)(object)target).Givepoint_ClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3281224843(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) { float updatedValue = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref updatedValue, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).TeamLootValueUpdate_ServerRpc(updatedValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2696007838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int newSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newSlots); target.__rpc_exec_stage = (__RpcExecStage)1; ((XP)(object)target).ServerHandSlots_ServerRpc(playerID, newSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2549144616(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int newSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newSlots); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SetPlayerHandslots_ClientRpc(playerID, newSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2063608820(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; ((XP)(object)target).GetEveryoneHandSlots_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4146414765(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); int handSlots = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref handSlots); target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SendEveryoneHandSlots_ClientRpc(playerID, handSlots); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2203520695(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; ((XP)(object)target).PlayerConnect_ServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2502216668(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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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)); string serializedConfig = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref serializedConfig, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((XP)(object)target).SendEveryoneConfigs_ClientRpc(serializedConfig); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "XP"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalProgression"; public const string PLUGIN_NAME = "LethalProgression"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LethalProgression.GUI { [HarmonyPatch] internal class GUIUpdate { public static bool isMenuOpen; public static SkillsGUI guiInstance; [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "Update")] private static void SkillMenuUpdate(QuickMenuManager __instance) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (guiInstance == null || !Object.op_Implicit((Object)(object)guiInstance.mainPanel)) { return; } if (isMenuOpen) { if (bool.Parse(SkillConfig.hostConfig["Unspec in Ship Only"]) && !bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { guiInstance.SetUnspec(show: true); } else { guiInstance.SetUnspec(show: false); } } if (bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { guiInstance.SetUnspec(show: false); } Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); GameObject gameObject = ((Component)guiInstance.mainPanel.transform.GetChild(2)).gameObject; float x = gameObject.transform.position.x; Rect rect = gameObject.GetComponent<RectTransform>().rect; float num = x - ((Rect)(ref rect)).width; float x2 = gameObject.transform.position.x; rect = gameObject.GetComponent<RectTransform>().rect; float num2 = x2 + ((Rect)(ref rect)).width; float y = gameObject.transform.position.y; rect = gameObject.GetComponent<RectTransform>().rect; float num3 = y - ((Rect)(ref rect)).height; float y2 = gameObject.transform.position.y; rect = gameObject.GetComponent<RectTransform>().rect; float num4 = y2 + ((Rect)(ref rect)).height; if (val.x >= num && val.x <= num2) { if (val.y >= num3 && val.y <= num4) { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(true); } else { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(false); } } else { ((Component)guiInstance.mainPanel.transform.GetChild(2).GetChild(2)).gameObject.SetActive(false); } guiInstance.mainPanel.SetActive(true); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); val2.SetActive(false); GameObject val3 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList"); val3.SetActive(false); RealTimeUpdateInfo(); } else { guiInstance.mainPanel.SetActive(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")] private static void SkillMenuClose(QuickMenuManager __instance) { isMenuOpen = false; } private static void RealTimeUpdateInfo() { GameObject gameObject = ((Component)guiInstance.mainPanel.transform.GetChild(2)).gameObject; gameObject = ((Component)gameObject.transform.GetChild(1)).gameObject; TextMeshProUGUI component = gameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).text = LP_NetworkManager.xpInstance.GetSkillPoints().ToString(); } } internal class SkillsGUI { public GameObject mainPanel; public GameObject infoPanel; public Skill activeSkill; public GameObject templateSlot; public List<GameObject> skillButtonsList = new List<GameObject>(); public int shownSkills = 0; public SkillsGUI() { CreateSkillMenu(); GUIUpdate.guiInstance = this; } public void OpenSkillMenu() { GUIUpdate.isMenuOpen = true; mainPanel.SetActive(true); } public void CreateSkillMenu() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown mainPanel = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("SkillMenu")); ((Object)mainPanel).name = "SkillMenu"; mainPanel.SetActive(false); templateSlot = Object.Instantiate<GameObject>(GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3")); ((Object)templateSlot).name = "TemplateSlot"; templateSlot.SetActive(false); infoPanel = ((Component)mainPanel.transform.GetChild(1)).gameObject; infoPanel.SetActive(false); GameObject gameObject = ((Component)mainPanel.transform.GetChild(4)).gameObject; gameObject.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject.GetComponent<Button>().onClick).AddListener(new UnityAction(BackButton)); shownSkills = 0; if (LP_NetworkManager.xpInstance.skillList.skills == null) { return; } foreach (KeyValuePair<UpgradeType, Skill> skill in LP_NetworkManager.xpInstance.skillList.skills) { LethalPlugin.Log.LogInfo((object)("Creating button for " + skill.Value.GetShortName())); GameObject val = SetupUpgradeButton(skill.Value); LethalPlugin.Log.LogInfo((object)"Setup passed!"); skillButtonsList.Add(val); LethalPlugin.Log.LogInfo((object)"Added to skill list.."); LoadSkillData(skill.Value, val); } TeamLootHudUpdate(1f, 1f); } public void BackButton() { GUIUpdate.isMenuOpen = false; GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); val.SetActive(true); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList"); val2.SetActive(true); } public void SetUnspec(bool show) { GameObject gameObject = ((Component)infoPanel.transform.GetChild(6)).gameObject; GameObject gameObject2 = ((Component)infoPanel.transform.GetChild(7)).gameObject; GameObject gameObject3 = ((Component)infoPanel.transform.GetChild(8)).gameObject; gameObject.SetActive(show); gameObject2.SetActive(show); gameObject3.SetActive(show); if (!bool.Parse(SkillConfig.hostConfig["Disable Unspec"])) { GameObject gameObject4 = ((Component)infoPanel.transform.GetChild(9)).gameObject; gameObject4.SetActive(!show); } } public GameObject SetupUpgradeButton(Skill skill) { //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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 GameObject gameObject = ((Component)mainPanel.transform.GetChild(0)).gameObject; GameObject val = Object.Instantiate<GameObject>(gameObject); if (!Object.op_Implicit((Object)(object)gameObject)) { LethalPlugin.Log.LogError((object)"Couldn't find template button!"); return null; } ((Object)val).name = skill.GetShortName(); GameObject gameObject2 = ((Component)mainPanel.transform.GetChild(3)).gameObject; GameObject gameObject3 = ((Component)gameObject2.transform.GetChild(1)).gameObject; val.transform.SetParent(gameObject3.transform, false); shownSkills++; GameObject gameObject4 = ((Component)val.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject4.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject5 = ((Component)val.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject5.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); GameObject gameObject6 = ((Component)val.transform.GetChild(2)).gameObject; ((TMP_Text)gameObject6.GetComponent<TextMeshProUGUI>()).SetText("(" + skill.GetLevel() + " " + skill.GetAttribute() + ")", true); ((TMP_Text)val.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); val.SetActive(true); val.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { UpdateStatInfo(skill); }); return val; } public void LoadSkillData(Skill skill, GameObject skillButton) { if (!skill._teamShared) { GameObject gameObject = ((Component)skillButton.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject2 = ((Component)skillButton.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject2.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); GameObject gameObject3 = ((Component)skillButton.transform.GetChild(2)).gameObject; ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText("(+" + (float)skill.GetLevel() * skill.GetMultiplier() + "% " + skill.GetAttribute() + ")", true); ((TMP_Text)skillButton.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); } } public void UpdateStatInfo(Skill skill) { //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown if (!infoPanel.activeSelf) { infoPanel.SetActive(true); } TextMeshProUGUI component = ((Component)infoPanel.transform.GetChild(0)).gameObject.GetComponent<TextMeshProUGUI>(); TextMeshProUGUI component2 = ((Component)infoPanel.transform.GetChild(1)).gameObject.GetComponent<TextMeshProUGUI>(); TextMeshProUGUI component3 = ((Component)infoPanel.transform.GetChild(2)).gameObject.GetComponent<TextMeshProUGUI>(); activeSkill = skill; ((TMP_Text)component).SetText(skill.GetName(), true); if (skill.GetMaxLevel() == 99999) { ((TMP_Text)component2).SetText($"{skill.GetLevel()}", true); } else { ((TMP_Text)component2).SetText($"{skill.GetLevel()} / {skill.GetMaxLevel()}", true); } ((TMP_Text)component3).SetText(skill.GetDescription(), true); GameObject gameObject = ((Component)infoPanel.transform.GetChild(3)).gameObject; GameObject gameObject2 = ((Component)infoPanel.transform.GetChild(4)).gameObject; GameObject gameObject3 = ((Component)infoPanel.transform.GetChild(5)).gameObject; gameObject.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddSkillPoint(skill, 5); }); gameObject2.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddSkillPoint(skill, 2); }); gameObject3.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject3.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { AddSkillPoint(skill, 1); }); GameObject gameObject4 = ((Component)infoPanel.transform.GetChild(6)).gameObject; GameObject gameObject5 = ((Component)infoPanel.transform.GetChild(7)).gameObject; GameObject gameObject6 = ((Component)infoPanel.transform.GetChild(8)).gameObject; gameObject4.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject4.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveSkillPoint(skill, 5); }); gameObject5.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject5.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveSkillPoint(skill, 2); }); gameObject6.GetComponent<Button>().onClick = new ButtonClickedEvent(); ((UnityEvent)gameObject6.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RemoveSkillPoint(skill, 1); }); } public void AddSkillPoint(Skill skill, int amt) { if (LP_NetworkManager.xpInstance.GetSkillPoints() <= 0) { return; } int skillPoints = LP_NetworkManager.xpInstance.GetSkillPoints(); if (skillPoints < amt) { amt = skillPoints; } if (skill.GetLevel() + amt > skill.GetMaxLevel()) { amt = skill.GetMaxLevel() - skill.GetLevel(); } skill.AddLevel(amt); LP_NetworkManager.xpInstance.SetSkillPoints(LP_NetworkManager.xpInstance.GetSkillPoints() - amt); UpdateStatInfo(skill); foreach (GameObject skillButtons in skillButtonsList) { if (((Object)skillButtons).name == skill.GetShortName()) { LoadSkillData(skill, skillButtons); } } } public void RemoveSkillPoint(Skill skill, int amt) { if (skill.GetLevel() == 0) { return; } int level = skill.GetLevel(); if (level < amt) { amt = level; } skill.AddLevel(-amt); LP_NetworkManager.xpInstance.SetSkillPoints(LP_NetworkManager.xpInstance.GetSkillPoints() + amt); UpdateStatInfo(skill); foreach (GameObject skillButtons in skillButtonsList) { if (((Object)skillButtons).name == skill.GetShortName()) { LoadSkillData(skill, skillButtons); } } } public void TeamLootHudUpdate(float oldValue, float newValue) { foreach (GameObject skillButtons in skillButtonsList) { if (((Object)skillButtons).name == "VAL") { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Value]; LoadSkillData(skill, skillButtons); GameObject gameObject = ((Component)skillButtons.transform.GetChild(0)).gameObject; ((TMP_Text)gameObject.GetComponent<TextMeshProUGUI>()).SetText(skill.GetShortName(), true); GameObject gameObject2 = ((Component)skillButtons.transform.GetChild(1)).gameObject; ((TMP_Text)gameObject2.GetComponent<TextMeshProUGUI>()).SetText(skill.GetLevel().ToString(), true); ((TMP_Text)skillButtons.GetComponentInChildren<TextMeshProUGUI>()).SetText(skill.GetShortName() + ":", true); GameObject gameObject3 = ((Component)skillButtons.transform.GetChild(2)).gameObject; ((TMP_Text)gameObject3.GetComponent<TextMeshProUGUI>()).SetText("(+" + LP_NetworkManager.xpInstance.teamLootValue.Value + "% " + skill.GetAttribute() + ")", true); LethalPlugin.Log.LogInfo((object)$"Setting team value hud to {LP_NetworkManager.xpInstance.teamLootValue.Value}"); } } } } } namespace LethalProgression.Skills { public enum UpgradeType { HPRegen, Stamina, Battery, HandSlot, Value, Oxygen } internal class SkillList { public Dictionary<UpgradeType, Skill> skills = new Dictionary<UpgradeType, Skill>(); public void CreateSkill(UpgradeType upgrade, string name, string description, string shortname, string attribute, UpgradeType upgradeType, int cost, int maxLevel, float multiplier, Action<int, int> callback = null, bool teamShared = false) { Skill value = new Skill(name, description, shortname, attribute, upgradeType, cost, maxLevel, multiplier, callback, teamShared); skills.Add(upgrade, value); } public bool IsSkillListValid() { if (skills.Count == 0) { return false; } return true; } public bool IsSkillValid(UpgradeType upgrade) { if (!skills.ContainsKey(upgrade)) { LethalPlugin.Log.LogInfo((object)("Skill " + upgrade.ToString() + " is not in the skill list!")); return false; } return true; } public void InitializeSkills() { if (bool.Parse(SkillConfig.hostConfig["Health Regen Enabled"])) { LethalPlugin.Log.LogInfo((object)"HP Regen check 1"); CreateSkill(UpgradeType.HPRegen, "Health Regen", "The company installs a basic healer into your suit, letting you regenerate health slowly. Only regenerate up to 100 HP.", "HPR", "Health Regeneration", UpgradeType.HPRegen, 1, int.Parse(SkillConfig.hostConfig["Health Regen Max Level"]), float.Parse(SkillConfig.hostConfig["Health Regen Multiplier"], CultureInfo.InvariantCulture)); } if (bool.Parse(SkillConfig.hostConfig["Stamina Enabled"])) { CreateSkill(UpgradeType.Stamina, "Stamina", "Hours on that company gym finally coming into play. Allows you to run for longer.", "STM", "Stamina", UpgradeType.Stamina, 1, int.Parse(SkillConfig.hostConfig["Stamina Max Level"]), float.Parse(SkillConfig.hostConfig["Stamina Multiplier"], CultureInfo.InvariantCulture), Stamina.StaminaUpdate); } if (bool.Parse(SkillConfig.hostConfig["Battery Life Enabled"])) { CreateSkill(UpgradeType.Battery, "Battery Life", "The company provides you with better batteries. Replace your batteries AT THE SHIP'S CHARGER to see an effect.", "BAT", "Battery Life", UpgradeType.Battery, 1, int.Parse(SkillConfig.hostConfig["Battery Life Max Level"]), float.Parse(SkillConfig.hostConfig["Battery Life Multiplier"], CultureInfo.InvariantCulture)); } if (bool.Parse(SkillConfig.hostConfig["Hand Slots Enabled"]) && !LethalPlugin.ReservedSlots) { CreateSkill(UpgradeType.HandSlot, "Hand Slot", "The company finally gives you a better belt! Fit more stuff! (Reach 100% for one slot.)", "HND", "Hand Slots", UpgradeType.HandSlot, 1, int.Parse(SkillConfig.hostConfig["Hand Slots Max Level"]), float.Parse(SkillConfig.hostConfig["Hand Slots Multiplier"], CultureInfo.InvariantCulture), HandSlots.HandSlotsUpdate); } if (bool.Parse(SkillConfig.hostConfig["Loot Value Enabled"])) { CreateSkill(UpgradeType.Value, "Loot Value", "The company gives you a better pair of eyes, allowing you to see the value in things.", "VAL", "Loot Value", UpgradeType.Value, 1, int.Parse(SkillConfig.hostConfig["Loot Value Max Level"]), float.Parse(SkillConfig.hostConfig["Loot Value Multiplier"], CultureInfo.InvariantCulture), LootValue.LootValueUpdate); } if (bool.Parse(SkillConfig.hostConfig["Oxygen Enabled"])) { CreateSkill(UpgradeType.Oxygen, "Oxygen", "The company installs you with oxygen tanks. You gain extra time in the water. (Start drowning when the bar is empty.)", "OXY", "Extra Oxygen", UpgradeType.Oxygen, 1, int.Parse(SkillConfig.hostConfig["Oxygen Max Level"]), float.Parse(SkillConfig.hostConfig["Oxygen Multiplier"], CultureInfo.InvariantCulture)); } } } internal class Skill { private readonly string _shortName; private readonly string _name; private readonly string _attribute; private readonly string _description; private readonly UpgradeType _upgradeType; private readonly int _cost; private readonly int _maxLevel; private readonly float _multiplier; private readonly Action<int, int> _callback; public bool _teamShared; private int _level; public Skill(string name, string description, string shortname, string attribute, UpgradeType upgradeType, int cost, int maxLevel, float multiplier, Action<int, int> callback = null, bool teamShared = false) { _name = name; _shortName = shortname; _attribute = attribute; _description = description; _upgradeType = upgradeType; _cost = cost; _maxLevel = maxLevel; _multiplier = multiplier; _level = 0; _callback = callback; _teamShared = teamShared; } public string GetName() { return _name; } public string GetShortName() { return _shortName; } public string GetAttribute() { return _attribute; } public string GetDescription() { return _description; } public UpgradeType GetUpgradeType() { return _upgradeType; } public int GetCost() { return _cost; } public int GetMaxLevel() { return _maxLevel; } public int GetLevel() { return _level; } public float GetMultiplier() { return _multiplier; } public float GetTrueValue() { return _multiplier * (float)_level; } public void SetLevel(int level) { _level = level; } public void AddLevel(int level) { _level += level; int level2 = _level; _callback?.Invoke(level, level2); } } [HarmonyPatch] internal class BatteryLife { [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "SyncBatteryServerRpc")] public static void BatteryUpdate(ref int charge) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Battery) && charge == 100) { charge += (int)LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Battery].GetTrueValue(); } } } internal class HandSlots { public static int currentSlotCount = 4; public static void HandSlotsUpdate(int updateValue, int newValue) { //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) if (LethalPlugin.ReservedSlots || !LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HandSlot)) { return; } XP xpInstance = LP_NetworkManager.xpInstance; float num = xpInstance.skillList.skills[UpgradeType.HandSlot].GetTrueValue() / 100f; int num2 = 4 + (int)Math.Floor(num); int num3 = num2 - currentSlotCount; GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory"); List<string> list = new List<string> { "Slot0", "Slot1", "Slot2", "Slot3" }; for (int i = 0; i < val.transform.childCount; i++) { Transform child = val.transform.GetChild(i); if (!list.Contains(((Object)((Component)child).gameObject).name)) { Object.Destroy((Object)(object)((Component)child).gameObject); } } int num4 = (int)xpInstance.skillList.skills[UpgradeType.HandSlot].GetTrueValue(); int newSlots = (int)Math.Floor((double)(num4 / 100)); Image[] array = (Image[])(object)new Image[num2]; array[0] = HUDManager.Instance.itemSlotIconFrames[0]; array[1] = HUDManager.Instance.itemSlotIconFrames[1]; array[2] = HUDManager.Instance.itemSlotIconFrames[2]; array[3] = HUDManager.Instance.itemSlotIconFrames[3]; Image[] array2 = (Image[])(object)new Image[num2]; array2[0] = HUDManager.Instance.itemSlotIcons[0]; array2[1] = HUDManager.Instance.itemSlotIcons[1]; array2[2] = HUDManager.Instance.itemSlotIcons[2]; array2[3] = HUDManager.Instance.itemSlotIcons[3]; GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/Inventory/Slot3"); GameObject templateSlot = xpInstance.guiObj.templateSlot; GameObject val3 = val2; currentSlotCount = num2; for (int j = 0; j < (int)num; j++) { GameObject val4 = Object.Instantiate<GameObject>(templateSlot); ((Object)val4).name = $"Slot{3 + (j + 1)}"; val4.transform.SetParent(val.transform); Vector3 localPosition = val3.transform.localPosition; val4.transform.SetLocalPositionAndRotation(new Vector3(localPosition.x + 50f, localPosition.y, localPosition.z), val3.transform.localRotation); val3 = val4; array[3 + (j + 1)] = val4.GetComponent<Image>(); array2[3 + (j + 1)] = ((Component)val4.transform.GetChild(0)).GetComponent<Image>(); val4.SetActive(true); } for (int k = 0; k < array.Length; k++) { Vector3 localPosition2 = ((Component)array[k]).transform.localPosition; ((Component)array[k]).transform.SetLocalPositionAndRotation(new Vector3(localPosition2.x - (float)(num3 * 25), localPosition2.y, localPosition2.z), ((Component)array[k]).transform.localRotation); } HUDManager.Instance.itemSlotIconFrames = array; HUDManager.Instance.itemSlotIcons = array2; ulong playerClientId = GameNetworkManager.Instance.localPlayerController.playerClientId; xpInstance.ServerHandSlots_ServerRpc(playerClientId, newSlots); } } [HarmonyPatch] internal class HPRegen { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void HPRegenUpdate(PlayerControllerB __instance) { if (__instance.health >= 100 || !LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.HPRegen) || LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.HPRegen].GetLevel() == 0) { return; } if (__instance.healthRegenerateTimer <= 0f) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.HPRegen]; float trueValue = skill.GetTrueValue(); __instance.healthRegenerateTimer = 1f / trueValue; __instance.health++; if (__instance.health >= 20) { __instance.MakeCriticallyInjured(false); } HUDManager.Instance.UpdateHealthUI(__instance.health, false); } else { __instance.healthRegenerateTimer -= Time.deltaTime; } } } [HarmonyPatch] internal class LootValue { [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] private static void AddLootValue() { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Value)) { RoundManager.Instance.scrapValueMultiplier = RoundManager.Instance.scrapValueMultiplier + LP_NetworkManager.xpInstance.teamLootValue.Value / 100f; } } public static void LootValueUpdate(int change, int newLevel) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Value)) { LP_NetworkManager.xpInstance.TeamLootValueUpdate(change, newLevel); } } } [HarmonyPatch] internal class Oxygen { private static GameObject oxygenBar; private static float oxygen = 0f; private static float oxygenTimer = 0f; private static bool inWater = false; private static bool canDrown = true; [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceUnderwaterClientRpc")] private static void EnteredWater(PlayerControllerB __instance) { inWater = true; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceOutOfWaterClientRpc")] private static void LeftWater(PlayerControllerB __instance) { inWater = false; } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "SetFaceUnderwaterFilters")] private static void ShouldDrown(PlayerControllerB __instance) { if (!canDrown) { StartOfRound.Instance.drowningTimer = 99f; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] private static void OxygenUpdate(PlayerControllerB __instance) { if (!LP_NetworkManager.xpInstance.skillList.IsSkillListValid() || !LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Oxygen)) { return; } if (__instance.isPlayerDead) { if (Object.op_Implicit((Object)(object)oxygenBar)) { oxygenBar.SetActive(false); } return; } if (LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Oxygen].GetLevel() == 0) { if (Object.op_Implicit((Object)(object)oxygenBar)) { oxygenBar.SetActive(false); } if (!canDrown) { canDrown = true; StartOfRound.Instance.drowningTimer = 1f; } return; } if (!Object.op_Implicit((Object)(object)oxygenBar)) { CreateOxygenBar(); } Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Oxygen]; float trueValue = skill.GetTrueValue(); if (inWater) { oxygenBar.SetActive(true); if (oxygenTimer <= 0f) { oxygenTimer = 0.1f; if (oxygen > 0f) { oxygen -= 0.1f; } else if (!canDrown) { canDrown = true; StartOfRound.Instance.drowningTimer = 1f; } } else { oxygenTimer -= Time.deltaTime; } } if (!inWater) { if (oxygenTimer <= 0f) { oxygenTimer = 0.1f; if (oxygen < trueValue) { oxygenBar.SetActive(true); oxygen += 0.1f; canDrown = false; } else { oxygenBar.SetActive(false); } } else { oxygenTimer -= Time.deltaTime; } } if (oxygen > trueValue) { oxygenBar.SetActive(false); oxygen = trueValue; } if (oxygenBar.activeSelf) { float fillAmount = oxygen / trueValue; ((Component)oxygenBar.transform.GetChild(0).GetChild(0)).GetComponent<Image>().fillAmount = fillAmount; } } public static void CreateOxygenBar() { oxygenBar = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("OxygenBar")); oxygenBar.SetActive(false); } } internal class Stamina { public static void StaminaUpdate(int updatedValue, int newStamina) { if (LP_NetworkManager.xpInstance.skillList.IsSkillListValid() && LP_NetworkManager.xpInstance.skillList.IsSkillValid(UpgradeType.Stamina)) { Skill skill = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.Stamina]; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; float num = (float)updatedValue * skill.GetMultiplier() / 100f * 11f; localPlayerController.sprintTime += num; LethalPlugin.Log.LogInfo((object)$"{updatedValue} change, {newStamina} new stamina points, Adding {num} resulting in {localPlayerController.sprintTime} stamina"); } } } } namespace LethalProgression.Patches { [HarmonyPatch] internal class HUDManagerPatch { private static GameObject _tempBar; private static TextMeshProUGUI _tempText; private static float _tempBarTime; private static GameObject levelText; private static float levelTextTime; private static Dictionary<string, int> _enemyReward = new Dictionary<string, int> { { "HoarderBug (EnemyType)", 30 }, { "BaboonBird (EnemyType)", 15 }, { "MouthDog (EnemyType)", 200 }, { "Centipede (EnemyType)", 30 }, { "Flowerman (EnemyType)", 200 }, { "SandSpider (EnemyType)", 50 }, { "Crawler (EnemyType)", 50 }, { "Puffer (EnemyType)", 15 } }; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "AddNewScrapFoundToDisplay")] private static void GiveXPForScrap(GrabbableObject GObject) { if (GameNetworkManager.Instance.isHostingGame) { int scrapValue = GObject.scrapValue; LP_NetworkManager.xpInstance.AddXPServerRPC(scrapValue); } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] private static void GiveXPForKill(EnemyAI __instance) { string text = ((object)__instance.enemyType).ToString(); LethalPlugin.Log.LogInfo((object)("Enemy type: " + text)); int xp = 30; if (_enemyReward.ContainsKey(text)) { xp = _enemyReward[text]; } LP_NetworkManager.xpInstance.AddXPServerRPC(xp); } public static void ShowXPUpdate(int oldXP, int newXP, int xp) { if (!Object.op_Implicit((Object)(object)_tempBar)) { MakeBar(); } GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPBarProgress"); val.GetComponent<Image>().fillAmount = (float)newXP / (float)LP_NetworkManager.xpInstance.GetXPRequirement(); ((TMP_Text)_tempText).text = newXP + " / " + (float)LP_NetworkManager.xpInstance.GetXPRequirement(); _tempBarTime = 2f; if (!_tempBar.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(XPBarCoroutine()); } } private static IEnumerator XPBarCoroutine() { _tempBar.SetActive(true); while (_tempBarTime > 0f) { float time = _tempBarTime; _tempBarTime = 0f; yield return (object)new WaitForSeconds(time); } _tempBar.SetActive(false); } public static void ShowLevelUp() { if (!Object.op_Implicit((Object)(object)levelText)) { MakeLevelUp(); } levelTextTime = 5f; if (!levelText.gameObject.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(LevelUpCoroutine()); } } public static void MakeLevelUp() { levelText = Object.Instantiate<GameObject>(LethalPlugin.skillBundle.LoadAsset<GameObject>("LevelUp")); ((TMP_Text)((Component)levelText.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Level Up! Spend your skill points."; levelText.gameObject.SetActive(false); } private static IEnumerator LevelUpCoroutine() { levelText.gameObject.SetActive(true); while (levelTextTime > 0f) { float time = levelTextTime; levelTextTime = 0f; yield return (object)new WaitForSeconds(time); } levelText.gameObject.SetActive(false); } private static void MakeBar() { //IL_0082: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu/XPBar"); QuickMenuManagerPatch.MakeNewXPBar(); val = GameObject.Find("/Systems/UI/Canvas/QuickMenu/XPBar"); _tempBar = Object.Instantiate<GameObject>(val); ((Object)_tempBar).name = "XPUpdate"; _tempText = _tempBar.GetComponentInChildren<TextMeshProUGUI>(); GameObject val2 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle"); _tempBar.transform.SetParent(val2.transform, false); _tempBar.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); GameObject val3 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPLevel"); Object.Destroy((Object)(object)val3); GameObject val4 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/XPUpdate/XPProfit"); Object.Destroy((Object)(object)val4); _tempBar.transform.Translate(3.1f, -2.1f, 0f); Vector3 localPosition = _tempBar.transform.localPosition; _tempBar.transform.localPosition = new Vector3(localPosition.x, localPosition.y + 5f, localPosition.z); _tempBar.SetActive(false); } } [HarmonyPatch] internal class QuickMenuManagerPatch { [CompilerGenerated] private static class <>O { public static UnityAction <0>__OpenSkillTree; } private static GameObject _xpBar; private static GameObject _xpBarProgress; private static TextMeshProUGUI _xpText; private static TextMeshProUGUI _xpLevel; private static TextMeshProUGUI _profit; private static GameObject skillTreeButton; [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] private static void QuickMenuXPBar(QuickMenuManager __instance) { if (__instance.isMenuOpen) { if (!Object.op_Implicit((Object)(object)_xpBar) || !Object.op_Implicit((Object)(object)_xpBarProgress)) { MakeNewXPBar(); } _xpBar.SetActive(true); _xpBarProgress.SetActive(true); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "Update")] private static void XPMenuUpdate(QuickMenuManager __instance) { if (Object.op_Implicit((Object)(object)_xpBar) && Object.op_Implicit((Object)(object)_xpBarProgress)) { if (__instance.mainButtonsPanel.activeSelf) { _xpBar.SetActive(true); _xpBarProgress.SetActive(true); } else { _xpBar.SetActive(false); _xpBarProgress.SetActive(false); } ((TMP_Text)_xpText).text = LP_NetworkManager.xpInstance.GetXP() + " / " + LP_NetworkManager.xpInstance.xpReq.Value; ((TMP_Text)_xpLevel).text = "Level: " + LP_NetworkManager.xpInstance.GetLevel(); ((TMP_Text)_profit).text = "You've made.. " + LP_NetworkManager.xpInstance.GetProfit() + "$"; _xpBarProgress.GetComponent<Image>().fillAmount = (float)LP_NetworkManager.xpInstance.GetXP() / (float)LP_NetworkManager.xpInstance.xpReq.Value; } } public static void MakeNewXPBar() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu"); if (!Object.op_Implicit((Object)(object)_xpBar)) { GameObject val2 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpBox"); _xpBar = Object.Instantiate<GameObject>(val2); ((Object)_xpBar).name = "XPBar"; _xpBar.transform.SetParent(val.transform, false); _xpBar.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); _xpBar.transform.Translate(-2f, 1f, 0f); } if (!Object.op_Implicit((Object)(object)_xpBarProgress)) { GameObject val3 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpMeter"); _xpBarProgress = Object.Instantiate<GameObject>(val3); ((Object)_xpBarProgress).name = "XPBarProgress"; _xpBarProgress.transform.SetParent(_xpBar.transform, false); _xpBarProgress.GetComponent<Image>().fillAmount = 0f; _xpBarProgress.transform.localScale = new Vector3(0.597f, 5.21f, 1f); _xpBarProgress.transform.Translate(-0.8f, 0.2f, 0f); Vector3 localPosition = _xpBarProgress.transform.localPosition; _xpBarProgress.transform.localPosition = new Vector3(localPosition.x + 7f, localPosition.y - 3.5f, 0f); GameObject val4 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total"); _xpText = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_xpText).name = "XPText"; ((TMP_Text)_xpText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_xpText).SetText("0/1000", true); ((TMP_Text)_xpText).transform.SetParent(_xpBar.transform, false); ((Graphic)_xpText).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_xpText).transform.Translate(-0.75f, 0.21f, 0f); _xpLevel = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_xpLevel).name = "XPLevel"; ((TMP_Text)_xpLevel).alignment = (TextAlignmentOptions)514; ((TMP_Text)_xpLevel).SetText("Level: 0", true); ((TMP_Text)_xpLevel).transform.SetParent(_xpBar.transform, false); ((Graphic)_xpLevel).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_xpLevel).transform.Translate(-1f, 0.4f, 0f); _profit = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>(); ((Object)_profit).name = "XPProfit"; ((TMP_Text)_profit).alignment = (TextAlignmentOptions)514; ((TMP_Text)_profit).SetText("You've made.. 0$.", true); ((TMP_Text)_profit).transform.SetParent(_xpBar.transform, false); ((Graphic)_profit).color = new Color(1f, 0.6f, 0f, 1f); ((TMP_Text)_profit).transform.Translate(-0.8f, 0f, 0f); } } [HarmonyPostfix] [HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")] private static void SkillTreeAwake(QuickMenuManager __instance) { if (__instance.isMenuOpen && !Object.op_Implicit((Object)(object)skillTreeButton)) { MakeSkillTreeButton(); } } private static void MakeSkillTreeButton() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown GameObject val = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons/Resume"); skillTreeButton = Object.Instantiate<GameObject>(val); GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/MainButtons"); skillTreeButton.transform.SetParent(val2.transform, false); ((Object)skillTreeButton).name = "Skills"; ((TMP_Text)skillTreeButton.GetComponentInChildren<TextMeshProUGUI>()).text = "> Skills"; skillTreeButton.transform.Translate(0.7f, 1.1f, 0f); skillTreeButton.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = skillTreeButton.GetComponent<Button>().onClick; object obj = <>O.<0>__OpenSkillTree; if (obj == null) { UnityAction val3 = OpenSkillTree; <>O.<0>__OpenSkillTree = val3; obj = (object)val3; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } private static void OpenSkillTree() { LP_NetworkManager.xpInstance.guiObj.OpenSkillMenu(); } } [HarmonyPatch] internal class XPPatches { [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")] private static void SaveXPValues(GameNetworkManager __instance) { if (GameNetworkManager.Instance.isHostingGame && StartOfRound.Instance.inShipPhase) { int num = __instance.saveFileNum + 1; string path = Application.persistentDataPath + "/lethalprogression/save" + num + ".txt"; string text = ""; text = text + LP_NetworkManager.xpInstance.GetLevel() + "\n"; text = text + LP_NetworkManager.xpInstance.GetXP() + "\n"; text = text + LP_NetworkManager.xpInstance.GetProfit() + "\n"; File.WriteAllText(path, text); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "FirePlayersAfterDeadlineClientRpc")] private static void ResetXPValues(StartOfRound __instance) { XP xpInstance = LP_NetworkManager.xpInstance; int num = GameNetworkManager.Instance.saveFileNum + 1; string path = Application.persistentDataPath + "/lethalprogression/save" + num + ".txt"; if (File.Exists(path)) { File.Delete(path); } Directory.CreateDirectory(Application.persistentDataPath + "/lethalprogression"); File.WriteAllText(path, ""); string text = ""; text += "0\n"; text += "0\n"; text += "0\n"; File.WriteAllText(path, text); xpInstance.xpReq.Value = xpInstance.GetXPRequirement(); foreach (Skill value in xpInstance.skillList.skills.Values) { value.SetLevel(0); } xpInstance.SetSkillPoints(5); xpInstance.xpLevel.Value = 0; xpInstance.xpPoints.Value = 0; xpInstance.profit.Value = 0; xpInstance.teamLootValue.Value = 0f; } [HarmonyPostfix] [HarmonyPatch(typeof(DeleteFileButton), "DeleteFile")] private static void XPFileDeleteReset() { int num = GameNetworkManager.Instance.saveFileNum + 1; string path = Application.persistentDataPath + "/lethalprogression/save" + num + ".txt"; if (File.Exists(path)) { File.Delete(path); } Directory.CreateDirectory(Application.persistentDataPath + "/lethalprogression"); File.WriteAllText(path, ""); string text = ""; text += "0\n"; text += "0\n"; text += "0\n"; File.WriteAllText(path, text); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] private static void DisconnectXPHandler() { int level = LP_NetworkManager.xpInstance.skillList.skills[UpgradeType.HandSlot].GetLevel(); LP_NetworkManager.xpInstance.TeamLootValueUpdate(-level, 0); GUIUpdate.isMenuOpen = false; } [HarmonyPostfix] [HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")] private static void ProfitQuotaUpdate(TimeOfDay __instance) { if (GameNetworkManager.Instance.isHostingGame) { LP_NetworkManager.xpInstance.xpReq.Value = LP_NetworkManager.xpInstance.GetXPRequirement(); } } } } namespace LethalProgression.Config { internal class SkillConfig { public static IDictionary<string, string> hostConfig = new Dictionary<string, string>(); public static void InitConfig() { LethalPlugin.Instance.BindConfig("General", "Person Multiplier", 35, "How much does XP cost to level up go up per person?"); LethalPlugin.Instance.BindConfig("General", "Quota Multiplier", 30, "How much more XP does it cost to level up go up per quota? (Percent)"); LethalPlugin.Instance.BindConfig("General", "XP Minimum", 40, "Minimum XP to level up."); LethalPlugin.Instance.BindConfig("General", "XP Maximum", 750, "Maximum XP to level up."); LethalPlugin.Instance.BindConfig("General", "Unspec in Ship Only", defaultValue: true, "Disallows unspecing stats if you're not currently on the ship."); LethalPlugin.Instance.BindConfig("General", "Disable Unspec", defaultValue: false, "Disallows unspecing altogether."); LethalPlugin.Instance.BindConfig("Skills", "Health Regen Enabled", defaultValue: true, "Enable the Health Regen skill?"); LethalPlugin.Instance.BindConfig("Skills", "Health Regen Max Level", 20, "Maximum level for the health regen."); LethalPlugin.Instance.BindConfig("Skills", "Health Regen Multiplier", 0.05f, "How much does the health regen skill increase per level?"); LethalPlugin.Instance.BindConfig("Skills", "Stamina Enabled", defaultValue: true, "Enable the Stamina skill?"); LethalPlugin.Instance.BindConfig("Skills", "Stamina Max Level", 99999, "Maximum level for the stamina."); LethalPlugin.Instance.BindConfig("Skills", "Stamina Multiplier", 2f, "How much does the stamina skill increase per level?"); LethalPlugin.Instance.BindConfig("Skills", "Battery Life Enabled", defaultValue: true, "Enable the Battery Life skill?"); LethalPlugin.Instance.BindConfig("Skills", "Battery Life Max Level", 99999, "Maximum level for the battery life."); LethalPlugin.Instance.BindConfig("Skills", "Battery Life Multiplier", 5f, "How much does the battery life skill increase per level?"); LethalPlugin.Instance.BindConfig("Skills", "Hand Slots Enabled", defaultValue: true, "Enable the Hand Slots skill?"); LethalPlugin.Instance.BindConfig("Skills", "Hand Slots Max Level", 30, "Maximum level for the hand slots."); LethalPlugin.Instance.BindConfig("Skills", "Hand Slots Multiplier", 10f, "How much does the hand slots skill increase per level?"); LethalPlugin.Instance.BindConfig("Skills", "Loot Value Enabled", defaultValue: true, "Enable the Loot Value skill?"); LethalPlugin.Instance.BindConfig("Skills", "Loot Value Max Level", 99999, "Maximum level for the loot value."); LethalPlugin.Instance.BindConfig("Skills", "Loot Value Multiplier", 0.25f, "How much does the loot value skill increase per level?"); LethalPlugin.Instance.BindConfig("Skills", "Oxygen Enabled", defaultValue: true, "Enable the Oxygen skill?"); LethalPlugin.Instance.BindConfig("Skills", "Oxygen Max Level", 99999, "Maximum level for Oxygen."); LethalPlugin.Instance.BindConfig("Skills", "Oxygen Multiplier", 1f, "How much does the Oxygen skill increase per level?"); } } }
plugins/LethalSDK.dll
Decompiled 9 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using DunGen; using DunGen.Adapters; using GameNetcodeStuff; using LethalSDK.Component; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using Unity.Netcode; using UnityEditor; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalSDK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalSDK")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4d234a4d-c807-438a-b717-4c6d77706054")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public class AssetModificationProcessor : AssetPostprocessor { private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string assetPath in importedAssets) { ProcessAsset(assetPath); } foreach (string assetPath2 in movedAssets) { ProcessAsset(assetPath2); } } private static void ProcessAsset(string assetPath) { if (assetPath.Contains("NavMesh-Environment")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? (SelectionLogger.name + "NavMesh") : "New NavMesh"); } if (assetPath.Contains("New Terrain")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? SelectionLogger.name : "New Terrain"); } if (assetPath.ToLower().StartsWith("assets/mods/") && assetPath.Split(new char[1] { '/' }).Length > 3 && !assetPath.ToLower().EndsWith(".unity") && !assetPath.ToLower().Contains("/scenes")) { AssetImporter atPath = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath != (Object)null) { string text2 = (atPath.assetBundleName = ExtractBundleNameFromPath(assetPath)); atPath.assetBundleVariant = "lem"; Debug.Log((object)(assetPath + " asset moved to " + text2 + " asset bundle.")); } if (assetPath != "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4)) { AssetDatabase.MoveAsset(assetPath, "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4)); } } else { AssetImporter atPath2 = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath2 != (Object)null) { atPath2.assetBundleName = null; Debug.Log((object)(assetPath + " asset removed from asset bundle.")); } } } public static string ExtractBundleNameFromPath(string path) { string[] array = path.Split(new char[1] { '/' }); if (array.Length > 3) { return array[2].ToLower(); } return ""; } } [InitializeOnLoad] public class SelectionLogger { public static string name; static SelectionLogger() { Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged)); } private static void OnSelectionChanged() { if ((Object)(object)Selection.activeGameObject != (Object)null) { name = ((Object)GetRootParent(Selection.activeGameObject)).name; } else { name = string.Empty; } } public static GameObject GetRootParent(GameObject obj) { if ((Object)(object)obj != (Object)null && (Object)(object)obj.transform.parent != (Object)null) { return GetRootParent(((Component)obj.transform.parent).gameObject); } return obj; } } [InitializeOnLoad] public class AssetBundleVariantAssigner { static AssetBundleVariantAssigner() { AssignVariantToAssetBundles(); } [InitializeOnLoadMethod] private static void AssignVariantToAssetBundles() { string[] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames(); string[] array = allAssetBundleNames; foreach (string text in array) { if (!text.Contains(".")) { string[] assetPathsFromAssetBundle = AssetDatabase.GetAssetPathsFromAssetBundle(text); string[] array2 = assetPathsFromAssetBundle; foreach (string text2 in array2) { AssetImporter.GetAtPath(text2).SetAssetBundleNameAndVariant(text, "lem"); } Debug.Log((object)("File extention added to AssetBundle: " + text)); } } AssetDatabase.SaveAssets(); string text3 = "Assets/AssetBundles"; if (!Directory.Exists(text3)) { Debug.LogError((object)("The folder doesn't exist : " + text3)); return; } string[] files = Directory.GetFiles(text3); string[] array3 = files; foreach (string text4 in array3) { if (Path.GetExtension(text4) == "" && Path.GetFileName(text4) != "AssetBundles") { string path = text4 + ".meta"; string text5 = text4 + ".manifest"; string path2 = text5 + ".meta"; File.Delete(text4); if (File.Exists(path)) { File.Delete(path); } if (File.Exists(text5)) { File.Delete(text5); } if (File.Exists(path2)) { File.Delete(path2); } Debug.Log((object)("File deleted : " + text4)); } } AssetDatabase.Refresh(); } } public class CubemapTextureBuilder : EditorWindow { private Texture2D[] textures = (Texture2D[])(object)new Texture2D[6]; private string[] labels = new string[6] { "Right", "Left", "Top", "Bottom", "Front", "Back" }; private TextureFormat[] HDRFormats; private Vector2Int[] placementRects; [MenuItem("LethalSDK/Cubemap Builder", false, 100)] public static void OpenWindow() { EditorWindow.GetWindow<CubemapTextureBuilder>(); } private Texture2D UpscaleTexture(Texture2D original, int targetWidth, int targetHeight) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(targetWidth, targetHeight)); Graphics.Blit((Texture)(object)original, val); Texture2D val2 = new Texture2D(targetWidth, targetHeight); val2.ReadPixels(new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), 0, 0); val2.Apply(); RenderTexture.ReleaseTemporary(val); return val2; } private void OnGUI() { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown for (int i = 0; i < 6; i++) { ref Texture2D reference = ref textures[i]; Object obj = EditorGUILayout.ObjectField(labels[i], (Object)(object)textures[i], typeof(Texture2D), false, Array.Empty<GUILayoutOption>()); reference = (Texture2D)(object)((obj is Texture2D) ? obj : null); } if (!GUILayout.Button("Build Cubemap", Array.Empty<GUILayoutOption>())) { return; } if (textures.Any((Texture2D t) => (Object)(object)t == (Object)null)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok"); return; } int size = ((Texture)textures[0]).width; if (textures.Any((Texture2D t) => ((Texture)t).width != size || ((Texture)t).height != size)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok"); return; } bool flag = HDRFormats.Any((TextureFormat f) => f == textures[0].format); string[] array = textures.Select((Texture2D t) => AssetDatabase.GetAssetPath((Object)(object)t)).ToArray(); string text = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(array[0]), "Cubemap", flag ? "exr" : "png"); if (!string.IsNullOrEmpty(text)) { bool[] array2 = textures.Select((Texture2D t) => ((Texture)t).isReadable).ToArray(); TextureImporter[] array3 = array.Select(delegate(string p) { AssetImporter atPath2 = AssetImporter.GetAtPath(p); return (TextureImporter)(object)((atPath2 is TextureImporter) ? atPath2 : null); }).ToArray(); TextureImporter[] array4 = array3; foreach (TextureImporter val in array4) { val.isReadable = true; } AssetDatabase.Refresh(); string[] array5 = array; foreach (string text2 in array5) { AssetDatabase.ImportAsset(text2); } Texture2D val2 = new Texture2D(size * 4, size * 3, (TextureFormat)(flag ? 20 : 4), false); for (int l = 0; l < 6; l++) { val2.SetPixels(((Vector2Int)(ref placementRects[l])).x * size, ((Vector2Int)(ref placementRects[l])).y * size, size, size, textures[l].GetPixels(0)); } val2.Apply(false); byte[] bytes = (flag ? ImageConversion.EncodeToEXR(val2) : ImageConversion.EncodeToPNG(val2)); File.WriteAllBytes(text, bytes); Object.Destroy((Object)(object)val2); for (int m = 0; m < 6; m++) { array3[m].isReadable = array2[m]; } text = text.Remove(0, Application.dataPath.Length - 6); AssetDatabase.ImportAsset(text); AssetImporter atPath = AssetImporter.GetAtPath(text); TextureImporter val3 = (TextureImporter)(object)((atPath is TextureImporter) ? atPath : null); val3.textureShape = (TextureImporterShape)2; val3.sRGBTexture = false; val3.generateCubemap = (TextureImporterGenerateCubemap)5; string[] array6 = array; foreach (string text3 in array6) { AssetDatabase.ImportAsset(text3); } AssetDatabase.ImportAsset(text); AssetDatabase.Refresh(); } } public CubemapTextureBuilder() { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) TextureFormat[] array = new TextureFormat[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); HDRFormats = (TextureFormat[])(object)array; placementRects = (Vector2Int[])(object)new Vector2Int[6] { new Vector2Int(2, 1), new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(1, 0), new Vector2Int(1, 1), new Vector2Int(3, 1) }; ((EditorWindow)this)..ctor(); } } public class PlayerShip : MonoBehaviour { public readonly Vector3 shipPosition = new Vector3(-17.5f, 5.75f, -16.55f); private void Start() { Object.Destroy((Object)(object)this); } } [CustomEditor(typeof(PlayerShip))] public class PlayerShipEditor : Editor { public override void OnInspectorGUI() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) ((Editor)this).OnInspectorGUI(); PlayerShip playerShip = (PlayerShip)(object)((Editor)this).target; if (((Component)playerShip).transform.position != playerShip.shipPosition) { ((Component)playerShip).transform.position = playerShip.shipPosition; } } } namespace LethalSDK.ScriptableObjects { [CreateAssetMenu(fileName = "AssetBank", menuName = "LethalSDK/Asset Bank")] public class AssetBank : ScriptableObject { [Header("Audio Clips")] [SerializeField] private AudioClipInfoPair[] _audioClips = new AudioClipInfoPair[0]; [SerializeField] private PlanetPrefabInfoPair[] _planetPrefabs = new PlanetPrefabInfoPair[0]; [SerializeField] private PrefabInfoPair[] _networkPrefabs = new PrefabInfoPair[0]; [HideInInspector] public string serializedAudioClips; [HideInInspector] public string serializedPlanetPrefabs; [HideInInspector] public string serializedNetworkPrefabs; private void OnValidate() { for (int i = 0; i < _audioClips.Length; i++) { _audioClips[i].AudioClipName = _audioClips[i].AudioClipName.RemoveNonAlphanumeric(1); _audioClips[i].AudioClipPath = _audioClips[i].AudioClipPath.RemoveNonAlphanumeric(4); } for (int j = 0; j < _planetPrefabs.Length; j++) { _planetPrefabs[j].PlanetPrefabName = _planetPrefabs[j].PlanetPrefabName.RemoveNonAlphanumeric(1); _planetPrefabs[j].PlanetPrefabPath = _planetPrefabs[j].PlanetPrefabPath.RemoveNonAlphanumeric(4); } for (int k = 0; k < _networkPrefabs.Length; k++) { _networkPrefabs[k].PrefabName = _networkPrefabs[k].PrefabName.RemoveNonAlphanumeric(1); _networkPrefabs[k].PrefabPath = _networkPrefabs[k].PrefabPath.RemoveNonAlphanumeric(4); } serializedAudioClips = string.Join(";", _audioClips.Select((AudioClipInfoPair p) => ((p.AudioClipName.Length != 0) ? p.AudioClipName : (((Object)(object)p.AudioClip != (Object)null) ? ((Object)p.AudioClip).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.AudioClip))); serializedPlanetPrefabs = string.Join(";", _planetPrefabs.Select((PlanetPrefabInfoPair p) => ((p.PlanetPrefabName.Length != 0) ? p.PlanetPrefabName : (((Object)(object)p.PlanetPrefab != (Object)null) ? ((Object)p.PlanetPrefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.PlanetPrefab))); serializedNetworkPrefabs = string.Join(";", _networkPrefabs.Select((PrefabInfoPair p) => ((p.PrefabName.Length != 0) ? p.PrefabName : (((Object)(object)p.Prefab != (Object)null) ? ((Object)p.Prefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.Prefab))); } public AudioClipInfoPair[] AudioClips() { if (serializedAudioClips != null) { return (from s in serializedAudioClips.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new AudioClipInfoPair(split[0], split[1])).ToArray(); } return new AudioClipInfoPair[0]; } public bool HaveAudioClip(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().Any((AudioClipInfoPair a) => a.AudioClipName == audioClipName); } return false; } public string AudioClipPath(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().First((AudioClipInfoPair c) => c.AudioClipName == audioClipName).AudioClipPath; } return string.Empty; } public Dictionary<string, string> AudioClipsDictionary() { if (serializedAudioClips != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); AudioClipInfoPair[] audioClips = _audioClips; for (int i = 0; i < audioClips.Length; i++) { AudioClipInfoPair audioClipInfoPair = audioClips[i]; dictionary.Add(audioClipInfoPair.AudioClipName, audioClipInfoPair.AudioClipPath); } return dictionary; } return new Dictionary<string, string>(); } public PlanetPrefabInfoPair[] PlanetPrefabs() { if (serializedPlanetPrefabs != null) { return (from s in serializedPlanetPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PlanetPrefabInfoPair(split[0], split[1])).ToArray(); } return new PlanetPrefabInfoPair[0]; } public bool HavePlanetPrefabs(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().Any((PlanetPrefabInfoPair a) => a.PlanetPrefabName == planetPrefabName); } return false; } public string PlanetPrefabsPath(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().First((PlanetPrefabInfoPair c) => c.PlanetPrefabName == planetPrefabName).PlanetPrefabPath; } return string.Empty; } public Dictionary<string, string> PlanetPrefabsDictionary() { if (serializedPlanetPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PlanetPrefabInfoPair[] planetPrefabs = _planetPrefabs; for (int i = 0; i < planetPrefabs.Length; i++) { PlanetPrefabInfoPair planetPrefabInfoPair = planetPrefabs[i]; dictionary.Add(planetPrefabInfoPair.PlanetPrefabName, planetPrefabInfoPair.PlanetPrefabPath); } return dictionary; } return new Dictionary<string, string>(); } public PrefabInfoPair[] NetworkPrefabs() { if (serializedNetworkPrefabs != null) { return (from s in serializedNetworkPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PrefabInfoPair(split[0], split[1])).ToArray(); } return new PrefabInfoPair[0]; } public bool HaveNetworkPrefabs(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().Any((PrefabInfoPair a) => a.PrefabName == networkPrefabName); } return false; } public string NetworkPrefabsPath(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().First((PrefabInfoPair c) => c.PrefabName == networkPrefabName).PrefabPath; } return string.Empty; } public Dictionary<string, string> NetworkPrefabsDictionary() { if (serializedNetworkPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PrefabInfoPair[] networkPrefabs = _networkPrefabs; for (int i = 0; i < networkPrefabs.Length; i++) { PrefabInfoPair prefabInfoPair = networkPrefabs[i]; dictionary.Add(prefabInfoPair.PrefabName, prefabInfoPair.PrefabPath); } return dictionary; } return new Dictionary<string, string>(); } } [CreateAssetMenu(fileName = "ModManifest", menuName = "LethalSDK/Mod Manifest")] public class ModManifest : ScriptableObject { public string modName = "NewMod"; [Space] [SerializeField] private SerializableVersion version = new SerializableVersion(0, 0, 0, 0); [HideInInspector] public string serializedVersion; [Space] public string author = "Author"; [Space] [TextArea(5, 15)] public string description = "Mod Description"; [Space] [Header("Content")] public Scrap[] scraps = new Scrap[0]; public Moon[] moons = new Moon[0]; [Space] public AssetBank assetBank; private void OnValidate() { serializedVersion = version.ToString(); } public SerializableVersion GetVersion() { int[] array = ((serializedVersion != null) ? serializedVersion.Split(new char[1] { '.' }).Select(int.Parse).ToArray() : new int[4]); return new SerializableVersion(array[0], array[1], array[2], array[3]); } } [CreateAssetMenu(fileName = "New Moon", menuName = "LethalSDK/Moon")] public class Moon : ScriptableObject { public string MoonName = "NewMoon"; public string[] RequiredBundles; public string[] IncompatibleBundles; public bool IsEnabled = true; public bool IsHidden = false; public bool IsLocked = false; [Header("Info")] public string OrbitPrefabName = "Moon1"; public bool SpawnEnemiesAndScrap = true; public string PlanetName = "New Moon"; public GameObject MainPrefab; [TextArea(5, 15)] public string PlanetDescription; [TextArea(5, 15)] public string PlanetLore; public VideoClip PlanetVideo; public string RiskLevel = "X"; [Range(0f, 16f)] public float TimeToArrive = 1f; [Header("Time")] [Range(0.1f, 5f)] public float DaySpeedMultiplier = 1f; public bool PlanetHasTime = true; [SerializeField] private RandomWeatherPair[] _RandomWeatherTypes = new RandomWeatherPair[6] { new RandomWeatherPair(LevelWeatherType.None, 0, 0), new RandomWeatherPair(LevelWeatherType.Rainy, 0, 0), new RandomWeatherPair(LevelWeatherType.Stormy, 1, 0), new RandomWeatherPair(LevelWeatherType.Foggy, 1, 0), new RandomWeatherPair(LevelWeatherType.Flooded, -4, 5), new RandomWeatherPair(LevelWeatherType.Eclipsed, 1, 0) }; public bool OverwriteWeather = false; public LevelWeatherType OverwriteWeatherType = LevelWeatherType.None; [Header("Route")] public string RouteWord = "newmoon"; public int RoutePrice; public string BoughtComment = "Please enjoy your flight."; [Header("Dungeon")] [Range(1f, 5f)] public float FactorySizeMultiplier = 1f; public int FireExitsAmountOverwrite = 1; [SerializeField] private DungeonFlowPair[] _DungeonFlowTypes = new DungeonFlowPair[2] { new DungeonFlowPair(0, 300), new DungeonFlowPair(1, 1) }; [SerializeField] private SpawnableScrapPair[] _SpawnableScrap = new SpawnableScrapPair[19] { new SpawnableScrapPair("Cog1", 80), new SpawnableScrapPair("EnginePart1", 90), new SpawnableScrapPair("FishTestProp", 12), new SpawnableScrapPair("MetalSheet", 88), new SpawnableScrapPair("FlashLaserPointer", 4), new SpawnableScrapPair("BigBolt", 80), new SpawnableScrapPair("BottleBin", 19), new SpawnableScrapPair("Ring", 3), new SpawnableScrapPair("SteeringWheel", 32), new SpawnableScrapPair("MoldPan", 5), new SpawnableScrapPair("EggBeater", 10), new SpawnableScrapPair("PickleJar", 10), new SpawnableScrapPair("DustPan", 32), new SpawnableScrapPair("Airhorn", 3), new SpawnableScrapPair("ClownHorn", 3), new SpawnableScrapPair("CashRegister", 3), new SpawnableScrapPair("Candy", 2), new SpawnableScrapPair("GoldBar", 1), new SpawnableScrapPair("YieldSign", 6) }; public string[] spawnableScrapBlacklist = new string[0]; [Range(0f, 100f)] public int MinScrap = 8; [Range(0f, 100f)] public int MaxScrap = 12; public string LevelAmbienceClips = "Level1TypeAmbience"; [Range(0f, 30f)] public int MaxEnemyPowerCount = 4; [SerializeField] private SpawnableEnemiesPair[] _Enemies = new SpawnableEnemiesPair[8] { new SpawnableEnemiesPair("Centipede", 51), new SpawnableEnemiesPair("SandSpider", 58), new SpawnableEnemiesPair("HoarderBug", 28), new SpawnableEnemiesPair("Flowerman", 13), new SpawnableEnemiesPair("Crawler", 16), new SpawnableEnemiesPair("Blob", 31), new SpawnableEnemiesPair("DressGirl", 1), new SpawnableEnemiesPair("Puffer", 28) }; public AnimationCurve EnemySpawnChanceThroughoutDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0015411376953125,\"value\":-3.0,\"inSlope\":19.556997299194337,\"outSlope\":19.556997299194337,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.12297855317592621},{\"serializedVersion\":\"3\",\"time\":0.4575331211090088,\"value\":4.796203136444092,\"inSlope\":24.479534149169923,\"outSlope\":24.479534149169923,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.396077424287796,\"outWeight\":0.35472238063812258},{\"serializedVersion\":\"3\",\"time\":0.7593884468078613,\"value\":4.973001480102539,\"inSlope\":2.6163148880004885,\"outSlope\":2.6163148880004885,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2901076376438141,\"outWeight\":0.5360636115074158},{\"serializedVersion\":\"3\",\"time\":1.0,\"value\":15.0,\"inSlope\":35.604026794433597,\"outSlope\":35.604026794433597,\"tangentMode\":0,\"weightedMode\":1,\"inWeight\":0.04912583902478218,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float SpawnProbabilityRange = 4f; [Header("Outside")] [SerializeField] private SpawnableMapObjectPair[] _SpawnableMapObjects = new SpawnableMapObjectPair[2] { new SpawnableMapObjectPair("Landmine", spawnFacingAwayFromWall: false, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-0.003082275390625,\"value\":0.0,\"inSlope\":0.23179344832897187,\"outSlope\":0.23179344832897187,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27936428785324099},{\"serializedVersion\":\"3\",\"time\":0.8171924352645874,\"value\":1.7483322620391846,\"inSlope\":7.064207077026367,\"outSlope\":7.064207077026367,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2631833553314209,\"outWeight\":0.6898177862167358},{\"serializedVersion\":\"3\",\"time\":1.0002186298370362,\"value\":11.760997772216797,\"inSlope\":968.80810546875,\"outSlope\":968.80810546875,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.029036391526460649,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableMapObjectPair("TurretContainer", spawnFacingAwayFromWall: true, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.354617178440094,\"outSlope\":0.354617178440094,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9190289974212647,\"value\":1.0005745887756348,\"inSlope\":Infinity,\"outSlope\":1.7338485717773438,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.6534967422485352},{\"serializedVersion\":\"3\",\"time\":1.0038425922393799,\"value\":7.198680877685547,\"inSlope\":529.4945068359375,\"outSlope\":529.4945068359375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.14589552581310273,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [SerializeField] private SpawnableOutsideObjectPair[] _SpawnableOutsideObjects = new SpawnableOutsideObjectPair[7] { new SpawnableOutsideObjectPair("LargeRock1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7571572661399841,\"value\":0.6448163986206055,\"inSlope\":2.974250078201294,\"outSlope\":2.974250078201294,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995536804199219,\"value\":5.883961200714111,\"inSlope\":65.30631256103516,\"outSlope\":65.30631256103516,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.12097536772489548,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock2", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7562879920005798,\"value\":1.2308543920516968,\"inSlope\":5.111926555633545,\"outSlope\":5.111926555633545,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.21955738961696626},{\"serializedVersion\":\"3\",\"time\":1.0010795593261719,\"value\":7.59307336807251,\"inSlope\":92.0470199584961,\"outSlope\":92.0470199584961,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.05033162236213684,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock3", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9964686632156372,\"value\":2.0009398460388185,\"inSlope\":6.82940673828125,\"outSlope\":6.82940673828125,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06891261041164398,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock4", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9635604619979858,\"value\":2.153383493423462,\"inSlope\":6.251225471496582,\"outSlope\":6.251225471496582,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.07428120821714401,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995394349098206,\"value\":5.0,\"inSlope\":15.746581077575684,\"outSlope\":15.746581077575684,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06317413598299027,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("TreeLeafless1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.776531994342804,\"value\":6.162014007568359,\"inSlope\":30.075166702270509,\"outSlope\":30.075166702270509,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.5323987007141113},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":38.093849182128909,\"inSlope\":1448.839111328125,\"outSlope\":1448.839111328125,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0620061457157135,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("SmallGreyRocks1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.802714467048645,\"value\":1.5478605031967164,\"inSlope\":9.096116065979004,\"outSlope\":9.096116065979004,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.58766108751297},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":14.584033966064454,\"inSlope\":1244.9173583984375,\"outSlope\":1244.9173583984375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.054620321840047839,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("GiantPumpkin", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.8832725882530212,\"value\":0.5284063816070557,\"inSlope\":3.2962090969085695,\"outSlope\":29.38977813720703,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.19772815704345704,\"outWeight\":0.8989489078521729},{\"serializedVersion\":\"3\",\"time\":0.972209095954895,\"value\":6.7684478759765629,\"inSlope\":140.27394104003907,\"outSlope\":140.27394104003907,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.39466607570648196,\"outWeight\":0.47049039602279665},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":23.0,\"inSlope\":579.3037109375,\"outSlope\":14.8782377243042,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.648808479309082,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [Range(0f, 30f)] public int MaxOutsideEnemyPowerCount = 8; [Range(0f, 30f)] public int MaxDaytimeEnemyPowerCount = 5; [SerializeField] private SpawnableEnemiesPair[] _OutsideEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("MouthDog", 75), new SpawnableEnemiesPair("ForestGiant", 0), new SpawnableEnemiesPair("SandWorm", 56) }; [SerializeField] private SpawnableEnemiesPair[] _DaytimeEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("RedLocustBees", 22), new SpawnableEnemiesPair("Doublewing", 74), new SpawnableEnemiesPair("DocileLocustBees", 52) }; public AnimationCurve OutsideEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-7.736962288618088e-7,\"value\":-2.996999979019165,\"inSlope\":Infinity,\"outSlope\":0.5040292143821716,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.08937685936689377},{\"serializedVersion\":\"3\",\"time\":0.7105481624603272,\"value\":-0.6555822491645813,\"inSlope\":9.172262191772461,\"outSlope\":9.172262191772461,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.3333333432674408,\"outWeight\":0.7196550369262695},{\"serializedVersion\":\"3\",\"time\":1.0052626132965088,\"value\":5.359400749206543,\"inSlope\":216.42247009277345,\"outSlope\":11.374387741088868,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.044637180864810947,\"outWeight\":0.48315444588661196}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); public AnimationCurve DaytimeEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":2.2706568241119386,\"inSlope\":-7.500085353851318,\"outSlope\":-7.500085353851318,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.20650266110897065},{\"serializedVersion\":\"3\",\"time\":0.38507816195487978,\"value\":-0.0064108967781066898,\"inSlope\":-2.7670974731445314,\"outSlope\":-2.7670974731445314,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.28388944268226626,\"outWeight\":0.30659767985343935},{\"serializedVersion\":\"3\",\"time\":0.6767024993896484,\"value\":-7.021658420562744,\"inSlope\":-27.286888122558595,\"outSlope\":-27.286888122558595,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.10391546785831452,\"outWeight\":0.12503522634506226},{\"serializedVersion\":\"3\",\"time\":0.9998173117637634,\"value\":-14.818100929260254,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float DaytimeEnemiesProbabilityRange = 5f; public bool LevelIncludesSnowFootprints = false; [HideInInspector] public string serializedRandomWeatherTypes; [HideInInspector] public string serializedDungeonFlowTypes; [HideInInspector] public string serializedSpawnableScrap; [HideInInspector] public string serializedEnemies; [HideInInspector] public string serializedOutsideEnemies; [HideInInspector] public string serializedDaytimeEnemies; [HideInInspector] public string serializedSpawnableMapObjects; [HideInInspector] public string serializedSpawnableOutsideObjects; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); MoonName = MoonName.RemoveNonAlphanumeric(1); OrbitPrefabName = OrbitPrefabName.RemoveNonAlphanumeric(1); RiskLevel = RiskLevel.RemoveNonAlphanumeric(); RouteWord = RouteWord.RemoveNonAlphanumeric(2); BoughtComment = BoughtComment.RemoveNonAlphanumeric(); LevelAmbienceClips = LevelAmbienceClips.RemoveNonAlphanumeric(1); TimeToArrive = Mathf.Clamp(TimeToArrive, 0f, 16f); DaySpeedMultiplier = Mathf.Clamp(DaySpeedMultiplier, 0.1f, 5f); RoutePrice = Mathf.Clamp(RoutePrice, 0, int.MaxValue); FactorySizeMultiplier = Mathf.Clamp(FactorySizeMultiplier, 1f, 5f); FireExitsAmountOverwrite = Mathf.Clamp(FireExitsAmountOverwrite, 0, 20); MinScrap = Mathf.Clamp(MinScrap, 0, MaxScrap); MaxScrap = Mathf.Clamp(MaxScrap, MinScrap, 100); MaxEnemyPowerCount = Mathf.Clamp(MaxEnemyPowerCount, 0, 30); MaxOutsideEnemyPowerCount = Mathf.Clamp(MaxOutsideEnemyPowerCount, 0, 30); MaxDaytimeEnemyPowerCount = Mathf.Clamp(MaxDaytimeEnemyPowerCount, 0, 30); SpawnProbabilityRange = Mathf.Clamp(SpawnProbabilityRange, 0f, 30f); DaytimeEnemiesProbabilityRange = Mathf.Clamp(DaytimeEnemiesProbabilityRange, 0f, 30f); for (int i = 0; i < _SpawnableScrap.Length; i++) { _SpawnableScrap[i].ObjectName = _SpawnableScrap[i].ObjectName.RemoveNonAlphanumeric(1); } for (int j = 0; j < _Enemies.Length; j++) { _Enemies[j].EnemyName = _Enemies[j].EnemyName.RemoveNonAlphanumeric(1); } for (int k = 0; k < _SpawnableMapObjects.Length; k++) { _SpawnableMapObjects[k].ObjectName = _SpawnableMapObjects[k].ObjectName.RemoveNonAlphanumeric(1); } for (int l = 0; l < _SpawnableOutsideObjects.Length; l++) { _SpawnableOutsideObjects[l].ObjectName = _SpawnableOutsideObjects[l].ObjectName.RemoveNonAlphanumeric(1); } for (int m = 0; m < _OutsideEnemies.Length; m++) { _OutsideEnemies[m].EnemyName = _OutsideEnemies[m].EnemyName.RemoveNonAlphanumeric(1); } for (int n = 0; n < _DaytimeEnemies.Length; n++) { _DaytimeEnemies[n].EnemyName = _DaytimeEnemies[n].EnemyName.RemoveNonAlphanumeric(1); } serializedRandomWeatherTypes = string.Join(";", _RandomWeatherTypes.Select((RandomWeatherPair p) => $"{(int)p.Weather},{p.WeatherVariable1},{p.WeatherVariable2}")); serializedDungeonFlowTypes = string.Join(";", _DungeonFlowTypes.Select((DungeonFlowPair p) => $"{p.ID},{p.Rarity}")); serializedSpawnableScrap = string.Join(";", _SpawnableScrap.Select((SpawnableScrapPair p) => $"{p.ObjectName},{p.SpawnWeight}")); serializedEnemies = string.Join(";", _Enemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedOutsideEnemies = string.Join(";", _OutsideEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedDaytimeEnemies = string.Join(";", _DaytimeEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedSpawnableMapObjects = string.Join(";", _SpawnableMapObjects.Select((SpawnableMapObjectPair p) => $"{p.ObjectName}|{p.SpawnFacingAwayFromWall}|{CurveContainer.SerializeCurve(p.SpawnRate)}")); serializedSpawnableOutsideObjects = string.Join(";", _SpawnableOutsideObjects.Select((SpawnableOutsideObjectPair p) => p.ObjectName + "|" + CurveContainer.SerializeCurve(p.SpawnRate))); } public RandomWeatherPair[] RandomWeatherTypes() { return (from s in serializedRandomWeatherTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 3 select new RandomWeatherPair((LevelWeatherType)int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]))).ToArray(); } public DungeonFlowPair[] DungeonFlowTypes() { return (from s in serializedDungeonFlowTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new DungeonFlowPair(int.Parse(split[0]), int.Parse(split[1]))).ToArray(); } public SpawnableScrapPair[] SpawnableScrap() { return (from s in serializedSpawnableScrap.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableScrapPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] Enemies() { return (from s in serializedEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] OutsideEnemies() { return (from s in serializedOutsideEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] DaytimeEnemies() { return (from s in serializedDaytimeEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableMapObjectPair[] SpawnableMapObjects() { return (from s in serializedSpawnableMapObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 3 select new SpawnableMapObjectPair(split[0], bool.Parse(split[1]), CurveContainer.DeserializeCurve(split[2]))).ToArray(); } public SpawnableOutsideObjectPair[] SpawnableOutsideObjects() { return (from s in serializedSpawnableOutsideObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 2 select new SpawnableOutsideObjectPair(split[0], CurveContainer.DeserializeCurve(split[1]))).ToArray(); } } [CreateAssetMenu(fileName = "New Scrap", menuName = "LethalSDK/Scrap")] public class Scrap : ScriptableObject { public string[] RequiredBundles; public string[] IncompatibleBundles; [Header("Base")] public ScrapType scrapType = ScrapType.Normal; public string itemName = "NewScrap"; public int minValue = 0; public int maxValue = 0; public bool twoHanded = false; public GrabAnim HandedAnimation = GrabAnim.OneHanded; public bool requiresBattery = false; public bool isConductiveMetal = false; public int weight = 0; public GameObject prefab; public float useCooldown = 0f; [Header("Sounds")] public string grabSFX = string.Empty; public string dropSFX = string.Empty; [Header("Offsets")] public float verticalOffset = 0f; public Vector3 restingRotation = Vector3.zero; public Vector3 positionOffset = Vector3.zero; public Vector3 rotationOffset = Vector3.zero; [Header("Variants")] public Mesh[] meshVariants = (Mesh[])(object)new Mesh[0]; public Material[] materialVariants = (Material[])(object)new Material[0]; [Header("Spawn rate")] public bool useGlobalSpawnWeight = true; [Range(0f, 100f)] public int globalSpawnWeight = 10; [SerializeField] private ScrapSpawnChancePerScene[] _perPlanetSpawnWeight = new ScrapSpawnChancePerScene[9] { new ScrapSpawnChancePerScene("41 Experimentation", 10), new ScrapSpawnChancePerScene("220 Assurance", 10), new ScrapSpawnChancePerScene("56 Vow", 10), new ScrapSpawnChancePerScene("21 Offense", 10), new ScrapSpawnChancePerScene("61 March", 10), new ScrapSpawnChancePerScene("85 Rend", 10), new ScrapSpawnChancePerScene("7 Dine", 10), new ScrapSpawnChancePerScene("8 Titan", 10), new ScrapSpawnChancePerScene("Others", 10) }; public string[] planetSpawnBlacklist = new string[0]; [Header("Shovel")] public int shovelHitForce = 1; public AudioSource shovelAudio; public string reelUp = "ShovelReelUp"; public string swing = "ShovelSwing"; public string[] hitSFX = new string[2] { "ShovelHitDefault", "ShovelHitDefault2" }; [Header("Flashlight")] public bool usingPlayerHelmetLight = false; public int flashlightInterferenceLevel = 0; public Light flashlightBulb; public Light flashlightBulbGlow; public AudioSource flashlightAudio; public string[] flashlightClips = new string[1] { "FlashlightClick" }; public string outOfBatteriesClip = "FlashlightOutOfBatteries"; public string flashlightFlicker = "FlashlightFlicker"; public Material bulbLight; public Material bulbDark; public MeshRenderer flashlightMesh; public int flashlightTypeID = 0; public bool changeMaterial = true; [Header("Noisemaker")] public AudioSource noiseAudio; public AudioSource noiseAudioFar; public string[] noiseSFX = new string[1] { "ClownHorn1" }; public string[] noiseSFXFar = new string[1] { "ClownHornFar" }; public float noiseRange = 60f; public float maxLoudness = 1f; public float minLoudness = 0.6f; public float minPitch = 0.93f; public float maxPitch = 1f; public Animator triggerAnimator; [Header("WhoopieCushion")] public AudioSource whoopieCushionAudio; public string[] fartAudios = new string[4] { "Fart1", "Fart2", "Fart3", "Fart5" }; [HideInInspector] public string serializedData; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); itemName = itemName.RemoveNonAlphanumeric(1); grabSFX = grabSFX.RemoveNonAlphanumeric(1); dropSFX = dropSFX.RemoveNonAlphanumeric(1); for (int i = 0; i < _perPlanetSpawnWeight.Length; i++) { _perPlanetSpawnWeight[i].SceneName = _perPlanetSpawnWeight[i].SceneName.RemoveNonAlphanumeric(1); } serializedData = string.Join(";", _perPlanetSpawnWeight.Select((ScrapSpawnChancePerScene p) => $"{p.SceneName},{p.SpawnWeight}")); } public ScrapSpawnChancePerScene[] perPlanetSpawnWeight() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new ScrapSpawnChancePerScene(split[0], int.Parse(split[1]))).ToArray(); } } public enum ScrapType { Normal, Shovel, Flashlight, Noisemaker, WhoopieCushion } public enum GrabAnim { OneHanded, TwoHanded, Shotgun, Jetpack, Clipboard } } namespace LethalSDK.Utils { public static class AssetGatherDialog { public static Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public static Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public static Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); } [Serializable] public class SerializableVersion { public int Major = 1; public int Minor = 0; public int Build = 0; public int Revision = 0; public SerializableVersion(int major, int minor, int build, int revision) { Major = major; Minor = minor; Build = build; Revision = revision; } public Version ToVersion() { return new Version(Major, Minor, Build, Revision); } public override string ToString() { return $"{Major}.{Minor}.{Build}.{Revision}"; } } [Serializable] public class CurveContainer { public AnimationCurve curve; public static string SerializeCurve(AnimationCurve curve) { CurveContainer curveContainer = new CurveContainer { curve = curve }; return JsonUtility.ToJson((object)curveContainer); } public static AnimationCurve DeserializeCurve(string json) { CurveContainer curveContainer = JsonUtility.FromJson<CurveContainer>(json); return curveContainer.curve; } } public static class NetworkDataManager { public static Dictionary<ulong, SI_NetworkData> NetworkData = new Dictionary<ulong, SI_NetworkData>(); } public class SI_NetworkData : NetworkBehaviour { public StringStringPair[] data = new StringStringPair[0]; [HideInInspector] public string serializedData = string.Empty; public string datacache = string.Empty; public UnityEvent dataChangeEvent = new UnityEvent(); public void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (dataChangeEvent != null) { dataChangeEvent.AddListener(new UnityAction(OnDataChanged)); } } public void Update() { if (datacache != serializedData && dataChangeEvent != null) { dataChangeEvent.Invoke(); } } public override void OnNetworkSpawn() { NetworkDataManager.NetworkData.Add(((NetworkBehaviour)this).NetworkObjectId, this); } public override void OnNetworkDespawn() { NetworkDataManager.NetworkData.Remove(((NetworkBehaviour)this).NetworkObjectId); } public virtual void OnDataChanged() { datacache = serializedData; } public override void OnDestroy() { if (dataChangeEvent != null) { ((UnityEventBase)dataChangeEvent).RemoveAllListeners(); } } public virtual StringStringPair[] getData() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new StringStringPair(split[0], split[1])).ToArray(); } public virtual void setData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); } else { serializedData = datastring; } } public virtual void setData(StringStringPair[] dataarray) { string source = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)); if (!Enumerable.Contains(source, ',')) { Debug.LogWarning((object)"Invalid datastring format."); } else { serializedData = source; } } public virtual void addData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } serializedData += datastring; serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void addData(StringStringPair[] dataarray) { string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";"); if (!Enumerable.Contains(text, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } serializedData += text; serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void delData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } if (!serializedData.Contains(datastring)) { Debug.Log((object)"Datastring doesn't exist in serializedData."); return; } serializedData = serializedData.Replace(datastring, string.Empty); serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void delData(StringStringPair[] dataarray) { string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";"); if (!Enumerable.Contains(text, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } if (!serializedData.Contains(text)) { Debug.Log((object)"Datastring doesn't exist in serializedData."); return; } serializedData = serializedData.Replace(text, string.Empty); serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } } [Serializable] public struct StringIntPair { public string _string; public int _int; public StringIntPair(string _string, int _int) { this._string = _string.RemoveNonAlphanumeric(1); this._int = Mathf.Clamp(_int, 0, 100); } } [Serializable] public struct StringStringPair { public string _string1; public string _string2; public StringStringPair(string _string1, string _string2) { this._string1 = _string1.RemoveNonAlphanumeric(1); this._string2 = _string2.RemoveNonAlphanumeric(1); } } [Serializable] public struct IntIntPair { public int _int1; public int _int2; public IntIntPair(int _int1, int _int2) { this._int1 = _int1; this._int2 = _int2; } } [Serializable] public struct DungeonFlowPair { public int ID; [Range(0f, 300f)] public int Rarity; public DungeonFlowPair(int id, int rarity) { ID = id; Rarity = Mathf.Clamp(rarity, 0, 300); } } [Serializable] public struct SpawnableScrapPair { public string ObjectName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableScrapPair(string objectName, int spawnWeight) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct SpawnableMapObjectPair { public string ObjectName; public bool SpawnFacingAwayFromWall; public AnimationCurve SpawnRate; public SpawnableMapObjectPair(string objectName, bool spawnFacingAwayFromWall, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnFacingAwayFromWall = spawnFacingAwayFromWall; SpawnRate = spawnRate; } } [Serializable] public struct SpawnableOutsideObjectPair { public string ObjectName; public AnimationCurve SpawnRate; public SpawnableOutsideObjectPair(string objectName, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnRate = spawnRate; } } [Serializable] public struct SpawnableEnemiesPair { public string EnemyName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableEnemiesPair(string enemyName, int spawnWeight) { EnemyName = enemyName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapSpawnChancePerScene { public string SceneName; [Range(0f, 100f)] public int SpawnWeight; public ScrapSpawnChancePerScene(string sceneName, int spawnWeight) { SceneName = sceneName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapInfoPair { public string ScrapPath; public Scrap Scrap; public ScrapInfoPair(string scrapPath, Scrap scrap) { ScrapPath = scrapPath.RemoveNonAlphanumeric(4); Scrap = scrap; } } [Serializable] public struct AudioClipInfoPair { public string AudioClipName; [HideInInspector] public string AudioClipPath; [SerializeField] public AudioClip AudioClip; public AudioClipInfoPair(string audioClipName, string audioClipPath) { AudioClipName = audioClipName.RemoveNonAlphanumeric(1); AudioClipPath = audioClipPath.RemoveNonAlphanumeric(4); AudioClip = null; } } [Serializable] public struct PlanetPrefabInfoPair { public string PlanetPrefabName; [HideInInspector] public string PlanetPrefabPath; [SerializeField] public GameObject PlanetPrefab; public PlanetPrefabInfoPair(string planetPrefabName, string planetPrefabPath) { PlanetPrefabName = planetPrefabName.RemoveNonAlphanumeric(1); PlanetPrefabPath = planetPrefabPath.RemoveNonAlphanumeric(4); PlanetPrefab = null; } } [Serializable] public struct PrefabInfoPair { public string PrefabName; [HideInInspector] public string PrefabPath; [SerializeField] public GameObject Prefab; public PrefabInfoPair(string prefabName, string prefabPath) { PrefabName = prefabName.RemoveNonAlphanumeric(1); PrefabPath = prefabPath.RemoveNonAlphanumeric(4); Prefab = null; } } [Serializable] public struct RandomWeatherPair { public LevelWeatherType Weather; [Tooltip("Thunder Frequency, Flooding speed or minimum initial enemies in eclipses")] public int WeatherVariable1; [Tooltip("Flooding offset when Weather is Flooded")] public int WeatherVariable2; public RandomWeatherPair(LevelWeatherType weather, int weatherVariable1, int weatherVariable2) { Weather = weather; WeatherVariable1 = weatherVariable1; WeatherVariable2 = weatherVariable2; } } public enum LevelWeatherType { None = -1, DustClouds, Rainy, Stormy, Foggy, Flooded, Eclipsed } public class SpawnPrefab { private static SpawnPrefab _instance; public GameObject waterSurface; public static SpawnPrefab Instance { get { if (_instance == null) { _instance = new SpawnPrefab(); } return _instance; } } } public static class TypeExtensions { public enum removeType { Normal, Serializable, Keyword, Path, SerializablePath } public static readonly Dictionary<removeType, string> regexes = new Dictionary<removeType, string> { { removeType.Normal, "[^a-zA-Z0-9 ,.!?_-]" }, { removeType.Serializable, "[^a-zA-Z0-9 .!_-]" }, { removeType.Keyword, "[^a-zA-Z0-9._-]" }, { removeType.Path, "[^a-zA-Z0-9 ,.!_/-]" }, { removeType.SerializablePath, "[^a-zA-Z0-9 .!_/-]" } }; public static string RemoveNonAlphanumeric(this string input) { if (input != null) { return Regex.Replace(input, regexes[removeType.Normal], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType.Normal], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, removeType removeType = removeType.Normal) { if (input != null) { return Regex.Replace(input, regexes[removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, removeType removeType = removeType.Normal) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, int removeType = 0) { if (input != null) { return Regex.Replace(input, regexes[(removeType)removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, int removeType = 0) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[(removeType)removeType], string.Empty); } return input; } return new string[0]; } } } namespace LethalSDK.Editor { internal class CopyrightsWindow : EditorWindow { private Vector2 scrollPosition; private readonly Dictionary<string, string> assetAuthorList = new Dictionary<string, string> { { "Drop Ship assets, Sun cycle animations, ScrapItem sprite, ScavengerSuit Textures/Arms Mesh and MonitorWall mesh", "Zeekerss" }, { "SDK Scripts, Sun Texture, CrossButton Sprite (Inspired of vanilla), OldSeaPort planet prefab texture", "HolographicWings" }, { "Old Sea Port asset package", "VIVID Arts" }, { "Survival Game Tools asset package", "cookiepopworks.com" } }; [MenuItem("LethalSDK/Copyrights", false, 999)] public static void ShowWindow() { EditorWindow.GetWindow<CopyrightsWindow>("Copyrights"); } private void OnGUI() { //IL_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("List of Copyrights", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(5f); foreach (KeyValuePair<string, string> assetAuthor in assetAuthorList) { GUILayout.Label("Asset: " + assetAuthor.Key + " - By: " + assetAuthor.Value, EditorStyles.wordWrappedLabel, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(2f); } EditorGUILayout.Space(5f); GUILayout.Label("This SDK do not embed any Vanilla script.", Array.Empty<GUILayoutOption>()); GUILayout.EndScrollView(); } } public class EditorChecker : Editor { public override void OnInspectorGUI() { ((Editor)this).DrawDefaultInspector(); } } [CustomEditor(typeof(ModManifest))] public class ModManifestEditor : EditorChecker { public override void OnInspectorGUI() { ModManifest modManifest = (ModManifest)(object)((Editor)this).target; if (modManifest.serializedVersion == "0.0.0.0") { EditorGUILayout.HelpBox("Please define a version to your mod and don't forget to increment it at each update.", (MessageType)2); } if (modManifest.modName == null || modManifest.modName.Length == 0) { EditorGUILayout.HelpBox("Your mod need a name.", (MessageType)3); } IEnumerable<string> enumerable = from e in modManifest.scraps.Where((Scrap e) => (Object)(object)e != (Object)null).ToList() group e by e.itemName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Scraps. Duplicated Scraps are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in modManifest.moons.Where((Moon e) => (Object)(object)e != (Object)null).ToList() group e by e.MoonName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Moons. Duplicated Moons are: " + text2, (MessageType)2); } string text3 = string.Empty; Scrap[] scraps = modManifest.scraps; foreach (Scrap scrap in scraps) { if ((Object)(object)scrap != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)scrap).name + ","; } } Moon[] moons = modManifest.moons; foreach (Moon moon in moons) { if ((Object)(object)moon != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)moon).name + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register a Scrap or a Moon from another mod folder. " + text3, (MessageType)2); } if ((Object)(object)modManifest.assetBank != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest.assetBank)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { EditorGUILayout.HelpBox("You try to register an AssetBank from another mod folder.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(AssetBank))] public class AssetBankEditor : EditorChecker { public override void OnInspectorGUI() { AssetBank assetBank = (AssetBank)(object)((Editor)this).target; IEnumerable<string> enumerable = from e in (from e in assetBank.AudioClips() where e.AudioClipName != null && e.AudioClipName.Length > 0 select e).ToList() group e by e.AudioClipName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Audio Clip. Duplicated Clips are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in (from e in assetBank.PlanetPrefabs() where e.PlanetPrefabName != null && e.PlanetPrefabName.Length > 0 select e).ToList() group e by e.PlanetPrefabName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Planet Prefabs. Duplicated Planet Prefabs are: " + text2, (MessageType)2); } string text3 = string.Empty; AudioClipInfoPair[] array = assetBank.AudioClips(); for (int i = 0; i < array.Length; i++) { AudioClipInfoPair audioClipInfoPair = array[i]; if (audioClipInfoPair.AudioClipName != null && audioClipInfoPair.AudioClipName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(audioClipInfoPair.AudioClipPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + audioClipInfoPair.AudioClipName + ","; } } PlanetPrefabInfoPair[] array2 = assetBank.PlanetPrefabs(); for (int j = 0; j < array2.Length; j++) { PlanetPrefabInfoPair planetPrefabInfoPair = array2[j]; if (planetPrefabInfoPair.PlanetPrefabName != null && planetPrefabInfoPair.PlanetPrefabName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(planetPrefabInfoPair.PlanetPrefabPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + planetPrefabInfoPair.PlanetPrefabName + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register an Audio Clip or a Planet Prefab from another mod folder. " + text3, (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DungeonGenerator))] public class SI_DungeonGeneratorEditor : EditorChecker { public override void OnInspectorGUI() { SI_DungeonGenerator sI_DungeonGenerator = (SI_DungeonGenerator)(object)((Editor)this).target; string assetPath = AssetDatabase.GetAssetPath((Object)(object)sI_DungeonGenerator.DungeonRoot); if (assetPath != null && assetPath.Length > 0) { EditorGUILayout.HelpBox("Dungeon Root must be in the scene.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_ScanNode))] public class SI_ScanNodeEditor : EditorChecker { public override void OnInspectorGUI() { SI_ScanNode sI_ScanNode = (SI_ScanNode)(object)((Editor)this).target; if (sI_ScanNode.MinRange > sI_ScanNode.MaxRange) { EditorGUILayout.HelpBox("Min Range must be smaller than Max Ranger.", (MessageType)3); } if (sI_ScanNode.CreatureScanID < -1) { EditorGUILayout.HelpBox("Creature Scan ID can't be less than -1.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_AnimatedSun))] public class SI_AnimatedSunEditor : EditorChecker { public override void OnInspectorGUI() { SI_AnimatedSun sI_AnimatedSun = (SI_AnimatedSun)(object)((Editor)this).target; if ((Object)(object)sI_AnimatedSun.directLight == (Object)null || (Object)(object)sI_AnimatedSun.indirectLight == (Object)null) { EditorGUILayout.HelpBox("A direct and an indirect light must be defined.", (MessageType)2); } if ((Object)(object)((Component)sI_AnimatedSun.directLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform || (Object)(object)((Component)sI_AnimatedSun.indirectLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform) { EditorGUILayout.HelpBox("Direct and an indirect light must be a child of the AnimatedSun in the hierarchy.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_EntranceTeleport))] public class SI_EntranceTeleportEditor : EditorChecker { public override void OnInspectorGUI() { SI_EntranceTeleport sI_EntranceTeleport = (SI_EntranceTeleport)(object)((Editor)this).target; IEnumerable<int> enumerable = from e in Object.FindObjectsOfType<SI_EntranceTeleport>().ToList() group e by e.EntranceID into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (int item in enumerable) { text += $"{item},"; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("Two entrances or more have same Entrance ID. Duplicated entrances are: " + text, (MessageType)2); } if ((Object)(object)sI_EntranceTeleport.EntrancePoint == (Object)null) { EditorGUILayout.HelpBox("An entrance point must be defined.", (MessageType)3); } if (sI_EntranceTeleport.AudioReverbPreset < 0) { EditorGUILayout.HelpBox("Audio Reverb Preset can't be negative.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Scrap))] public class ScrapEditor : EditorChecker { public override void OnInspectorGUI() { Scrap scrap = (Scrap)(object)((Editor)this).target; if ((Object)(object)scrap.prefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Prefab to your Scrap.", (MessageType)1); } else { if ((Object)(object)scrap.prefab.GetComponent<NetworkObject>() == (Object)null) { EditorGUILayout.HelpBox("The Prefab must have a NetworkObject.", (MessageType)3); } else { NetworkObject component = scrap.prefab.GetComponent<NetworkObject>(); string text = string.Empty; if (component.AlwaysReplicateAsRoot) { text += "\n- AlwaysReplicateAsRoot should be false."; } if (!component.SynchronizeTransform) { text += "\n- SynchronizeTransform should be true."; } if (component.ActiveSceneSynchronization) { text += "\n- ActiveSceneSynchronization should be false."; } if (!component.SceneMigrationSynchronization) { text += "\n- SceneMigrationSynchronization should be true."; } if (!component.SpawnWithObservers) { text += "\n- SpawnWithObservers should be true."; } if (!component.DontDestroyWithOwner) { text += "\n- DontDestroyWithOwner should be true."; } if (component.AutoObjectParentSync) { text += "\n- AutoObjectParentSync should be false."; } if (text.Length > 0) { EditorGUILayout.HelpBox("The NetworkObject of the Prefab have incorrect settings: " + text, (MessageType)2); } } if ((Object)(object)scrap.prefab.transform.Find("ScanNode") == (Object)null) { EditorGUILayout.HelpBox("The Prefab don't have a ScanNode.", (MessageType)2); } if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap.prefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap))) { EditorGUILayout.HelpBox("The Prefab must come from the same mod folder as your Scrap.", (MessageType)2); } } if (scrap.itemName == null || scrap.itemName.Length == 0) { EditorGUILayout.HelpBox("Your scrap must have a Name.", (MessageType)3); } if (!scrap.useGlobalSpawnWeight && !scrap.perPlanetSpawnWeight().Any((ScrapSpawnChancePerScene w) => w.SceneName != null && w.SceneName.Length > 0)) { EditorGUILayout.HelpBox("Your scrap use Per Planet Spawn Weight but no planet are defined.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Moon))] public class MoonEditor : EditorChecker { public override void OnInspectorGUI() { Moon moon = (Moon)(object)((Editor)this).target; if (moon.MoonName == null || moon.MoonName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Name.", (MessageType)3); } if (moon.PlanetName == null || moon.PlanetName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Planet Name.", (MessageType)3); } if (moon.RouteWord == null || moon.RouteWord.Length < 3) { EditorGUILayout.HelpBox("Your moon route word must be at least 3 characters long.", (MessageType)3); } if ((Object)(object)moon.MainPrefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Main Prefab to your Scrap.", (MessageType)1); } else if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon.MainPrefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon))) { EditorGUILayout.HelpBox("The Main Prefab must come from the same mod folder as your Moon.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DoorLock))] public class SI_DoorLockEditor : EditorChecker { public override void OnInspectorGUI() { SI_DoorLock sI_DoorLock = (SI_DoorLock)(object)((Editor)this).target; EditorGUILayout.HelpBox("DoorLock is not implemented yet.", (MessageType)1); base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_Ladder))] public class SI_LadderEditor : EditorChecker { public override void OnInspectorGUI() { SI_Ladder sI_Ladder = (SI_Ladder)(object)((Editor)this).target; EditorGUILayout.HelpBox("Ladder is experimental.", (MessageType)1); base.OnInspectorGUI(); } } [InitializeOnLoad] [CustomEditor(typeof(TerrainChecker))] public class TerrainCheckerEditor : EditorChecker { static TerrainCheckerEditor() { Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged)); } private static void OnSelectionChanged() { if (Object.op_Implicit((Object)(object)Selection.activeGameObject) && Object.op_Implicit((Object)(object)Selection.activeGameObject.GetComponent<Terrain>())) { Terrain component = Selection.activeGameObject.GetComponent<Terrain>(); if (!Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent<TerrainChecker>())) { ((Component)component).gameObject.AddComponent<TerrainChecker>(); } } } public override void OnInspectorGUI() { TerrainChecker terrainChecker = (TerrainChecker)(object)((Editor)this).target; if ((Object)(object)terrainChecker.terrain != (Object)null) { int num = 1024; if ((terrainChecker.terrain.renderingLayerMask & num) == 0) { EditorGUILayout.HelpBox("Quicksand will not show on this terrain, to fix you must enable the '10: Decal Layer 2' in Terrain Settings > Rendering Layer Mask.", (MessageType)2); } if ((Object)(object)terrainChecker.terrain.materialTemplate != (Object)null && ((Object)terrainChecker.terrain.materialTemplate.shader).name != "HDRP/UpdatedTerrainLit") { EditorGUILayout.HelpBox("To use Terrain Holes, you must change the material of the terrain with another one that use the HDRP/UpdatedTerrainLit shader in Terrain Settings > Basic Terrain > Material.", (MessageType)1); } if (!terrainChecker.terrain.drawInstanced) { EditorGUILayout.HelpBox("For performances with a lot of trees, grass and other details, it's recommended to enable Terrain Settings > Basic Terrain > Draw Instanced.", (MessageType)1); } } } } internal class OldAssetsRemover { private static readonly List<string> assetPaths = new List<string> { "Assets/LethalCompanyAssets", "Assets/Mods/LethalExpansion/Audio", "Assets/Mods/LethalExpansion/AudioMixerController", "Assets/Mods/LethalExpansion/Materials/Default.mat", "Assets/Mods/LethalExpansion/Prefabs/Settings", "Assets/Mods/LethalExpansion/Prefabs/EntranceTeleportA.prefab", "Assets/Mods/LethalExpansion/Prefabs/Prefabs.zip", "Assets/Mods/LethalExpansion/Scenes/ItemPlaceTest", "Assets/Mods/LethalExpansion/Sprites/HandIcon.png", "Assets/Mods/LethalExpansion/Sprites/HandIconPoint.png", "Assets/Mods/LethalExpansion/Sprites/HandLadderIcon.png", "Assets/Mods/TemplateMod/Moons/NavMesh-Environment.asset", "Assets/Mods/TemplateMod/Moons/OldSeaPort.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile 1.asset", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunCompanyLevel.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeB.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBStormy.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeC.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCStormy.anim", "Assets/Mods/LethalExpansion/Skybox", "Assets/Mods/LethalExpansion/Sprites/XButton.png", "Assets/Mods/LethalExpansion/Textures/sunTexture1.png", "Assets/Mods/OldSeaPort/Materials/Maple_bark_1.mat", "Assets/Mods/OldSeaPort/Materials/maple_leaves.mat", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/OldSeaPort/EffectExamples/Shared/Scripts", "Assets/Mods/OldSeaPort/scenes", "Assets/Mods/OldSeaPort/prefabs/Plane (12).prefab", "Assets/Mods/LethalExpansion/Meshes/labyrinth.fbx", "Assets/Mods/ChristmasVillage/christmas-assets-free/fbx/Materials", "Assets/Mods/OldSeaPort/effectexamples/profiles", "Assets/Mods/OldSeaPort/effectexamples/shared/animation", "Assets/Mods/OldSeaPort/effectexamples/shared/fonts", "Assets/Mods/OldSeaPort/effectexamples/shared/shaders", "Assets/Mods/OldSeaPort/effectexamples/shared/sprites" }; [InitializeOnLoadMethod] public static void CheckOldAssets() { foreach (string assetPath in assetPaths) { if (AssetDatabase.IsValidFolder(assetPath)) { DeleteFolder(assetPath); } else if ((Object)(object)AssetDatabase.LoadAssetAtPath<GameObject>(assetPath) != (Object)null) { DeleteAsset(assetPath); } } } private static void DeleteFolder(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted folder at: " + path)); } else { Debug.LogError((object)("Failed to delete folder at: " + path)); } } private static void DeleteAsset(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted asset at: " + path)); } else { Debug.LogError((object)("Failed to delete asset at: " + path)); } } } public class VersionChecker : Editor { [InitializeOnLoadMethod] public static void CheckVersion() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown UnityWebRequest www = UnityWebRequest.Get("https://raw.githubusercontent.com/HolographicWings/LethalSDK-Unity-Project/main/last.txt"); UnityWebRequestAsyncOperation operation = www.SendWebRequest(); CallbackFunction callback = null; callback = (CallbackFunction)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (((AsyncOperation)operation).isDone) { EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); OnRequestComplete(www); } }; EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); } private static void OnRequestComplete(UnityWebRequest www) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)www.result == 2 || (int)www.result == 3) { Debug.LogError((object)("Error when getting last version number: " + www.error)); } else { CompareVersions(www.downloadHandler.text); } } private static void CompareVersions(string onlineVersion) { if (Version.Parse(PlayerSettings.bundleVersion) < Version.Parse(onlineVersion) && EditorUtility.DisplayDialogComplex("Warning", "The SDK is not up to date: " + onlineVersion, "Update", "Ignore", "") == 0) { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalSDK/"); } } } internal class LethalSDKCategory : EditorWindow { [MenuItem("LethalSDK/Lethal SDK v1.3.0", false, 0)] public static void ShowWindow() { } } public class Lethal_AssetBundleBuilderWindow : EditorWindow { private enum compressionOption { NormalCompression, FastCompression, Uncompressed } private static string assetBundleDirectoryKey = "LethalSDK_AssetBundleBuilderWindow_assetBundleDirectory"; private static string compressionModeKey = "LethalSDK_AssetBundleBuilderWindow_compressionMode"; private static string _64BitsModeKey = "LethalSDK_AssetBundleBuilderWindow_64BitsMode"; private string assetBundleDirectory = string.Empty; private compressionOption compressionMode = compressionOption.NormalCompression; private bool _64BitsMode; [MenuItem("LethalSDK/AssetBundle Builder", false, 100)] public static void ShowWindow() { //IL_0017: 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) Lethal_AssetBundleBuilderWindow window = EditorWindow.GetWindow<Lethal_AssetBundleBuilderWindow>("AssetBundle Builder"); ((EditorWindow)window).minSize = new Vector2(295f, 133f); ((EditorWindow)window).maxSize = new Vector2(295f, 133f); window.LoadPreferences(); } private void OnGUI() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown GUILayout.Label("Base Settings", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Output Path", "The directory where the asset bundles will be saved."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(84f) }); assetBundleDirectory = EditorGUILayout.TextField(assetBundleDirectory, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.Label("Options", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Compression Mode", "Select the compression option for the asset bundle. Faster the compression is, faster the assets will load and less CPU it will use, but the Bundle will be bigger."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) }); compressionMode = (compressionOption)(object)EditorGUILayout.EnumPopup((Enum)compressionMode, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("64 Bits Asset Bundle (Not recommended)", "Better performances but incompatible with 32 bits computers."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) }); _64BitsMode = EditorGUILayout.Toggle(_64BitsMode, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Build AssetBundles", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) })) { BuildAssetBundles(); } if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) })) { ClearPreferences(); } GUILayout.EndHorizontal(); } private void ClearPreferences() { EditorPrefs.DeleteKey(assetBundleDirectoryKey); EditorPrefs.DeleteKey(compressionModeKey); EditorPrefs.DeleteKey(_64BitsModeKey); LoadPreferences(); } private void BuildAssetBundles() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_009e: Unknown result type (might be due to invalid IL or missing references) if (!Directory.Exists(assetBundleDirectory)) { Directory.CreateDirectory(assetBundleDirectory); } BuildAssetBundleOptions val = (BuildAssetBundleOptions)0; val = (BuildAssetBundleOptions)(compressionMode switch { compressionOption.NormalCompression => 0, compressionOption.FastCompression => 256, compressionOption.Uncompressed => 1, _ => 0, }); BuildTarget val2 = (BuildTarget)(_64BitsMode ? 19 : 5); if (assetBundleDirectory != null || assetBundleDirectory.Length != 0 || assetBundleDirectory != string.Empty) { AssetBundleManifest val3 = null; try { val3 = BuildPipeline.BuildAssetBundles(assetBundleDirectory, val, val2); } catch (Exception ex) { Debug.LogError((object)ex.Message); } if ((Object)(object)val3 != (Object)null) { Debug.Log((object)"AssetBundles built successfully."); } else { Debug.LogError((object)"Cannot build AssetBundles."); } } else { Debug.LogError((object)"AssetBundles path cannot be blank."); } } private void OnLostFocus() { SavePreferences(); } private void OnDisable() { SavePreferences(); } private void LoadPreferences() { assetBundleDirectory = EditorPrefs.GetString(assetBundleDirectoryKey, "Assets/AssetBundles"); compressionMode = (compressionOption)EditorPrefs.GetInt(compressionModeKey, 0); _64BitsMode = EditorPrefs.GetBool(_64BitsModeKey, false); } private void SavePreferences() { EditorPrefs.SetString(assetBundleDirectoryKey, assetBundleDirectory); EditorPrefs.SetInt(compressionModeKey, (int)compressionMode); EditorPrefs.SetBool(_64BitsModeKey, _64BitsMode); } } [RequireComponent(typeof(Terrain))] public class TerrainChecker : MonoBehaviour { [HideInInspector] public Terrain terrain; private void OnDrawGizmosSelected() { terrain = ((Component)this).GetComponent<Terrain>(); } private void Awake() { Object.Destroy((Object)(object)this); } } } namespace LethalSDK.Component { [AddComponentMenu("LethalSDK/DamagePlayer")] public class SI_DamagePlayer : MonoBehaviour { public bool kill = false; public bool dontSpawnBody = false; public SI_CauseOfDeath causeOfDeath = SI_CauseOfDeath.Gravity; public int damages = 25; public int numberIterations = 1; public int iterationCooldown = 1000; public int warmupCooldown = 0; public UnityEvent postEvent = new UnityEvent(); public void Trigger(object player) { if (kill) { ((MonoBehaviour)this).StartCoroutine(Kill(player)); } else { ((MonoBehaviour)this).StartCoroutine(Damage(player)); } } public IEnumerator Kill(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).KillPlayer(Vector3.zero, !dontSpawnBody, (CauseOfDeath)causeOfDeath, 0); postEvent.Invoke(); } public IEnumerator Damage(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); int iteration = 0; while (iteration < numberIterations || numberIterations == -1) { ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).DamagePlayer(damages, true, true, (CauseOfDeath)causeOfDeath, 0, false, Vector3.zero); postEvent.Invoke(); iteration++; yield return (object)new WaitForSeconds((float)iterationCooldown / 1000f); } } public void StopCounter(object player) { ((MonoBehaviour)this).StopAllCoroutines(); } } [AddComponentMenu("LethalSDK/SoundYDistance")] public class SI_SoundYDistance : MonoBehaviour { public AudioSource audioSource; public int maxDistance = 50; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } } public void Update() { //IL_0032: 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) if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null) { audioSource.volume = 1f - Mathf.Abs(((Component)this).transform.position.y - ((Component)RoundManager.Instance.playersManager.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[((NetworkBehaviour)StartOfRound.Instance).NetworkManager.LocalClientId]].gameplayCamera).transform.position.y) / (float)maxDistance; } } } [AddComponentMenu("LethalSDK/AudioOutputInterface")] public class SI_AudioOutputInterface : MonoBehaviour { public AudioSource audioSource; public string mixerName = "Diagetic"; public string mixerGroupName = "Master"; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } if (mixerName != null && mixerName.Length > 0 && mixerGroupName != null && mixerGroupName.Length > 0) { audioSource.outputAudioMixerGroup = AssetGatherDialog.audioMixers[mixerName].Item2.First((AudioMixerGroup g) => ((Object)g).name == mixerGroupName); } Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/NetworkPrefabInstancier")] public class SI_NetworkPrefabInstancier : MonoBehaviour { public GameObject prefab; [HideInInspector] public GameObject instance; public void Awake() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null) { SI_NetworkDataInterfacing component2 = ((Component)this).GetComponent<SI_NetworkDataInterfacing>(); SI_NetworkData sI_NetworkData = null; if ((Object)(object)component2 != (Object)null) { sI_NetworkData = prefab.GetComponent<SI_NetworkData>(); if ((Object)(object)sI_NetworkData == (Object)null) { prefab.AddComponent<SI_NetworkData>(); } } if (component.NetworkManager.IsHost) { instance = Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent); SI_NetworkData component3 = instance.GetComponent<SI_NetworkData>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null) { component3.setData(component2.getData()); } instance.GetComponent<NetworkObject>().Spawn(false); } } } ((Component)this).gameObject.SetActive(false); } public void OnDestroy() { if ((Object)(object)instance != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null && component.NetworkManager.IsHost) { instance.GetComponent<NetworkObject>().Despawn(true); Object.Destroy((Object)(object)instance); } } } } [AddComponentMenu("LethalSDK/NetworkDataInterfacing")] public class SI_NetworkDataInterfacing : MonoBehaviour { public StringStringPair[] data = new StringStringPair[0]; [HideInInspector] public string serializedData = string.Empty; private void OnValidate() { serializedData = string.Join(";", data.Select((StringStringPair p) => p._string1.RemoveNonAlphanumeric(1) + "," + p._string2.RemoveNonAlphanumeric(1))); } public virtual StringStringPair[] getData() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new StringStringPair(split[0], split[1])).ToArray(); } } public class ScriptImporter : MonoBehaviour { public virtual void Awake() { Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/MatchLocalPlayerPosition")] public class SI_MatchLocalPlayerPosition : ScriptImporter { public override void Awake() { ((Component)this).gameObject.AddComponent<MatchLocalPlayerPosition>(); base.Awake(); } } [AddComponentMenu("LethalSDK/AnimatedSun")] public class SI_AnimatedSun : ScriptImporter { public Light indirectLight; public Light directLight; public override void Awake() { animatedSun val = ((Component)this).gameObject.AddComponent<animatedSun>(); val.indirectLight = indirectLight; val.directLight = directLight; base.Awake(); } } [AddComponentMenu("LethalSDK/ScanNode")] public class SI_ScanNode : ScriptImporter { public int MaxRange; public int MinRange; public bool RequiresLineOfSight; public string HeaderText; public string SubText; public int ScrapValue; public int CreatureScanID; public NodeType NodeType; public override void Awake() { ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>(); val.minRange = MinRange; val.maxRange = MaxRange; val.requiresLineOfSight = RequiresLineOfSight; val.headerText = HeaderText; val.subText = SubText; val.scrapValue = ScrapValue; val.creatureScanID = CreatureScanID; val.nodeType = (int)NodeType; base.Awake(); } } public enum NodeType { Information = 0, Danger = 0, Ressource = 0 } [AddComponentMenu("LethalSDK/AudioReverbPresets")] public class SI_AudioReverbPresets : ScriptImporter { public GameObject[] presets; public override void Awake() { } public void Update() { int num = 0; GameObject[] array = presets; foreach (GameObject val in array) { if ((Object)(object)val.GetComponent<SI_AudioReverbTrigger>() != (Object)null) { num++; } } if (num != 0) { return; } List<AudioReverbTrigger> list = new List<AudioReverbTrigger>(); GameObject[] array2 = presets; foreach (GameObject val2 in array2) { if ((Object)(object)val2.GetComponent<AudioReverbTrigger>() != (Object)null) { list.Add(val2.GetComponent<AudioReverbTrigger>()); } } AudioReverbPresets val3 = ((Component)this).gameObject.AddComponent<AudioReverbPresets>(); val3.audioPresets = list.ToArray(); Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/AudioReverbTrigger")] public class SI_AudioReverbTrigger : ScriptImporter { [Header("Reverb Preset")] public bool ChangeDryLevel = false; [Range(-10000f, 0f)] public float DryLevel = 0f; public bool ChangeHighFreq = false; [Range(-10000f, 0f)] public float HighFreq = -270f; public bool ChangeLowFreq = false; [Range(-10000f, 0f)] public float LowFreq = -244f; public bool ChangeDecayTime = false; [Range(0f, 35f)] public float DecayTime = 1.4f; public bool ChangeRoom = false; [Range(-10000f, 0f)] public float Room = -600f; [Header("MISC")] public bool ElevatorTriggerForProps = false; public bool SetInElevatorTrigger = false; public bool IsShipRoom = false; public bool ToggleLocalFog = false; public float FogEnabledAmount = 10f; [Header("Weather and effects")] public bool SetInsideAtmosphere = false; public bool InsideLighting = false; public int WeatherEffect = -1; public bool EffectEnabled = true; public bool DisableAllWeather = false; public bool EnableCurrentLevelWeather = true; public override void Awake() { AudioReverbTrigger val = ((Component)this).gameObject.AddComponent<AudioReverbTrigger>(); ReverbPreset val2 = ScriptableObject.CreateInstance<ReverbPreset>(); val2.changeDryLevel = ChangeDryLevel; val2.dryLevel = DryLevel; val2.changeHighFreq = ChangeHighFreq; val2.highFreq = HighFreq; val2.changeLowFreq = ChangeLowFreq; val2.lowFreq = LowFreq; val2.changeDecayTime = ChangeDecayTime; val2.decayTime = DecayTime; val2.changeRoom = ChangeRoom; val2.room = Room; val.reverbPreset = val2; val.usePreset = -1; val.audioChanges = (switchToAudio[])(object)new switchToAudio[0]; val.elevatorTriggerForProps = ElevatorTriggerForProps; val.setInElevatorTrigger = SetInElevatorTrigger; val.isShipRoom = IsShipRoom; val.toggleLocalFog = ToggleLocalFog; val.fogEnabledAmount = FogEnabledAmount; val.setInsideAtmosphere = SetInsideAtmosphere; val.insideLighting = InsideLighting; val.weatherEffect = WeatherEffect; val.effectEnabled = EffectEnabled; val.disableAllWeather = DisableAllWeather; val.enableCurrentLevelWeather = EnableCurrentLevelWeather; base.Awake(); } } [AddComponentMenu("LethalSDK/DungeonGenerator")] public class SI_DungeonGenerator : ScriptImporter { public GameObject DungeonRoot; public override void Awake() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0113: 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) //IL_009b: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).tag != "DungeonGenerator") { ((Component)this).tag = "DungeonGenerator"; } RuntimeDungeon val = ((Component)this).gameObject.AddComponent<RuntimeDungeon>(); val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; val.Generator.LengthMultiplier = 0.8f; val.Generator.PauseBetweenRooms = 0.2f; val.GenerateOnStart = false; if ((Object)(object)DungeonRoot != (Object)null) { _ = DungeonRoot.scene; if (false) { DungeonRoot = new GameObject(); ((Object)DungeonRoot).name = "DungeonRoot"; DungeonRoot.transform.position = new Vector3(0f, -200f, 0f); } } val.Root = DungeonRoot; val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter val2 = ((Component)this).gameObject.AddComponent<UnityNavMeshAdapter>(); val2.BakeMode = (RuntimeNavMeshBakeMode)3; val2.LayerMask = LayerMask.op_Implicit(35072); base.Awake(); } } [AddComponentMenu("LethalSDK/EntranceTeleport")] public class SI_EntranceTeleport : ScriptImporter { public int EntranceID = 0; public Transform EntrancePoint; public int AudioReverbPreset = 2; public AudioClip[] DoorAudios = (AudioClip[])(object)new AudioClip[0]; public override void Awake() { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got
plugins/LethalThings/LethalThings.dll
Decompiled 9 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.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 System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLib.Extras; using LethalLib.Modules; using LethalThings.Extensions; using LethalThings.MonoBehaviours; using LethalThings.NetcodePatcher; using LethalThings.Patches; using Microsoft.CodeAnalysis; using On; using On.GameNetcodeStuff; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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: AssemblyCompany("LethalThings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dffd1fa1a88c1099e7d37ac2a79e708256ab06a6")] [assembly: AssemblyProduct("LethalThings")] [assembly: AssemblyTitle("LethalThings")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Vector3>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Vector3>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<HackingTool.HackState>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<HackingTool.HackState>(); } } 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 LethalLib.Modules { public class SaveData { [CompilerGenerated] private static class <>O { public static hook_ResetSavedGameValues <0>__GameNetworkManager_ResetSavedGameValues; public static hook_SaveItemsInShip <1>__GameNetworkManager_SaveItemsInShip; public static hook_LoadShipGrabbableItems <2>__StartOfRound_LoadShipGrabbableItems; } public static List<string> saveKeys = new List<string>(); public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: 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: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_ResetSavedGameValues; if (obj == null) { hook_ResetSavedGameValues val = GameNetworkManager_ResetSavedGameValues; <>O.<0>__GameNetworkManager_ResetSavedGameValues = val; obj = (object)val; } GameNetworkManager.ResetSavedGameValues += (hook_ResetSavedGameValues)obj; object obj2 = <>O.<1>__GameNetworkManager_SaveItemsInShip; if (obj2 == null) { hook_SaveItemsInShip val2 = GameNetworkManager_SaveItemsInShip; <>O.<1>__GameNetworkManager_SaveItemsInShip = val2; obj2 = (object)val2; } GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj2; object obj3 = <>O.<2>__StartOfRound_LoadShipGrabbableItems; if (obj3 == null) { hook_LoadShipGrabbableItems val3 = StartOfRound_LoadShipGrabbableItems; <>O.<2>__StartOfRound_LoadShipGrabbableItems = val3; obj3 = (object)val3; } StartOfRound.LoadShipGrabbableItems += (hook_LoadShipGrabbableItems)obj3; } private static void StartOfRound_LoadShipGrabbableItems(orig_LoadShipGrabbableItems orig, StartOfRound self) { orig.Invoke(self); SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>(); SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>(); SaveableObject[] array3 = array; foreach (SaveableObject saveableObject in array3) { saveableObject.LoadObjectData(); } SaveableNetworkBehaviour[] array4 = array2; foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4) { saveableNetworkBehaviour.LoadObjectData(); } if (ES3.KeyExists("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName)) { saveKeys = ES3.Load<List<string>>("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName); } } private static void GameNetworkManager_SaveItemsInShip(orig_SaveItemsInShip orig, GameNetworkManager self) { orig.Invoke(self); SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>(); SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>(); SaveableObject[] array3 = array; foreach (SaveableObject saveableObject in array3) { saveableObject.SaveObjectData(); } SaveableNetworkBehaviour[] array4 = array2; foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4) { saveableNetworkBehaviour.SaveObjectData(); } ES3.Save<List<string>>("LethalLibItemSaveKeys", saveKeys, GameNetworkManager.Instance.currentSaveFileName); } private static void GameNetworkManager_ResetSavedGameValues(orig_ResetSavedGameValues orig, GameNetworkManager self) { orig.Invoke(self); foreach (string saveKey in saveKeys) { ES3.DeleteKey(saveKey, GameNetworkManager.Instance.currentSaveFileName); } saveKeys.Clear(); } public static void SaveObjectData<T>(string key, T data, int objectId) { List<T> list = new List<T>(); if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName); } List<int> list2 = new List<int>(); if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName); } list.Add(data); list2.Add(objectId); if (!saveKeys.Contains("LethalThingsSave_" + key)) { saveKeys.Add("LethalThingsSave_" + key); } if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key)) { saveKeys.Add("LethalThingsSave_objectIds_" + key); } ES3.Save<List<T>>("LethalThingsSave_" + key, list, GameNetworkManager.Instance.currentSaveFileName); ES3.Save<List<int>>("LethalThingsSave_objectIds_" + key, list2, GameNetworkManager.Instance.currentSaveFileName); } public static T LoadObjectData<T>(string key, int objectId) { List<T> list = new List<T>(); if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName); } List<int> list2 = new List<int>(); if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName); } if (!saveKeys.Contains("LethalThingsSave_" + key)) { saveKeys.Add("LethalThingsSave_" + key); } if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key)) { saveKeys.Add("LethalThingsSave_objectIds_" + key); } if (list2.Contains(objectId)) { int index = list2.IndexOf(objectId); return list[index]; } return default(T); } } } namespace LethalThings { public class Content { public static AssetBundle MainAssets; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static ContentLoader ContentLoader; public static GameObject devMenuPrefab; public static GameObject configManagerPrefab; public static void Init() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalthings")); configManagerPrefab = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/LTNetworkConfig.prefab"); NetworkPrefabs.RegisterNetworkPrefab(configManagerPrefab); ContentLoader = new ContentLoader(Plugin.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab) { Prefabs.Add(content.ID, prefab); }); CustomContent[] array = (CustomContent[])(object)new CustomContent[26] { (CustomContent)new ScrapItem("Arson", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlush.asset", NetworkConfig.arsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Cookie", "Assets/Custom/LethalThings/Scrap/Cookie/CookieFumo.asset", NetworkConfig.cookieSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Bilka", "Assets/Custom/LethalThings/Scrap/Toimari/ToimariPlush.asset", NetworkConfig.toimariSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Hamis", "Assets/Custom/LethalThings/Scrap/Hamis/HamisPlush.asset", NetworkConfig.hamisSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("ArsonDirty", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlushDirty.asset", NetworkConfig.dirtyArsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Maxwell", "Assets/Custom/LethalThings/Scrap/Maxwell/Dingus.asset", NetworkConfig.maxwellSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Glizzy", "Assets/Custom/LethalThings/Scrap/glizzy/glizzy.asset", NetworkConfig.glizzySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Revolver", "Assets/Custom/LethalThings/Scrap/Flaggun/Toygun.asset", NetworkConfig.revolverSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("GremlinEnergy", "Assets/Custom/LethalThings/Scrap/GremlinEnergy/GremlinEnergy.asset", NetworkConfig.gremlinSodaSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("ToyHammerScrap", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerScrapSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Gnarpy", "Assets/Custom/LethalThings/Scrap/Gnarpy/GnarpyPlush.asset", NetworkConfig.gnarpySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ShopItem("RocketLauncher", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncher.asset", NetworkConfig.rocketLauncherPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncherInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().missilePrefab); }), (CustomContent)new ShopItem("Flaregun", "Assets/Custom/LethalThings/Items/Flaregun/Flaregun.asset", NetworkConfig.flareGunPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<ProjectileWeapon>().projectilePrefab); }), (CustomContent)new ShopItem("FlaregunAmmo", "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmo.asset", NetworkConfig.flareGunAmmoPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmoInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("ToyHammerShop", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammerInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("RemoteRadar", "Assets/Custom/LethalThings/Items/Radar/HandheldRadar.asset", NetworkConfig.remoteRadarPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Radar/HandheldRadarInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("PouchyBelt", "Assets/Custom/LethalThings/Items/Pouch/Pouch.asset", NetworkConfig.pouchyBeltPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Pouch/PouchInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("HackingTool", "Assets/Custom/LethalThings/Items/HackingTool/HackingTool.asset", NetworkConfig.hackingToolPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/HackingTool/HackingToolInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("Pinger", "Assets/Custom/LethalThings/Items/PingingTool/PingTool.asset", NetworkConfig.pingerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/PingingTool/PingToolInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<Pinger>().pingMarkerPrefab); }), (CustomContent)new CustomItem("Dart", "Assets/Custom/LethalThings/Unlockables/dartboard/Dart.asset", (Action<Item>)null), (CustomContent)new Unlockable("SmallRug", "Assets/Custom/LethalThings/Unlockables/Rug/SmallRug.asset", NetworkConfig.smallRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("LargeRug", "Assets/Custom/LethalThings/Unlockables/Rug/LargeRug.asset", NetworkConfig.largeRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("FatalitiesSign", "Assets/Custom/LethalThings/Unlockables/Sign/Sign.asset", NetworkConfig.fatalitiesSignPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Sign/SignInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("Dartboard", "Assets/Custom/LethalThings/Unlockables/dartboard/Dartboard.asset", NetworkConfig.dartBoardPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/dartboard/DartboardInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new CustomEnemy("Boomba", "Assets/Custom/LethalThings/Enemies/Roomba/Boomba.asset", NetworkConfig.boombaSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/Roomba/BoombaFile.asset", (string)null, (Action<EnemyType>)null), (CustomContent)new MapHazard("TeleporterTrap", "Assets/Custom/LethalThings/hazards/TeleporterTrap/TeleporterTrap.asset", (LevelTypes)(-1), (string[])null, (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f), new Keyframe(1f, 4f) })), (Action<SpawnableMapObjectDef>)null) }; ContentLoader.RegisterAll(array); foreach (KeyValuePair<string, GameObject> prefab in Prefabs) { GameObject value = prefab.Value; string key = prefab.Key; AudioSource[] componentsInChildren = value.GetComponentsInChildren<AudioSource>(); if (componentsInChildren.Length != 0) { ConfigEntry<float> val = NetworkConfig.VolumeConfig.Bind<float>("Volume", key ?? "", 100f, "Audio volume for " + key + " (0 - 100)"); AudioSource[] array2 = componentsInChildren; foreach (AudioSource val2 in array2) { val2.volume *= val.Value / 100f; } } } GameObject val3 = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/DevMenu.prefab"); NetworkPrefabs.RegisterNetworkPrefab(val3); devMenuPrefab = val3; try { IEnumerable<Type> loadableTypes = Assembly.GetExecutingAssembly().GetLoadableTypes(); foreach (Type item in loadableTypes) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array3 = methods; foreach (MethodInfo methodInfo in array3) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception) { } } } public static class InputCompat { public static InputActionAsset Asset; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils"); public static InputAction LTUtilityBeltQuick1 => Keybinds.Instance.LTUtilityBeltQuick1; public static InputAction LTUtilityBeltQuick2 => Keybinds.Instance.LTUtilityBeltQuick2; public static InputAction LTUtilityBeltQuick3 => Keybinds.Instance.LTUtilityBeltQuick3; public static InputAction LTUtilityBeltQuick4 => Keybinds.Instance.LTUtilityBeltQuick4; public static void Init() { Keybinds.Instance = new Keybinds(); Asset = Keybinds.Instance.GetAsset(); } } public class Keybinds : LcInputActions { public static Keybinds Instance; [InputAction("", Name = "[LT] Utility Belt Quick 1")] public InputAction LTUtilityBeltQuick1 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 2")] public InputAction LTUtilityBeltQuick2 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 3")] public InputAction LTUtilityBeltQuick3 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 4")] public InputAction LTUtilityBeltQuick4 { get; set; } public InputActionAsset GetAsset() { return ((LcInputActions)this).Asset; } } public class Dingus : SaveableObject { public AudioSource noiseAudio; public AudioSource noiseAudioFar; public AudioSource musicAudio; public AudioSource musicAudioFar; [Space(3f)] public AudioClip[] noiseSFX; public AudioClip[] noiseSFXFar; public AudioClip evilNoise; [Space(3f)] public float noiseRange; public float maxLoudness; public float minLoudness; public float minPitch; public float maxPitch; private Random noisemakerRandom; public Animator triggerAnimator; private int timesPlayedWithoutTurningOff = 0; private RoundManager roundManager; private float noiseInterval = 1f; public Animator danceAnimator; public bool wasLoadedFromSave = false; public bool exploding = false; private NetworkVariable<bool> isEvil = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public GameObject evilObject; public NetworkVariable<bool> isPlayingMusic = new NetworkVariable<bool>(NetworkConfig.maxwellPlayMusicDefault.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<bool> isPipebomb = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public override void SaveObjectData() { SaveData.SaveObjectData("dingusBeEvil", isEvil.Value, uniqueId); } public override void LoadObjectData() { if (((NetworkBehaviour)this).IsHost) { bool flag = SaveData.LoadObjectData<bool>("dingusBeEvil", uniqueId); Plugin.logger.LogInfo((object)$"Loading object[{uniqueId}] save data, evil? {flag}"); if (flag) { isEvil.Value = flag; } } } public override void Start() { ((GrabbableObject)this).Start(); roundManager = Object.FindObjectOfType<RoundManager>(); noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); Debug.Log((object)"Making the dingus dance"); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = NetworkConfig.Instance.maxwellPlayMusicDefaultNetVar.Value; } if (((NetworkBehaviour)this).IsHost) { isEvil.Value = Random.Range(0f, 100f) <= NetworkConfig.evilMaxwellChance.Value; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { int num = noisemakerRandom.Next(0, noiseSFX.Length); float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f; float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f; noiseAudio.pitch = pitch; noiseAudio.PlayOneShot(noiseSFX[num], num2); if ((Object)(object)noiseAudioFar != (Object)null) { noiseAudioFar.pitch = pitch; noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2); } if ((Object)(object)triggerAnimator != (Object)null) { triggerAnimator.SetTrigger("playAnim"); } WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } public override void DiscardItem() { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; danceAnimator.Play("dingusIdle"); Debug.Log((object)"Making the dingus idle"); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && ((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = !isPlayingMusic.Value; } } public override void InteractItem() { ((GrabbableObject)this).InteractItem(); if (isEvil.Value && !exploding && !isPipebomb.Value) { EvilMaxwellServerRpc(); } } public void EvilMaxwellTruly() { danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } ((MonoBehaviour)this).StartCoroutine(evilMaxwellMoment()); } [ServerRpc(RequireOwnership = false)] public void EvilMaxwellServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(88404199u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 88404199u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { isPipebomb.Value = true; EvilMaxwellClientRpc(); } } } [ClientRpc] public void EvilMaxwellClientRpc() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1120322383u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1120322383u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EvilMaxwellTruly(); exploding = true; if (((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = false; } timesPlayedWithoutTurningOff = 0; danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } Plugin.logger.LogInfo((object)"Evil maxwell moment"); } } public IEnumerator evilMaxwellMoment() { yield return (object)new WaitForSeconds(1f); noiseAudio.PlayOneShot(evilNoise, 1f); evilObject.SetActive(true); ((Renderer)((GrabbableObject)this).mainObjectRenderer).enabled = false; if ((Object)(object)noiseAudioFar != (Object)null) { noiseAudioFar.PlayOneShot(evilNoise, 1f); } if ((Object)(object)triggerAnimator != (Object)null) { triggerAnimator.SetTrigger("playAnim"); } WalkieTalkie.TransmitOneShotAudio(noiseAudio, evilNoise, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); yield return (object)new WaitForSeconds(1.5f); Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3); Rigidbody[] componentsInChildren = evilObject.GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody rb in componentsInChildren) { rb.isKinematic = false; rb.AddExplosionForce(1000f, evilObject.transform.position, 100f); } yield return (object)new WaitForSeconds(2f); if (((NetworkBehaviour)this).IsServer) { ((Component)this).GetComponent<NetworkObject>().Despawn(true); } } public override void Update() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (isEvil.Value) { ((GrabbableObject)this).grabbable = false; ((GrabbableObject)this).grabbableToEnemies = false; } if (isPlayingMusic.Value && !exploding) { if (!musicAudio.isPlaying) { musicAudio.Play(); musicAudioFar.Play(); } if (!((GrabbableObject)this).isHeld) { danceAnimator.Play("dingusDance"); } else { danceAnimator.Play("dingusIdle"); } if (noiseInterval <= 0f) { noiseInterval = 1f; timesPlayedWithoutTurningOff++; roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5); } else { noiseInterval -= Time.deltaTime; } } else { timesPlayedWithoutTurningOff = 0; danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } } } protected override void __initializeVariables() { if (isEvil == null) { throw new Exception("Dingus.isEvil cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isEvil).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isEvil, "isEvil"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isEvil); if (isPlayingMusic == null) { throw new Exception("Dingus.isPlayingMusic cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isPlayingMusic).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPlayingMusic, "isPlayingMusic"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPlayingMusic); if (isPipebomb == null) { throw new Exception("Dingus.isPipebomb cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isPipebomb).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPipebomb, "isPipebomb"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPipebomb); base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Dingus() { //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 NetworkManager.__rpc_func_table.Add(88404199u, new RpcReceiveHandler(__rpc_handler_88404199)); NetworkManager.__rpc_func_table.Add(1120322383u, new RpcReceiveHandler(__rpc_handler_1120322383)); } private static void __rpc_handler_88404199(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; ((Dingus)(object)target).EvilMaxwellServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1120322383(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; ((Dingus)(object)target).EvilMaxwellClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Dingus"; } } public class Missile : NetworkBehaviour { public int damage = 50; public float maxDistance = 10f; public float minDistance = 0f; public float gravity = 2.4f; public float flightDelay = 0.5f; public float flightForce = 150f; public float flightTime = 2f; public float autoDestroyTime = 3f; private float timeAlive = 0f; public float LobForce = 100f; public ParticleSystem particleSystem; private void OnCollisionEnter(Collision collision) { if (((NetworkBehaviour)this).IsHost) { Boom(); BoomClientRpc(); } else { BoomServerRpc(); } } private void Start() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((Component)this).GetComponent<Rigidbody>().useGravity = false; if (((NetworkBehaviour)this).IsHost) { ((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * LobForce, (ForceMode)1); } } [ClientRpc] public void BoomClientRpc() { //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(3331368301u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3331368301u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Boom(); } } } [ServerRpc] public void BoomServerRpc() { //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(452316787u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 452316787u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Boom(); BoomClientRpc(); } } public void CreateExplosion() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId)); Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, minDistance, maxDistance, 10, (CauseOfDeath)3, attacker); } public void Boom() { //IL_006c: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)particleSystem == (Object)null) { Debug.LogError((object)"No particle system set on missile, destruction time!!"); CreateExplosion(); if (((NetworkBehaviour)this).IsHost) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } particleSystem.Stop(true, (ParticleSystemStopBehavior)1); ((Component)particleSystem).transform.SetParent((Transform)null); ((Component)particleSystem).transform.localScale = Vector3.one; GameObject gameObject = ((Component)particleSystem).gameObject; MainModule main = particleSystem.main; float duration = ((MainModule)(ref main)).duration; main = particleSystem.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constant); CreateExplosion(); if (((NetworkBehaviour)this).IsHost) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void FixedUpdate() { //IL_0022: 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_006b: 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) if (!((NetworkBehaviour)this).IsHost) { return; } ((Component)this).GetComponent<Rigidbody>().useGravity = false; ((Component)this).GetComponent<Rigidbody>().AddForce(Vector3.down * gravity); if (timeAlive <= flightTime && timeAlive >= flightDelay) { ((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * flightForce); } timeAlive += Time.fixedDeltaTime; if (timeAlive > autoDestroyTime) { if (((NetworkBehaviour)this).IsHost) { Boom(); BoomClientRpc(); } else { BoomServerRpc(); } } else { Debug.Log((object)("Time alive: " + timeAlive + " / " + autoDestroyTime)); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Missile() { //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 NetworkManager.__rpc_func_table.Add(3331368301u, new RpcReceiveHandler(__rpc_handler_3331368301)); NetworkManager.__rpc_func_table.Add(452316787u, new RpcReceiveHandler(__rpc_handler_452316787)); } private static void __rpc_handler_3331368301(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; ((Missile)(object)target).BoomClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_452316787(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; ((Missile)(object)target).BoomServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Missile"; } } public class PouchyBelt : GrabbableObject { [CompilerGenerated] private static class <>O { public static hook_SetHoverTipAndCurrentInteractTrigger <0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; public static hook_BeginGrabObject <1>__PlayerControllerB_BeginGrabObject; } public Transform beltCosmetic; public Vector3 beltCosmeticPositionOffset = new Vector3(0f, 0f, 0f); public Vector3 beltCosmeticRotationOffset = new Vector3(0f, 0f, 0f); public int beltCapacity = 3; private PlayerControllerB previousPlayerHeldBy; public List<int> slotIndexes = new List<int>(); public static void Initialize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; if (obj == null) { hook_SetHoverTipAndCurrentInteractTrigger val = PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger = val; obj = (object)val; } PlayerControllerB.SetHoverTipAndCurrentInteractTrigger += (hook_SetHoverTipAndCurrentInteractTrigger)obj; object obj2 = <>O.<1>__PlayerControllerB_BeginGrabObject; if (obj2 == null) { hook_BeginGrabObject val2 = PlayerControllerB_BeginGrabObject; <>O.<1>__PlayerControllerB_BeginGrabObject = val2; obj2 = (object)val2; } PlayerControllerB.BeginGrabObject += (hook_BeginGrabObject)obj2; } public void Awake() { if (InputCompat.Enabled) { InputCompat.LTUtilityBeltQuick1.started += InputReceived; InputCompat.LTUtilityBeltQuick2.started += InputReceived; InputCompat.LTUtilityBeltQuick3.started += InputReceived; InputCompat.LTUtilityBeltQuick4.started += InputReceived; } } private static void PlayerControllerB_BeginGrabObject(orig_BeginGrabObject orig, PlayerControllerB self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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_0027: 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) self.interactRay = new Ray(((Component)self.gameplayCamera).transform.position, ((Component)self.gameplayCamera).transform.forward); if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref self.hit)).collider).tag == "PhysicsProp") || self.twoHanded || self.sinkingValue > 0.73f) { return; } self.currentlyGrabbingObject = ((Component)((Component)((RaycastHit)(ref self.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>(); if ((!GameNetworkManager.Instance.gameHasStarted && !self.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && ((Object)(object)StartOfRound.Instance.testRoom == (Object)null || !StartOfRound.Instance.testRoom.activeSelf)) || (Object)(object)self.currentlyGrabbingObject == (Object)null || self.inSpecialInteractAnimation || self.currentlyGrabbingObject.isHeld || self.currentlyGrabbingObject.isPocketed) { return; } NetworkObject networkObject = ((NetworkBehaviour)self.currentlyGrabbingObject).NetworkObject; if (!((Object)(object)networkObject == (Object)null) && networkObject.IsSpawned) { if (self.currentlyGrabbingObject is PouchyBelt && self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt)) { self.currentlyGrabbingObject.grabbable = false; } orig.Invoke(self); if (self.currentlyGrabbingObject is PouchyBelt) { self.currentlyGrabbingObject.grabbable = true; } } } private static void PlayerControllerB_SetHoverTipAndCurrentInteractTrigger(orig_SetHoverTipAndCurrentInteractTrigger orig, PlayerControllerB self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8) { return; } string tag = ((Component)((RaycastHit)(ref self.hit)).collider).tag; if (!(tag == "PhysicsProp")) { return; } if (self.FirstEmptyItemSlot() == -1) { ((TMP_Text)self.cursorTip).text = "Inventory full!"; return; } GrabbableObject component = ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.GetComponent<GrabbableObject>(); if (component is PouchyBelt) { if (self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt)) { ((TMP_Text)self.cursorTip).text = "(Cannot hold more than 1 belt)"; } else { ((TMP_Text)self.cursorTip).text = "Pick up belt"; } } } public void InputReceived(CallbackContext context) { if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null && ((CallbackContext)(ref context)).started) { int num = -1; if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick1) { num = 0; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick2) { num = 1; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick3) { num = 2; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick4) { num = 3; } if (num != -1 && num < slotIndexes.Count) { base.playerHeldBy.SwitchItemSlots(slotIndexes[num]); } } } public override void LateUpdate() { //IL_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) //IL_00a9: 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_00b8: 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) ((GrabbableObject)this).LateUpdate(); if ((Object)(object)previousPlayerHeldBy != (Object)null) { ((Component)beltCosmetic).gameObject.SetActive(true); beltCosmetic.SetParent((Transform)null); ((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = true; if (((NetworkBehaviour)this).IsOwner) { ((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = false; } Transform parent = previousPlayerHeldBy.lowerSpine.parent; beltCosmetic.position = parent.position + beltCosmeticPositionOffset; Quaternion rotation = parent.rotation; Quaternion rotation2 = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + beltCosmeticRotationOffset); beltCosmetic.rotation = rotation2; ((Renderer)base.mainObjectRenderer).enabled = false; ((Component)this).gameObject.SetActive(true); } else { ((Component)beltCosmetic).gameObject.SetActive(false); ((Renderer)base.mainObjectRenderer).enabled = true; beltCosmetic.SetParent(((Component)this).transform); } } public void UpdateHUD(bool add) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) slotIndexes.Clear(); HUDManager instance = HUDManager.Instance; if (add) { int num = 0; GrabbableObject[] itemSlots = GameNetworkManager.Instance.localPlayerController.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (val is PouchyBelt) { num++; } } Image val2 = instance.itemSlotIconFrames[0]; Image val3 = instance.itemSlotIcons[0]; int num2 = instance.itemSlotIconFrames.Length; CanvasScaler componentInParent = ((Component)val2).GetComponentInParent<CanvasScaler>(); AspectRatioFitter componentInParent2 = ((Component)val2).GetComponentInParent<AspectRatioFitter>(); float x = ((Graphic)val2).rectTransform.sizeDelta.x; float y = ((Graphic)val2).rectTransform.sizeDelta.y; float num3 = ((Graphic)val2).rectTransform.anchoredPosition.y + 1.125f * y * (float)num; Vector3 localEulerAngles = ((Transform)((Graphic)val2).rectTransform).localEulerAngles; Vector3 localEulerAngles2 = ((Transform)((Graphic)val3).rectTransform).localEulerAngles; List<Image> list = instance.itemSlotIconFrames.ToList(); List<Image> list2 = instance.itemSlotIcons.ToList(); int count = list.Count; float num4 = (float)beltCapacity * x + (float)(beltCapacity - 1) * 15f; Debug.Log((object)$"Adding {beltCapacity} item slots! Surely this will go well.."); Debug.Log((object)$"Adding after index: {count}"); for (int j = 0; j < beltCapacity; j++) { float num5 = 0f - ((Component)((Transform)((Graphic)val2).rectTransform).parent).GetComponent<RectTransform>().sizeDelta.x / 2f - 3f; float num6 = num5 + (float)j * x + (float)j * 15f; Image val4 = list[0]; Image val5 = Object.Instantiate<Image>(val4, ((Component)val2).transform.parent); ((Object)val5).name = $"Slot{num2 + j}[LethalThingsBelt]"; ((Graphic)val5).rectTransform.anchoredPosition = new Vector2(num6, num3); ((Transform)((Graphic)val5).rectTransform).eulerAngles = localEulerAngles; Image component = ((Component)((Component)val5).transform.GetChild(0)).GetComponent<Image>(); ((Object)component).name = "icon"; ((Behaviour)component).enabled = false; ((Transform)((Graphic)component).rectTransform).eulerAngles = localEulerAngles2; ((Transform)((Graphic)component).rectTransform).Rotate(new Vector3(0f, 0f, -90f)); int num7 = count + j; list.Insert(num7, val5); list2.Insert(num7, component); slotIndexes.Add(num7); ((Component)val5).transform.SetSiblingIndex(num7); } instance.itemSlotIconFrames = list.ToArray(); instance.itemSlotIcons = list2.ToArray(); Debug.Log((object)$"Added {beltCapacity} item slots!"); return; } List<Image> list3 = instance.itemSlotIconFrames.ToList(); List<Image> list4 = instance.itemSlotIcons.ToList(); int count2 = list3.Count; int num8 = 0; for (int num9 = count2 - 1; num9 >= 0; num9--) { if (((Object)list3[num9]).name.Contains("[LethalThingsBelt]")) { num8++; Image val6 = list3[num9]; list3.RemoveAt(num9); list4.RemoveAt(num9); Object.Destroy((Object)(object)((Component)val6).gameObject); if (num8 >= beltCapacity) { break; } } } instance.itemSlotIconFrames = list3.ToArray(); instance.itemSlotIcons = list4.ToArray(); Debug.Log((object)$"Removed {beltCapacity} item slots!"); } public void AddItemSlots() { if ((Object)(object)base.playerHeldBy != (Object)null) { List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList(); base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count + beltCapacity]; for (int i = 0; i < list.Count; i++) { base.playerHeldBy.ItemSlots[i] = list[i]; } if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { UpdateHUD(add: true); } } } public void RemoveItemSlots() { if (!((Object)(object)base.playerHeldBy != (Object)null)) { return; } int num = base.playerHeldBy.ItemSlots.Length - beltCapacity; int currentItemSlot = base.playerHeldBy.currentItemSlot; for (int i = 0; i < beltCapacity; i++) { GrabbableObject val = base.playerHeldBy.ItemSlots[num + i]; if ((Object)(object)val != (Object)null) { base.playerHeldBy.DropItem(val, num + i); } } int currentItemSlot2 = base.playerHeldBy.currentItemSlot; currentItemSlot2 = ((currentItemSlot < base.playerHeldBy.ItemSlots.Length) ? currentItemSlot : 0); List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList(); base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count - beltCapacity]; for (int j = 0; j < base.playerHeldBy.ItemSlots.Length; j++) { base.playerHeldBy.ItemSlots[j] = list[j]; } if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { UpdateHUD(add: false); } base.playerHeldBy.SwitchItemSlots(currentItemSlot2); } public override void DiscardItem() { RemoveItemSlots(); previousPlayerHeldBy = null; ((GrabbableObject)this).DiscardItem(); } public override void OnNetworkDespawn() { RemoveItemSlots(); previousPlayerHeldBy = null; ((NetworkBehaviour)this).OnNetworkDespawn(); } public void GrabItemOnClient() { ((GrabbableObject)this).GrabItemOnClient(); } public override void OnDestroy() { if (InputCompat.Enabled) { InputCompat.LTUtilityBeltQuick1.started -= InputReceived; InputCompat.LTUtilityBeltQuick2.started -= InputReceived; InputCompat.LTUtilityBeltQuick3.started -= InputReceived; InputCompat.LTUtilityBeltQuick4.started -= InputReceived; } ((NetworkBehaviour)this).OnDestroy(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { if ((Object)(object)base.playerHeldBy != (Object)(object)previousPlayerHeldBy) { AddItemSlots(); } previousPlayerHeldBy = base.playerHeldBy; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PouchyBelt"; } } public class PowerOutletStun : NetworkBehaviour { private Coroutine electrocutionCoroutine; public AudioSource strikeAudio; public ParticleSystem strikeParticle; private NetworkVariable<int> damage = new NetworkVariable<int>(20, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public void Electrocute(ItemCharger socket) { Debug.Log((object)"Attempting electrocution"); if (electrocutionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(electrocutionCoroutine); } electrocutionCoroutine = ((MonoBehaviour)this).StartCoroutine(electrocutionDelayed(socket)); } public void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) StormyWeather val = Object.FindObjectOfType<StormyWeather>(true); GameObject gameObject = ((Component)val.targetedStrikeAudio).gameObject; strikeAudio = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform).GetComponent<AudioSource>(); ((Component)strikeAudio).transform.localPosition = Vector3.zero; ((Component)strikeAudio).gameObject.SetActive(true); strikeParticle = Object.Instantiate<GameObject>(((Component)val.explosionEffectParticle).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>(); ((Component)strikeParticle).transform.localPosition = Vector3.zero; ((Component)strikeParticle).gameObject.SetActive(true); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsHost) { damage.Value = NetworkConfig.itemChargerElectrocutionDamage.Value; } } private IEnumerator electrocutionDelayed(ItemCharger socket) { Debug.Log((object)"Electrocution started"); socket.zapAudio.Play(); yield return (object)new WaitForSeconds(0.75f); socket.chargeStationAnimator.SetTrigger("zap"); Debug.Log((object)"Electrocution finished"); if (((NetworkBehaviour)this).NetworkObject.IsOwner && !((NetworkBehaviour)this).NetworkObject.IsOwnedByServer) { Debug.Log((object)"Sending stun to server!!"); ElectrocutedServerRpc(((Component)this).transform.position); } else if (((NetworkBehaviour)this).NetworkObject.IsOwner && ((NetworkBehaviour)this).NetworkObject.IsOwnedByServer) { Debug.Log((object)"Sending stun to clients!!"); ElectrocutedClientRpc(((Component)this).transform.position); Electrocuted(((Component)this).transform.position); } } [ClientRpc] private void ElectrocutedClientRpc(Vector3 position) { //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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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(328188188u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 328188188u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"Stun received!!"); Electrocuted(position); } } } private void Electrocuted(Vector3 position) { //IL_0008: 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) StormyWeather val = Object.FindObjectOfType<StormyWeather>(true); Utilities.CreateExplosion(position, spawnExplosionEffect: false, damage.Value, 0f, 5f, 3, (CauseOfDeath)11); strikeParticle.Play(); val.PlayThunderEffects(position, strikeAudio); } [ServerRpc] private void ElectrocutedServerRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cf: 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(2844681185u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2844681185u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ElectrocutedClientRpc(position); } } protected override void __initializeVariables() { if (damage == null) { throw new Exception("PowerOutletStun.damage cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)damage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)damage, "damage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)damage); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PowerOutletStun() { //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 NetworkManager.__rpc_func_table.Add(328188188u, new RpcReceiveHandler(__rpc_handler_328188188)); NetworkManager.__rpc_func_table.Add(2844681185u, new RpcReceiveHandler(__rpc_handler_2844681185)); } private static void __rpc_handler_328188188(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((PowerOutletStun)(object)target).ElectrocutedClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2844681185(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_0083: 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_009d: 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 { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((PowerOutletStun)(object)target).ElectrocutedServerRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PowerOutletStun"; } } public class ProjectileWeapon : SaveableObject { public AudioSource mainAudio; public AudioClip[] activateClips; public AudioClip[] noAmmoSounds; public AudioClip[] reloadSounds; public Transform aimDirection; public int maxAmmo = 4; [HideInInspector] private NetworkVariable<int> currentAmmo = new NetworkVariable<int>(4, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public GameObject projectilePrefab; public float LobForce = 100f; private float timeSinceLastShot; private PlayerControllerB previousPlayerHeldBy; public Animator Animator; public ParticleSystem particleSystem; public Item ammoItem; public int ammoSlotToUse = -1; public override void SaveObjectData() { SaveData.SaveObjectData("projectileWeaponAmmoData", currentAmmo.Value, uniqueId); } public override void LoadObjectData() { if (((NetworkBehaviour)this).IsHost) { currentAmmo.Value = SaveData.LoadObjectData<int>("projectileWeaponAmmoData", uniqueId); } } public static void Init() { } private static bool GrabbableObject_UseItemBatteries(orig_UseItemBatteries orig, GrabbableObject self) { if (self is ProjectileWeapon) { return true; } return orig.Invoke(self); } public override void Start() { ((GrabbableObject)this).Start(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { currentAmmo.Value = maxAmmo; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_00c8: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (currentAmmo.Value > 0) { if (((NetworkBehaviour)this).IsHost) { NetworkVariable<int> obj = currentAmmo; int value = obj.Value; obj.Value = value - 1; } PlayRandomAudio(mainAudio, activateClips); Animator.Play("fire"); particleSystem.Play(); timeSinceLastShot = 0f; if (((NetworkBehaviour)this).IsOwner) { if (((NetworkBehaviour)this).IsHost) { ProjectileSpawner(aimDirection.position, aimDirection.rotation, aimDirection.forward); } else { SpawnProjectileServerRpc(aimDirection.position, aimDirection.rotation, aimDirection.forward); } } } else { PlayRandomAudio(mainAudio, noAmmoSounds); } } private bool ReloadedGun() { int num = FindAmmoInInventory(); if (num == -1) { return false; } ammoSlotToUse = num; return true; } private int FindAmmoInInventory() { for (int i = 0; i < ((GrabbableObject)this).playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[i] == (Object)null) && ((GrabbableObject)this).playerHeldBy.ItemSlots[i].itemProperties.itemId == ammoItem.itemId) { return i; } } return -1; } [ServerRpc] private void FixWeightServerRpc() { //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)((NetworkBehaviour)this).__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(43845628u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 43845628u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { FixWeightClientRpc(); } } [ClientRpc] private void FixWeightClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(948021082u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 948021082u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.carryWeight -= Mathf.Clamp(ammoItem.weight - 1f, 0f, 10f); } } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (right || !((NetworkBehaviour)this).IsOwner) { return; } if (ReloadedGun()) { if (currentAmmo.Value > 0) { HUDManager.Instance.DisplayTip("Item already loaded.", "You can reload once you use up all the ammo.", false, false, "LC_Tip1"); return; } ReloadAmmoServerRpc(); DestroyItemInSlotAndSync(ammoSlotToUse); ammoSlotToUse = -1; } else { HUDManager.Instance.DisplayTip("No ammo found.", "Buy " + ammoItem.itemName + " from the Terminal to reload.", false, false, "LC_Tip1"); } } [ServerRpc] private void ReloadAmmoServerRpc() { //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)((NetworkBehaviour)this).__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(1064596822u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1064596822u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { currentAmmo.Value = maxAmmo; ReloadAmmoSoundClientRpc(); } } [ClientRpc] private void ReloadAmmoSoundClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3520251861u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3520251861u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayRandomAudio(mainAudio, reloadSounds); Animator.Play("reload"); } } } [ServerRpc] private void SpawnProjectileServerRpc(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Invalid comparison between Unknown and I4 //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e9: 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)((NetworkBehaviour)this).__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(1043162412u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1043162412u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ProjectileSpawner(aimPosition, aimRotation, forward); } } private void ProjectileSpawner(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //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_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(projectilePrefab, aimPosition, aimRotation); val.GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false); ApplyProjectileForceClientRpc(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), aimPosition, aimRotation, forward); } [ClientRpc] public void ApplyProjectileForceClientRpc(NetworkObjectReference projectile, Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2170744407u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref projectile, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2170744407u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref projectile)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)val3).gameObject; gameObject.transform.position = aimPosition; gameObject.transform.rotation = aimRotation; gameObject.GetComponent<Rigidbody>().AddForce(forward * LobForce, (ForceMode)1); } } } private void PlayRandomAudio(AudioSource audioSource, AudioClip[] audioClips) { if (audioClips.Length != 0) { audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]); } } public override void Update() { ((GrabbableObject)this).Update(); timeSinceLastShot += Time.deltaTime; } private void OnEnable() { } private void OnDisable() { } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; } public void DestroyItemInSlotAndSync(int itemSlot) { if (((NetworkBehaviour)this).IsOwner) { if (itemSlot >= ((GrabbableObject)this).playerHeldBy.ItemSlots.Length || (Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] == (Object)null) { Debug.LogError((object)$"Destroy item in slot called for a slot (slot {itemSlot}) which is empty or incorrect"); } DestroyItemInSlotServerRpc(itemSlot); } } [ServerRpc] public void DestroyItemInSlotServerRpc(int itemSlot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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)((NetworkBehaviour)this).__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(3656085789u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemSlot); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3656085789u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { DestroyItemInSlotClientRpc(itemSlot); } } [ClientRpc] public void DestroyItemInSlotClientRpc(int itemSlot) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(314723133u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemSlot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 314723133u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { DestroyItemInSlot(itemSlot); } } } public void DestroyItemInSlot(int itemSlot) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.ShutdownInProgress) { return; } GrabbableObject val = ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot]; if ((Object)(object)val == (Object)null || (Object)(object)val.itemProperties == (Object)null) { Plugin.logger.LogError((object)"Item properties are null, cannot destroy item in slot"); return; } PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.carryWeight -= Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f); if (((GrabbableObject)this).playerHeldBy.currentItemSlot == itemSlot) { ((GrabbableObject)this).playerHeldBy.isHoldingObject = false; ((GrabbableObject)this).playerHeldBy.twoHanded = false; if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("cancelHolding", true); ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("Throw"); ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false; HUDManager.Instance.ClearControlTips(); ((GrabbableObject)this).playerHeldBy.activatingItem = false; } } if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false; } if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)(object)val) { if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { ((GrabbableObject)this).playerHeldBy.SetSpecialGrabAnimationBool(false, ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer); ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer.DiscardItemOnClient(); } ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer = null; } ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] = null; if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } } protected override void __initializeVariables() { if (currentAmmo == null) { throw new Exception("ProjectileWeapon.currentAmmo cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)currentAmmo).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentAmmo, "currentAmmo"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentAmmo); base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ProjectileWeapon() { //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 NetworkManager.__rpc_func_table.Add(43845628u, new RpcReceiveHandler(__rpc_handler_43845628)); NetworkManager.__rpc_func_table.Add(948021082u, new RpcReceiveHandler(__rpc_handler_948021082)); NetworkManager.__rpc_func_table.Add(1064596822u, new RpcReceiveHandler(__rpc_handler_1064596822)); NetworkManager.__rpc_func_table.Add(3520251861u, new RpcReceiv
plugins/LethalVocabulary.dll
Decompiled 9 months agousing System; using System.Collections.Generic; 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 System.Speech.Recognition; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalVocabulary.NetcodePatcher; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalVocabulary")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A mod for Lethal Company that makes your vocabulary a little more... lethal.")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: AssemblyInformationalVersion("0.1.2")] [assembly: AssemblyProduct("LethalVocabulary")] [assembly: AssemblyTitle("LethalVocabulary")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalVocabulary { public class Config { private static readonly string CustomWordTip = "Words must be separated by a comma (,). Capitalization does not matter. Words in ALL CAPS will not trigger a penalty unless EnableExtendedWords is enabled."; public static ConfigEntry<bool> EnableExtendedWords; public static ConfigEntry<int> CategoriesPerMoon; public static ConfigEntry<string> SnareFleaWords; public static ConfigEntry<string> BunkerSpiderWords; public static ConfigEntry<string> HoardingBugWords; public static ConfigEntry<string> BrackenWords; public static ConfigEntry<string> ThumperWords; public static ConfigEntry<string> HygrodereWords; public static ConfigEntry<string> GhostGirlWords; public static ConfigEntry<string> SporeLizardWords; public static ConfigEntry<string> NutcrackerWords; public static ConfigEntry<string> CoilHeadWords; public static ConfigEntry<string> JesterWords; public static ConfigEntry<string> MaskedWords; public static ConfigEntry<string> EyelessDogWords; public static ConfigEntry<string> ForestKeeperWords; public static ConfigEntry<string> EarthLeviathanWords; public static ConfigEntry<string> BaboonHawkWords; public Config(ConfigFile cfg) { EnableExtendedWords = cfg.Bind<bool>("Gameplay", "EnableExtendedWords", false, "Words in ALL CAPS are considered \"extended words\" and will not be included unless this setting is true"); CategoriesPerMoon = cfg.Bind<int>("Gameplay", "CategoriesPerMoon", 1, "The number of categories that will be banned per moon."); SnareFleaWords = cfg.Bind<string>("Categories.Entities", "Snare Flea", "snare,flea,fleas,centipede,centipedes,FACE,HUGGER,HUGGERS,HEAD,CRAB,CRABS", CategoryDescriptionFor("Snare Flea")); BunkerSpiderWords = cfg.Bind<string>("Categories.Entities", "Bunker Spider", "bunker,spider,spiders,web,webs,ARACHNID,ARACHNIDS", CategoryDescriptionFor("Bunker Spider")); HoardingBugWords = cfg.Bind<string>("Categories.Entities", "Hoarding Bug", "hoard,hoarding,bug,bugs,loot", CategoryDescriptionFor("Hoarding Bug")); BrackenWords = cfg.Bind<string>("Categories.Entities", "Bracken", "bracken,flower", CategoryDescriptionFor("Bracken")); ThumperWords = cfg.Bind<string>("Categories.Entities", "Thumper", "thumper,thumpers,crawler,crawlers", CategoryDescriptionFor("Thumper")); HygrodereWords = cfg.Bind<string>("Categories.Entities", "Hygrodere (Slime)", "hygrodere,hygroderes,slime,slimes", CategoryDescriptionFor("Hygrodere (Slime)")); GhostGirlWords = cfg.Bind<string>("Categories.Entities", "Ghost Girl", "ghost,ghosts,girl,girls,haunt,haunted", CategoryDescriptionFor("Ghost Girl")); SporeLizardWords = cfg.Bind<string>("Categories.Entities", "Spore Lizard", "spore,spores,lizard,lizards", CategoryDescriptionFor("Spore Lizard")); NutcrackerWords = cfg.Bind<string>("Categories.Entities", "Nutcracker", "nut,nuts,cracker,crackers,shotgun,gun,soldier", CategoryDescriptionFor("Nutcracker")); CoilHeadWords = cfg.Bind<string>("Categories.Entities", "Coil Head", "coil,coils,head,heads", CategoryDescriptionFor("Coil Head")); JesterWords = cfg.Bind<string>("Categories.Entities", "Jester", "jester,winding", CategoryDescriptionFor("Jester")); MaskedWords = cfg.Bind<string>("Categories.Entities", "Masked", "mask,masked,mimic,mimics", CategoryDescriptionFor("Masked")); EyelessDogWords = cfg.Bind<string>("Categories.Entities", "Eyeless Dog", "eye,eyes,eyeless,dog,dogs", CategoryDescriptionFor("Eyeless Dog")); ForestKeeperWords = cfg.Bind<string>("Categories.Entities", "Forest Keeper (Giant)", "forest,keeper,keepers,giant,giants", CategoryDescriptionFor("Forest Keeper (Giant)")); EarthLeviathanWords = cfg.Bind<string>("Categories.Entities", "Earth Leviathan (Worm)", "earth,leviathan,leviathans,worm,worms", CategoryDescriptionFor("Earth Leviathan (Worm)")); BaboonHawkWords = cfg.Bind<string>("Categories.Entities", "Baboon Hawk", "baboon,baboons,hawk,hawks", CategoryDescriptionFor("Baboon Hawk")); } private static string CategoryDescriptionFor(string category) { return "Words that count as mentioning the " + category + "\n" + CustomWordTip; } } public class PenaltyManager : NetworkBehaviour { public static PenaltyManager Instance; private void Awake() { Instance = this; } [ServerRpc(RequireOwnership = false)] public void PunishPlayerServerRpc(ulong clientId) { //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) 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(2979100391u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2979100391u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PunishPlayerClientRpc(clientId); } } } [ClientRpc] public void PunishPlayerClientRpc(ulong clientId) { //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_00ee: 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(2420793007u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2420793007u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)StartOfRound.Instance == (Object)null)) { GameObject val3 = StartOfRound.Instance.allPlayerObjects[clientId]; Landmine.SpawnExplosion(val3.transform.position, true, 1f, 0f); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PenaltyManager() { //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 NetworkManager.__rpc_func_table.Add(2979100391u, new RpcReceiveHandler(__rpc_handler_2979100391)); NetworkManager.__rpc_func_table.Add(2420793007u, new RpcReceiveHandler(__rpc_handler_2420793007)); } private static void __rpc_handler_2979100391(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PenaltyManager)(object)target).PunishPlayerServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2420793007(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PenaltyManager)(object)target).PunishPlayerClientRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PenaltyManager"; } } [BepInPlugin("LethalVocabulary", "LethalVocabulary", "0.1.2")] public class Plugin : BaseUnityPlugin { public static Plugin Instance; private static Harmony _harmony; public static ManualLogSource logger; public GameObject penaltyManagerPrefab; public bool roundInProgress; public readonly HashSet<string> ClientBannedCategories = new HashSet<string>(); public readonly HashSet<string> ClientBannedWords = new HashSet<string>(); public Dictionary<string, HashSet<string>> ClientCategories = new Dictionary<string, HashSet<string>>(); private SpeechRecognizer _speechRecognizer; public static Config Config { get; internal set; } private void Awake() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown 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); } } } Instance = this; _harmony = new Harmony("LethalVocabulary"); logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); _speechRecognizer = new SpeechRecognizer(); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalvocabularybundle"); AssetBundle val = AssetBundle.LoadFromFile(text); penaltyManagerPrefab = val.LoadAsset<GameObject>("Assets/LethalVocabulary/PenaltyManager.prefab"); penaltyManagerPrefab.AddComponent<PenaltyManager>(); ClientCategories = GetCategoriesFromConfig(Config.EnableExtendedWords.Value); _speechRecognizer.AddSpeechRecognizedHandler(delegate(object _, SpeechRecognizedEventArgs e) { string text2 = ((RecognizedPhrase)((RecognitionEventArgs)e).Result).Text; float confidence = ((RecognizedPhrase)((RecognitionEventArgs)e).Result).Confidence; if (roundInProgress && !(confidence < 0.85f) && !((Object)(object)RoundManager.Instance == (Object)null)) { PlayerControllerB localPlayerController = RoundManager.Instance.playersManager.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && !localPlayerController.isPlayerDead && StringHasWords(text2, ClientBannedWords)) { PenaltyManager.Instance.PunishPlayerServerRpc(((NetworkBehaviour)localPlayerController).NetworkManager.LocalClientId); } } }); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalVocabulary is loaded!"); } public void StartRound() { if (roundInProgress) { return; } ClientBannedCategories.UnionWith(PickRandomCategories(Math.Max(1, Config.CategoriesPerMoon.Value))); foreach (string clientBannedCategory in ClientBannedCategories) { ClientBannedWords.UnionWith(ClientCategories[clientBannedCategory]); } DisplayHUDTip("Don't talk about...", string.Join(", ", ClientBannedCategories), warning: false); ((BaseUnityPlugin)this).Logger.LogError((object)string.Join(", ", ClientBannedWords)); roundInProgress = true; } public void EndRound() { roundInProgress = false; ClientBannedCategories.Clear(); ClientBannedWords.Clear(); } public string[] PickRandomCategories(int amount) { List<string> list = ClientCategories.Keys.ToList(); List<string> list2 = new List<string>(); for (int i = 0; i < Math.Min(amount, list.Count); i++) { int index = Random.RandomRangeInt(0, list.Count); list2.Add(list[index]); list.RemoveAt(index); } return list2.ToArray(); } public static string[] GetAllWordsFromConfig(bool getExtendedWords) { HashSet<string> hashSet = new HashSet<string>(); foreach (KeyValuePair<string, HashSet<string>> item in GetCategoriesFromConfig(getExtendedWords)) { hashSet.UnionWith(item.Value); } return hashSet.ToArray(); } public static Dictionary<string, HashSet<string>> GetCategoriesFromConfig(bool getExtendedWords) { Dictionary<string, HashSet<string>> dictionary = new Dictionary<string, HashSet<string>>(); dictionary.Add("Snare Flea", ProcessCategoryWords(Config.SnareFleaWords.Value, getExtendedWords)); dictionary.Add("Bunker Spider", ProcessCategoryWords(Config.BunkerSpiderWords.Value, getExtendedWords)); dictionary.Add("Hoarding Bug", ProcessCategoryWords(Config.HoardingBugWords.Value, getExtendedWords)); dictionary.Add("Bracken", ProcessCategoryWords(Config.BrackenWords.Value, getExtendedWords)); dictionary.Add("Thumper", ProcessCategoryWords(Config.ThumperWords.Value, getExtendedWords)); dictionary.Add("Hygrodere (Slime)", ProcessCategoryWords(Config.HygrodereWords.Value, getExtendedWords)); dictionary.Add("Ghost Girl", ProcessCategoryWords(Config.GhostGirlWords.Value, getExtendedWords)); dictionary.Add("Spore Lizard", ProcessCategoryWords(Config.SporeLizardWords.Value, getExtendedWords)); dictionary.Add("Nutcracker", ProcessCategoryWords(Config.NutcrackerWords.Value, getExtendedWords)); dictionary.Add("Coil Head", ProcessCategoryWords(Config.CoilHeadWords.Value, getExtendedWords)); dictionary.Add("Jester", ProcessCategoryWords(Config.JesterWords.Value, getExtendedWords)); dictionary.Add("Masked", ProcessCategoryWords(Config.MaskedWords.Value, getExtendedWords)); dictionary.Add("Eyeless Dog", ProcessCategoryWords(Config.EyelessDogWords.Value, getExtendedWords)); dictionary.Add("Forest Keeper", ProcessCategoryWords(Config.ForestKeeperWords.Value, getExtendedWords)); dictionary.Add("Earth Leviathan (Worm)", ProcessCategoryWords(Config.EarthLeviathanWords.Value, getExtendedWords)); dictionary.Add("Baboon Hawk", ProcessCategoryWords(Config.BaboonHawkWords.Value, getExtendedWords)); return dictionary; } private static HashSet<string> ProcessCategoryWords(string categoryWords, bool includeExtendedWords) { HashSet<string> hashSet = new HashSet<string>(); string[] array = categoryWords.Split(","); foreach (string text in array) { if (!StringIsAllUpper(text) || includeExtendedWords) { hashSet.Add(text.ToLower()); } } return hashSet; } public static bool StringHasWords(string @string, HashSet<string> words) { return words.Any((string word) => @string.Contains(word)); } public static void DisplayHUDTip(string title, string body, bool warning) { if ((Object)(object)HUDManager.Instance == (Object)null) { logger.LogInfo((object)"Failed to display tip, no active HUDManager"); } else { HUDManager.Instance.DisplayTip(title, body, warning, false, "LC_Tip1"); } } private static bool StringIsAllUpper(string word) { return word.All((char c) => !char.IsLetter(c) || char.IsUpper(c)); } } public class SpeechRecognizer { private static readonly Grammar CommonWords = new Grammar(new GrammarBuilder(new Choices(new string[55] { "cog", "heck", "some", "something", "ok", "way", "main", "fire", "exit", "hello", "lyrics", "uh", "oh", "hi", "sing", "sky", "forever", "for", "see", "fly", "word", "what", "hey", "hm", "mine", "turret", "door", "lock", "locked", "explode", "exploded", "dead", "end", "pipe", "steam", "smoke", "scrap", "flash", "stun", "light", "shovel", "stop", "sign", "yield", "boom", "boombox", "box", "ladder", "emergency", "pro", "tzp", "inhale", "use", "drop", "miss" }))); private readonly SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine(); public SpeechRecognizer() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown _recognizer.SetInputToDefaultAudioDevice(); _recognizer.LoadGrammar(CommonWords); _recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(Plugin.GetAllWordsFromConfig(getExtendedWords: true))))); _recognizer.RecognizeAsync((RecognizeMode)1); } public void AddSpeechRecognizedHandler(EventHandler<SpeechRecognizedEventArgs> eventHandler) { _recognizer.SpeechRecognized += eventHandler; } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalVocabulary"; public const string PLUGIN_NAME = "LethalVocabulary"; public const string PLUGIN_VERSION = "0.1.2"; } } namespace LethalVocabulary.Patches { [HarmonyPatch(typeof(GameNetworkManager))] public class GameNetworkManagerPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void AddPenaltyManager(ref GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.Instance.penaltyManagerPrefab); } [HarmonyPostfix] [HarmonyPatch("StartDisconnect")] private static void PerformDisconnectOperations(ref GameNetworkManager __instance) { Plugin.Instance.EndRound(); } } [HarmonyPatch(typeof(HUDManager))] public class HUDManagerPatch { [HarmonyPrefix] [HarmonyPatch("SubmitChat_performed")] private static void CheckSubmittedChat(ref HUDManager __instance) { string @string = __instance.chatTextField.text.ToLower(); if (Plugin.Instance.roundInProgress && Plugin.StringHasWords(@string, Plugin.Instance.ClientBannedWords)) { PenaltyManager.Instance.PunishPlayerServerRpc(((NetworkBehaviour)__instance).NetworkManager.LocalClientId); __instance.chatTextField.text = ""; } } } [HarmonyPatch(typeof(RoundManager))] public class RoundManagerPatch { [HarmonyPostfix] [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] private static void PickNewBannedCategories(ref RoundManager __instance) { Plugin.Instance.StartRound(); } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void SpawnPenaltyManagerPrefab(ref StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsHost) { GameObject val = Object.Instantiate<GameObject>(Plugin.Instance.penaltyManagerPrefab); val.GetComponent<NetworkObject>().Spawn(false); } } [HarmonyPostfix] [HarmonyPatch("EndOfGameClientRpc")] private static void PerformEndOfGameOperations() { Plugin.Instance.EndRound(); } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { [HarmonyPrefix] [HarmonyPatch("ParsePlayerSentence")] private static void CheckSubmittedCommand(ref Terminal __instance) { string text = ((TMP_Text)__instance.inputFieldText).text.ToLower(); if (Plugin.Instance.roundInProgress && Plugin.StringHasWords(text, Plugin.Instance.ClientBannedWords)) { PenaltyManager.Instance.PunishPlayerServerRpc(((NetworkBehaviour)__instance).NetworkManager.LocalClientId); if (text.StartsWith("transmit")) { ((TMP_Text)__instance.inputFieldText).text = ""; } } } } } namespace LethalVocabulary.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/MaxwellScrap.dll
Decompiled 9 months agousing System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LaserTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LaserTweaks")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4963e0ea-7a99-4390-9cae-a4bdd01b6b43")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace MaxwellScrap { public class Assets { public static AssetBundle MainAssetBundle; public static Item Item; internal static Stream GetEmbededResource(string name) { return Assembly.GetExecutingAssembly().GetManifestResourceStream("MaxwellScrap." + name); } public static void Init() { MainAssetBundle = AssetBundle.LoadFromStream(GetEmbededResource("maxwell.bundle")); Item = MainAssetBundle.LoadAsset<Item>("Assets/Mods/MaxwellScrapItem/Maxwell.asset"); } } [BepInPlugin("Kittenji.MaxwellScrap", "Maxwell Scrap", "1.0.1")] public class Loader : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.Item.spawnPrefab); Debug.Log((object)"[MAXWELL] Added network prefab"); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref StartOfRound __instance) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Assets.Item)) { continue; } int num = 2; SpawnableItemWithRarity val2 = val.spawnableScrap.Find((SpawnableItemWithRarity s) => Object.op_Implicit((Object)(object)s.spawnableItem) && Object.op_Implicit((Object)(object)s.spawnableItem.spawnPrefab) && ((Object)s.spawnableItem.spawnPrefab).name == "CashRegisterItem"); if (val2 != null) { num = val2.rarity; } else if (val.spawnableScrap.Count > 0) { int num2 = int.MaxValue; foreach (SpawnableItemWithRarity item2 in val.spawnableScrap) { if (item2.rarity < num2) { num2 = item2.rarity; } } num = num2; } num = Mathf.Min(100, Mathf.Max(1, num)); SpawnableItemWithRarity item = new SpawnableItemWithRarity { spawnableItem = Assets.Item, rarity = num }; val.spawnableScrap.Add(item); } if (!__instance.allItemsList.itemsList.Contains(Assets.Item)) { __instance.allItemsList.itemsList.Add(Assets.Item); } } } private const string modGUID = "Kittenji.MaxwellScrap"; private readonly Harmony harmony = new Harmony("Kittenji.MaxwellScrap"); private const int DefaultSpawnRarity = 2; private void Awake() { Assets.Init(); harmony.PatchAll(); } } }
plugins/MemeSoundboard.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MemeSoundboard")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MemeSoundboard")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2a19c5a9-6341-4a09-b1eb-a1a2ae48ec34")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MemeSoundboard { [BepInPlugin("florianbutz.memesoundboard", "Meme Soundboard", "1.1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MemeSoundboardBase : BaseUnityPlugin { private const string modGUID = "florianbutz.memesoundboard"; private const string modName = "Meme Soundboard"; private const string modVersion = "1.1.2.0"; private static string bundlePath = ""; private readonly Harmony harmony = new Harmony("florianbutz.memesoundboard"); public static MemeSoundboardBase instance; internal ManualLogSource logSource; public static GameObject soundboardItemPrefab; private void Awake() { //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)(instance = null))) { instance = this; } logSource = Logger.CreateLogSource("Meme Soundboard"); Configuration.Init(); bundlePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "soundboarditemmodel"); Assets.LoadAssetBundle(bundlePath); AssetBundle bundle = Assets.GetBundle(); Item val = bundle.LoadAsset<Item>("soundboarditem"); Soundboard soundboard = val.spawnPrefab.AddComponent<Soundboard>(); ((GrabbableObject)soundboard).itemProperties = val; AudioSource component = val.spawnPrefab.GetComponent<AudioSource>(); component.volume = Mathf.Clamp(Configuration.SoundboardVolume, 0f, 1f); component.dopplerLevel = Mathf.Clamp(Configuration.DopplerLevel, 0f, 2f); Soundboard.soundboardClips = new List<AudioClip>(); Soundboard.soundboardClipNames = new List<string>(); AddNewSound("Vine Boom", bundle.LoadAsset<AudioClip>("vineboom")); AddNewSound("Tacco Bell", bundle.LoadAsset<AudioClip>("bell")); AddNewSound("Siren", bundle.LoadAsset<AudioClip>("siren")); AddNewSound("Violin Screech", bundle.LoadAsset<AudioClip>("violinscreech")); AddNewSound("Wilhelm Scream", bundle.LoadAsset<AudioClip>("wilhelmscream")); AddNewSound("Augh", bundle.LoadAsset<AudioClip>("augh")); AddNewSound("Reverb Fart", bundle.LoadAsset<AudioClip>("reverbfart")); AddNewSound("Horn", bundle.LoadAsset<AudioClip>("horn")); AddNewSound("Bowomp", bundle.LoadAsset<AudioClip>("bowomp")); AddNewSound("Ghost", bundle.LoadAsset<AudioClip>("ghost")); AddNewSound("Inception", bundle.LoadAsset<AudioClip>("inception")); AddNewSound("Fnaf Jumpscare", bundle.LoadAsset<AudioClip>("fnafjumpscare")); AddNewSound("Metal Pipe", bundle.LoadAsset<AudioClip>("metalpipe")); AddNewSound("What the hell bruh", bundle.LoadAsset<AudioClip>("browthbruh")); AddNewSound("Yippee", bundle.LoadAsset<AudioClip>("yippee")); soundboard.switchSoundClip = bundle.LoadAsset<AudioClip>("switchsound"); TerminalNode val2 = (TerminalNode)ScriptableObject.CreateInstance("TerminalNode"); Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, 15); soundboardItemPrefab = val.spawnPrefab; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } logSource.LogInfo((object)"Meme Soundboard has started successfully!"); harmony.PatchAll(); } public static void AddNewSound(string soundName, AudioClip soundClip) { Soundboard.soundboardClips.Add(soundClip); Soundboard.soundboardClipNames.Add(soundName); } } public class Soundboard : GrabbableObject { private AudioSource soundboardSource; private Text selectedSoundText; public AudioClip switchSoundClip; public static List<AudioClip> soundboardClips; public static List<string> soundboardClipNames; private Animator antennaLightAnim; public NetworkVariable<int> selectedSound = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool isItemInMainHand; public void Awake() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown base.customGrabTooltip = "Grab - Play Meme Sounds!"; base.grabbable = true; base.grabbableToEnemies = true; base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); base.useCooldown = 2f; base.insertedBattery = new Battery(false, 5f); soundboardSource = ((Component)this).GetComponent<AudioSource>(); antennaLightAnim = ((Component)this).GetComponentInChildren<Animator>(); Text[] componentsInChildren = ((Component)this).GetComponentsInChildren<Text>(); foreach (Text val in componentsInChildren) { if (((Object)((Component)val).gameObject).name == "SelectedSound") { selectedSoundText = val; } } selectedSoundText.text = soundboardClipNames[selectedSound.Value]; foreach (string soundboardClipName in soundboardClipNames) { Debug.Log((object)soundboardClipName); } NetworkVariable<int> obj = selectedSound; obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnValueChanged)); } [ServerRpc(RequireOwnership = false)] public void ChangeSelectedSoundServerRpc(int index) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4043019660u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4043019660u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { selectedSound.Value = index; soundboardSource.Stop(); } } } private void OnValueChanged(int previous, int current) { Debug.Log((object)$"Detected NetworkVariable Change: Previous: {previous} | Current: {current}"); selectedSoundText.text = soundboardClipNames[selectedSound.Value]; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); soundboardSource.PlayOneShot(GetSoundboardSound(), Configuration.SoundboardVolume); antennaLightAnim.Play("AntennaLightFlicker_Animation"); } public override void Update() { ((GrabbableObject)this).Update(); if (((ButtonControl)Keyboard.current[(Key)32]).wasPressedThisFrame && base.isHeld && ((NetworkBehaviour)this).IsOwner && isItemInMainHand) { Debug.Log((object)"Key was pressed! Switching Sound..."); ChangeSelectedSoundServerRpc(NextIndex()); selectedSoundText.text = soundboardClipNames[selectedSound.Value]; Debug.Log((object)("Next Sound: " + (object)soundboardClips[selectedSound.Value])); soundboardSource.PlayOneShot(switchSoundClip, 0.35f); } if (((ButtonControl)Keyboard.current[(Key)31]).wasPressedThisFrame && base.isHeld && ((NetworkBehaviour)this).IsOwner && isItemInMainHand) { Debug.Log((object)"Key was pressed! Switching Sound..."); ChangeSelectedSoundServerRpc(LastIndex()); selectedSoundText.text = soundboardClipNames[selectedSound.Value]; Debug.Log((object)("Next Sound: " + (object)soundboardClips[selectedSound.Value])); soundboardSource.PlayOneShot(switchSoundClip, 0.35f); } if (((ButtonControl)Keyboard.current[(Key)2]).wasPressedThisFrame && base.isHeld && ((NetworkBehaviour)this).IsOwner) { _ = isItemInMainHand; } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ((Component)((Component)selectedSoundText).transform.parent).gameObject.SetActive(false); selectedSoundText.text = soundboardClipNames[selectedSound.Value]; isItemInMainHand = false; soundboardSource.Stop(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((Component)((Component)selectedSoundText).transform.parent).gameObject.SetActive(true); isItemInMainHand = true; selectedSoundText.text = soundboardClipNames[selectedSound.Value]; } public AudioClip GetSoundboardSound() { return soundboardClips[selectedSound.Value]; } public int NextIndex() { Debug.Log((object)"Getting next soundindex..."); if (soundboardClips.Count > selectedSound.Value + 1) { Debug.Log((object)"Aquired next sound index"); return selectedSound.Value + 1; } return 0; } public int LastIndex() { Debug.Log((object)"Getting next soundindex..."); if (0 <= selectedSound.Value - 1) { Debug.Log((object)"Aquired last sound index"); return selectedSound.Value - 1; } return soundboardClips.Count - 1; } protected override void __initializeVariables() { if (selectedSound == null) { throw new Exception("Soundboard.selectedSound cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)selectedSound).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)selectedSound, "selectedSound"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)selectedSound); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Soundboard() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(4043019660u, new RpcReceiveHandler(__rpc_handler_4043019660)); } private static void __rpc_handler_4043019660(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((Soundboard)(object)target).ChangeSelectedSoundServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Soundboard"; } } [HarmonyPatch] public class NetworkObjectManager { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = MemeSoundboardBase.soundboardItemPrefab; NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //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) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity).GetComponent<NetworkObject>().Spawn(false); } } } internal class Assets { internal static AssetBundle mainAssetBundle; private static string[] assetNames = new string[0]; internal static void LoadAssetBundle(string assetbundlePath) { if ((Object)(object)mainAssetBundle == (Object)null) { mainAssetBundle = AssetBundle.LoadFromFile(assetbundlePath); } assetNames = mainAssetBundle.GetAllAssetNames(); } internal static AssetBundle GetBundle() { if (!Object.op_Implicit((Object)(object)mainAssetBundle)) { Debug.LogError((object)"There is no AssetBundle to load assets from."); return null; } return mainAssetBundle; } } internal static class Configuration { private const string CONFIG_FILE_NAME = "Soundboard.cfg"; private static ConfigFile config; private static ConfigEntry<float> soundboardVolume; private static ConfigEntry<float> dopplerLevel; public static float SoundboardVolume => soundboardVolume.Value; public static float DopplerLevel => dopplerLevel.Value; public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown config = new ConfigFile(Path.Combine(Paths.ConfigPath, "Soundboard.cfg"), true); soundboardVolume = config.Bind<float>("Config", "Soundboard master volume", 1f, "Changes the volume of the soundboard sounds. Value can be between 0 and 1."); dopplerLevel = config.Bind<float>("Config", "Soundboard doppler level", 0.5f, "Changes the doppler level of the soundboard sounds. Value can be between 0 and 2."); } } }
plugins/MetalRecharging.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; 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("MetalRecharging")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Allows you to charge metal objects")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MetalRecharging")] [assembly: AssemblyTitle("MetalRecharging")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MetalRecharging { [BepInPlugin("MetalRecharging", "MetalRecharging", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MetalRecharging is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "MetalRecharging"; public const string PLUGIN_NAME = "MetalRecharging"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MetalRecharging.Patches { [HarmonyPatch(typeof(HUDManager))] internal class ChatPatch { private static bool _justExploded; private static SpawnableMapObject? _landmine; [HarmonyPatch("AddPlayerChatMessageServerRpc")] [HarmonyPatch("AddChatMessage")] [HarmonyPostfix] private static void OnServerMessageAdded(HUDManager __instance, ref string chatMessage) { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) if (_justExploded || (Object)(object)((NetworkBehaviour)__instance).NetworkManager == (Object)null || !chatMessage.Contains("iexplode")) { return; } string[] array = chatMessage.Split('-'); if (array.Length != 3) { return; } ulong playerId = ulong.Parse(array[1]); PlayerControllerB val = ((IEnumerable<PlayerControllerB>)__instance.playersManager.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => x.playerClientId == playerId)); if (_landmine == null) { _landmine = __instance.playersManager?.levels?.SelectMany((SelectableLevel x) => x.spawnableMapObjects).FirstOrDefault((Func<SpawnableMapObject, bool>)((SpawnableMapObject x) => ((Object)x.prefabToSpawn).name == "Landmine")); } if (!((Object)(object)val == (Object)null) && _landmine != null) { if (!((NetworkBehaviour)__instance).NetworkManager.IsHost && !((NetworkBehaviour)__instance).NetworkManager.IsServer) { LandminePatch.LastExplosionWasCharger = true; return; } LandminePatch.LastExplosionWasCharger = true; Debug.Log((object)"Explisuion time."); _justExploded = true; Vector3 val2 = ((Component)val).transform.position - new Vector3(0f, 0.25f, 0f); GameObject obj = Object.Instantiate<GameObject>(_landmine.prefabToSpawn, val2, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); Landmine componentInChildren = obj.GetComponentInChildren<Landmine>(); obj.GetComponent<NetworkObject>().Spawn(true); componentInChildren.ExplodeMineServerRpc(); Unexplode(); } } private static async Task Unexplode() { await Task.Delay(200); _justExploded = false; } public static void SendExplosionChat() { if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { int num = (int)GameNetworkManager.Instance.localPlayerController.playerClientId; HUDManager.Instance.AddTextToChatOnServer("<size=0>-" + num + "-iexplode</size>", num); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class InteractPerformedPatch { private static bool _swappingTwoHandedValue; [HarmonyPatch("Interact_performed")] [HarmonyPrefix] internal static void InteractPerformedPrefix(PlayerControllerB __instance) { if (!((Object)(object)__instance.hoveringOverTrigger == (Object)null) && __instance.twoHanded) { Transform parent = ((Component)__instance.hoveringOverTrigger).transform.parent; if (!((Object)(object)parent == (Object)null) && !(((Object)((Component)parent).gameObject).name != "ChargeStationTrigger")) { _swappingTwoHandedValue = true; __instance.twoHanded = false; } } } [HarmonyPatch("Interact_performed")] [HarmonyPostfix] internal static void InteractPerformedPostfix(PlayerControllerB __instance) { if (_swappingTwoHandedValue) { _swappingTwoHandedValue = false; __instance.twoHanded = true; } } } [HarmonyPatch(typeof(ItemCharger))] internal class ItemChargerPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static bool ItemChargerUpdate(ItemCharger __instance, ref float ___updateInterval, ref InteractTrigger ___triggerScript) { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } if (___updateInterval > 1f) { ___updateInterval = 0f; if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer == (Object)null || (!currentlyHeldObjectServer.itemProperties.isConductiveMetal && !currentlyHeldObjectServer.itemProperties.requiresBattery)) { ___triggerScript.interactable = false; ___triggerScript.disabledHoverTip = "(Requires battery-powered or metal item)"; } else { ___triggerScript.interactable = true; } ___triggerScript.twoHandedItemAllowed = true; return false; } } ___updateInterval += Time.deltaTime; return false; } [HarmonyPatch("ChargeItem")] [HarmonyPostfix] private static void ItemChargerCharge(ItemCharger __instance) { GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && !currentlyHeldObjectServer.itemProperties.requiresBattery && currentlyHeldObjectServer.itemProperties.isConductiveMetal) { LandminePatch.LastExplosionWasLocalPlayer = true; ChatPatch.SendExplosionChat(); } } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { public static bool LastExplosionWasLocalPlayer; public static bool LastExplosionWasCharger; [HarmonyPatch("SpawnExplosion")] [HarmonyPrefix] private static bool SpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0061: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Spawning explosion"); Debug.Log((object)"Charger:"); Debug.Log((object)LastExplosionWasCharger); Debug.Log((object)LastExplosionWasLocalPlayer); if (!LastExplosionWasCharger) { return true; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Vector3 val = (((Component)localPlayerController.gameplayCamera).transform.position - explosionPosition) * 80f / Vector3.Distance(((Component)localPlayerController.gameplayCamera).transform.position, explosionPosition); if (LastExplosionWasLocalPlayer) { localPlayerController.KillPlayer(val, true, (CauseOfDeath)3, 0); } LastExplosionWasCharger = false; LastExplosionWasLocalPlayer = false; int num = ~LayerMask.GetMask(new string[1] { "Room" }); num = ~LayerMask.GetMask(new string[1] { "Colliders" }); Collider[] array = Physics.OverlapSphere(explosionPosition, 10f, num); for (int i = 0; i < array.Length; i++) { Rigidbody component = ((Component)array[i]).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } return false; } } }
plugins/MoreBlood.dll
Decompiled 9 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using MoreBlood.Config; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreBlood")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreBlood")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d1f1321d-30a3-4600-9bf8-1e69fe1abf8c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreBlood { [BepInPlugin("FlipMods.MoreBlood", "MoreBlood", "1.0.2")] public class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony _harmony; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown instance = this; _harmony = new Harmony("MoreBlood"); ConfigSettings.BindConfigSettings(); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreBlood loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.MoreBlood"; public const string PLUGIN_NAME = "MoreBlood"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace MoreBlood.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class MoreBloodPatcher { private static int bloodCount; [HarmonyPatch("DropBlood")] [HarmonyPostfix] public static void MoreBlood(PlayerControllerB __instance, Vector3 direction = default(Vector3), bool leaveBlood = true, bool leaveFootprint = false) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) bloodCount++; if (bloodCount < ConfigSettings.numBloodPools.Value) { __instance.DropBlood(direction, leaveBlood, leaveFootprint); } else { bloodCount = 0; } } [HarmonyPatch("RandomizeBloodRotationAndScale")] [HarmonyPostfix] public static void RandomizeBloodScale(ref Transform blood, PlayerControllerB __instance) { //IL_0004: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) Transform obj = blood; obj.localScale *= ConfigSettings.bloodScale.Value; blood.position += new Vector3((float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value, 0.55f, (float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value); } } } namespace MoreBlood.Config { public static class ConfigSettings { public static ConfigEntry<float> bloodScale; public static ConfigEntry<int> numBloodPools; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); bloodScale = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("MoreBlood", "BloodScale", 4f, "The size of the blood pools"); numBloodPools = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("MoreBlood", "NumberOfBloodPools", 4, "Max number of blood pools spread around the blood source."); } } }
plugins/MoreCompany.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using MoreCompany.Utils; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © NotNotSwipez 2023")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreCompany")] [assembly: AssemblyTitle("MoreCompany")] [assembly: AssemblyVersion("1.0.0.0")] [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 MoreCompany { [HarmonyPatch(typeof(AudioMixer), "SetFloat")] public static class AudioMixerSetFloatPatch { public static bool Prefix(string name, float value) { if (name.StartsWith("PlayerVolume") || name.StartsWith("PlayerPitch")) { string s = name.Replace("PlayerVolume", "").Replace("PlayerPitch", ""); int num = int.Parse(s); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[num]; if ((Object)(object)val != (Object)null) { AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource; if (Object.op_Implicit((Object)(object)currentVoiceChatAudioSource)) { if (name.StartsWith("PlayerVolume")) { currentVoiceChatAudioSource.volume = value / 16f; } else if (name.StartsWith("PlayerPitch")) { currentVoiceChatAudioSource.pitch = value; } } return false; } } return true; } } [HarmonyPatch(typeof(HUDManager), "AddTextToChatOnServer")] public static class SendChatToServerPatch { public static bool Prefix(HUDManager __instance, string chatMessage, int playerId = -1) { if (((NetworkBehaviour)StartOfRound.Instance).IsHost && chatMessage.StartsWith("/mc") && DebugCommandRegistry.commandEnabled) { string text = chatMessage.Replace("/mc ", ""); DebugCommandRegistry.HandleCommand(text.Split(' ')); return false; } if (chatMessage.StartsWith("[morecompanycosmetics]")) { ReflectionUtils.InvokeMethod(__instance, "AddPlayerChatMessageServerRpc", new object[2] { chatMessage, 99 }); return false; } return true; } } [HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageServerRpc")] public static class ServerReceiveMessagePatch { public static string previousDataMessage = ""; public static bool Prefix(HUDManager __instance, ref string chatMessage, int playerId) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (chatMessage.StartsWith("[morecompanycosmetics]") && networkManager.IsServer) { previousDataMessage = chatMessage; chatMessage = "[replacewithdata]"; } return true; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static class ConnectClientToPlayerObjectPatch { public static void Postfix(PlayerControllerB __instance) { string text = "[morecompanycosmetics]"; text = text + ";" + __instance.playerClientId; foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { text = text + ";" + locallySelectedCosmetic; } HUDManager.Instance.AddTextToChatOnServer(text, -1); } } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] public static class AddChatMessagePatch { public static bool Prefix(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped = "") { if (chatMessage.StartsWith("[replacewithdata]") || chatMessage.StartsWith("[morecompanycosmetics]")) { return false; } return true; } } [HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")] public static class ClientReceiveMessagePatch { public static bool ignoreSample; public static bool Prefix(ref HUDManager __instance, ref string chatMessage, int playerId) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (networkManager.IsServer) { if (chatMessage.StartsWith("[replacewithdata]")) { chatMessage = ServerReceiveMessagePatch.previousDataMessage; HandleDataMessage(ref chatMessage); } else if (chatMessage.StartsWith("[morecompanycosmetics]")) { return false; } } else if (chatMessage.StartsWith("[morecompanycosmetics]")) { HandleDataMessage(ref chatMessage); } return true; } private static void HandleDataMessage(ref string chatMessage) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (ignoreSample) { return; } chatMessage = chatMessage.Replace("[morecompanycosmetics]", ""); string[] array = chatMessage.Split(';'); string text = array[1]; int num = int.Parse(text); CosmeticApplication component = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } CosmeticApplication cosmeticApplication = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.AddComponent<CosmeticApplication>(); cosmeticApplication.ClearCosmetics(); List<string> list = new List<string>(); string[] array2 = array; foreach (string text2 in array2) { if (!(text2 == text)) { list.Add(text2); if (MainClass.showCosmetics) { cosmeticApplication.ApplyCosmetic(text2, startEnabled: true); } } } if (num == StartOfRound.Instance.thisClientPlayerId) { cosmeticApplication.ClearCosmetics(); } foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } MainClass.playerIdsAndCosmetics.Remove(num); MainClass.playerIdsAndCosmetics.Add(num, list); if (!GameNetworkManager.Instance.isHostingGame || num == 0) { return; } ignoreSample = true; foreach (KeyValuePair<int, List<string>> playerIdsAndCosmetic in MainClass.playerIdsAndCosmetics) { string text3 = "[morecompanycosmetics]"; text3 = text3 + ";" + playerIdsAndCosmetic.Key; foreach (string item in playerIdsAndCosmetic.Value) { text3 = text3 + ";" + item; } HUDManager.Instance.AddTextToChatOnServer(text3, -1); } ignoreSample = false; } } public class DebugCommandRegistry { public static bool commandEnabled; public static void HandleCommand(string[] args) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) if (!commandEnabled) { return; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; switch (args[0]) { case "money": { int groupCredits = int.Parse(args[1]); Terminal val5 = Resources.FindObjectsOfTypeAll<Terminal>().First(); val5.groupCredits = groupCredits; break; } case "spawnscrap": { string text = ""; for (int i = 1; i < args.Length; i++) { text = text + args[i] + " "; } text = text.Trim(); Vector3 val = ((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 2f; SpawnableItemWithRarity val2 = null; foreach (SpawnableItemWithRarity item in StartOfRound.Instance.currentLevel.spawnableScrap) { if (item.spawnableItem.itemName.ToLower() == text.ToLower()) { val2 = item; break; } } GameObject val3 = Object.Instantiate<GameObject>(val2.spawnableItem.spawnPrefab, val, Quaternion.identity, (Transform)null); GrabbableObject component = val3.GetComponent<GrabbableObject>(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); component.fallTime = 0f; NetworkObject component2 = val3.GetComponent<NetworkObject>(); component2.Spawn(false); break; } case "spawnenemy": { string text2 = ""; for (int j = 1; j < args.Length; j++) { text2 = text2 + args[j] + " "; } text2 = text2.Trim(); SpawnableEnemyWithRarity val4 = null; foreach (SpawnableEnemyWithRarity enemy in StartOfRound.Instance.currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower() == text2.ToLower()) { val4 = enemy; break; } } RoundManager.Instance.SpawnEnemyGameObject(((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 2f, 0f, -1, val4.enemyType); break; } case "listall": MainClass.StaticLogger.LogInfo((object)"Spawnable scrap:"); foreach (SpawnableItemWithRarity item2 in StartOfRound.Instance.currentLevel.spawnableScrap) { MainClass.StaticLogger.LogInfo((object)item2.spawnableItem.itemName); } MainClass.StaticLogger.LogInfo((object)"Spawnable enemies:"); { foreach (SpawnableEnemyWithRarity enemy2 in StartOfRound.Instance.currentLevel.Enemies) { MainClass.StaticLogger.LogInfo((object)enemy2.enemyType.enemyName); } break; } } } } [HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")] public static class LookForPlayersForestGiantPatch { public static void Prefix(ref ForestGiantAI __instance) { if (__instance.playerStealthMeters.Length != MainClass.newPlayerCount) { Array.Resize(ref __instance.playerStealthMeters, MainClass.newPlayerCount); for (int i = 0; i < MainClass.newPlayerCount; i++) { __instance.playerStealthMeters[i] = 0f; } } } } [HarmonyPatch(typeof(BlobAI), "Start")] public static class BlobAIStartPatch { public static void Postfix(ref BlobAI __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "ragdollColliders", value); } } [HarmonyPatch(typeof(CrawlerAI), "Start")] public static class CrawlerAIStartPatch { public static void Postfix(ref CrawlerAI __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "nearPlayerColliders", value); } } [HarmonyPatch(typeof(SpringManAI), "Update")] public static class SpringManAIUpdatePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call static float UnityEngine.Vector3::Distance(UnityEngine.Vector3 a, UnityEngine.Vector3 b)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SpringManAI), "DoAIInterval")] public static class SpringManAIIntervalPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call void EnemyAI::SwitchToBehaviourState(int stateIndex)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(EnemyAI), "GetClosestPlayer")] public static class GetClosestPlayerPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; foreach (CodeInstruction instruction in instructions) { if (!flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(EnemyAI), "GetAllPlayersInLineOfSight")] public static class GetAllPlayersInLineOfSightPatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; foreach (CodeInstruction instruction in instructions) { if (!flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(DressGirlAI), "ChoosePlayerToHaunt")] public static class DressGirlHauntPatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] public static class HudChatPatch { public static void Prefix(HUDManager __instance, ref string chatMessage, string nameOfUserWhoTyped = "") { if (!(__instance.lastChatMessage == chatMessage)) { StringBuilder stringBuilder = new StringBuilder(chatMessage); for (int i = 0; i < MainClass.newPlayerCount; i++) { string oldValue = $"[playerNum{i}]"; string playerUsername = StartOfRound.Instance.allPlayerScripts[i].playerUsername; stringBuilder.Replace(oldValue, playerUsername); } chatMessage = stringBuilder.ToString(); } } } [HarmonyPatch(typeof(MenuManager), "Awake")] public static class MenuManagerLogoOverridePatch { public static List<TMP_InputField> inputFields = new List<TMP_InputField>(); public static void Postfix(MenuManager __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) try { MainClass.ReadSettingsFromFile(); GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject; Sprite sprite = Sprite.Create(MainClass.mainLogo, new Rect(0f, 0f, (float)((Texture)MainClass.mainLogo).width, (float)((Texture)MainClass.mainLogo).height), new Vector2(0.5f, 0.5f)); Transform val = gameObject.transform.Find("MenuContainer/MainButtons/HeaderImage"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.GetComponent<Image>().sprite = sprite; } Transform val2 = gameObject.transform.Find("MenuContainer/LoadingScreen"); if ((Object)(object)val2 != (Object)null) { val2.localScale = new Vector3(1.02f, 1.06f, 1.02f); Transform val3 = val2.Find("Image"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent<Image>().sprite = sprite; } } CosmeticRegistry.SpawnCosmeticGUI(); LANMenu.InitializeMenu(); inputFields.Clear(); Transform val4 = gameObject.transform.Find("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions"); if ((Object)(object)val4 != (Object)null) { CreateCrewCountInput(val4.Find(GameNetworkManager.Instance.disableSteam ? "LANOptions" : "OptionsNormal")); } Transform val5 = gameObject.transform.Find("MenuContainer/LobbyJoinSettings/JoinSettingsContainer/LobbyJoinOptions"); if ((Object)(object)val5 != (Object)null) { CreateCrewCountInput(val5.Find("LANOptions")); } } catch (Exception ex) { MainClass.StaticLogger.LogError((object)ex); } } private static void CreateCrewCountInput(Transform parent) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(MainClass.crewCountUI, parent); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localPosition = new Vector3(96.9f, -70f, -6.7f); TMP_InputField inputField = ((Component)val.transform.Find("InputField (TMP)")).GetComponent<TMP_InputField>(); inputField.characterLimit = 3; inputField.text = MainClass.newPlayerCount.ToString(); inputFields.Add(inputField); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(inputField.text == MainClass.newPlayerCount.ToString())) { if (int.TryParse(s, out var result)) { MainClass.newPlayerCount = Mathf.Clamp(result, MainClass.minPlayerCount, MainClass.maxPlayerCount); foreach (TMP_InputField inputField2 in inputFields) { inputField2.text = MainClass.newPlayerCount.ToString(); } MainClass.SaveSettingsToFile(); MainClass.StaticLogger.LogInfo((object)$"Changed Crew Count: {MainClass.newPlayerCount}"); } else if (s.Length != 0) { foreach (TMP_InputField inputField3 in inputFields) { inputField3.text = MainClass.newPlayerCount.ToString(); inputField3.caretPosition = 1; } } } }); } } [HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")] public static class AddUserPlayerListPatch { private static bool Prefix(QuickMenuManager __instance, ulong steamId, string playerName, int playerObjectId) { QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance); MainClass.EnablePlayerObjectsBasedOnConnected(); return false; } } [HarmonyPatch(typeof(QuickMenuManager), "RemoveUserFromPlayerList")] public static class RemoveUserPlayerListPatch { public static bool Prefix(QuickMenuManager __instance) { QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance); return false; } } [HarmonyPatch(typeof(QuickMenuManager), "Update")] public static class QuickMenuUpdatePatch { public static bool Prefix() { return false; } } [HarmonyPatch(typeof(QuickMenuManager), "NonHostPlayerSlotsEnabled")] public static class QuickMenuDisplayPatch { public static bool Prefix(ref bool __result) { __result = false; for (int i = 1; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (val.isPlayerControlled || val.isPlayerDead) { __result = true; break; } } return false; } } [HarmonyPatch(typeof(QuickMenuManager), "Start")] public static class QuickmenuVisualInjectPatch { public static GameObject quickMenuScrollInstance; public static void Postfix(QuickMenuManager __instance) { //IL_0050: 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) GameObject gameObject = ((Component)__instance.playerListPanel.transform.Find("Image")).gameObject; GameObject val = Object.Instantiate<GameObject>(MainClass.quickMenuScrollParent); val.transform.SetParent(gameObject.transform); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localPosition = new Vector3(0f, -31.2f, 0f); ((Transform)component).localScale = Vector3.one; quickMenuScrollInstance = val; } public static void PopulateQuickMenu(QuickMenuManager __instance) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown int childCount = quickMenuScrollInstance.transform.Find("Holder").childCount; List<GameObject> list = new List<GameObject>(); for (int i = 0; i < childCount; i++) { list.Add(((Component)quickMenuScrollInstance.transform.Find("Holder").GetChild(i)).gameObject); } foreach (GameObject item in list) { Object.Destroy((Object)(object)item); } if (!Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return; } for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) { PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[j]; if (!playerScript.isPlayerControlled && !playerScript.isPlayerDead) { continue; } GameObject val = Object.Instantiate<GameObject>(MainClass.playerEntry, quickMenuScrollInstance.transform.Find("Holder")); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localScale = Vector3.one; ((Transform)component).localPosition = new Vector3(0f, 0f - ((Transform)component).localPosition.y, 0f); TextMeshProUGUI component2 = ((Component)val.transform.Find("PlayerNameButton").Find("PName")).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).text = playerScript.playerUsername; Slider playerVolume = ((Component)val.transform.Find("PlayerVolumeSlider")).GetComponent<Slider>(); int finalIndex = j; ((UnityEvent<float>)(object)playerVolume.onValueChanged).AddListener((UnityAction<float>)delegate(float f) { if (playerScript.isPlayerControlled || playerScript.isPlayerDead) { float num = f / playerVolume.maxValue + 1f; if (num <= -1f) { SoundManager.Instance.playerVoiceVolumes[finalIndex] = -70f; } else { SoundManager.Instance.playerVoiceVolumes[finalIndex] = num; } } }); if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null && StartOfRound.Instance.localPlayerController.playerClientId == playerScript.playerClientId) { ((Component)playerVolume).gameObject.SetActive(false); ((Component)val.transform.Find("Text (1)")).gameObject.SetActive(false); } Button component3 = ((Component)val.transform.Find("KickButton")).GetComponent<Button>(); ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { __instance.KickUserFromServer(finalIndex); }); if (!GameNetworkManager.Instance.isHostingGame) { ((Component)component3).gameObject.SetActive(false); } Button component4 = ((Component)val.transform.Find("ProfileIcon")).GetComponent<Button>(); ((UnityEvent)component4.onClick).AddListener((UnityAction)delegate { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.disableSteam) { SteamFriends.OpenUserOverlay(SteamId.op_Implicit(playerScript.playerSteamId), "steamid"); } }); } } } [HarmonyPatch(typeof(QuickMenuManager), "ConfirmKickUserFromServer")] public static class KickPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "ldfld int QuickMenuManager::playerObjToKick") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.3 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(HUDManager), "UpdateBoxesSpectateUI")] public static class SpectatorBoxUpdatePatch { public static void Postfix(HUDManager __instance) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Dictionary<Animator, PlayerControllerB> fieldValue = ReflectionUtils.GetFieldValue<Dictionary<Animator, PlayerControllerB>>(__instance, "spectatingPlayerBoxes"); int num = -64; int num2 = 0; int num3 = 0; int num4 = -70; int num5 = 230; int num6 = 4; foreach (KeyValuePair<Animator, PlayerControllerB> item in fieldValue) { if (((Component)item.Key).gameObject.activeInHierarchy) { GameObject gameObject = ((Component)item.Key).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); int num7 = (int)Math.Floor((double)num3 / (double)num6); int num8 = num3 % num6; int num9 = num8 * num4; int num10 = num7 * num5; component.anchoredPosition = Vector2.op_Implicit(new Vector3((float)(num + num10), (float)(num2 + num9), 0f)); num3++; } } } } [HarmonyPatch(typeof(HUDManager), "Start")] public static class HudStartPatch { public static void Postfix(HUDManager __instance) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) EndOfGameStatUIElements statsUIElements = __instance.statsUIElements; GameObject gameObject = ((Component)((Component)statsUIElements.playerNamesText[0]).gameObject.transform.parent).gameObject; GameObject gameObject2 = ((Component)gameObject.transform.parent.parent).gameObject; GameObject gameObject3 = ((Component)gameObject2.transform.Find("BGBoxes")).gameObject; gameObject2.transform.parent.Find("DeathScreen").SetSiblingIndex(3); gameObject3.transform.localScale = new Vector3(2.5f, 1f, 1f); MakePlayerHolder(4, gameObject, statsUIElements, new Vector3(426.9556f, -0.7932f, 0f)); MakePlayerHolder(5, gameObject, statsUIElements, new Vector3(426.9556f, -115.4483f, 0f)); MakePlayerHolder(6, gameObject, statsUIElements, new Vector3(-253.6783f, -115.4483f, 0f)); MakePlayerHolder(7, gameObject, statsUIElements, new Vector3(-253.6783f, -0.7932f, 0f)); for (int i = 8; i < MainClass.newPlayerCount; i++) { MakePlayerHolder(i, gameObject, statsUIElements, new Vector3(10000f, 10000f, 0f)); } } public static void MakePlayerHolder(int index, GameObject original, EndOfGameStatUIElements uiElements, Vector3 localPosition) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (index + 1 <= MainClass.newPlayerCount) { GameObject val = Object.Instantiate<GameObject>(original); RectTransform component = val.GetComponent<RectTransform>(); RectTransform component2 = original.GetComponent<RectTransform>(); ((Transform)component).SetParent(((Transform)component2).parent); ((Transform)component).localScale = new Vector3(1f, 1f, 1f); ((Transform)component).localPosition = localPosition; GameObject gameObject = ((Component)val.transform.Find("PlayerName1")).gameObject; GameObject gameObject2 = ((Component)val.transform.Find("Notes")).gameObject; ((Transform)gameObject2.GetComponent<RectTransform>()).localPosition = new Vector3(-95.7222f, 43.3303f, 0f); GameObject gameObject3 = ((Component)val.transform.Find("Symbol")).gameObject; if (index >= uiElements.playerNamesText.Length) { Array.Resize(ref uiElements.playerNamesText, index + 1); Array.Resize(ref uiElements.playerStates, index + 1); Array.Resize(ref uiElements.playerNotesText, index + 1); } uiElements.playerNamesText[index] = gameObject.GetComponent<TextMeshProUGUI>(); uiElements.playerNotesText[index] = gameObject2.GetComponent<TextMeshProUGUI>(); uiElements.playerStates[index] = gameObject3.GetComponent<Image>(); } } } public class LANMenu : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__0_0; internal void <InitializeMenu>b__0_0() { TextMeshProUGUI component = GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings/JoinSettingsContainer/PrivatePublicDescription").GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(true); } } public static void InitializeMenu() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown CreateUI(); GameObject val = GameObject.Find("Canvas/MenuContainer/MainButtons/StartLAN"); if (!((Object)(object)val != (Object)null)) { return; } MainClass.StaticLogger.LogInfo((object)"LANMenu startLAN Patched"); val.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = val.GetComponent<Button>().onClick; object obj = <>c.<>9__0_0; if (obj == null) { UnityAction val2 = delegate { TextMeshProUGUI component = GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings/JoinSettingsContainer/PrivatePublicDescription").GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(true); }; <>c.<>9__0_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } private static GameObject CreateUI() { //IL_0066: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown if ((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings") != (Object)null) { return null; } GameObject val = GameObject.Find("Canvas/MenuContainer"); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings"); if ((Object)(object)val2 == (Object)null) { return null; } GameObject val3 = Object.Instantiate<GameObject>(val2, val2.transform.position, val2.transform.rotation, val.transform); ((Object)val3).name = "LobbyJoinSettings"; Transform val4 = val3.transform.Find("HostSettingsContainer"); if ((Object)(object)val4 != (Object)null) { ((Object)val4).name = "JoinSettingsContainer"; ((Object)((Component)val4).transform.Find("LobbyHostOptions")).name = "LobbyJoinOptions"; Object.Destroy((Object)(object)((Component)val3.transform.Find("ChallengeLeaderboard")).gameObject); Object.Destroy((Object)(object)((Component)val3.transform.Find("FilesPanel")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/OptionsNormal")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/AllowRemote")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/Local")).gameObject); Transform val5 = ((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/Header"); if ((Object)(object)val5 != (Object)null) { ((TMP_Text)((Component)val5).GetComponent<TextMeshProUGUI>()).text = "Join LAN Server:"; } Transform val6 = ((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/ServerNameField"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).transform.localPosition = new Vector3(0f, 15f, -6.5f); ((Component)val6).gameObject.SetActive(true); } TMP_InputField ip_field = ((Component)val6).GetComponent<TMP_InputField>(); if ((Object)(object)ip_field != (Object)null) { TextMeshProUGUI ip_placeholder = ((Component)ip_field.placeholder).GetComponent<TextMeshProUGUI>(); ((TMP_Text)ip_placeholder).text = ES3.Load<string>("LANIPAddress", "LCGeneralSaveData", "127.0.0.1"); Transform obj = ((Component)val4).transform.Find("Confirm"); Button val7 = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null); if ((Object)(object)val7 != (Object)null) { val7.onClick = new ButtonClickedEvent(); ((UnityEvent)val7.onClick).AddListener((UnityAction)delegate { string text = "127.0.0.1"; text = ((!(ip_field.text != "")) ? ((TMP_Text)ip_placeholder).text : ip_field.text); ES3.Save<string>("LANIPAddress", text, "LCGeneralSaveData"); GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(false); ((Component)NetworkManager.Singleton).GetComponent<UnityTransport>().ConnectionData.Address = text; MainClass.StaticLogger.LogInfo((object)("Listening to LAN server: " + text)); GameObject.Find("MenuManager").GetComponent<MenuManager>().StartAClient(); }); } } TextMeshProUGUI component = ((Component)((Component)val4).transform.Find("PrivatePublicDescription")).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } ((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions")).gameObject.SetActive(true); } return val3; } } [HarmonyPatch(typeof(GameNetworkManager), "SetConnectionDataBeforeConnecting")] public static class ConnectionDataPatch { public static void Postfix(ref GameNetworkManager __instance) { if (__instance.disableSteam) { NetworkManager.Singleton.NetworkConfig.ConnectionData = Encoding.ASCII.GetBytes(__instance.gameVersionNum + "," + MainClass.newPlayerCount); } } } [HarmonyPatch(typeof(GameNetworkManager), "OnLocalClientConnectionDisapproved")] public static class ConnectionDisapprovedPatch { private static int crewSizeMismatch; private static IEnumerator delayedReconnect() { yield return (object)new WaitForSeconds(0.5f); GameObject.Find("MenuManager").GetComponent<MenuManager>().StartAClient(); } private static void Prefix(ref GameNetworkManager __instance, ulong clientId) { crewSizeMismatch = 0; if (!__instance.disableSteam) { return; } try { if (!string.IsNullOrEmpty(NetworkManager.Singleton.DisconnectReason) && NetworkManager.Singleton.DisconnectReason.StartsWith("Crew size mismatch!")) { crewSizeMismatch = int.Parse(NetworkManager.Singleton.DisconnectReason.Split("Their size: ")[1].Split(". ")[0]); } } catch { } } private static void Postfix(ref GameNetworkManager __instance, ulong clientId) { if (__instance.disableSteam && crewSizeMismatch != 0) { MainClass.newPlayerCount = Mathf.Clamp(crewSizeMismatch, MainClass.minPlayerCount, MainClass.maxPlayerCount); GameObject.Find("MenuManager").GetComponent<MenuManager>().menuNotification.SetActive(false); Object.FindObjectOfType<MenuManager>().SetLoadingScreen(true, (RoomEnter)5, ""); ((MonoBehaviour)__instance).StartCoroutine(delayedReconnect()); crewSizeMismatch = 0; } } } public static class PluginInformation { public const string PLUGIN_NAME = "MoreCompany"; public const string PLUGIN_VERSION = "1.8.1"; public const string PLUGIN_GUID = "me.swipez.melonloader.morecompany"; } [BepInPlugin("me.swipez.melonloader.morecompany", "MoreCompany", "1.8.1")] public class MainClass : BaseUnityPlugin { public static int newPlayerCount = 32; public static int minPlayerCount = 4; public static int maxPlayerCount = 50; public static bool showCosmetics = true; public static List<PlayerControllerB> notSupposedToExistPlayers = new List<PlayerControllerB>(); public static Texture2D mainLogo; public static GameObject quickMenuScrollParent; public static GameObject playerEntry; public static GameObject crewCountUI; public static GameObject cosmeticGUIInstance; public static GameObject cosmeticButton; public static ManualLogSource StaticLogger; public static Dictionary<int, List<string>> playerIdsAndCosmetics = new Dictionary<int, List<string>>(); public static string cosmeticSavePath = Application.persistentDataPath + "/morecompanycosmetics.txt"; public static string moreCompanySave = Application.persistentDataPath + "/morecompanysave.txt"; public static string dynamicCosmeticsPath = Paths.PluginPath + "/MoreCompanyCosmetics"; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown StaticLogger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("me.swipez.melonloader.morecompany"); try { val.PatchAll(); } catch (Exception ex) { StaticLogger.LogError((object)("Failed to patch: " + ex)); } StaticLogger.LogInfo((object)"Loading MoreCompany..."); SteamFriends.OnGameLobbyJoinRequested += delegate(Lobby lobby, SteamId steamId) { newPlayerCount = ((Lobby)(ref lobby)).MaxMembers; }; SteamMatchmaking.OnLobbyEntered += delegate(Lobby lobby) { newPlayerCount = ((Lobby)(ref lobby)).MaxMembers; }; StaticLogger.LogInfo((object)("Checking: " + dynamicCosmeticsPath)); if (!Directory.Exists(dynamicCosmeticsPath)) { StaticLogger.LogInfo((object)"Creating cosmetics directory"); Directory.CreateDirectory(dynamicCosmeticsPath); } ReadSettingsFromFile(); ReadCosmeticsFromFile(); StaticLogger.LogInfo((object)"Read settings and cosmetics"); AssetBundle bundle = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.assets", Assembly.GetExecutingAssembly()); AssetBundle val2 = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.cosmetics", Assembly.GetExecutingAssembly()); CosmeticRegistry.LoadCosmeticsFromBundle(val2); val2.Unload(false); StaticLogger.LogInfo((object)"Loading USER COSMETICS..."); RecursiveCosmeticLoad(Paths.PluginPath); LoadAssets(bundle); StaticLogger.LogInfo((object)"Loaded MoreCompany FULLY"); } private void RecursiveCosmeticLoad(string directory) { string[] directories = Directory.GetDirectories(directory); foreach (string directory2 in directories) { RecursiveCosmeticLoad(directory2); } string[] files = Directory.GetFiles(directory); foreach (string text in files) { if (text.EndsWith(".cosmetics")) { AssetBundle val = AssetBundle.LoadFromFile(text); CosmeticRegistry.LoadCosmeticsFromBundle(val); val.Unload(false); } } } public static void EnablePlayerObjectsBasedOnConnected() { int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { for (int j = 0; j < connectedPlayersAmount + 1; j++) { if (!val.isPlayerControlled) { ((Component)val).gameObject.SetActive(false); } else { ((Component)val).gameObject.SetActive(true); } } } } private void ReadCosmeticsFromFile() { if (File.Exists(cosmeticSavePath)) { string[] array = File.ReadAllLines(cosmeticSavePath); string[] array2 = array; foreach (string item in array2) { CosmeticRegistry.locallySelectedCosmetics.Add(item); } } } public static void WriteCosmeticsToFile() { string text = ""; foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { text = text + locallySelectedCosmetic + "\n"; } File.WriteAllText(cosmeticSavePath, text); } public static void SaveSettingsToFile() { string text = ""; text = text + newPlayerCount + "\n"; text = text + showCosmetics + "\n"; File.WriteAllText(moreCompanySave, text); } public static void ReadSettingsFromFile() { if (File.Exists(moreCompanySave)) { string[] array = File.ReadAllLines(moreCompanySave); try { newPlayerCount = Mathf.Clamp(int.Parse(array[0]), minPlayerCount, maxPlayerCount); showCosmetics = bool.Parse(array[1]); } catch (Exception) { StaticLogger.LogError((object)"Failed to read settings from file, resetting to default"); newPlayerCount = 32; showCosmetics = true; } } } private static void LoadAssets(AssetBundle bundle) { if (Object.op_Implicit((Object)(object)bundle)) { mainLogo = bundle.LoadPersistentAsset<Texture2D>("assets/morecompanyassets/morecompanytransparentred.png"); quickMenuScrollParent = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/quickmenuoverride.prefab"); playerEntry = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/playerlistslot.prefab"); cosmeticGUIInstance = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/testoverlay.prefab"); cosmeticButton = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/cosmeticinstance.prefab"); crewCountUI = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/crewcountfield.prefab"); bundle.Unload(false); } } public static void ResizePlayerCache(Dictionary<uint, Dictionary<int, NetworkObject>> ScenePlacedObjects) { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown StartOfRound instance = StartOfRound.Instance; if (instance.allPlayerObjects.Length != newPlayerCount) { StaticLogger.LogInfo((object)$"ResizePlayerCache: {newPlayerCount}"); playerIdsAndCosmetics.Clear(); uint num = 10000u; int num2 = instance.allPlayerObjects.Length; int num3 = newPlayerCount - num2; Array.Resize(ref instance.allPlayerObjects, newPlayerCount); Array.Resize(ref instance.allPlayerScripts, newPlayerCount); Array.Resize(ref instance.gameStats.allPlayerStats, newPlayerCount); Array.Resize(ref instance.playerSpawnPositions, newPlayerCount); StaticLogger.LogInfo((object)$"Resizing player cache from {num2} to {newPlayerCount} with difference of {num3}"); if (num3 > 0) { GameObject val = instance.allPlayerObjects[3]; for (int i = 0; i < num3; i++) { uint num4 = num + (uint)i; GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.parent); NetworkObject component = val2.GetComponent<NetworkObject>(); ReflectionUtils.SetFieldValue(component, "GlobalObjectIdHash", num4); Scene scene = ((Component)component).gameObject.scene; int handle = ((Scene)(ref scene)).handle; uint num5 = num4; if (!ScenePlacedObjects.ContainsKey(num5)) { ScenePlacedObjects.Add(num5, new Dictionary<int, NetworkObject>()); } if (ScenePlacedObjects[num5].ContainsKey(handle)) { string arg = (((Object)(object)ScenePlacedObjects[num5][handle] != (Object)null) ? ((Object)ScenePlacedObjects[num5][handle]).name : "Null Entry"); throw new Exception(((Object)component).name + " tried to registered with ScenePlacedObjects which already contains " + string.Format("the same {0} value {1} for {2}!", "GlobalObjectIdHash", num5, arg)); } ScenePlacedObjects[num5].Add(handle, component); ((Object)val2).name = $"Player ({4 + i})"; PlayerControllerB componentInChildren = val2.GetComponentInChildren<PlayerControllerB>(); notSupposedToExistPlayers.Add(componentInChildren); componentInChildren.playerClientId = (ulong)(4 + i); componentInChildren.playerUsername = $"Player #{componentInChildren.playerClientId}"; componentInChildren.isPlayerControlled = false; componentInChildren.isPlayerDead = false; componentInChildren.DropAllHeldItems(false, false); componentInChildren.TeleportPlayer(instance.notSpawnedPosition.position, false, 0f, false, true); UnlockableSuit.SwitchSuitForPlayer(componentInChildren, 0, false); instance.allPlayerObjects[num2 + i] = val2; instance.gameStats.allPlayerStats[num2 + i] = new PlayerStats(); instance.allPlayerScripts[num2 + i] = componentInChildren; instance.playerSpawnPositions[num2 + i] = instance.playerSpawnPositions[3]; } } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { ((TMP_Text)val3.usernameBillboardText).text = val3.playerUsername; } } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] public static class PlayerControllerBStartPatch { public static void Postfix(ref PlayerControllerB __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "nearByPlayers", value); } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesServerRpc")] public static class SendNewPlayerValuesServerRpcPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt virtual void System.Collections.Generic.List<ulong>::Add(ulong item)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")] public static class SendNewPlayerValuesClientRpcPatch { public static void Prefix(PlayerControllerB __instance, ref ulong[] playerSteamIds) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || StartOfRound.Instance.mapScreen.radarTargets.Count == StartOfRound.Instance.allPlayerScripts.Length) { return; } List<PlayerControllerB> useless = new List<PlayerControllerB>(); foreach (PlayerControllerB notSupposedToExistPlayer in MainClass.notSupposedToExistPlayers) { if (Object.op_Implicit((Object)(object)notSupposedToExistPlayer)) { StartOfRound.Instance.mapScreen.radarTargets.Add(new TransformAndName(((Component)notSupposedToExistPlayer).transform, notSupposedToExistPlayer.playerUsername, false)); } else { useless.Add(notSupposedToExistPlayer); } } MainClass.notSupposedToExistPlayers.RemoveAll((PlayerControllerB x) => useless.Contains(x)); } } [HarmonyPatch(typeof(HUDManager), "SyncAllPlayerLevelsServerRpc", new Type[] { })] public static class SyncAllPlayerLevelsPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch] public static class SyncShipUnlockablesPatch { [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ServerTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; int num = 0; foreach (CodeInstruction instruction in instructions) { if (num != 2) { if (!flag && ((object)instruction).ToString() == "callvirt bool Unity.Netcode.NetworkManager::get_IsHost()") { flag = true; } else if (((object)instruction).ToString().StartsWith("ldc.i4.4 NULL")) { num++; CodeInstruction val = new CodeInstruction(instruction); val.opcode = OpCodes.Ldsfld; val.operand = AccessTools.Field(typeof(MainClass), "newPlayerCount"); list.Add(val); continue; } } list.Add(instruction); } return list.AsEnumerable(); } [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ClientTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt void UnityEngine.Renderer::set_sharedMaterial(UnityEngine.Material value)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(NetworkSceneManager), "PopulateScenePlacedObjects")] public static class ScenePlacedObjectsInitPatch { public static void Postfix(ref Dictionary<uint, Dictionary<int, NetworkObject>> ___ScenePlacedObjects) { MainClass.ResizePlayerCache(___ScenePlacedObjects); } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] public static class LobbyDataJoinablePatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call int Steamworks.Data.Lobby::get_MemberCount()") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "maxPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SteamMatchmaking), "CreateLobbyAsync")] public static class LobbyThingPatch { public static void Prefix(ref int maxMembers) { MainClass.ReadSettingsFromFile(); maxMembers = MainClass.newPlayerCount; } } [HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")] public static class ConnectionApproval { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "ldfld int GameNetworkManager::connectedPlayers") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } private static void Postfix(ref GameNetworkManager __instance, ref ConnectionApprovalRequest request, ref ConnectionApprovalResponse response) { if (response.Approved && __instance.disableSteam) { string @string = Encoding.ASCII.GetString(request.Payload); string[] array = @string.Split(","); if (!string.IsNullOrEmpty(@string) && (array.Length < 2 || array[1] != MainClass.newPlayerCount.ToString())) { response.Reason = $"Crew size mismatch! Their size: {MainClass.newPlayerCount}. Your size: {array[1]}"; response.Approved = false; } } } } public class MimicPatches { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetEnemyOutside")] public class MaskedPlayerEnemyOnEnablePatch { public static void Postfix(MaskedPlayerEnemy __instance) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.mimickingPlayer != (Object)null) || !MainClass.showCosmetics) { return; } List<string> list = MainClass.playerIdsAndCosmetics[(int)__instance.mimickingPlayer.playerClientId]; Transform val = ((Component)__instance).transform.Find("ScavengerModel").Find("metarig"); CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } component = ((Component)val).gameObject.AddComponent<CosmeticApplication>(); foreach (string item in list) { component.ApplyCosmetic(item, startEnabled: true); } foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } } } } public class ReflectionUtils { public static void InvokeMethod(object obj, string methodName, object[] parameters) { Type type = obj.GetType(); MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); method.Invoke(obj, parameters); } public static void InvokeMethod(object obj, Type forceType, string methodName, object[] parameters) { MethodInfo method = forceType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); method.Invoke(obj, parameters); } public static void SetPropertyValue(object obj, string propertyName, object value) { Type type = obj.GetType(); PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); property.SetValue(obj, value); } public static T InvokeMethod<T>(object obj, string methodName, object[] parameters) { Type type = obj.GetType(); MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (T)method.Invoke(obj, parameters); } public static T GetFieldValue<T>(object obj, string fieldName) { Type type = obj.GetType(); FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (T)field.GetValue(obj); } public static void SetFieldValue(object obj, string fieldName, object value) { Type type = obj.GetType(); FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field.SetValue(obj, value); } } [HarmonyPatch(typeof(ShipTeleporter), "Awake")] public static class ShipTeleporterAwakePatch { public static void Postfix(ref ShipTeleporter __instance) { int[] array = new int[MainClass.newPlayerCount]; for (int i = 0; i < MainClass.newPlayerCount; i++) { array[i] = -1; } ReflectionUtils.SetFieldValue(__instance, "playersBeingTeleported", array); } } [HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")] public static class SpectatePatches { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SoundManager), "Start")] public static class SoundManagerStartPatch { public static void Postfix(ref SoundManager __instance) { Array.Resize(ref __instance.playerVoicePitchLerpSpeed, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoicePitchTargets, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoicePitches, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoiceVolumes, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoiceMixers, MainClass.newPlayerCount); AudioMixerGroup val = ((IEnumerable<AudioMixerGroup>)Resources.FindObjectsOfTypeAll<AudioMixerGroup>()).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name.Contains("Voice"))); for (int i = 0; i < MainClass.newPlayerCount; i++) { __instance.playerVoicePitchLerpSpeed[i] = 3f; __instance.playerVoicePitchTargets[i] = 1f; __instance.playerVoicePitches[i] = 1f; __instance.playerVoiceVolumes[i] = 0.5f; if (!Object.op_Implicit((Object)(object)__instance.playerVoiceMixers[i])) { __instance.playerVoiceMixers[i] = val; } } } } [HarmonyPatch(typeof(StartOfRound), "GetPlayerSpawnPosition")] public static class SpawnPositionClampPatch { public static void Prefix(ref StartOfRound __instance, ref int playerNum, bool simpleTeleport = false) { if (!Object.op_Implicit((Object)(object)__instance.playerSpawnPositions[playerNum])) { playerNum = __instance.playerSpawnPositions.Length - 1; } } } [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] public static class OnClientConnectedPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt virtual bool System.Collections.Generic.List<int>::Contains(int item)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class LoadLobbyListAndFilterPatch { private static void Postfix() { LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>(); LobbySlot[] array2 = array; foreach (LobbySlot val in array2) { ((TMP_Text)val.playerCount).text = $"{((Lobby)(ref val.thisLobby)).MemberCount} / {((Lobby)(ref val.thisLobby)).MaxMembers}"; } } } [HarmonyPatch(typeof(GameNetworkManager), "Awake")] public static class GameNetworkAwakePatch { public static int originalVersion; public static void Postfix(GameNetworkManager __instance) { originalVersion = __instance.gameVersionNum; if (!AssemblyChecker.HasAssemblyLoaded("lc_api")) { __instance.gameVersionNum = 9999; } } } [HarmonyPatch(typeof(MenuManager), "Awake")] public static class MenuManagerVersionDisplayPatch { public static void Postfix(MenuManager __instance) { if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)__instance.versionNumberText != (Object)null) { ((TMP_Text)__instance.versionNumberText).text = $"v{GameNetworkAwakePatch.originalVersion} (MC)"; } } } } namespace MoreCompany.Utils { public class AssemblyChecker { public static bool HasAssemblyLoaded(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly[] array = assemblies; foreach (Assembly assembly in array) { if (assembly.GetName().Name.ToLower().Equals(name)) { return true; } } return false; } } public class BundleUtilities { public static byte[] GetResourceBytes(string filename, Assembly assembly) { string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.Contains(filename)) { continue; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); return array; } return null; } public static AssetBundle LoadBundleFromInternalAssembly(string filename, Assembly assembly) { return AssetBundle.LoadFromMemory(GetResourceBytes(filename, assembly)); } } public static class AssetBundleExtension { public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object { Object val = bundle.LoadAsset(name); if (val != (Object)null) { val.hideFlags = (HideFlags)32; return (T)(object)val; } return default(T); } } } namespace MoreCompany.Cosmetics { public class CosmeticApplication : MonoBehaviour { public Transform head; public Transform hip; public Transform lowerArmRight; public Transform shinLeft; public Transform shinRight; public Transform chest; public List<CosmeticInstance> spawnedCosmetics = new List<CosmeticInstance>(); public void Awake() { head = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003") .Find("spine.004"); chest = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003"); lowerArmRight = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003") .Find("shoulder.R") .Find("arm.R_upper") .Find("arm.R_lower"); hip = ((Component)this).transform.Find("spine"); shinLeft = ((Component)this).transform.Find("spine").Find("thigh.L").Find("shin.L"); shinRight = ((Component)this).transform.Find("spine").Find("thigh.R").Find("shin.R"); RefreshAllCosmeticPositions(); } private void OnDisable() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.SetActive(false); } } private void OnEnable() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.SetActive(true); } } public void ClearCosmetics() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { Object.Destroy((Object)(object)((Component)spawnedCosmetic).gameObject); } spawnedCosmetics.Clear(); } public void ApplyCosmetic(string cosmeticId, bool startEnabled) { if (CosmeticRegistry.cosmeticInstances.ContainsKey(cosmeticId)) { CosmeticInstance cosmeticInstance = CosmeticRegistry.cosmeticInstances[cosmeticId]; GameObject val = Object.Instantiate<GameObject>(((Component)cosmeticInstance).gameObject); val.SetActive(startEnabled); CosmeticInstance component = val.GetComponent<CosmeticInstance>(); spawnedCosmetics.Add(component); if (startEnabled) { ParentCosmetic(component); } } } public void RefreshAllCosmeticPositions() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ParentCosmetic(spawnedCosmetic); } } private void ParentCosmetic(CosmeticInstance cosmeticInstance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Transform val = null; switch (cosmeticInstance.cosmeticType) { case CosmeticType.HAT: val = head; break; case CosmeticType.R_LOWER_ARM: val = lowerArmRight; break; case CosmeticType.HIP: val = hip; break; case CosmeticType.L_SHIN: val = shinLeft; break; case CosmeticType.R_SHIN: val = shinRight; break; case CosmeticType.CHEST: val = chest; break; } ((Component)cosmeticInstance).transform.position = val.position; ((Component)cosmeticInstance).transform.rotation = val.rotation; ((Component)cosmeticInstance).transform.parent = val; } } public class CosmeticInstance : MonoBehaviour { public CosmeticType cosmeticType; public string cosmeticId; public Texture2D icon; } public class CosmeticGeneric { public virtual string gameObjectPath { get; } public virtual string cosmeticId { get; } public virtual string textureIconPath { get; } public CosmeticType cosmeticType { get; } public void LoadFromBundle(AssetBundle bundle) { GameObject val = bundle.LoadPersistentAsset<GameObject>(gameObjectPath); Texture2D icon = bundle.LoadPersistentAsset<Texture2D>(textureIconPath); CosmeticInstance cosmeticInstance = val.AddComponent<CosmeticInstance>(); cosmeticInstance.cosmeticId = cosmeticId; cosmeticInstance.icon = icon; cosmeticInstance.cosmeticType = cosmeticType; MainClass.StaticLogger.LogInfo((object)("Loaded cosmetic: " + cosmeticId + " from bundle: " + ((Object)bundle).name)); CosmeticRegistry.cosmeticInstances.Add(cosmeticId, cosmeticInstance); } } public enum CosmeticType { HAT, WRIST, CHEST, R_LOWER_ARM, HIP, L_SHIN, R_SHIN } public class CosmeticRegistry { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__8_0; public static UnityAction <>9__8_1; internal void <SpawnCosmeticGUI>b__8_0() { MainClass.showCosmetics = true; MainClass.SaveSettingsToFile(); } internal void <SpawnCosmeticGUI>b__8_1() { MainClass.showCosmetics = false; MainClass.SaveSettingsToFile(); } } public static Dictionary<string, CosmeticInstance> cosmeticInstances = new Dictionary<string, CosmeticInstance>(); public static GameObject cosmeticGUI; private static GameObject displayGuy; private static CosmeticApplication cosmeticApplication; public static List<string> locallySelectedCosmetics = new List<string>(); public const float COSMETIC_PLAYER_SCALE_MULT = 0.38f; public static void LoadCosmeticsFromBundle(AssetBundle bundle) { string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (!text.EndsWith(".prefab")) { continue; } GameObject val = bundle.LoadPersistentAsset<GameObject>(text); CosmeticInstance component = val.GetComponent<CosmeticInstance>(); if (!((Object)(object)component == (Object)null)) { MainClass.StaticLogger.LogInfo((object)("Loaded cosmetic: " + component.cosmeticId + " from bundle")); if (cosmeticInstances.ContainsKey(component.cosmeticId)) { MainClass.StaticLogger.LogError((object)("Duplicate cosmetic id: " + component.cosmeticId)); } else { cosmeticInstances.Add(component.cosmeticId, component); } } } } public static void LoadCosmeticsFromAssembly(Assembly assembly, AssetBundle bundle) { Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(CosmeticGeneric))) { CosmeticGeneric cosmeticGeneric = (CosmeticGeneric)type.GetConstructor(new Type[0]).Invoke(new object[0]); cosmeticGeneric.LoadFromBundle(bundle); } } } public static void SpawnCosmeticGUI() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown cosmeticGUI = Object.Instantiate<GameObject>(MainClass.cosmeticGUIInstance); ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale")).transform.localScale = new Vector3(2f, 2f, 2f); displayGuy = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("ObjectHolder") .Find("ScavengerModel") .Find("metarig")).gameObject; cosmeticApplication = displayGuy.AddComponent<CosmeticApplication>(); GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("EnableButton")).gameObject; ButtonClickedEvent onClick = gameObject.GetComponent<Button>().onClick; object obj = <>c.<>9__8_0; if (obj == null) { UnityAction val = delegate { MainClass.showCosmetics = true; MainClass.SaveSettingsToFile(); }; <>c.<>9__8_0 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject gameObject2 = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("DisableButton")).gameObject; ButtonClickedEvent onClick2 = gameObject2.GetComponent<Button>().onClick; object obj2 = <>c.<>9__8_1; if (obj2 == null) { UnityAction val2 = delegate { MainClass.showCosmetics = false; MainClass.SaveSettingsToFile(); }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); if (MainClass.showCosmetics) { gameObject.SetActive(false); gameObject2.SetActive(true); } else { gameObject.SetActive(true); gameObject2.SetActive(false); } PopulateCosmetics(); UpdateCosmeticsOnDisplayGuy(startEnabled: false); } public static void PopulateCosmetics() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("CosmeticsHolder") .Find("Content")).gameObject; List<Transform> list = new List<Transform>(); for (int i = 0; i < gameObject.transform.childCount; i++) { list.Add(gameObject.transform.GetChild(i)); } foreach (Transform item in list) { Object.Destroy((Object)(object)((Component)item).gameObject); } foreach (KeyValuePair<string, CosmeticInstance> cosmeticInstance in cosmeticInstances) { GameObject val = Object.Instantiate<GameObject>(MainClass.cosmeticButton, gameObject.transform); val.transform.localScale = Vector3.one; GameObject disabledOverlay = ((Component)val.transform.Find("Deselected")).gameObject; disabledOverlay.SetActive(true); GameObject enabledOverlay = ((Component)val.transform.Find("Selected")).gameObject; enabledOverlay.SetActive(true); if (IsEquipped(cosmeticInstance.Value.cosmeticId)) { enabledOverlay.SetActive(true); disabledOverlay.SetActive(false); } else { enabledOverlay.SetActive(false); disabledOverlay.SetActive(true); } RawImage component = ((Component)val.transform.Find("Icon")).GetComponent<RawImage>(); component.texture = (Texture)(object)cosmeticInstance.Value.icon; Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { ToggleCosmetic(cosmeticInstance.Value.cosmeticId); if (IsEquipped(cosmeticInstance.Value.cosmeticId)) { enabledOverlay.SetActive(true); disabledOverlay.SetActive(false); } else { enabledOverlay.SetActive(false); disabledOverlay.SetActive(true); } MainClass.WriteCosmeticsToFile(); UpdateCosmeticsOnDisplayGuy(startEnabled: true); }); } } private static Color HexToColor(string hex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0016: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ColorUtility.TryParseHtmlString(hex, ref result); return result; } public static void UpdateCosmeticsOnDisplayGuy(bool startEnabled) { cosmeticApplication.ClearCosmetics(); foreach (string locallySelectedCosmetic in locallySelectedCosmetics) { cosmeticApplication.ApplyCosmetic(locallySelectedCosmetic, startEnabled); } foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics) { RecursiveLayerChange(((Component)spawnedCosmetic).transform, 5); } } private static void RecursiveLayerChange(Transform transform, int layer) { ((Component)transform).gameObject.layer = layer; for (int i = 0; i < transform.childCount; i++) { RecursiveLayerChange(transform.GetChild(i), layer); } } public static bool IsEquipped(string cosmeticId) { return locallySelectedCosmetics.Contains(cosmeticId); } public static void ToggleCosmetic(string cosmeticId) { if (locallySelectedCosmetics.Contains(cosmeticId)) { locallySelectedCosmetics.Remove(cosmeticId); } else { locallySelectedCosmetics.Add(cosmeticId); } } } } namespace MoreCompany.Behaviors { public class SpinDragger : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler { public float speed = 1f; private Vector2 lastMousePosition; private bool dragging = false; private Vector3 rotationalVelocity = Vector3.zero; public float dragSpeed = 1f; public float airDrag = 0.99f; public GameObject target; private void Update() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //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_002b: 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_0038: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006e: Unknown result type (might be due to invalid IL or missing references) if (dragging) { Vector3 val = Vector2.op_Implicit(((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue() - lastMousePosition); rotationalVelocity += new Vector3(0f, 0f - val.x, 0f) * dragSpeed; lastMousePosition = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); } rotationalVelocity *= airDrag; target.transform.Rotate(rotationalVelocity * Time.deltaTime * speed, (Space)0); } public void OnPointerDown(PointerEventData eventData) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) lastMousePosition = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); dragging = true; } public void OnPointerUp(PointerEventData eventData) { dragging = false; } } }
plugins/MoreEmotes1.3.3.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using MoreEmotes.Patch; using MoreEmotes.Scripts; using RuntimeNetcodeRPCValidator; using TMPro; using Tools; using Unity.Netcode; using UnityEngine; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FuckYouMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FuckYouMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5ecc2bf2-af12-4e83-a6f1-cf2eacbf3060")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Tools { public class Ref { public static object GetInstanceField(Type type, object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField(fieldName, bindingAttr); return field.GetValue(instance); } public static object Method(object instance, string methodName, params object[] args) { MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { return method.Invoke(instance, args); } return null; } } public class D : MonoBehaviour { public static bool Debug; public static void L(string msg) { if (Debug) { Debug.Log((object)msg); } } public static void W(string msg) { if (Debug) { Debug.LogWarning((object)msg); } } } } namespace MoreEmotes { [BepInPlugin("MoreEmotes", "MoreEmotes-Sligili", "1.3.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MoreEmotesInitialization : BaseUnityPlugin { private Harmony _harmony; private NetcodeValidator netcodeValidator; private ConfigEntry<string> config_KeyWheel; private ConfigEntry<string> config_KeyWheel_c; private ConfigEntry<bool> config_InventoryCheck; private ConfigEntry<bool> config_UseConfigFile; private ConfigEntry<string> config_KeyEmote3; private ConfigEntry<string> config_KeyEmote4; private ConfigEntry<string> config_KeyEmote5; private ConfigEntry<string> config_KeyEmote6; private ConfigEntry<string> config_KeyEmote7; private ConfigEntry<string> config_KeyEmote8; private ConfigEntry<string> config_KeyEmote9; private ConfigEntry<string> config_KeyEmote10; private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreEmotes loaded"); LoadAssetBundles(); LoadAssets(); ConfigFile(); SearchForIncompatibleMods(); _harmony = new Harmony("MoreEmotes"); _harmony.PatchAll(typeof(EmotePatch)); netcodeValidator = new NetcodeValidator("MoreEmotes"); netcodeValidator.PatchAll(); netcodeValidator.BindToPreExistingObjectByBehaviour<SignEmoteText, PlayerControllerB>(); netcodeValidator.BindToPreExistingObjectByBehaviour<SyncAnimatorToOthers, PlayerControllerB>(); } private void LoadAssetBundles() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animationsbundle"); string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animatorbundle"); try { EmotePatch.AnimationsBundle = AssetBundle.LoadFromFile(text); EmotePatch.AnimatorBundle = AssetBundle.LoadFromFile(text2); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load AssetBundles. Make sure \"animatorsbundle\" and \"animationsbundle\" are inside the MoreEmotes folder.\nError: " + ex.Message)); } } private void LoadAssets() { string path = "Assets/MoreEmotes"; EmotePatch.local = EmotePatch.AnimatorBundle.LoadAsset<RuntimeAnimatorController>(Path.Combine(path, "NEWmetarig.controller")); EmotePatch.others = EmotePatch.AnimatorBundle.LoadAsset<RuntimeAnimatorController>(Path.Combine(path, "NEWmetarigOtherPlayers.controller")); MoreEmotesEvents.ClapSounds[0] = EmotePatch.AnimationsBundle.LoadAsset<AudioClip>(Path.Combine(path, "SingleClapEmote1.wav")); MoreEmotesEvents.ClapSounds[1] = EmotePatch.AnimationsBundle.LoadAsset<AudioClip>(Path.Combine(path, "SingleClapEmote2.wav")); EmotePatch.SettingsPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>(Path.Combine(path, "Resources/MoreEmotesPanel.prefab")); EmotePatch.ButtonPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>(Path.Combine(path, "Resources/MoreEmotesButton.prefab")); EmotePatch.LegsPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>(Path.Combine(path, "Resources/plegs.prefab")); EmotePatch.SignPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>(Path.Combine(path, "Resources/Sign.prefab")); EmotePatch.SignUIPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>(Path.Combine(path, "Resources/SignTextUI.prefab")); EmotePatch.WheelPrefab = EmotePatch.AnimationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesMenu.prefab"); } private void ConfigFile() { EmotePatch.ConfigFile_Keybinds = new string[32]; config_KeyWheel = ((BaseUnityPlugin)this).Config.Bind<string>("EMOTE WHEEL", "Key", "v", (ConfigDescription)null); EmotePatch.ConfigFile_WheelKeybind = config_KeyWheel.Value; config_KeyWheel_c = ((BaseUnityPlugin)this).Config.Bind<string>("EMOTE WHEEL (Controller)", "Key", "leftshoulder", (ConfigDescription)null); EmotePatch.ConfigFile_WheelKeybind_controller = config_KeyWheel_c.Value; config_InventoryCheck = ((BaseUnityPlugin)this).Config.Bind<bool>("OTHERS", "InventoryCheck", true, "Prevents some emotes from performing while holding any item/scrap"); EmotePatch.ConfigFile_InventoryCheck = config_InventoryCheck.Value; config_UseConfigFile = ((BaseUnityPlugin)this).Config.Bind<bool>("OTHERS", "ConfigFile", false, "Ignores all in-game saved settings and instead uses the config file"); EmotePatch.UseConfigFile = config_UseConfigFile.Value; config_KeyEmote3 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Middle Finger", "3", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[2] = config_KeyEmote3.Value.Replace(" ", ""); config_KeyEmote4 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "The Griddy", "6", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[5] = config_KeyEmote4.Value.Replace(" ", ""); config_KeyEmote5 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Shy", "5", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[4] = config_KeyEmote5.Value.Replace(" ", ""); config_KeyEmote6 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Clap", "4", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[3] = config_KeyEmote6.Value.Replace(" ", ""); config_KeyEmote7 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Twerk", "7", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[6] = config_KeyEmote7.Value.Replace(" ", ""); config_KeyEmote8 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Salute", "8", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[7] = config_KeyEmote8.Value.Replace(" ", ""); config_KeyEmote9 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Prisyadka", "9", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[8] = config_KeyEmote9.Value.Replace(" ", ""); config_KeyEmote10 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Sign", "0", (ConfigDescription)null); EmotePatch.ConfigFile_Keybinds[9] = config_KeyEmote10.Value.Replace(" ", ""); } private void SearchForIncompatibleMods() { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { BepInPlugin metadata = pluginInfo.Value.Metadata; if (metadata.GUID.Equals("com.malco.lethalcompany.moreshipupgrades", StringComparison.OrdinalIgnoreCase) || metadata.GUID.Equals("Stoneman.LethalProgression", StringComparison.OrdinalIgnoreCase)) { EmotePatch.IncompatibleStuff = true; break; } } } } public static class PluginInfo { public const string GUID = "MoreEmotes"; public const string NAME = "MoreEmotes-Sligili"; public const string VER = "1.3.3"; } } namespace MoreEmotes.Patch { public enum Emotes { D_Sign = 1010, D_Clap = 1004, D_Middle_Finger = 1003, Dance = 1, Point = 2, Middle_Finger = 3, Clap = 4, Shy = 5, The_Griddy = 6, Twerk = 7, Salute = 8, Prisyadka = 9, Sign = 10 } public class EmotePatch { public static AssetBundle AnimationsBundle; public static AssetBundle AnimatorBundle; public static RuntimeAnimatorController local; public static RuntimeAnimatorController others; public static bool UseConfigFile; public static string[] ConfigFile_Keybinds; public static string ConfigFile_WheelKeybind; public static string ConfigFile_WheelKeybind_controller; public static bool ConfigFile_InventoryCheck; public static string EmoteWheelKeyboard; public static string EmoteWheelController; public static bool IncompatibleStuff; private static int s_currentEmoteID = 0; private static float s_defaultPlayerSpeed; private static bool[] s_wasPerformingEmote = new bool[32]; public static bool IsEmoteWheelOpen; private static bool s_isPlayerFirstFrame; private static bool s_isFirstTimeOnMenu; private static bool s_isPlayerSpawning; public const int AlternateEmoteIDOffset = 1000; private static int[] s_doubleEmotesIDS = new int[2] { 3, 4 }; public static bool LocalArmsSeparatedFromCamera; private static Transform s_freeArmsTarget; private static Transform s_lockedArmsTarget; private static CallbackContext emptyContext; public static GameObject ButtonPrefab; public static GameObject SettingsPrefab; public static GameObject LegsPrefab; public static GameObject SignPrefab; public static GameObject SignUIPrefab; public static GameObject WheelPrefab; private static GameObject s_localPlayerLevelBadge; private static GameObject s_localPlayerBetaBadge; private static Transform s_legsMesh; private static EmoteWheel s_selectionWheel; private static SignUI s_customSignInputField; private static SyncAnimatorToOthers s_syncAnimator; private static int _AlternateEmoteIDOffset => 1000; private static void InstantiateSettingsMenu(Transform container) { RebindButton.ConfigFile_Keybinds = ConfigFile_Keybinds; if (!PlayerPrefs.HasKey("InvCheck") || UseConfigFile) { PlayerPrefs.SetInt("InvCheck", ConfigFile_InventoryCheck ? 1 : 0); } ToggleButton.s_InventoryCheck = (UseConfigFile ? ConfigFile_InventoryCheck : (PlayerPrefs.GetInt("InvCheck") == 1)); SetupUI.UseConfigFile = UseConfigFile; SetupUI.InventoryCheck = ToggleButton.s_InventoryCheck; GameObject gameObject = ((Component)((Component)container).transform.Find("SettingsPanel")).gameObject; Object.Instantiate<GameObject>(ButtonPrefab, gameObject.transform).transform.SetSiblingIndex(7); Object.Instantiate<GameObject>(SettingsPrefab, gameObject.transform); gameObject.AddComponent<SetupUI>(); } private static void CheckEmoteInput(string keyBind, bool needsEmptyHands, int emoteID, PlayerControllerB player) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Emotes emotes = (Emotes)emoteID; string text = emotes.ToString(); bool flag; if (UseConfigFile) { flag = ConfigFile_InventoryCheck; keyBind = ConfigFile_Keybinds[emoteID - 1]; } else { flag = PlayerPrefs.GetInt("InvCheck") == 1; if (PlayerPrefs.HasKey(text)) { keyBind = PlayerPrefs.GetString(text); } else { PlayerPrefs.SetString(text, keyBind); } } if (!keyBind.Equals(string.Empty) && InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[keyBind], 0f) && (!player.isHoldingObject || !needsEmptyHands || !flag)) { player.PerformEmote(emptyContext, emoteID); } } private static void CheckWheelInput(string keybind, string controller, PlayerControllerB player) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; if (Gamepad.all.Count != 0 && !controller.Equals(string.Empty)) { flag = InputControlExtensions.IsPressed(((InputControl)Gamepad.current)[controller], 0f); } if (keybind != string.Empty) { flag2 = InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[keybind], 0f) && !((ButtonControl)Keyboard.current[(Key)55]).wasPressedThisFrame; } bool flag3 = flag || flag2; if (flag3 && !IsEmoteWheelOpen && !player.isPlayerDead && !player.inTerminalMenu && !player.quickMenuManager.isMenuOpen && !player.isTypingChat && !s_customSignInputField.IsSignUIOpen) { IsEmoteWheelOpen = true; Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; ((Component)s_selectionWheel).gameObject.SetActive(IsEmoteWheelOpen); player.disableLookInput = true; } else { if (!IsEmoteWheelOpen || (flag3 && !player.quickMenuManager.isMenuOpen && !player.isTypingChat && !s_customSignInputField.IsSignUIOpen)) { return; } int selectedEmoteID = s_selectionWheel.SelectedEmoteID; if (!player.quickMenuManager.isMenuOpen && !s_customSignInputField.IsSignUIOpen) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } if (!player.isPlayerDead && !player.quickMenuManager.isMenuOpen) { if (selectedEmoteID <= 3 || selectedEmoteID == 6 || !ConfigFile_InventoryCheck) { player.PerformEmote(emptyContext, selectedEmoteID); } else if (!player.isHoldingObject) { player.PerformEmote(emptyContext, selectedEmoteID); } } if (!s_customSignInputField.IsSignUIOpen) { player.disableLookInput = false; } IsEmoteWheelOpen = false; ((Component)s_selectionWheel).gameObject.SetActive(IsEmoteWheelOpen); } } private static void OnFirstLocalPlayerFrameWithNewAnimator(PlayerControllerB player) { s_isPlayerFirstFrame = false; TurnControllerIntoAnOverrideController(player.playerBodyAnimator.runtimeAnimatorController); s_syncAnimator = ((Component)player).GetComponent<SyncAnimatorToOthers>(); s_customSignInputField.Player = player; s_freeArmsTarget = Object.Instantiate<Transform>(player.localArmsRotationTarget, player.localArmsRotationTarget.parent.parent); s_lockedArmsTarget = player.localArmsRotationTarget; Transform val = ((Component)player).transform.Find("ScavengerModel").Find("metarig").Find("spine") .Find("spine.001") .Find("spine.002") .Find("spine.003"); s_localPlayerLevelBadge = ((Component)val.Find("LevelSticker")).gameObject; s_localPlayerBetaBadge = ((Component)val.Find("BetaBadge")).gameObject; player.SpawnPlayerAnimation(); } private static void SpawnSign(PlayerControllerB player) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(SignPrefab, ((Component)((Component)((Component)player).transform.Find("ScavengerModel")).transform.Find("metarig")).transform); val.transform.SetSiblingIndex(6); ((Object)val).name = "Sign"; val.transform.localPosition = new Vector3(0.029f, -0.45f, 1.3217f); val.transform.localRotation = Quaternion.Euler(65.556f, 180f, 180f); } private static void SpawnLegs(PlayerControllerB player) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(LegsPrefab, ((Component)((Component)player.playerBodyAnimator).transform.parent).transform); s_legsMesh = val.transform.Find("Mesh"); ((Component)s_legsMesh).transform.parent = ((Component)player.playerBodyAnimator).transform.parent; ((Object)s_legsMesh).name = "LEGS"; GameObject gameObject = ((Component)val.transform.Find("Armature")).gameObject; gameObject.transform.parent = ((Component)player.playerBodyAnimator).transform; ((Object)gameObject).name = "FistPersonLegs"; gameObject.transform.position = new Vector3(0f, 0.197f, 0f); gameObject.transform.localScale = new Vector3(13.99568f, 13.99568f, 13.99568f); Object.Destroy((Object)(object)val); } private static void ResetIKWeights(PlayerControllerB player) { Transform val = ((Component)player.playerBodyAnimator).transform.Find("Rig 1"); ChainIKConstraint component = ((Component)val.Find("RightArm")).GetComponent<ChainIKConstraint>(); ChainIKConstraint component2 = ((Component)val.Find("LeftArm")).GetComponent<ChainIKConstraint>(); TwoBoneIKConstraint component3 = ((Component)val.Find("RightLeg")).GetComponent<TwoBoneIKConstraint>(); TwoBoneIKConstraint component4 = ((Component)val.Find("LeftLeg")).GetComponent<TwoBoneIKConstraint>(); Transform val2 = ((Component)player.playerBodyAnimator).transform.Find("ScavengerModelArmsOnly").Find("metarig").Find("spine.003") .Find("RigArms"); ChainIKConstraint component5 = ((Component)val2.Find("RightArm")).GetComponent<ChainIKConstraint>(); ChainIKConstraint component6 = ((Component)val2.Find("LeftArm")).GetComponent<ChainIKConstraint>(); ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)component).weight = 1f; ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)component2).weight = 1f; ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)component).weight = 1f; ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)component4).weight = 1f; ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)component5).weight = 1f; ((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)component6).weight = 1f; } private static void UpdateLegsMaterial(PlayerControllerB player) { ((Renderer)((Component)s_legsMesh).GetComponent<SkinnedMeshRenderer>()).material = ((Renderer)((Component)((Component)((Component)player.playerBodyAnimator).transform.parent).transform.Find("LOD1")).gameObject.GetComponent<SkinnedMeshRenderer>()).material; } private static void TogglePlayerBadges(bool enabled) { if ((Object)(object)s_localPlayerBetaBadge != (Object)null) { ((Renderer)s_localPlayerBetaBadge.GetComponent<MeshRenderer>()).enabled = enabled; } if ((Object)(object)s_localPlayerLevelBadge != (Object)null) { ((Renderer)s_localPlayerLevelBadge.GetComponent<MeshRenderer>()).enabled = enabled; } else { Debug.LogError((object)"[MoreEmotes-Sligili] Couldn't find the level badge"); } } private static bool CheckIfTooManyEmotesIsPlaying(PlayerControllerB player) { //IL_000a: 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) Animator playerBodyAnimator = player.playerBodyAnimator; AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(1); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Dance1") && player.performingEmote && GetAnimatorEmoteClipName(playerBodyAnimator) != "Dance1"; } private static string GetAnimatorEmoteClipName(Animator animator) { AnimatorClipInfo[] currentAnimatorClipInfo = animator.GetCurrentAnimatorClipInfo(1); return ((Object)((AnimatorClipInfo)(ref currentAnimatorClipInfo[0])).clip).name; } private static void TurnControllerIntoAnOverrideController(RuntimeAnimatorController controller) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (!(controller is AnimatorOverrideController)) { controller = (RuntimeAnimatorController)new AnimatorOverrideController(controller); } } public static void UpdateWheelKeybinds() { if (UseConfigFile) { EmoteWheelKeyboard = ConfigFile_WheelKeybind; EmoteWheelController = ConfigFile_WheelKeybind_controller; return; } if (!PlayerPrefs.HasKey("Emote_Wheel_c")) { PlayerPrefs.SetString("Emote_Wheel_c", ConfigFile_WheelKeybind_controller); } EmoteWheelController = PlayerPrefs.GetString("Emote_Wheel_c"); if (!PlayerPrefs.HasKey("Emote_Wheel")) { PlayerPrefs.SetString("Emote_Wheel", ConfigFile_WheelKeybind); } EmoteWheelKeyboard = PlayerPrefs.GetString("Emote_Wheel"); if (!PlayerPrefs.HasKey("InvCheck")) { PlayerPrefs.SetInt("InvCheck", ConfigFile_InventoryCheck ? 1 : 0); } ConfigFile_InventoryCheck = PlayerPrefs.GetInt("InvCheck") == 1; } [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPostfix] private static void MenuStart(MenuManager __instance) { D.Debug = true; try { InstantiateSettingsMenu(((Component)((Component)__instance).transform.parent).transform.Find("MenuContainer")); } catch (Exception ex) { if (!s_isFirstTimeOnMenu) { s_isFirstTimeOnMenu = true; } else { Debug.LogError((object)(ex.Message + "\n[MoreEmotes-Sligili] Couldn't find MenuContainer")); } } } [HarmonyPatch(typeof(RoundManager), "Awake")] [HarmonyPostfix] private static void AwakePost(RoundManager __instance) { if (!PlayerPrefs.HasKey("InvCheck")) { PlayerPrefs.SetInt("InvCheck", ConfigFile_InventoryCheck ? 1 : 0); } UpdateWheelKeybinds(); GameObject gameObject = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject; InstantiateSettingsMenu(gameObject.transform.Find("QuickMenu")); s_selectionWheel = Object.Instantiate<GameObject>(WheelPrefab, gameObject.transform).AddComponent<EmoteWheel>(); s_customSignInputField = Object.Instantiate<GameObject>(SignUIPrefab, gameObject.transform).AddComponent<SignUI>(); EmoteWheel.Keybinds = new string[ConfigFile_Keybinds.Length + 1]; EmoteWheel.Keybinds = ConfigFile_Keybinds; s_isPlayerFirstFrame = true; } [HarmonyPatch(typeof(HUDManager), "EnableChat_performed")] [HarmonyPrefix] private static bool OpenChatPrefix() { if (s_customSignInputField.IsSignUIOpen) { return false; } return true; } [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] [HarmonyPrefix] private static bool SubmitChatPrefix() { if (s_customSignInputField.IsSignUIOpen) { return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void StartPostfix(PlayerControllerB __instance) { ((Component)((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel")).transform.Find("metarig")).gameObject.AddComponent<MoreEmotesEvents>().Player = __instance; s_defaultPlayerSpeed = __instance.movementSpeed; ((Component)__instance).gameObject.AddComponent<CustomAnimationObjects>(); SpawnSign(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { if (!__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner) { __instance.playerBodyAnimator.runtimeAnimatorController = others; TurnControllerIntoAnOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController); return; } if ((Object)(object)__instance.playerBodyAnimator != (Object)(object)local) { if (s_isPlayerFirstFrame) { SpawnLegs(__instance); } __instance.playerBodyAnimator.runtimeAnimatorController = local; if (s_isPlayerFirstFrame) { OnFirstLocalPlayerFrameWithNewAnimator(__instance); } if (s_isPlayerSpawning) { __instance.SpawnPlayerAnimation(); s_isPlayerSpawning = false; } } if (!IncompatibleStuff) { if ((bool)Ref.Method(__instance, "CheckConditionsForEmote") && __instance.performingEmote) { switch (s_currentEmoteID) { case 6: __instance.movementSpeed = s_defaultPlayerSpeed / 2f; break; case 9: __instance.movementSpeed = s_defaultPlayerSpeed / 3f; break; } } else { __instance.movementSpeed = s_defaultPlayerSpeed; } } __instance.localArmsRotationTarget = (LocalArmsSeparatedFromCamera ? (__instance.localArmsRotationTarget = s_freeArmsTarget) : (__instance.localArmsRotationTarget = s_lockedArmsTarget)); CheckWheelInput(EmoteWheelKeyboard, EmoteWheelController, __instance); if (!__instance.quickMenuManager.isMenuOpen && !IsEmoteWheelOpen) { CheckEmoteInput(ConfigFile_Keybinds[2], needsEmptyHands: false, 3, __instance); CheckEmoteInput(ConfigFile_Keybinds[3], needsEmptyHands: true, 4, __instance); CheckEmoteInput(ConfigFile_Keybinds[4], needsEmptyHands: true, 5, __instance); CheckEmoteInput(ConfigFile_Keybinds[5], needsEmptyHands: false, 6, __instance); CheckEmoteInput(ConfigFile_Keybinds[6], needsEmptyHands: true, 7, __instance); CheckEmoteInput(ConfigFile_Keybinds[7], needsEmptyHands: true, 8, __instance); CheckEmoteInput(ConfigFile_Keybinds[8], needsEmptyHands: true, 9, __instance); CheckEmoteInput(ConfigFile_Keybinds[9], needsEmptyHands: true, 10, __instance); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void UpdatePrefix(PlayerControllerB __instance) { if (__instance.performingEmote) { s_wasPerformingEmote[__instance.playerClientId] = true; } if (!__instance.performingEmote && s_wasPerformingEmote[__instance.playerClientId]) { s_wasPerformingEmote[__instance.playerClientId] = false; ResetIKWeights(__instance); } } [HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")] [HarmonyPrefix] private static void OnLocalPlayerSpawn(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { s_isPlayerSpawning = true; } } [HarmonyPatch(typeof(PlayerControllerB), "CheckConditionsForEmote")] [HarmonyPrefix] private static bool CheckConditionsPrefix(ref bool __result, PlayerControllerB __instance) { bool flag = (bool)Ref.GetInstanceField(typeof(PlayerControllerB), __instance, "isJumping"); bool flag2 = (bool)Ref.GetInstanceField(typeof(PlayerControllerB), __instance, "isWalking"); if (s_currentEmoteID == 6 || s_currentEmoteID == 9) { __result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !flag && __instance.moveInputVector.x == 0f && !__instance.isSprinting && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu && !__instance.isTypingChat; return false; } if (s_currentEmoteID == 10 || s_currentEmoteID == 1010) { __result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !flag && !flag2 && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu; return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")] [HarmonyPrefix] private static bool PerformEmotePrefix(CallbackContext context, int emoteID, PlayerControllerB __instance) { if ((emoteID < 0 || CheckIfTooManyEmotesIsPlaying(__instance)) && emoteID > 2) { return false; } if ((!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject)) && !__instance.isTestingPlayer) { return false; } if (s_customSignInputField.IsSignUIOpen && emoteID != 1010) { return false; } if (emoteID > 0 && emoteID < 3 && !IsEmoteWheelOpen && !((CallbackContext)(ref context)).performed) { return false; } int[] array = s_doubleEmotesIDS; foreach (int num in array) { int num2 = num + _AlternateEmoteIDOffset; bool flag = (UseConfigFile ? ConfigFile_InventoryCheck : (PlayerPrefs.GetInt("InvCheck") == 1)); if (emoteID == num && s_currentEmoteID == emoteID && __instance.performingEmote && (!__instance.isHoldingObject || !flag)) { if (emoteID == num) { emoteID += _AlternateEmoteIDOffset; } else { emoteID -= 1000; } } } if ((s_currentEmoteID != emoteID && emoteID < 3) || !__instance.performingEmote) { ResetIKWeights(__instance); } if (!(bool)Ref.Method(__instance, "CheckConditionsForEmote")) { return false; } if (__instance.timeSinceStartingEmote < 0.5f) { return false; } s_currentEmoteID = emoteID; Action action = delegate { __instance.timeSinceStartingEmote = 0f; __instance.playerBodyAnimator.SetInteger("emoteNumber", emoteID); __instance.performingEmote = true; __instance.StartPerformingEmoteServerRpc(); s_syncAnimator.UpdateEmoteIDForOthers(emoteID); TogglePlayerBadges(enabled: false); }; switch (emoteID) { case 9: action = (Action)Delegate.Combine(action, (Action)delegate { UpdateLegsMaterial(__instance); }); break; case 10: action = (Action)Delegate.Combine(action, (Action)delegate { ((Component)s_customSignInputField).gameObject.SetActive(true); }); break; } action(); return false; } [HarmonyPatch(typeof(PlayerControllerB), "StopPerformingEmoteServerRpc")] [HarmonyPostfix] private static void StopPerformingEmoteServerPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { __instance.playerBodyAnimator.SetInteger("emoteNumber", 0); } TogglePlayerBadges(enabled: true); s_syncAnimator.UpdateEmoteIDForOthers(0); s_currentEmoteID = 0; } } } namespace MoreEmotes.Scripts { public class MoreEmotesEvents : MonoBehaviour { private Animator _playerAnimator; private AudioSource _playerAudioSource; public static AudioClip[] ClapSounds = (AudioClip[])(object)new AudioClip[2]; public PlayerControllerB Player; private void Start() { _playerAnimator = ((Component)this).GetComponent<Animator>(); _playerAudioSource = Player.movementAudio; } public void PlayClapSound() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (Player.performingEmote) { int currentEmoteID = GetCurrentEmoteID(); if (!((NetworkBehaviour)Player).IsOwner || !Player.isPlayerControlled || currentEmoteID == 4) { bool flag = Player.isInHangarShipRoom && Player.playersManager.hangarDoorsClosed; RoundManager.Instance.PlayAudibleNoise(((Component)Player).transform.position, 22f, 0.6f, 0, flag, 6); _playerAudioSource.pitch = Random.Range(0.59f, 0.79f); _playerAudioSource.PlayOneShot(ClapSounds[Random.Range(0, ClapSounds.Length)]); } } } public void PlayFootstepSound() { if (Player.performingEmote) { int currentEmoteID = GetCurrentEmoteID(); if ((!((NetworkBehaviour)Player).IsOwner || !Player.isPlayerControlled || currentEmoteID == 6 || currentEmoteID == 8 || currentEmoteID == 9) && ((Vector2)(ref Player.moveInputVector)).sqrMagnitude == 0f) { Player.PlayFootstepLocal(); Player.PlayFootstepServer(); } } } private int GetCurrentEmoteID() { int num = _playerAnimator.GetInteger("emoteNumber"); if (num >= 1000) { num -= 1000; } return num; } } public class SignEmoteText : NetworkBehaviour { private PlayerControllerB _playerInstance; private TextMeshPro _signModelText; public string Text => ((TMP_Text)_signModelText).text; private void Start() { _playerInstance = ((Component)this).GetComponent<PlayerControllerB>(); _signModelText = ((Component)((Component)_playerInstance).transform.Find("ScavengerModel").Find("metarig").Find("Sign") .Find("Text")).GetComponent<TextMeshPro>(); } public void UpdateSignText(string newText) { if (((NetworkBehaviour)_playerInstance).IsOwner && _playerInstance.isPlayerControlled) { UpdateSignTextServerRpc(newText); } } [ServerRpc(RequireOwnership = false)] private void UpdateSignTextServerRpc(string newText) { UpdateSignTextClientRpc(newText); } [ClientRpc] private void UpdateSignTextClientRpc(string newText) { ((TMP_Text)_signModelText).text = newText; } } public class EmoteWheel : MonoBehaviour { private RectTransform _graphics_selectedBlock; private RectTransform _graphics_selectionArrow; private Text _graphics_emoteInformation; private Text _graphics_pageInformation; private int _blocksNumber = 8; private int _selectedBlock = 1; private float _changePageCooldown = 0.1f; private float _selectionArrowLerpSpeed = 30f; private float _angle; private GameObject[] _pages; public float WheelMovementDeadzone = 3.3f; public float WheelMovementDeadzoneController = 0.7f; public static string[] Keybinds; private Vector2 _wheelCenter; private Vector2 _lastMouseCoords; public int SelectedPageNumber { get; private set; } public int SelectedEmoteID { get; private set; } public bool IsUsingController { get; private set; } private void Awake() { GetVanillaKeybinds(); FindGraphics(); FindPages(((Component)this).gameObject.transform.Find("FunctionalContent")); UpdatePageInfo(); } private void OnEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) _wheelCenter = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)); Mouse.current.WarpCursorPosition(_wheelCenter); } private void GetVanillaKeybinds() { PlayerInput component = GameObject.Find("PlayerSettingsObject").GetComponent<PlayerInput>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)" MoreEmotes: PlayerSettingsObject is null"); return; } Keybinds[0] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote1", false), 0, (DisplayStringOptions)0); Keybinds[1] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote2", false), 0, (DisplayStringOptions)0); } private void FindGraphics() { _graphics_selectionArrow = ((Component)((Component)((Component)this).gameObject.transform.Find("Graphics")).gameObject.transform.Find("SelectionArrow")).gameObject.GetComponent<RectTransform>(); _graphics_selectedBlock = ((Component)((Component)this).gameObject.transform.Find("SelectedEmote")).gameObject.GetComponent<RectTransform>(); _graphics_emoteInformation = ((Component)((Component)((Component)this).gameObject.transform.Find("Graphics")).gameObject.transform.Find("EmoteInfo")).GetComponent<Text>(); _graphics_pageInformation = ((Component)((Component)((Component)this).gameObject.transform.Find("Graphics")).gameObject.transform.Find("PageNumber")).GetComponent<Text>(); } private void FindPages(Transform contentParent) { _pages = (GameObject[])(object)new GameObject[((Component)contentParent).transform.childCount]; _graphics_pageInformation.text = "< Page " + (SelectedPageNumber + 1) + "/" + _pages.Length + " >"; for (int i = 0; i < ((Component)contentParent).transform.childCount; i++) { _pages[i] = ((Component)((Component)contentParent).transform.GetChild(i)).gameObject; } } private void Update() { ControllerInput(); if (!IsUsingController) { MouseInput(); } Cursor.visible = !IsUsingController; UpdateSelectionArrow(); PageSelection(); SelectedEmoteID = _selectedBlock + Mathf.RoundToInt((float)(_blocksNumber / 4)) + _blocksNumber * SelectedPageNumber; UpdateEmoteInfo(); } private unsafe void ControllerInput() { //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_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_00c5: 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_0088: Unknown result type (might be due to invalid IL or missing references) if (Gamepad.all.Count == 0) { IsUsingController = false; return; } float num = ((InputControl<float>)(object)((Vector2Control)Gamepad.current.rightStick).x).ReadUnprocessedValue(); float num2 = ((InputControl<float>)(object)((Vector2Control)Gamepad.current.rightStick).y).ReadUnprocessedValue(); if (Mathf.Abs(num) < WheelMovementDeadzoneController && Mathf.Abs(num2) < WheelMovementDeadzoneController) { if (System.Runtime.CompilerServices.Unsafe.Read<Vector2>((void*)((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).value) != _lastMouseCoords) { IsUsingController = false; } } else { IsUsingController = true; _lastMouseCoords = System.Runtime.CompilerServices.Unsafe.Read<Vector2>((void*)((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).value); WheelSelection(Vector2.zero, num, num2); } } private void MouseInput() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) if (!(Vector2.Distance(_wheelCenter, ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()) < WheelMovementDeadzone)) { WheelSelection(_wheelCenter, ((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue(), ((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue()); } } private void WheelSelection(Vector2 origin, float xAxisValue, float yAxisValue) { //IL_0002: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_00e9: 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) bool flag = xAxisValue > origin.x; bool flag2 = yAxisValue > origin.y; int num = ((!flag) ? (flag2 ? 2 : 3) : (flag2 ? 1 : 4)); float num2 = (yAxisValue - origin.y) / (xAxisValue - origin.x); float num3 = 180 * (num - ((num <= 2) ? 1 : 2)); _angle = Mathf.Atan(num2) * (180f / (float)Math.PI) + num3; if (_angle == 90f) { _angle = 270f; } else if (_angle == 270f) { _angle = 90f; } float num4 = 360 / _blocksNumber; _selectedBlock = Mathf.RoundToInt((_angle - num4 * 1.5f) / num4); ((Transform)_graphics_selectedBlock).localRotation = Quaternion.Euler(((Component)this).transform.rotation.z, ((Component)this).transform.rotation.y, num4 * (float)_selectedBlock); } private void PageSelection() { UpdatePageInfo(); if (_changePageCooldown > 0f) { _changePageCooldown -= Time.deltaTime; return; } int num; if (IsUsingController) { if (!Gamepad.current.dpad.left.isPressed && !Gamepad.current.dpad.right.isPressed) { return; } num = (Gamepad.current.dpad.left.isPressed ? 1 : (-1)); } else { if (((InputControl<float>)(object)((Vector2Control)Mouse.current.scroll).y).ReadValue() == 0f) { return; } num = ((((InputControl<float>)(object)((Vector2Control)Mouse.current.scroll).y).ReadValue() > 0f) ? 1 : (-1)); } GameObject[] pages = _pages; foreach (GameObject val in pages) { val.SetActive(false); } SelectedPageNumber = (SelectedPageNumber + num + _pages.Length) % _pages.Length; _pages[SelectedPageNumber].SetActive(true); _changePageCooldown = ((!IsUsingController) ? 0.1f : 0.3f); } private void UpdatePageInfo() { _graphics_pageInformation.text = $"<color=#fe6b02><</color> Page {SelectedPageNumber + 1}/{_pages.Length} <color=#fe6b02>></color>"; } private void UpdateEmoteInfo() { string text = ((SelectedEmoteID > Keybinds.Length) ? "" : Keybinds[SelectedEmoteID - 1]); int num = 0; foreach (Emotes value in Enum.GetValues(typeof(Emotes))) { if (value >= Emotes.Dance && value < (Emotes)64) { num++; } } string text2 = ((SelectedEmoteID > num) ? "EMPTY" : ((Emotes)SelectedEmoteID).ToString().Replace("_", " ")); if (SelectedEmoteID > 2 && SelectedEmoteID <= Keybinds.Length) { if (!PlayerPrefs.HasKey(text2.Replace(" ", "_"))) { PlayerPrefs.SetString(text2.Replace(" ", "_"), (SelectedEmoteID > Keybinds.Length) ? "" : Keybinds[SelectedEmoteID - 1]); } else { text = PlayerPrefs.GetString(text2.Replace(" ", "_")); } } text = "<size=120>[" + text + "]</size>"; _graphics_emoteInformation.text = text2 + "\n" + text.ToUpper(); } private void UpdateSelectionArrow() { //IL_0027: 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_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references) float num = 360 / _blocksNumber; Quaternion val = Quaternion.Euler(0f, 0f, _angle - num * 2f); ((Transform)_graphics_selectionArrow).localRotation = Quaternion.Lerp(((Transform)_graphics_selectionArrow).localRotation, val, Time.deltaTime * _selectionArrowLerpSpeed); } } public class RebindButton : MonoBehaviour { public static string[] ConfigFile_Keybinds; private string _defaultKey; private string _playerPrefsString; private Transform _waitingForInput; private Text _keyInfo; public bool IsControllerButton { get; private set; } = false; private void Start() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown string text = ((Component)((Component)this).gameObject.transform.Find("Description")).GetComponent<Text>().text; IsControllerButton = GetControllerFlag(); _playerPrefsString = ((Component)((Component)this).gameObject.transform.Find("Description")).GetComponent<Text>().text.Replace(" ", "_") + (IsControllerButton ? "_c" : ""); _defaultKey = GetDefaultKey(text); FindComponents(); ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener(new UnityAction(GetKey)); if (!PlayerPrefs.HasKey(_playerPrefsString)) { PlayerPrefs.SetString(_playerPrefsString, _defaultKey); } SetKeybind(PlayerPrefs.GetString(_playerPrefsString)); } private string GetDefaultKey(string emoteName) { if (Enum.TryParse<Emotes>(emoteName.Replace(" ", "_"), out var result)) { return ConfigFile_Keybinds[(int)(result - 1)]; } return IsControllerButton ? "leftshoulder" : "V"; } private bool GetControllerFlag() { Transform val = ((Component)this).gameObject.transform.Find("Description").Find("Subtext"); if ((Object)(object)val == (Object)null) { return false; } Text val2 = default(Text); if (((Component)val).TryGetComponent<Text>(ref val2)) { return val2.text.Equals("(Controller)", StringComparison.OrdinalIgnoreCase); } return false; } private void FindComponents() { ((Component)((Component)((Component)this).transform.parent).transform.Find("Delete")).gameObject.AddComponent<DeleteButton>(); _keyInfo = ((Component)((Component)this).transform.Find("InputText")).GetComponent<Text>(); _waitingForInput = ((Component)this).transform.Find("wait"); } public void SetKeybind(string key) { List<string> list = new List<string> { "up", "down", "left", "right" }; if (list.Contains(key.ToLower()) && key.Length < 5) { key = "dpad/" + key; } PlayerPrefs.SetString(_playerPrefsString, key); _keyInfo.text = key.ToUpper(); ((MonoBehaviour)this).StopAllCoroutines(); ((Component)_waitingForInput).gameObject.SetActive(false); } private void GetKey() { ((Component)_waitingForInput).gameObject.SetActive(true); ((MonoBehaviour)this).StartCoroutine(WaitForKey(delegate(string key) { SetKeybind(key); })); } private IEnumerator WaitForKey(Action<string> callback) { while (!((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame || (!((InputDevice)Gamepad.current).wasUpdatedThisFrame && !InputControlExtensions.IsActuated((InputControl)(object)Gamepad.current.leftStick, 0f) && !InputControlExtensions.IsActuated((InputControl)(object)Gamepad.current.rightStick, 0f))) { yield return (object)new WaitForEndOfFrame(); Observable.CallOnce<InputControl>(InputSystem.onAnyButtonPress, (Action<InputControl>)delegate(InputControl ctrl) { callback(((ctrl.device == Gamepad.current && IsControllerButton) || (ctrl.device == Keyboard.current && !IsControllerButton)) ? ctrl.name : _defaultKey); }); } } } public class DeleteButton : MonoBehaviour { private void Start() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown RebindButton _rebindButton = ((Component)((Component)((Component)this).transform.parent).transform.Find("Button")).GetComponent<RebindButton>(); ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _rebindButton.SetKeybind(string.Empty); }); } } public class ToggleButton : MonoBehaviour { private Toggle _toggle; public static bool s_InventoryCheck; public string PlayerPrefsString; private void Start() { _toggle = ((Component)this).GetComponent<Toggle>(); _toggle.isOn = s_InventoryCheck; ((UnityEvent<bool>)(object)_toggle.onValueChanged).AddListener((UnityAction<bool>)SetNewValue); if (!PlayerPrefs.HasKey(PlayerPrefsString)) { SetNewValue(s_InventoryCheck); } } public void SetNewValue(bool arg) { PlayerPrefs.SetInt(PlayerPrefsString, arg ? 1 : 0); } } public class EnableDisableButton : MonoBehaviour { public GameObject[] ToAlternateUI = (GameObject[])(object)new GameObject[1]; private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { GameObject[] toAlternateUI = ToAlternateUI; foreach (GameObject val in toAlternateUI) { val.SetActive((!val.activeInHierarchy) ? true : false); } }); if (((Object)((Component)this).gameObject).name.Equals("BackButton", StringComparison.OrdinalIgnoreCase)) { ToAlternateUI[0] = ((Component)((Component)this).transform.parent).gameObject; } if (((Object)((Component)this).gameObject).name.Equals("MoreEmotesButton(Clone)", StringComparison.OrdinalIgnoreCase)) { ToAlternateUI[0] = ((Component)((Component)((Component)this).transform.parent).gameObject.transform.Find("MoreEmotesPanel(Clone)")).gameObject; } } } public class SetupUI : MonoBehaviour { public static bool UseConfigFile; public static bool InventoryCheck; private void Awake() { Transform settingsUIPanel = ((Component)this).transform.Find("MoreEmotesPanel(Clone)"); ((Component)settingsUIPanel.Find("Version")).GetComponent<Text>().text = "1.3.3 - Sligili"; SetupOpenSettingsButton(); SetupBackButton(); SetupRebindButtons(((Component)settingsUIPanel).transform.Find("KeybindButtons")); SetupRebindButtons(((Component)((Component)((Component)settingsUIPanel).transform.Find("Scroll View")).transform.Find("Viewport")).transform.Find("Content")); SetupInventoryCheckToggle(); SetupUseConfigFileToggle(); void SetupBackButton() { ((Component)((Component)settingsUIPanel).transform.Find("BackButton")).gameObject.AddComponent<EnableDisableButton>(); } void SetupInventoryCheckToggle() { ((Component)((Component)settingsUIPanel).transform.Find("Inv")).gameObject.AddComponent<ToggleButton>().PlayerPrefsString = "InvCheck"; } void SetupOpenSettingsButton() { ((Component)((Component)this).transform.Find("MoreEmotesButton(Clone)")).gameObject.AddComponent<EnableDisableButton>(); } static void SetupRebindButtons(Transform ButtonsParent) { Transform[] array = (Transform[])(object)new Transform[ButtonsParent.childCount]; for (int i = 0; i < array.Length; i++) { array[i] = ButtonsParent.GetChild(i); } Transform[] array2 = array; foreach (Transform val in array2) { ((Component)val.Find("Button")).gameObject.AddComponent<RebindButton>(); } } void SetupUseConfigFileToggle() { ((Component)((Component)settingsUIPanel).transform.Find("cfg")).gameObject.GetComponent<Toggle>().isOn = UseConfigFile; } } private void Update() { EmotePatch.UpdateWheelKeybinds(); } } public class SignUI : MonoBehaviour { public PlayerControllerB Player; private TMP_InputField _inputField; private Text _charactersLeftText; private TMP_Text _previewText; private Button _submitButton; private Button _cancelButton; public bool IsSignUIOpen; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown FindComponents(); ((UnityEvent)_submitButton.onClick).AddListener(new UnityAction(SubmitText)); ((UnityEvent)_cancelButton.onClick).AddListener((UnityAction)delegate { Close(cancelAction: true); }); ((UnityEvent<string>)(object)_inputField.onValueChanged).AddListener((UnityAction<string>)delegate(string fieldText) { UpdatePreviewText(fieldText); UpdateCharactersLeftText(); }); } private void OnEnable() { Player.isTypingChat = true; IsSignUIOpen = true; ((Selectable)_inputField).Select(); _inputField.text = string.Empty; _previewText.text = "PREVIEW"; Player.disableLookInput = true; } private void Update() { //IL_009e: 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) Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; if (!Player.performingEmote) { Close(cancelAction: true); } if (((ButtonControl)Keyboard.current[(Key)2]).wasPressedThisFrame && !((ButtonControl)Keyboard.current[(Key)51]).isPressed) { SubmitText(); } if (Player.quickMenuManager.isMenuOpen || EmotePatch.IsEmoteWheelOpen || InputControlExtensions.IsPressed(((InputControl)Mouse.current)["rightButton"], 0f)) { Close(cancelAction: true); } if (Gamepad.all.Count != 0) { if (Gamepad.current.buttonWest.isPressed || Gamepad.current.startButton.isPressed) { SubmitText(); } if (Gamepad.current.buttonEast.isPressed || Gamepad.current.selectButton.isPressed) { Close(cancelAction: true); } } } private void FindComponents() { _inputField = ((Component)((Component)this).transform.Find("InputField")).GetComponent<TMP_InputField>(); _charactersLeftText = ((Component)((Component)this).transform.Find("CharsLeft")).GetComponent<Text>(); _submitButton = ((Component)((Component)this).transform.Find("Submit")).GetComponent<Button>(); _cancelButton = ((Component)((Component)this).transform.Find("Cancel")).GetComponent<Button>(); _previewText = ((Component)((Component)((Component)this).transform.Find("Sign")).transform.Find("Text")).GetComponent<TMP_Text>(); } private void UpdateCharactersLeftText() { _charactersLeftText.text = $"CHARACTERS LEFT: <color=yellow>{_inputField.characterLimit - _inputField.text.Length}</color>"; } private void UpdatePreviewText(string text) { _previewText.text = text; } private void SubmitText() { //IL_007c: 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) if (_inputField.text.Equals(string.Empty)) { Close(cancelAction: true); return; } D.L("Submitted " + _inputField.text + " to server"); ((Component)Player).GetComponent<SignEmoteText>().UpdateSignText(_inputField.text); float num = 0.5f; if (Player.timeSinceStartingEmote > num) { Player.PerformEmote(default(CallbackContext), 1010); } Close(cancelAction: false); } private void Close(bool cancelAction) { Player.isTypingChat = false; IsSignUIOpen = false; if (cancelAction) { Player.performingEmote = false; Player.StopPerformingEmoteServerRpc(); } if (!Player.quickMenuManager.isMenuOpen) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } Player.disableLookInput = false; ((Component)this).gameObject.SetActive(false); } } public class SyncAnimatorToOthers : NetworkBehaviour { private PlayerControllerB _player; private void Start() { _player = ((Component)this).GetComponent<PlayerControllerB>(); } public void UpdateEmoteIDForOthers(int newID) { if (((NetworkBehaviour)_player).IsOwner && _player.isPlayerControlled) { UpdateCurrentEmoteIDServerRpc(newID); } } [ServerRpc(RequireOwnership = false)] private void UpdateCurrentEmoteIDServerRpc(int newID) { UpdateCurrentEmoteIDClientRpc(newID); } [ClientRpc] private void UpdateCurrentEmoteIDClientRpc(int newID) { if (!((NetworkBehaviour)_player).IsOwner) { _player.playerBodyAnimator.SetInteger("emoteNumber", newID); } } } public class CustomAnimationObjects : MonoBehaviour { private PlayerControllerB _player; private MeshRenderer _sign; private GameObject _signText; private SkinnedMeshRenderer _legs; private void Start() { _player = ((Component)this).GetComponent<PlayerControllerB>(); } private void Update() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_sign == (Object)null || (Object)(object)_signText == (Object)null) { FindSign(); return; } ((Component)_sign).transform.localPosition = ((Component)_sign).transform.parent.Find("spine").localPosition; if ((Object)(object)_legs == (Object)null && ((NetworkBehaviour)_player).IsOwner && _player.isPlayerControlled) { FindLegs(); return; } DisableEverything(); if (!_player.performingEmote) { return; } switch (_player.playerBodyAnimator.GetInteger("emoteNumber")) { case 10: case 1010: ((Renderer)_sign).enabled = true; if (!_signText.activeSelf) { _signText.SetActive(true); } if (((NetworkBehaviour)_player).IsOwner) { EmotePatch.LocalArmsSeparatedFromCamera = true; } break; case 9: if ((Object)(object)_legs != (Object)null) { ((Renderer)_legs).enabled = true; } if (((NetworkBehaviour)_player).IsOwner) { EmotePatch.LocalArmsSeparatedFromCamera = true; } break; } } private void DisableEverything() { if ((Object)(object)_legs != (Object)null) { ((Renderer)_legs).enabled = false; } ((Renderer)_sign).enabled = false; if (_signText.activeSelf) { _signText.SetActive(false); } if (((NetworkBehaviour)_player).IsOwner && _player.isPlayerControlled) { EmotePatch.LocalArmsSeparatedFromCamera = false; } } private void FindSign() { _sign = ((Component)((Component)_player).transform.Find("ScavengerModel").Find("metarig").Find("Sign")).GetComponent<MeshRenderer>(); _signText = ((Component)((Component)_sign).transform.Find("Text")).gameObject; } private void FindLegs() { _legs = ((Component)((Component)_player).transform.Find("ScavengerModel").Find("LEGS")).GetComponent<SkinnedMeshRenderer>(); } } }
plugins/MoreSuits.dll
Decompiled 9 months agousing System; using System.Collections.Generic; 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 HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("MoreSuits")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that adds more suit options to Lethal Company")] [assembly: AssemblyFileVersion("1.4.1.0")] [assembly: AssemblyInformationalVersion("1.4.1")] [assembly: AssemblyProduct("MoreSuits")] [assembly: AssemblyTitle("MoreSuits")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.1.0")] [module: UnverifiableCode] namespace MoreSuits; [BepInPlugin("x753.More_Suits", "More Suits", "1.4.1")] public class MoreSuitsMod : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(ref StartOfRound __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Expected O, but got Unknown //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown try { if (SuitsAdded) { return; } int count = __instance.unlockablesList.unlockables.Count; UnlockableItem val = new UnlockableItem(); int num = 0; for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++) { UnlockableItem val2 = __instance.unlockablesList.unlockables[i]; if (!((Object)(object)val2.suitMaterial != (Object)null) || !val2.alreadyUnlocked) { continue; } val = val2; List<string> list = Directory.GetDirectories(Paths.PluginPath, "moresuits", SearchOption.AllDirectories).ToList(); List<string> list2 = new List<string>(); List<string> list3 = new List<string>(); List<string> list4 = DisabledSuits.ToLower().Replace(".png", "").Split(',') .ToList(); List<string> list5 = new List<string>(); if (!LoadAllSuits) { foreach (string item2 in list) { if (File.Exists(Path.Combine(item2, "!less-suits.txt"))) { string[] collection = new string[9] { "glow", "kirby", "knuckles", "luigi", "mario", "minion", "skeleton", "slayer", "smile" }; list5.AddRange(collection); break; } } } foreach (string item3 in list) { if (item3 != "") { string[] files = Directory.GetFiles(item3, "*.png"); string[] files2 = Directory.GetFiles(item3, "*.matbundle"); list2.AddRange(files); list3.AddRange(files2); } } list3.Sort(); list2.Sort(); try { foreach (string item4 in list3) { Object[] array = AssetBundle.LoadFromFile(item4).LoadAllAssets(); foreach (Object val3 in array) { if (val3 is Material) { Material item = (Material)val3; customMaterials.Add(item); } } } } catch (Exception ex) { Debug.Log((object)("Something went wrong with More Suits! Could not load materials from asset bundle(s). Error: " + ex)); } foreach (string item5 in list2) { if (list4.Contains(Path.GetFileNameWithoutExtension(item5).ToLower())) { continue; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (list5.Contains(Path.GetFileNameWithoutExtension(item5).ToLower()) && item5.Contains(directoryName)) { continue; } UnlockableItem val4; Material val5; if (Path.GetFileNameWithoutExtension(item5).ToLower() == "default") { val4 = val; val5 = val4.suitMaterial; } else { val4 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val)); val5 = Object.Instantiate<Material>(val4.suitMaterial); } byte[] array2 = File.ReadAllBytes(item5); Texture2D val6 = new Texture2D(2, 2); ImageConversion.LoadImage(val6, array2); val5.mainTexture = (Texture)(object)val6; val4.unlockableName = Path.GetFileNameWithoutExtension(item5); try { string path = Path.Combine(Path.GetDirectoryName(item5), "advanced", val4.unlockableName + ".json"); if (File.Exists(path)) { string[] array3 = File.ReadAllLines(path); for (int j = 0; j < array3.Length; j++) { string[] array4 = array3[j].Trim().Split(':'); if (array4.Length != 2) { continue; } string text = array4[0].Trim('"', ' ', ','); string text2 = array4[1].Trim('"', ' ', ','); if (text2.Contains(".png")) { byte[] array5 = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(item5), "advanced", text2)); Texture2D val7 = new Texture2D(2, 2); ImageConversion.LoadImage(val7, array5); val5.SetTexture(text, (Texture)(object)val7); continue; } if (text == "PRICE" && int.TryParse(text2, out var result)) { try { val4 = AddToRotatingShop(val4, result, __instance.unlockablesList.unlockables.Count); } catch (Exception ex2) { Debug.Log((object)("Something went wrong with More Suits! Could not add a suit to the rotating shop. Error: " + ex2)); } continue; } switch (text2) { case "KEYWORD": val5.EnableKeyword(text); continue; case "DISABLEKEYWORD": val5.DisableKeyword(text); continue; case "SHADERPASS": val5.SetShaderPassEnabled(text, true); continue; case "DISABLESHADERPASS": val5.SetShaderPassEnabled(text, false); continue; } float result2; Vector4 vector; if (text == "SHADER") { Shader shader = Shader.Find(text2); val5.shader = shader; } else if (text == "MATERIAL") { foreach (Material customMaterial in customMaterials) { if (((Object)customMaterial).name == text2) { val5 = Object.Instantiate<Material>(customMaterial); val5.mainTexture = (Texture)(object)val6; break; } } } else if (float.TryParse(text2, out result2)) { val5.SetFloat(text, result2); } else if (TryParseVector4(text2, out vector)) { val5.SetVector(text, vector); } } } } catch (Exception ex3) { Debug.Log((object)("Something went wrong with More Suits! Error: " + ex3)); } val4.suitMaterial = val5; if (val4.unlockableName.ToLower() != "default") { if (num == MaxSuits) { Debug.Log((object)"Attempted to add a suit, but you've already reached the max number of suits! Modify the config if you want more."); continue; } __instance.unlockablesList.unlockables.Add(val4); num++; } } SuitsAdded = true; break; } UnlockableItem val8 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val)); val8.alreadyUnlocked = false; val8.hasBeenMoved = false; val8.placedPosition = Vector3.zero; val8.placedRotation = Vector3.zero; val8.unlockableType = 753; while (__instance.unlockablesList.unlockables.Count < count + MaxSuits) { __instance.unlockablesList.unlockables.Add(val8); } } catch (Exception ex4) { Debug.Log((object)("Something went wrong with More Suits! Error: " + ex4)); } } [HarmonyPatch("PositionSuitsOnRack")] [HarmonyPrefix] private static bool PositionSuitsOnRackPatch(ref StartOfRound __instance) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) List<UnlockableSuit> source = Object.FindObjectsOfType<UnlockableSuit>().ToList(); source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList(); int num = 0; foreach (UnlockableSuit item in source) { AutoParentToShip component = ((Component)item).gameObject.GetComponent<AutoParentToShip>(); component.overrideOffset = true; float num2 = 0.18f; if (MakeSuitsFitOnRack && source.Count > 13) { num2 /= (float)Math.Min(source.Count, 20) / 12f; } component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + __instance.rightmostSuitPosition.forward * num2 * (float)num; component.rotationOffset = new Vector3(0f, 90f, 0f); num++; } return false; } } private const string modGUID = "x753.More_Suits"; private const string modName = "More Suits"; private const string modVersion = "1.4.1"; private readonly Harmony harmony = new Harmony("x753.More_Suits"); private static MoreSuitsMod Instance; public static bool SuitsAdded = false; public static string DisabledSuits; public static bool LoadAllSuits; public static bool MakeSuitsFitOnRack; public static int MaxSuits; public static List<Material> customMaterials = new List<Material>(); private static TerminalNode cancelPurchase; private static TerminalKeyword buyKeyword; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } DisabledSuits = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Disabled Suit List", "UglySuit751.png,UglySuit752.png,UglySuit753.png", "Comma-separated list of suits that shouldn't be loaded").Value; LoadAllSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Ignore !less-suits.txt", false, "If true, ignores the !less-suits.txt file and will attempt to load every suit, except those in the disabled list. This should be true if you're not worried about having too many suits.").Value; MakeSuitsFitOnRack = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Make Suits Fit on Rack", true, "If true, squishes the suits together so more can fit on the rack.").Value; MaxSuits = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Suits", 100, "The maximum number of suits to load. If you have more, some will be ignored.").Value; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin More Suits is loaded!"); } private static UnlockableItem AddToRotatingShop(UnlockableItem newSuit, int price, int unlockableID) { //IL_0065: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); for (int i = 0; i < val.terminalNodes.allKeywords.Length; i++) { if (((Object)val.terminalNodes.allKeywords[i]).name == "Buy") { buyKeyword = val.terminalNodes.allKeywords[i]; break; } } newSuit.alreadyUnlocked = false; newSuit.hasBeenMoved = false; newSuit.placedPosition = Vector3.zero; newSuit.placedRotation = Vector3.zero; newSuit.shopSelectionNode = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)newSuit.shopSelectionNode).name = newSuit.unlockableName + "SuitBuy1"; newSuit.shopSelectionNode.creatureName = newSuit.unlockableName + " suit"; newSuit.shopSelectionNode.displayText = "You have requested to order " + newSuit.unlockableName + " suits.\nTotal cost of item: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"; newSuit.shopSelectionNode.clearPreviousText = true; newSuit.shopSelectionNode.shipUnlockableID = unlockableID; newSuit.shopSelectionNode.itemCost = price; newSuit.shopSelectionNode.overrideOptions = true; CompatibleNoun val2 = new CompatibleNoun(); val2.noun = ScriptableObject.CreateInstance<TerminalKeyword>(); val2.noun.word = "confirm"; val2.noun.isVerb = true; val2.result = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val2.result).name = newSuit.unlockableName + "SuitBuyConfirm"; val2.result.creatureName = ""; val2.result.displayText = "Ordered " + newSuit.unlockableName + " suits! Your new balance is [playerCredits].\n\n"; val2.result.clearPreviousText = true; val2.result.shipUnlockableID = unlockableID; val2.result.buyUnlockable = true; val2.result.itemCost = price; val2.result.terminalEvent = ""; CompatibleNoun val3 = new CompatibleNoun(); val3.noun = ScriptableObject.CreateInstance<TerminalKeyword>(); val3.noun.word = "deny"; val3.noun.isVerb = true; if ((Object)(object)cancelPurchase == (Object)null) { cancelPurchase = ScriptableObject.CreateInstance<TerminalNode>(); } val3.result = cancelPurchase; ((Object)val3.result).name = "MoreSuitsCancelPurchase"; val3.result.displayText = "Cancelled order.\n"; newSuit.shopSelectionNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { val2, val3 }; TerminalKeyword val4 = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)val4).name = newSuit.unlockableName + "Suit"; val4.word = newSuit.unlockableName.ToLower() + " suit"; val4.defaultVerb = buyKeyword; CompatibleNoun val5 = new CompatibleNoun(); val5.noun = val4; val5.result = newSuit.shopSelectionNode; List<CompatibleNoun> list = buyKeyword.compatibleNouns.ToList(); list.Add(val5); buyKeyword.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val4); list2.Add(val2.noun); list2.Add(val3.noun); val.terminalNodes.allKeywords = list2.ToArray(); return newSuit; } public static bool TryParseVector4(string input, out Vector4 vector) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) vector = Vector4.zero; string[] array = input.Split(','); if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4)) { vector = new Vector4(result, result2, result3, result4); return true; } return false; } }
plugins/NicholaScott.BepInEx.RuntimeNetcodeRPCValidator.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; 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: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.5.0")] [assembly: AssemblyInformationalVersion("0.2.5+6e2f89b3631ae55d2f51a00ccfd3f20fec9d2372")] [assembly: AssemblyProduct("RuntimeNetcodeRPCValidator")] [assembly: AssemblyTitle("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace RuntimeNetcodeRPCValidator { public class AlreadyRegisteredException : Exception { public AlreadyRegisteredException(string PluginGUID) : base("Can't register plugin " + PluginGUID + " until the other instance of NetcodeValidator is Disposed of!") { } } public class InvalidPluginGuidException : Exception { public InvalidPluginGuidException(string pluginGUID) : base("Can't patch plugin " + pluginGUID + " because it doesn't exist!") { } } public class NotNetworkBehaviourException : Exception { public NotNetworkBehaviourException(Type type) : base("Netcode Runtime RPC Validator tried to NetcodeValidator.Patch type " + type.Name + " that doesn't inherit from NetworkBehaviour!") { } } public class MustCallFromDeclaredTypeException : Exception { public MustCallFromDeclaredTypeException() : base("Netcode Runtime RPC Validator tried to run NetcodeValidator.PatchAll from a delegate! You must call PatchAll from a declared type.") { } } public static class FastBufferExtensions { private const BindingFlags BindingAll = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static void WriteSystemSerializable(this FastBufferWriter fastBufferWriter, object serializable) { //IL_0025: 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) BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, serializable); byte[] array = memoryStream.ToArray(); int num = array.Length; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref fastBufferWriter)).WriteBytes(array, -1, 0); } private static void ReadSystemSerializable(this FastBufferReader fastBufferReader, out object serializable) { //IL_0006: 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) int num = default(int); ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); byte[] buffer = new byte[num]; ((FastBufferReader)(ref fastBufferReader)).ReadBytes(ref buffer, num, 0); using MemoryStream memoryStream = new MemoryStream(buffer); memoryStream.Seek(0L, SeekOrigin.Begin); BinaryFormatter binaryFormatter = new BinaryFormatter(); serializable = binaryFormatter.Deserialize(memoryStream); } private static void WriteNetcodeSerializable(this FastBufferWriter fastBufferWriter, object networkSerializable) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, -1); try { BufferSerializer<BufferSerializerWriter> val2 = default(BufferSerializer<BufferSerializerWriter>); val2..ctor(new BufferSerializerWriter(val)); object obj = ((networkSerializable is INetworkSerializable) ? networkSerializable : null); if (obj != null) { ((INetworkSerializable)obj).NetworkSerialize<BufferSerializerWriter>(val2); } byte[] array = ((FastBufferWriter)(ref val)).ToArray(); int num = array.Length; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref fastBufferWriter)).WriteBytes(array, -1, 0); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void ReadNetcodeSerializable(this FastBufferReader fastBufferReader, Type type, out object serializable) { //IL_0006: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) int num = default(int); ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); byte[] array = new byte[num]; ((FastBufferReader)(ref fastBufferReader)).ReadBytes(ref array, num, 0); FastBufferReader val = default(FastBufferReader); ((FastBufferReader)(ref val))..ctor(array, (Allocator)2, -1, 0); try { BufferSerializer<BufferSerializerReader> val2 = default(BufferSerializer<BufferSerializerReader>); val2..ctor(new BufferSerializerReader(val)); serializable = Activator.CreateInstance(type); object obj = serializable; object obj2 = ((obj is INetworkSerializable) ? obj : null); if (obj2 != null) { ((INetworkSerializable)obj2).NetworkSerialize<BufferSerializerReader>(val2); } } finally { ((IDisposable)(FastBufferReader)(ref val)).Dispose(); } } public static void WriteMethodInfoAndParameters(this FastBufferWriter fastBufferWriter, MethodBase methodInfo, object[] args) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe(methodInfo.Name, false); ParameterInfo[] parameters = methodInfo.GetParameters(); int num = parameters.Length; ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref num, default(ForPrimitives)); for (int i = 0; i < parameters.Length; i++) { ParameterInfo parameterInfo = parameters[i]; object obj = args[i]; bool flag = obj == null || parameterInfo.ParameterType == typeof(ServerRpcParams) || parameterInfo.ParameterType == typeof(ClientRpcParams); ((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { continue; } if (parameterInfo.ParameterType.GetInterfaces().Contains(typeof(INetworkSerializable))) { fastBufferWriter.WriteNetcodeSerializable(obj); continue; } if (parameterInfo.ParameterType.IsSerializable) { fastBufferWriter.WriteSystemSerializable(obj); continue; } throw new SerializationException(TextHandler.ObjectNotSerializable(parameterInfo)); } } public static MethodInfo ReadMethodInfoAndParameters(this FastBufferReader fastBufferReader, Type methodDeclaringType, ref object[] args) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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) string name = default(string); ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe(ref name, false); int num = default(int); ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); MethodInfo method = methodDeclaringType.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (num != method?.GetParameters().Length) { throw new Exception(TextHandler.InconsistentParameterCount(method, num)); } bool flag = default(bool); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { continue; } ParameterInfo parameterInfo = method.GetParameters()[i]; object serializable; if (parameterInfo.ParameterType.GetInterfaces().Contains(typeof(INetworkSerializable))) { fastBufferReader.ReadNetcodeSerializable(parameterInfo.ParameterType, out serializable); } else { if (!parameterInfo.ParameterType.IsSerializable) { throw new SerializationException(TextHandler.ObjectNotSerializable(parameterInfo)); } fastBufferReader.ReadSystemSerializable(out serializable); } args[i] = serializable; } return method; } } public sealed class NetcodeValidator : IDisposable { private static readonly List<string> AlreadyRegistered = new List<string>(); internal const string TypeCustomMessageHandlerPrefix = "Net"; private static List<(NetcodeValidator validator, Type custom, Type native)> BoundNetworkObjects { get; } = new List<(NetcodeValidator, Type, Type)>(); private List<string> CustomMessageHandlers { get; } private Harmony Patcher { get; } public string PluginGuid { get; } internal static event Action<NetcodeValidator, Type> AddedNewBoundBehaviour; private event Action<string> AddedNewCustomMessageHandler; public NetcodeValidator(string pluginGuid) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!Chainloader.PluginInfos.TryGetValue(pluginGuid, out var _)) { throw new InvalidPluginGuidException(pluginGuid); } if (AlreadyRegistered.Contains(pluginGuid)) { throw new AlreadyRegisteredException(pluginGuid); } AlreadyRegistered.Add(pluginGuid); PluginGuid = pluginGuid; CustomMessageHandlers = new List<string>(); Patcher = new Harmony(pluginGuid + "NicholaScott.BepInEx.RuntimeNetcodeRPCValidator"); Plugin.NetworkManagerInitialized += NetworkManagerInitialized; Plugin.NetworkManagerShutdown += NetworkManagerShutdown; } internal static void TryLoadRelatedComponentsInOrder(NetworkBehaviour __instance, MethodBase __originalMethod) { foreach (var item in from obj in BoundNetworkObjects where obj.native == __originalMethod.DeclaringType select obj into it orderby it.validator.PluginGuid select it) { Plugin.Logger.LogInfo((object)TextHandler.CustomComponentAddedToExistingObject(item, __originalMethod)); Component obj2 = ((Component)__instance).gameObject.AddComponent(item.custom); ((NetworkBehaviour)(object)((obj2 is NetworkBehaviour) ? obj2 : null)).SyncWithNetworkObject(); } } private bool Patch(MethodInfo rpcMethod, out bool isServerRpc, out bool isClientRpc) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown isServerRpc = ((MemberInfo)rpcMethod).GetCustomAttributes<ServerRpcAttribute>().Any(); isClientRpc = ((MemberInfo)rpcMethod).GetCustomAttributes<ClientRpcAttribute>().Any(); bool flag = rpcMethod.Name.EndsWith("ServerRpc"); bool flag2 = rpcMethod.Name.EndsWith("ClientRpc"); if (!isClientRpc && !isServerRpc && !flag2 && !flag) { return false; } if ((!isServerRpc && flag) || (!isClientRpc && flag2)) { Plugin.Logger.LogError((object)TextHandler.MethodLacksRpcAttribute(rpcMethod)); return false; } if ((isServerRpc && !flag) || (isClientRpc && !flag2)) { Plugin.Logger.LogError((object)TextHandler.MethodLacksSuffix(rpcMethod)); return false; } Patcher.Patch((MethodBase)rpcMethod, new HarmonyMethod(typeof(NetworkBehaviourExtensions), "MethodPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); return true; } public void BindToPreExistingObjectByBehaviour<TCustomBehaviour, TNativeBehaviour>() where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour { if (Object.op_Implicit((Object)(object)NetworkManager.Singleton) && (NetworkManager.Singleton.IsListening || NetworkManager.Singleton.IsConnectedClient)) { Plugin.Logger.LogError((object)TextHandler.PluginTriedToBindToPreExistingObjectTooLate(this, typeof(TCustomBehaviour), typeof(TNativeBehaviour))); } else { OnAddedNewBoundBehaviour(this, typeof(TCustomBehaviour), typeof(TNativeBehaviour)); } } public void Patch(Type netBehaviourTyped) { if (netBehaviourTyped.BaseType != typeof(NetworkBehaviour)) { throw new NotNetworkBehaviourException(netBehaviourTyped); } OnAddedNewCustomMessageHandler("Net." + netBehaviourTyped.Name); int num = 0; int num2 = 0; MethodInfo[] methods = netBehaviourTyped.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo rpcMethod in methods) { if (Patch(rpcMethod, out var isServerRpc, out var isClientRpc)) { num += (isServerRpc ? 1 : 0); num2 += (isClientRpc ? 1 : 0); } } Plugin.Logger.LogInfo((object)TextHandler.SuccessfullyPatchedType(netBehaviourTyped, num, num2)); } public void Patch(Assembly assembly) { Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.BaseType == typeof(NetworkBehaviour)) { Patch(type); } } } public void PatchAll() { Assembly assembly = new StackTrace().GetFrame(1).GetMethod().ReflectedType?.Assembly; if (assembly == null) { throw new MustCallFromDeclaredTypeException(); } Patch(assembly); } public void UnpatchSelf() { Plugin.Logger.LogInfo((object)TextHandler.PluginUnpatchedAllRPCs(this)); Patcher.UnpatchSelf(); } private static void RegisterMessageHandlerWithNetworkManager(string handler) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(handler, new HandleNamedMessageDelegate(NetworkBehaviourExtensions.ReceiveNetworkMessage)); } private void NetworkManagerInitialized() { AddedNewCustomMessageHandler += RegisterMessageHandlerWithNetworkManager; foreach (string customMessageHandler in CustomMessageHandlers) { RegisterMessageHandlerWithNetworkManager(customMessageHandler); } } private void NetworkManagerShutdown() { AddedNewCustomMessageHandler -= RegisterMessageHandlerWithNetworkManager; foreach (string customMessageHandler in CustomMessageHandlers) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(customMessageHandler); } } public void Dispose() { Plugin.NetworkManagerInitialized -= NetworkManagerInitialized; Plugin.NetworkManagerShutdown -= NetworkManagerShutdown; AlreadyRegistered.Remove(PluginGuid); if (Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { NetworkManagerShutdown(); } if (Patcher.GetPatchedMethods().Any()) { UnpatchSelf(); } } private void OnAddedNewCustomMessageHandler(string obj) { CustomMessageHandlers.Add(obj); this.AddedNewCustomMessageHandler?.Invoke(obj); } private static void OnAddedNewBoundBehaviour(NetcodeValidator validator, Type custom, Type native) { BoundNetworkObjects.Add((validator, custom, native)); NetcodeValidator.AddedNewBoundBehaviour?.Invoke(validator, native); } } public static class NetworkBehaviourExtensions { public enum RpcState { FromUser, FromNetworking } private static RpcState RpcSource; public static ClientRpcParams CreateSendToFromReceived(this ServerRpcParams senderId) { //IL_0002: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0033: Unknown result type (might be due to invalid IL or missing references) ClientRpcParams result = default(ClientRpcParams); result.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { senderId.Receive.SenderClientId } }; return result; } public static void SyncWithNetworkObject(this NetworkBehaviour networkBehaviour) { if (!networkBehaviour.NetworkObject.ChildNetworkBehaviours.Contains(networkBehaviour)) { networkBehaviour.NetworkObject.ChildNetworkBehaviours.Add(networkBehaviour); } networkBehaviour.UpdateNetworkProperties(); } private static bool ValidateRPCMethod(NetworkBehaviour networkBehaviour, MethodBase method, RpcState state, out RpcAttribute rpcAttribute) { bool flag = ((MemberInfo)method).GetCustomAttributes<ServerRpcAttribute>().Any(); bool flag2 = ((MemberInfo)method).GetCustomAttributes<ClientRpcAttribute>().Any(); bool num = flag && ((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>().RequireOwnership; rpcAttribute = (RpcAttribute)(flag ? ((object)((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>()) : ((object)((MemberInfo)method).GetCustomAttribute<ClientRpcAttribute>())); if (num && networkBehaviour.OwnerClientId != NetworkManager.Singleton.LocalClientId) { Plugin.Logger.LogError((object)TextHandler.NotOwnerOfNetworkObject((state == RpcState.FromUser) ? "We" : "Client", method, networkBehaviour.NetworkObject)); return false; } if (state == RpcState.FromUser && flag2 && !NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { Plugin.Logger.LogError((object)TextHandler.CantRunClientRpcFromClient(method)); return false; } if (state == RpcState.FromUser && !flag && !flag2) { Plugin.Logger.LogError((object)TextHandler.MethodPatchedButLacksAttributes(method)); return false; } if (state == RpcState.FromNetworking && !flag && !flag2) { Plugin.Logger.LogError((object)TextHandler.MethodPatchedAndNetworkCalledButLacksAttributes(method)); return false; } if (state == RpcState.FromNetworking && flag && !networkBehaviour.IsServer && !networkBehaviour.IsHost) { Plugin.Logger.LogError((object)TextHandler.CantRunServerRpcAsClient(method)); return false; } return true; } private static bool MethodPatchInternal(NetworkBehaviour networkBehaviour, MethodBase method, object[] args) { //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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton) || (!NetworkManager.Singleton.IsListening && !NetworkManager.Singleton.IsConnectedClient)) { Plugin.Logger.LogError((object)TextHandler.NoNetworkManagerPresentToSendRpc(networkBehaviour)); return false; } RpcState rpcSource = RpcSource; RpcSource = RpcState.FromUser; if (rpcSource == RpcState.FromNetworking) { return true; } if (!ValidateRPCMethod(networkBehaviour, method, rpcSource, out var rpcAttribute)) { return false; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor((method.GetParameters().Length + 1) * 128, (Allocator)2, -1); ulong networkObjectId = networkBehaviour.NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ushort networkBehaviourId = networkBehaviour.NetworkBehaviourId; ((FastBufferWriter)(ref val)).WriteValueSafe<ushort>(ref networkBehaviourId, default(ForPrimitives)); val.WriteMethodInfoAndParameters(method, args); string text = new StringBuilder("Net").Append(".").Append(method.DeclaringType.Name).ToString(); NetworkDelivery val2 = (NetworkDelivery)(((int)rpcAttribute.Delivery == 0) ? 2 : 0); if (rpcAttribute is ServerRpcAttribute) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(text, 0uL, val, val2); } else { ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length != 0 && parameters[^1].ParameterType == typeof(ClientRpcParams)) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(text, ((ClientRpcParams)args[^1]).Send.TargetClientIds, val, val2); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(text, val, val2); } } return false; } internal static void ReceiveNetworkMessage(ulong sender, FastBufferReader reader) { //IL_0006: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) ulong key = default(ulong); ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); ushort num = default(ushort); ((FastBufferReader)(ref reader)).ReadValueSafe<ushort>(ref num, default(ForPrimitives)); int position = ((FastBufferReader)(ref reader)).Position; string text = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); ((FastBufferReader)(ref reader)).Seek(position); if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value)) { Plugin.Logger.LogError((object)TextHandler.RpcCalledBeforeObjectSpawned()); return; } NetworkBehaviour networkBehaviourAtOrderIndex = value.GetNetworkBehaviourAtOrderIndex(num); MethodInfo method = ((object)networkBehaviourAtOrderIndex).GetType().GetMethod(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); RpcAttribute rpcAttribute; if (method == null) { Plugin.Logger.LogError((object)TextHandler.NetworkCalledNonExistentMethod(networkBehaviourAtOrderIndex, text)); } else if (ValidateRPCMethod(networkBehaviourAtOrderIndex, method, RpcState.FromNetworking, out rpcAttribute)) { RpcSource = RpcState.FromNetworking; ParameterInfo[] parameters = method.GetParameters(); bool num2 = rpcAttribute is ServerRpcAttribute && parameters.Length != 0 && parameters[^1].ParameterType == typeof(ServerRpcParams); object[] args = null; if (parameters.Length != 0) { args = new object[parameters.Length]; } reader.ReadMethodInfoAndParameters(method.DeclaringType, ref args); if (num2) { args[^1] = (object)new ServerRpcParams { Receive = new ServerRpcReceiveParams { SenderClientId = sender } }; } method.Invoke(networkBehaviourAtOrderIndex, args); } } internal static bool MethodPatch(NetworkBehaviour __instance, MethodBase __originalMethod, object[] __args) { return MethodPatchInternal(__instance, __originalMethod, __args); } } [BepInPlugin("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator", "RuntimeNetcodeRPCValidator", "0.2.5")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator"); private List<Type> AlreadyPatchedNativeBehaviours { get; } = new List<Type>(); internal static ManualLogSource Logger { get; private set; } public static event Action NetworkManagerInitialized; public static event Action NetworkManagerShutdown; private void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; NetcodeValidator.AddedNewBoundBehaviour += NetcodeValidatorOnAddedNewBoundBehaviour; _harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkManager), "Initialize", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "OnNetworkManagerInitialized", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(typeof(NetworkManager), "Shutdown", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "OnNetworkManagerShutdown", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private void NetcodeValidatorOnAddedNewBoundBehaviour(NetcodeValidator validator, Type netBehaviour) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown if (!AlreadyPatchedNativeBehaviours.Contains(netBehaviour)) { AlreadyPatchedNativeBehaviours.Add(netBehaviour); MethodBase methodBase = AccessTools.Method(netBehaviour, "Awake", (Type[])null, (Type[])null); if (methodBase == null) { methodBase = AccessTools.Method(netBehaviour, "Start", (Type[])null, (Type[])null); } if (methodBase == null) { methodBase = AccessTools.Constructor(netBehaviour, (Type[])null, false); } Logger.LogInfo((object)TextHandler.RegisteredPatchForType(validator, netBehaviour, methodBase)); HarmonyMethod val = new HarmonyMethod(typeof(NetcodeValidator), "TryLoadRelatedComponentsInOrder", (Type[])null); _harmony.Patch(methodBase, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } protected static void OnNetworkManagerInitialized() { Plugin.NetworkManagerInitialized?.Invoke(); } protected static void OnNetworkManagerShutdown() { Plugin.NetworkManagerShutdown?.Invoke(); } } internal static class TextHandler { private const string NoNetworkManagerPresentToSendRpcConst = "NetworkBehaviour {0} tried to send a RPC but the NetworkManager is non-existant!"; private const string MethodLacksAttributeConst = "Can't patch method {0}.{1} because it lacks a [{2}] attribute."; private const string MethodLacksSuffixConst = "Can't patch method {0}.{1} because it's name doesn't end with '{2}'!"; private const string SuccessfullyPatchedTypeConst = "Patched {0} ServerRPC{1} & {2} ClientRPC{3} on NetworkBehaviour {4}."; private const string NotOwnerOfNetworkObjectConst = "{0} tried to run ServerRPC {1} but not the owner of NetworkObject {2}"; private const string CantRunClientRpcFromClientConst = "Tried to run ClientRpc {0} but we're not a host! You should only call ClientRpc(s) from inside a ServerRpc OR if you've checked you're on the server with IsHost!"; private const string CantRunServerRpcAsClientConst = "Received message to run ServerRPC {0}.{1} but we're a client!"; private const string MethodPatchedButLacksAttributesConst = "Rpc Method {0} has been patched to attempt networking but lacks any RpcAttributes! This should never happen!"; private const string MethodPatchedAndNetworkCalledButLacksAttributesConst = "Rpc Method {0} has been patched && even received a network call to execute but lacks any RpcAttributes! This should never happen! Something is VERY fucky!!!"; private const string RpcCalledBeforeObjectSpawnedConst = "An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs."; private const string NetworkCalledNonExistentMethodConst = "NetworkBehaviour {0} received RPC {1} but that method doesn't exist on {2}!"; private const string ObjectNotSerializableConst = "[Network] Parameter ({0} {1}) is not marked [Serializable] nor does it implement INetworkSerializable!"; private const string InconsistentParameterCountConst = "[Network] NetworkBehaviour received a RPC {0} but the number of parameters sent {1} != MethodInfo param count {2}"; private const string PluginTriedToBindToPreExistingObjectTooLateConst = "Plugin '{0}' tried to bind {1} to {2} but it's too late! Make sure you bind to any pre-existing NetworkObjects before NetworkManager.IsListening || IsConnectedClient."; private const string RegisteredPatchForTypeConst = "Successfully registered first patch for type {0}.{1} | Triggered by {2}"; private const string CustomComponentAddedToExistingObjectConst = "Successfully added {0} to {1} via {2}. Triggered by plugin {3}"; private const string PluginUnpatchedAllRPCsConst = "Plugin {0} has unpatched all RPCs!"; internal static string NoNetworkManagerPresentToSendRpc(NetworkBehaviour networkBehaviour) { return $"NetworkBehaviour {networkBehaviour.NetworkBehaviourId} tried to send a RPC but the NetworkManager is non-existant!"; } internal static string MethodLacksRpcAttribute(MethodInfo method) { return string.Format("Can't patch method {0}.{1} because it lacks a [{2}] attribute.", method.DeclaringType?.Name, method.Name, method.Name.EndsWith("ServerRpc") ? "ServerRpc" : "ClientRpc"); } internal static string MethodLacksSuffix(MethodBase method) { return string.Format("Can't patch method {0}.{1} because it's name doesn't end with '{2}'!", method.DeclaringType?.Name, method.Name, (((MemberInfo)method).GetCustomAttribute<ServerRpcAttribute>() != null) ? "ServerRpc" : "ClientRpc"); } internal static string SuccessfullyPatchedType(Type networkType, int serverRpcCount, int clientRpcCount) { return string.Format("Patched {0} ServerRPC{1} & {2} ClientRPC{3} on NetworkBehaviour {4}.", serverRpcCount, (serverRpcCount == 1) ? "" : "s", clientRpcCount, (clientRpcCount == 1) ? "" : "s", networkType.Name); } internal static string NotOwnerOfNetworkObject(string whoIsNotOwner, MethodBase method, NetworkObject networkObject) { return $"{whoIsNotOwner} tried to run ServerRPC {method.Name} but not the owner of NetworkObject {networkObject.NetworkObjectId}"; } internal static string CantRunClientRpcFromClient(MethodBase method) { return $"Tried to run ClientRpc {method.Name} but we're not a host! You should only call ClientRpc(s) from inside a ServerRpc OR if you've checked you're on the server with IsHost!"; } internal static string CantRunServerRpcAsClient(MethodBase method) { return $"Received message to run ServerRPC {method.DeclaringType?.Name}.{method.Name} but we're a client!"; } internal static string MethodPatchedButLacksAttributes(MethodBase method) { return $"Rpc Method {method.Name} has been patched to attempt networking but lacks any RpcAttributes! This should never happen!"; } internal static string MethodPatchedAndNetworkCalledButLacksAttributes(MethodBase method) { return $"Rpc Method {method.Name} has been patched && even received a network call to execute but lacks any RpcAttributes! This should never happen! Something is VERY fucky!!!"; } internal static string RpcCalledBeforeObjectSpawned() { return "An RPC called on a NetworkObject that is not in the spawned objects list. Please make sure the NetworkObject is spawned before calling RPCs."; } internal static string NetworkCalledNonExistentMethod(NetworkBehaviour networkBehaviour, string rpcName) { return $"NetworkBehaviour {networkBehaviour.NetworkBehaviourId} received RPC {rpcName} but that method doesn't exist on {((object)networkBehaviour).GetType().Name}!"; } internal static string ObjectNotSerializable(ParameterInfo paramInfo) { return $"[Network] Parameter ({paramInfo.ParameterType.Name} {paramInfo.Name}) is not marked [Serializable] nor does it implement INetworkSerializable!"; } internal static string InconsistentParameterCount(MethodBase method, int paramsSent) { return $"[Network] NetworkBehaviour received a RPC {method.Name} but the number of parameters sent {paramsSent} != MethodInfo param count {method.GetParameters().Length}"; } internal static string PluginTriedToBindToPreExistingObjectTooLate(NetcodeValidator netcodeValidator, Type from, Type to) { return $"Plugin '{netcodeValidator.PluginGuid}' tried to bind {from.Name} to {to.Name} but it's too late! Make sure you bind to any pre-existing NetworkObjects before NetworkManager.IsListening || IsConnectedClient."; } internal static string RegisteredPatchForType(NetcodeValidator validator, Type netBehaviour, MethodBase method) { return $"Successfully registered first patch for type {netBehaviour.Name}.{method.Name} | Triggered by {validator.PluginGuid}"; } internal static string CustomComponentAddedToExistingObject((NetcodeValidator validator, Type custom, Type native) it, MethodBase methodBase) { return $"Successfully added {it.custom.Name} to {it.native.Name} via {methodBase.Name}. Triggered by plugin {it.validator.PluginGuid}"; } internal static string PluginUnpatchedAllRPCs(NetcodeValidator netcodeValidator) { return $"Plugin {netcodeValidator.PluginGuid} has unpatched all RPCs!"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "NicholaScott.BepInEx.RuntimeNetcodeRPCValidator"; public const string PLUGIN_NAME = "RuntimeNetcodeRPCValidator"; public const string PLUGIN_VERSION = "0.2.5"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
plugins/Peepers.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using LCPeeper.Properties; using Peepers.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Peepers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds a new non-lethal monster to the game with unique mechanics and interactions.")] [assembly: AssemblyFileVersion("0.9.6.0")] [assembly: AssemblyInformationalVersion("0.9.6")] [assembly: AssemblyProduct("Peepers")] [assembly: AssemblyTitle("Peepers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.6.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace LCPeeper { [BepInPlugin("x753.Peepers", "Peepers", "0.9.6")] public class Peeper : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(PeeperPrefab); } } private const string modGUID = "x753.Peepers"; private const string modName = "Peepers"; private const string modVersion = "0.9.6"; private readonly Harmony harmony = new Harmony("x753.Peepers"); private static Peeper Instance; public static GameObject PeeperPrefab; public static EnemyType PeeperType; public static TerminalNode PeeperFile; public static int PeeperCreatureID = 0; public static List<PeeperAI> PeeperList = new List<PeeperAI>(); public static List<string> ignoreEnemies = new List<string> { "Peeper", "Manticoil", "Docile Locust Bees", "Girl" }; public static float PeeperSpawnChance; public static int PeeperMinGroupSize; public static int PeeperMaxGroupSize; public static float PeeperWeight; private void Awake() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.peeper); PeeperPrefab = val.LoadAsset<GameObject>("Assets/PeeperPrefab.prefab"); PeeperType = val.LoadAsset<EnemyType>("Assets/PeeperType.asset"); PeeperFile = val.LoadAsset<TerminalNode>("Assets/PeeperFile.asset"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Peepers is loaded!"); PeeperSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Rate", "Hourly Spawn Chance (%)", 10f, "Chance of a group of peepers spawning each hour").Value; PeeperMinGroupSize = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Minimum Peeper Group Size", 2, "The minimum number of peepers in a single group").Value; PeeperMaxGroupSize = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Peeper Group Size", 4, "The maximum number of peepers in a single group").Value; PeeperWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Peeper Settings", "Peeper Weight (lb)", 10f, "The weight of a single peeper in pounds.").Value / 105f; 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); } } } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(Terminal __instance) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); if (!Object.op_Implicit((Object)(object)val.enemyFiles.Find((TerminalNode node) => node.creatureName == "Peepers"))) { Peeper.PeeperCreatureID = val.enemyFiles.Count; Peeper.PeeperFile.creatureFileID = Peeper.PeeperCreatureID; val.enemyFiles.Add(Peeper.PeeperFile); TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val3 = ScriptableObject.CreateInstance<TerminalKeyword>(); val3.word = "peepers"; val3.isVerb = false; val3.defaultVerb = val2; List<CompatibleNoun> list = val2.compatibleNouns.ToList(); list.Add(new CompatibleNoun { noun = val3, result = Peeper.PeeperFile }); val2.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val3); val.terminalNodes.allKeywords = list2.ToArray(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void AdvanceHourAndSpawnNewBatchOfEnemiesPatch(RoundManager __instance) { //IL_003a: 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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 100f); if (num > Peeper.PeeperSpawnChance) { return; } GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode"); Vector3 position = array[__instance.AnomalyRandom.Next(0, array.Length)].transform.position; position = __instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); int num2 = 0; bool flag = false; for (int i = 0; i < array.Length - 1; i++) { for (int j = 0; j < __instance.spawnDenialPoints.Length; j++) { flag = true; if (Vector3.Distance(position, __instance.spawnDenialPoints[j].transform.position) < 8f) { num2 = (num2 + 1) % array.Length; position = array[num2].transform.position; position = __instance.GetRandomNavMeshPositionInRadius(position, 4f, default(NavMeshHit)); flag = false; break; } } if (flag) { break; } } int num3 = Random.Range(Peeper.PeeperMinGroupSize, Peeper.PeeperMaxGroupSize); for (int k = 0; k <= num3; k++) { RoundManager.Instance.SpawnEnemyGameObject(position, 0f, -1, Peeper.PeeperType); EnemyType peeperType = Peeper.PeeperType; peeperType.numberSpawned++; RoundManager instance = RoundManager.Instance; instance.currentDaytimeEnemyPower++; } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref StartOfRound __instance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)Peeper.PeeperType)) { int rarity = 0; val.DaytimeEnemies.Add(new SpawnableEnemyWithRarity { enemyType = Peeper.PeeperType, rarity = rarity }); break; } } } [HarmonyPatch("EndOfGame")] [HarmonyPrefix] private static void EndOfGamePatch(StartOfRound __instance, int bodiesInsured = 0, int connectedPlayersOnServer = 0, int scrapCollected = 0) { foreach (PeeperAI peeper in Peeper.PeeperList) { if (peeper.isAttached && (Object)(object)peeper.attachedPlayer != (Object)null && !peeper.attachedPlayer.isPlayerDead) { peeper.IsWeighted = false; } } Peeper.PeeperList = new List<PeeperAI>(); PeeperAI.UsedAttachTargets = new List<Transform>(); } } [HarmonyPatch(typeof(StunGrenadeItem))] internal class StunGrenadeItemPatch { [HarmonyPatch("StunExplosion")] [HarmonyPostfix] private static void StunExplosion(StunGrenadeItem __instance, Vector3 explosionPosition, bool affectAudio, float flashSeverityMultiplier, float enemyStunTime, float flashSeverityDistanceRolloff = 1f, bool isHeldItem = false, PlayerControllerB playerHeldBy = null, PlayerControllerB playerThrownBy = null, float addToFlashSeverity = 0f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!(Vector3.Distance(((Component)localPlayerController).transform.position, explosionPosition) < 16f) || (Vector3.Distance(((Component)localPlayerController).transform.position, explosionPosition) > 5f && (!isHeldItem || !((Object)(object)playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)) && Physics.Linecast(explosionPosition + Vector3.up * 0.5f, ((Component)localPlayerController.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { return; } List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)localPlayerController && ((NetworkBehaviour)item).IsOwner) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } } } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManAIPatcher { [HarmonyPrefix] [HarmonyPatch("DoAIInterval")] private static void DoAllIntervalPrefix(ref SpringManAI __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (PeeperAI.HasLineOfSightToPeeper(((Component)__instance).transform.position)) { ((EnemyAI)__instance).currentBehaviourStateIndex = 1; } } [HarmonyTranspiler] [HarmonyPatch("Update")] private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown MethodInfo method = typeof(PeeperAI).GetMethod("HasLineOfSightToPeeper", BindingFlags.Static | BindingFlags.Public); MethodInfo method2 = typeof(SpringManAI).GetMethod("get_transform"); MethodInfo method3 = typeof(Transform).GetMethod("get_position"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 1; i < list.Count; i++) { if (!(list[i - 1].opcode != OpCodes.Ldc_I4_0) && !(list[i].opcode != OpCodes.Stloc_1)) { list.Insert(i, new CodeInstruction(OpCodes.Or, (object)null)); list.Insert(i, new CodeInstruction(OpCodes.Call, (object)method)); list.Insert(i, new CodeInstruction(OpCodes.Callvirt, (object)method3)); list.Insert(i, new CodeInstruction(OpCodes.Call, (object)method2)); list.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); break; } } return list; } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { private static FieldInfo SprayMatIndex = typeof(SprayPaintItem).GetField("sprayCanMatsIndex", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("SprayPaintClientRpc")] [HarmonyPrefix] private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_00bc: Unknown result type (might be due to invalid IL or missing references) try { Ray val = default(Ray); ((Ray)(ref val))..ctor(sprayPos, sprayRot); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 4f, 524288, (QueryTriggerInteraction)2) || !((Object)(object)((RaycastHit)(ref val2)).collider != (Object)null) || !(((Object)((RaycastHit)(ref val2)).collider).name == "PeeperSprayCollider")) { return; } PeeperAI component = ((Component)((Component)((RaycastHit)(ref val2)).collider).transform.parent.parent.parent.parent.parent.parent.parent).GetComponent<PeeperAI>(); if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)component.attachedPlayer)) { ((Renderer)component.peeperMesh).materials[0].color = __instance.sprayCanMats[(int)SprayMatIndex.GetValue(__instance)].color; if (component.isAttached) { component.EjectFromPlayerServerRpc(component.attachedPlayer.actualClientId); } } } catch (Exception) { } } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(FlashlightItem __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (!((NetworkBehaviour)__instance).IsOwner || __instance.flashlightTypeID != 2 || !((GrabbableObject)__instance).isBeingUsed) { return; } Transform transform = ((Component)__instance.flashlightBulb).transform; Ray val = default(Ray); ((Ray)(ref val))..ctor(transform.position, transform.forward); RaycastHit[] array = Physics.RaycastAll(val, 32f, 1 << LayerMask.NameToLayer("ScanNode")); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!(((Object)((RaycastHit)(ref val2)).collider).name == "PeeperScanNode")) { continue; } float num = Vector3.Angle(-((Ray)(ref val)).direction, ((RaycastHit)(ref val2)).transform.forward); if (num < 55f) { PeeperAI component = ((Component)((RaycastHit)(ref val2)).transform.parent.parent.parent.parent.parent.parent.parent).GetComponent<PeeperAI>(); if ((Object)(object)component.attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { break; } if (((NetworkBehaviour)component).IsOwner) { ((EnemyAI)component).KillEnemyOnOwnerClient(false); } else { component.KillEnemyNetworked(); } } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static void KillPlayerPatch(PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && ((NetworkBehaviour)item).IsOwner) { if ((int)causeOfDeath == 11 || (int)causeOfDeath == 3) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } else { item.EjectFromPlayerServerRpc(__instance.playerClientId); } } } } [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] private static void DamagePlayerPatch(PlayerControllerB __instance, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3)) { List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance) { item.EjectFromPlayerServerRpc(__instance.playerClientId); } } } [HarmonyPatch("IShockableWithGun.ShockWithGun")] [HarmonyPrefix] private static void DamagePlayerPatch(PlayerControllerB __instance, PlayerControllerB shockedByPlayer) { List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && ((NetworkBehaviour)item).IsOwner) { ((EnemyAI)item).KillEnemyOnOwnerClient(false); } } } [HarmonyPatch("DropAllHeldItems")] [HarmonyPostfix] private static void DamagePlayeDropAllHeldItemsPatch(PlayerControllerB __instance, bool itemsFall = true, bool disconnecting = false) { if (__instance.carryWeight != 1f) { return; } List<PeeperAI> list = new List<PeeperAI>(Peeper.PeeperList); foreach (PeeperAI item in list) { if ((Object)(object)item.attachedPlayer == (Object)(object)__instance && item.isAttached && !((EnemyAI)item).isEnemyDead) { __instance.carryWeight += Peeper.PeeperWeight; } } } } public class PeeperAI : EnemyAI { [Header("General")] public GameObject creatureModel; public SkinnedMeshRenderer peeperMesh; public ScanNodeProperties scanNode; [Header("AI and Pathfinding")] public AISearchRoutine searchForPlayers; public float maxSearchAndRoamRadius = 100f; public float searchPrecisionValue = 5f; private int sightRange = 30; [Header("Constraints and Transforms")] public Transform attachTargetTransform; public static List<Transform> UsedAttachTargets = new List<Transform>(); public Vector3 attachTargetTranslationOffset; public Vector3 attachTargetRotationOffset; public Transform eyeTransform; public Transform eyeOriginalTransform; public bool isAttached; public PlayerControllerB attachedPlayer; [Header("Colliders and Physics")] public SphereCollider attachCollider; public SphereCollider physicsCollider; public SphereCollider hitboxCollider; public Rigidbody physicsRigidbody; [Header("State Handling and Sync")] public float stateTimer; public float stateTimer2; public int stateCounter; [Header("Audio")] public AudioSource AttachSFXSource; public AudioClip walkSFX; public AudioClip runSFX; public AudioClip[] spotSFX; public AudioClip[] jumpSFX; public AudioClip[] attachSFX; public AudioClip[] deathSFX; public AudioClip[] ejectSFX; public AudioClip[] zapSFX; public AudioClip[] whisperSFX; public static float NextWhisperTime; [Header("Materials")] public Material baseMat; public Material paintedMat; public Material deadMat; public ParticleSystem deathParticles; [Header("Ragdoll")] private bool ragdollFrozen; public Rigidbody[] ragdollRigidbodies; public Collider[] ragdollColliders; private Vector3 agentLocalVelocity; private Vector3 previousPosition; private float velX; private float velZ; private float velXZ; private float footstepTimer; private Vector3 deathDirection = Vector3.zero; private float blinkTimer; private float blinkInterval; private bool isWeightedInternal; public bool IsWeighted { get { return isWeightedInternal; } set { if (value && !isWeightedInternal) { PlayerControllerB obj = attachedPlayer; obj.carryWeight += Peeper.PeeperWeight; } else if (!value && isWeightedInternal) { PlayerControllerB obj2 = attachedPlayer; obj2.carryWeight += 0f - Peeper.PeeperWeight; if (attachedPlayer.carryWeight < 1f) { attachedPlayer.carryWeight = 1f; } } isWeightedInternal = value; } } public override void Start() { ((EnemyAI)this).Start(); searchForPlayers.searchWidth = maxSearchAndRoamRadius; searchForPlayers.searchPrecision = searchPrecisionValue; Peeper.PeeperList.Add(this); AudioMixer diageticMixer = SoundManager.Instance.diageticMixer; base.creatureVoice.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; base.creatureSFX.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; AttachSFXSource.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0]; scanNode.creatureScanID = Peeper.PeeperCreatureID; SwitchBehaviourState(2); } public override void DoAIInterval() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (base.inSpecialAnimation) { return; } ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0 || base.isEnemyDead) { return; } if (base.currentBehaviourStateIndex != 0) { if (searchForPlayers.inProgress) { ((EnemyAI)this).StopSearch(searchForPlayers, true); base.movingTowardsTargetPlayer = true; } } else if (!searchForPlayers.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers); } } public override void FinishedCurrentSearchRoutine() { ((EnemyAI)this).FinishedCurrentSearchRoutine(); searchForPlayers.searchWidth = Mathf.Clamp(searchForPlayers.searchWidth + 20f, 1f, maxSearchAndRoamRadius); } private void CalculateAnimationDirection() { //IL_000d: 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_0018: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_009c: Unknown result type (might be due to invalid IL or missing references) agentLocalVelocity = ((Component)this).transform.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f)); velX = Mathf.Lerp(velX, agentLocalVelocity.x, 5f * Time.deltaTime); velZ = Mathf.Lerp(velZ, 0f - agentLocalVelocity.z, 5f * Time.deltaTime); previousPosition = ((Component)this).transform.position; velXZ = Mathf.Sqrt(velX * velX + velZ * velZ); base.creatureAnimator.SetFloat("Speed", velXZ); float num = ((base.currentBehaviourStateIndex != 1 && base.currentBehaviourStateIndex != 5) ? 0.3335f : 0.3f); footstepTimer += Time.deltaTime; if (footstepTimer < num) { return; } footstepTimer = 0f; if ((double)velXZ > 0.15) { if (base.currentBehaviourStateIndex == 1) { PlayCreatureSFX(2); } else { PlayCreatureSFX(1); } } } private void PutCreatureOnGround() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!(base.agent.velocity.y > 5f)) { base.creatureAnimator.SetBool("Grounded", true); base.creatureAnimator.SetBool("Jump", false); Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)this).transform.position + Vector3.up, Vector3.down); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 2f, LayerMask.GetMask(new string[2] { "Room", "Colliders" }), (QueryTriggerInteraction)1)) { creatureModel.transform.localPosition = new Vector3(0f, 0f - ((RaycastHit)(ref val2)).distance + 1f, 0f); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).HitEnemy(force, playerWhoHit, false); base.enemyHP -= force; if ((Object)(object)playerWhoHit != (Object)null) { Vector3 val = ((Component)this).transform.position - ((Component)playerWhoHit).transform.position; deathDirection = ((Vector3)(ref val)).normalized; } if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { base.enemyHP--; if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } public void KillEnemyNetworked() { if (((NetworkBehaviour)this).IsServer) { KillEnemyClientRpc(); } else { KillEnemyServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void KillEnemyServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1087886824u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1087886824u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { KillEnemyClientRpc(); } } } [ClientRpc] public void KillEnemyClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2756874777u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2756874777u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((EnemyAI)this).KillEnemy(false); } } } public override void KillEnemy(bool destroy = false) { //IL_004e: 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_008a: 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_00f2: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).KillEnemy(false); base.creatureVoice.Stop(); base.creatureSFX.Stop(); PlayCreatureSFX(5); SwitchBehaviourState(7); base.isEnemyDead = true; Peeper.PeeperList.Remove(this); creatureModel.transform.localPosition = Vector3.zero; if (isAttached && (Object)(object)attachedPlayer != (Object)null) { EjectFromPlayer(attachedPlayer); } Color color = ((Renderer)peeperMesh).material.color; ((Renderer)peeperMesh).materials = (Material[])(object)new Material[1] { deadMat }; ((Renderer)peeperMesh).materials[0].color = color; deathParticles.Play(); ((Behaviour)base.creatureAnimator).enabled = false; physicsRigidbody.isKinematic = true; Rigidbody[] array = ragdollRigidbodies; foreach (Rigidbody val in array) { val.isKinematic = false; if (deathDirection != Vector3.zero) { val.AddForce(15f * deathDirection, (ForceMode)1); } } Collider[] array2 = ragdollColliders; foreach (Collider val2 in array2) { val2.enabled = true; } peeperMesh.SetBlendShapeWeight(0, 0f); peeperMesh.SetBlendShapeWeight(1, 350f); } public void SwitchBehaviourState(int state) { SwitchBehaviourStateLocally(state); SwitchBehaviourStateServerRpc(state); } [ServerRpc(RequireOwnership = false)] public void SwitchBehaviourStateServerRpc(int state) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(316864934u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, state); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 316864934u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SwitchBehaviourStateClientRpc(state); } } } [ClientRpc] public void SwitchBehaviourStateClientRpc(int state) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4022924503u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, state); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4022924503u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SwitchBehaviourStateLocally(state); } } } public void SwitchBehaviourStateLocally(int state) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) stateTimer = 0f; stateTimer2 = 0f; stateCounter = 0; switch (state) { case 0: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 2f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 1: base.agent.speed = 6f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 2: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", true); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 3: { base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 2f; hitboxCollider.center = Vector3.zero; SphereCollider obj3 = physicsCollider; ((Collider)obj3).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj3).includeLayers) & -524289); SphereCollider obj4 = physicsCollider; ((Collider)obj4).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj4).excludeLayers) | 0x80000); break; } case 4: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; creatureModel.transform.localPosition = Vector3.zero; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", true); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = false; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = false; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; NextWhisperTime = Time.time + 10f; break; case 5: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", true); base.inSpecialAnimation = false; ((Behaviour)base.agent).enabled = true; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = new Vector3(0f, 0.5f, 0f); break; case 6: { stateTimer = Random.Range(0f, 1f); base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; SphereCollider obj = physicsCollider; ((Collider)obj).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj).includeLayers) | 0x80000); SphereCollider obj2 = physicsCollider; ((Collider)obj2).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj2).excludeLayers) & -524289); break; } case 7: base.targetPlayer = null; base.movingTowardsTargetPlayer = false; base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", false); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", true); base.creatureAnimator.SetBool("Grounded", false); base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = false; ((Collider)attachCollider).enabled = false; ((Collider)physicsCollider).enabled = false; physicsRigidbody.isKinematic = true; ((Collider)hitboxCollider).enabled = false; hitboxCollider.radius = 0.5f; hitboxCollider.center = Vector3.zero; break; } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(state); } private void LateUpdate() { //IL_0020: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead) { return; } if (isAttached) { ((Component)this).transform.position = attachTargetTransform.position; ((Component)this).transform.rotation = attachTargetTransform.rotation; ((Component)this).transform.Rotate(attachTargetRotationOffset); ((Component)this).transform.Translate(0f, 0f, attachTargetTranslationOffset.z, (Space)1); ((Component)this).transform.Translate(0f, attachTargetTranslationOffset.y, 0f, attachTargetTransform); } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if (currentBehaviourStateIndex == 4) { blinkTimer += Time.deltaTime; if (blinkTimer > blinkInterval) { base.creatureAnimator.SetTrigger("Blink"); blinkInterval = Random.Range(2f, 12f); blinkTimer = 0f; } } if (base.isEnemyDead || (Object)(object)attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } PlayerControllerB val = null; float num = 7f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)(object)attachedPlayer)) { float num2 = Vector3.Distance(eyeTransform.position, ((Component)val2.gameplayCamera).transform.position); Vector3 val3 = ((Component)val2).transform.position - eyeTransform.position; float num3 = Vector3.Angle(eyeOriginalTransform.forward, val3); if (num2 < num && num3 < 70f) { val = val2; num = num2; } } } if ((Object)(object)val != (Object)null) { Transform transform = ((Component)val.gameplayCamera).transform; float num4 = Vector3.Distance(eyeTransform.position, transform.position); if (num4 < 7f) { Vector3 val4 = transform.position - eyeTransform.position; Quaternion val5 = Quaternion.LookRotation(val4, eyeTransform.up); Quaternion val6 = Quaternion.RotateTowards(eyeOriginalTransform.rotation, val5, 40f); float num5 = Quaternion.Angle(val5, eyeOriginalTransform.rotation); if (num5 < 90f) { eyeTransform.rotation = Quaternion.RotateTowards(eyeTransform.rotation, val6, 120f * Time.deltaTime); return; } } } eyeTransform.rotation = Quaternion.RotateTowards(eyeTransform.rotation, eyeOriginalTransform.rotation, 20f * Time.deltaTime); } public override void Update() { //IL_00a4: 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_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { base.currentBehaviourStateIndex = 7; } else if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 5) { CalculateAnimationDirection(); } if (base.currentBehaviourStateIndex == 0) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } stateTimer += Time.deltaTime; if (!(stateTimer < 0.15f)) { stateTimer = 0f; PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if (!((Object)(object)val == (Object)null) && !(Vector3.Distance(base.eye.position, ((Component)val.gameplayCamera).transform.position) > (float)sightRange)) { PlayCreatureSFXServerRpc(0); BeginChasingPlayerServerRpc((int)val.playerClientId); SwitchBehaviourState(1); } } } else if (base.currentBehaviourStateIndex == 1) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } if (stateTimer2 < 0.5f) { stateTimer2 += Time.deltaTime; return; } if ((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)base.targetPlayer.playerGlobalHead).transform.position, base.eye.position) < 8f) { Vector3 val2 = ((Component)base.targetPlayer.playerGlobalHead).transform.position - base.eye.position; val2.y = 0f; Vector3 forward = base.eye.forward; forward.y = 0f; if (Vector3.Angle(forward, val2) < 15f) { PlayCreatureSFXServerRpc(3); SwitchBehaviourState(3); JumpAtPlayerServerRpc(base.targetPlayer.playerClientId); return; } } stateTimer += Time.deltaTime; if (stateTimer < 0.15f) { return; } stateTimer = 0f; PlayerControllerB val3 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if ((Object)(object)val3 == (Object)null || Vector3.Distance(base.eye.position, ((Component)val3.gameplayCamera).transform.position) > (float)sightRange) { stateCounter++; if (stateCounter >= 8) { stateCounter = 0; SwitchBehaviourState(0); } } else if ((Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController) { BeginChasingPlayerServerRpc((int)val3.playerClientId); } } else if (base.currentBehaviourStateIndex == 2) { PutCreatureOnGround(); if (!((NetworkBehaviour)this).IsOwner) { return; } stateTimer += Time.deltaTime; if (stateTimer > 5.5f) { stateTimer = 0f; if ((Object)(object)base.targetPlayer != (Object)null) { SwitchBehaviourState(1); } else { SwitchBehaviourState(0); } } stateTimer2 += Time.deltaTime; if (!(stateTimer2 < 0.5f)) { stateTimer2 = 0f; PlayerControllerB val4 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(70f, sightRange, 3, 0f); if (!((Object)(object)val4 == (Object)null) && !(Vector3.Distance(base.eye.position, ((Component)val4.gameplayCamera).transform.position) > (float)sightRange)) { BeginChasingPlayerServerRpc((int)val4.playerClientId); } } } else if (base.currentBehaviourStateIndex == 3) { if (!((NetworkBehaviour)this).IsOwner) { ((Component)this).transform.position = base.serverPosition; return; } ((EnemyAI)this).SyncPositionToClients(); if (stateCounter == 0) { stateTimer += Time.deltaTime; if (stateTimer > 2.5f) { hitboxCollider.radius = 0.5f; SphereCollider obj = physicsCollider; ((Collider)obj).includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj).includeLayers) | 0x80000); SphereCollider obj2 = physicsCollider; ((Collider)obj2).excludeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(((Collider)obj2).excludeLayers) & -524289); stateCounter = 1; } } stateTimer2 += Time.deltaTime; if (!(stateTimer2 < 5f)) { stateTimer2 = 0f; PlayCreatureSFXServerRpc(0, 0.5f); SwitchBehaviourState(5); } } else if (base.currentBehaviourStateIndex == 4) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).SyncPositionToClients(); } stateTimer += Time.deltaTime; if (stateTimer < 1f) { return; } stateTimer = 0f; if (Time.time < NextWhisperTime) { return; } NextWhisperTime = Time.time + 10f; Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 16f, LayerMask.GetMask(new string[1] { "Enemies" }), (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val5 in array2) { EnemyAI componentInParent = ((Component)val5).gameObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null && !Peeper.ignoreEnemies.Contains(componentInParent.enemyType.enemyName)) { PlayCreatureSFXServerRpc(7); NextWhisperTime = Time.time + Random.Range(6f, 12f); return; } } NextWhisperTime = Time.time + 1f; } else if (base.currentBehaviourStateIndex == 5) { PutCreatureOnGround(); if (((NetworkBehaviour)this).IsOwner) { stateTimer += Time.deltaTime; if (!(stateTimer < 1.2f)) { stateTimer = 0f; SwitchBehaviourState(0); } } } else if (base.currentBehaviourStateIndex == 6) { if (!((NetworkBehaviour)this).IsOwner) { ((Component)this).transform.position = base.serverPosition; return; } ((EnemyAI)this).SyncPositionToClients(); stateTimer += Time.deltaTime; if (!(stateTimer < 5f)) { stateTimer = 4.5f; Vector3 velocity = physicsRigidbody.velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude > 10f)) { PlayCreatureSFXServerRpc(0, 0.5f); SwitchBehaviourState(5); } } } else { if (base.currentBehaviourStateIndex != 7 || ragdollFrozen) { return; } stateTimer += Time.deltaTime; if (!(stateTimer < 15f)) { stateTimer = 0f; Rigidbody[] array3 = ragdollRigidbodies; foreach (Rigidbody val6 in array3) { val6.isKinematic = true; ragdollFrozen = true; } } } } [ServerRpc(RequireOwnership = false)] public void JumpAtPlayerServerRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3297439372u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3297439372u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { JumpAtPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void JumpAtPlayerClientRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3646752176u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3646752176u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { JumpAtPlayer(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } private void JumpAtPlayer(PlayerControllerB playerScript) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //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_0113: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (!base.isEnemyDead && !isAttached) { base.agent.speed = 0f; creatureModel.transform.localPosition = Vector3.zero; base.creatureAnimator.SetBool("Jump", true); base.creatureAnimator.SetBool("Attached", false); base.creatureAnimator.SetBool("Dead", false); isAttached = false; base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.enemyType.canBeStunned = true; ((Collider)attachCollider).enabled = true; ((Collider)physicsCollider).enabled = true; physicsRigidbody.isKinematic = false; ((Collider)hitboxCollider).enabled = true; hitboxCollider.radius = 2f; Vector3 val = ((Component)playerScript.playerGlobalHead).transform.position; if ((Object)(object)base.targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { val += base.targetPlayer.thisController.velocity / 5f; } else if (base.targetPlayer.timeSincePlayerMoving < 0.25f) { val += Vector3.Normalize((base.targetPlayer.serverPlayerPosition - base.targetPlayer.oldPlayerPosition) * 100f); } Rigidbody obj = physicsRigidbody; Vector3 val2 = val - ((Component)this).transform.position + Vector3.up; obj.velocity = 33f * ((Vector3)(ref val2)).normalized; base.creatureAnimator.SetBool("Grounded", false); } } [ServerRpc(RequireOwnership = false)] public void BeginChasingPlayerServerRpc(int playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2492932585u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2492932585u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { BeginChasingPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void BeginChasingPlayerClientRpc(int playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3529258009u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3529258009u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { BeginChasingPlayer(playerObjectId); } } } public void BeginChasingPlayer(int playerObjectId) { PlayerControllerB movingTowardsTargetPlayer = (base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]); if (((NetworkBehaviour)this).OwnerClientId != (ulong)playerObjectId) { ((EnemyAI)this).ChangeOwnershipOfEnemy((ulong)playerObjectId); } ((EnemyAI)this).SetMovingTowardsTargetPlayer(movingTowardsTargetPlayer); } [ServerRpc(RequireOwnership = false)] public void PlayCreatureSFXServerRpc(int index, float volume = 1f) { //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_0071: 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) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1656237277u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1656237277u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayCreatureSFXClientRpc(index, volume); } } } [ClientRpc] public void PlayCreatureSFXClientRpc(int index, float volume = 1f) { //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_0071: 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) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2720121576u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2720121576u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayCreatureSFX(index, volume); } } } private void PlayCreatureSFX(int index, float volume = 1f) { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) base.creatureVoice.pitch = Random.Range(0.8f, 1.1f); AttachSFXSource.pitch = Random.Range(0.9f, 1.05f); switch (index) { case 0: { AudioClip val = spotSFX[Random.Range(0, spotSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 1: base.creatureSFX.PlayOneShot(walkSFX, volume * 0.22f); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, walkSFX, volume * 0.22f); break; case 2: base.creatureSFX.PlayOneShot(runSFX, volume * 0.25f); WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, runSFX, volume * 0.25f); break; case 3: { AudioClip val = jumpSFX[Random.Range(0, jumpSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 4: { AudioClip val = attachSFX[0]; AttachSFXSource.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(AttachSFXSource, val, volume); break; } case 5: { AudioClip val = deathSFX[Random.Range(0, deathSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 6: { AudioClip val = ejectSFX[Random.Range(0, ejectSFX.Length)]; base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume); break; } case 7: { AudioClip val = whisperSFX[Random.Range(0, whisperSFX.Length)]; AttachSFXSource.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(AttachSFXSource, val, volume); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 18f, 0.6f, 0, false, 0); break; } } } [ServerRpc(RequireOwnership = false)] public void AttachToPlayerServerRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2592041692u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2592041692u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AttachToPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void AttachToPlayerClientRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4096406816u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4096406816u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AttachToPlayerLocally(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } private void AttachToPlayerLocally(PlayerControllerB playerScript) { //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || isAttached || playerScript.isPlayerDead) { return; } int num = 0; foreach (PeeperAI peeper in Peeper.PeeperList) { if ((Object)(object)peeper.attachedPlayer == (Object)(object)playerScript) { num++; } } if (num >= 10) { return; } isAttached = true; base.targetPlayer = playerScript; attachedPlayer = playerScript; if (!playerScript.isPlayerDead) { IsWeighted = true; } if ((Object)(object)playerScript == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } ((EnemyAI)this).ChangeOwnershipOfEnemy(playerScript.actualClientId); SwitchBehaviourStateLocally(4); PlayCreatureSFX(4); float num2 = 0f; float num3 = 0f; float num4 = 0f; Transform val = null; Random.InitState(base.thisEnemyIndex + StartOfRound.Instance.randomMapSeed); int num5 = Random.Range(0, 11); for (int i = 0; i < 10; i++) { if (num5 == 6) { num5++; } if (!UsedAttachTargets.Contains(attachedPlayer.bodyParts[num5])) { val = ((num5 != 0 || !((Object)(object)attachedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController)) ? attachedPlayer.bodyParts[num5] : ((Component)attachedPlayer.gameplayCamera).transform); UsedAttachTargets.Add(val); attachTargetTransform = val; break; } num5 = ((num5 != 10) ? (num5 + 1) : 0); } if (!((Object)(object)val == (Object)null)) { switch (num5) { case 0: num2 = Random.Range(-30f, -90f); num3 = Random.Range(80f, 280f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0.35f, 0.2f); break; case 1: num3 = Random.Range(60f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.075f); break; case 2: num3 = Random.Range(-60f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.075f); break; case 3: num3 = Random.Range(0f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 4: num3 = Random.Range(0f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 5: num3 = Random.Range(-30f, 30f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 7: num3 = Random.Range(0f, 160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 8: num3 = Random.Range(0f, -160f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.2f); break; case 9: num3 = Random.Range(160f, 280f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.15f); break; case 10: num3 = Random.Range(-20f, 100f); num4 = Random.Range(0f, 360f); attachTargetTranslationOffset = new Vector3(0f, 0f, 0.15f); break; default: Debug.Log((object)("Peepers have encountered an error when attaching! Report it to the developer! Target Index: " + num5)); break; } attachTargetRotationOffset = new Vector3(num2, num3, num4); creatureModel.transform.localPosition = Vector3.zero; } } [ServerRpc(RequireOwnership = false)] public void EjectFromPlayerServerRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1104444428u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1104444428u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EjectFromPlayerClientRpc(playerObjectId); } } } [ClientRpc] public void EjectFromPlayerClientRpc(ulong playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(280628075u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 280628075u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EjectFromPlayer(StartOfRound.Instance.allPlayerScripts[(int)(IntPtr)checked((long)playerObjectId)]); } } } public void EjectFromPlayer(PlayerControllerB playerScript) { //IL_0053: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (isAttached) { isAttached = false; if (!playerScript.isPlayerDead) { IsWeighted = false; } attachedPlayer = null; UsedAttachTargets.Remove(attachTargetTransform); attachTargetTransform = null; if (!base.isEnemyDead) { SwitchBehaviourStateLocally(6); } Vector3 val = ((Component)playerScript).transform.position - ((Component)this).transform.position; val.y = 0f; val = ((Vector3)(ref val)).normalized; val.y = -1f; physicsRigidbody.AddForce(-10f * val, (ForceMode)1); PlayCreatureSFX(6); } } public static bool HasLineOfSightToPeeper(Vector3 position) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references) foreach (PeeperAI peeper in Peeper.PeeperList) { if ((Object)(object)peeper != (Object)null) { Vector3 val = position - peeper.eyeTransform.position; float num = Vector3.Angle(peeper.eyeOriginalTransform.forward, val); if (Vector3.Distance(position, peeper.eyeTransform.position) < 10f && num < 60f && !Physics.Linecast(((Component)peeper.eyeTransform).transform.position, position, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1)) { return true; } } } return false; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PeeperAI() { //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 //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1087886824u, new RpcReceiveHandler(__rpc_handler_1087886824)); NetworkManager.__rpc_func_table.Add(2756874777u, new RpcReceiveHandler(__rpc_handler_2756874777)); NetworkManager.__rpc_func_table.Add(316864934u, new RpcReceiveHandler(__rpc_handler_316864934)); NetworkManager.__rpc_func_table.Add(4022924503u, new RpcReceiveHandler(__rpc_handler_4022924503)); NetworkManager.__rpc_func_table.Add(3297439372u, new RpcReceiveHandler(__rpc_handler_3297439372)); NetworkManager.__rpc_func_table.Add(3646752176u, new RpcReceiveHandler(__rpc_handler_3646752176)); NetworkManager.__rpc_func_table.Add(2492932585u, new RpcReceiveHandler(__rpc_handler_2492932585)); NetworkManager.__rpc_func_table.Add(3529258009u, new RpcReceiveHandler(__rpc_handler_3529258009)); NetworkManager.__rpc_func_table.Add(1656237277u, new RpcReceiveHandler(__rpc_handler_1656237277)); NetworkManager.__rpc_func_table.Add(2720121576u, new RpcReceiveHandler(__rpc_handler_2720121576)); NetworkManager.__rpc_func_table.Add(2592041692u, new RpcReceiveHandler(__rpc_handler_2592041692)); NetworkManager.__rpc_func_table.Add(4096406816u, new RpcReceiveHandler(__rpc_handler_4096406816)); NetworkManager.__rpc_func_table.Add(1104444428u, new RpcReceiveHandler(__rpc_handler_1104444428)); NetworkManager.__rpc_func_table.Add(280628075u, new RpcReceiveHandler(__rpc_handler_280628075)); } private static void __rpc_handler_1087886824(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; ((PeeperAI)(object)target).KillEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2756874777(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; ((PeeperAI)(object)target).KillEnemyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_316864934(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 state = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref state); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).SwitchBehaviourStateServerRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4022924503(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 state = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref state); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).SwitchBehaviourStateClientRpc(state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3297439372(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) { ulong playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).JumpAtPlayerServerRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3646752176(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) { ulong playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).JumpAtPlayerClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2492932585(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).BeginChasingPlayerServerRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3529258009(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).BeginChasingPlayerClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1656237277(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).PlayCreatureSFXServerRpc(index, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2720121576(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PeeperAI)(object)target).PlayCreatureSFXClientRpc(index, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2592041692(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) { ulong playerObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PeeperAI)(object)target).AttachToPlayerServerRpc(playerObjectId);
plugins/PintoBoy.dll
Decompiled 9 months agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Pinto Mod.NetcodePatcher; using PintoMod; using PintoMod.Properties; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Pinto_Mod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Pinto_Mod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ff99ad61-38a5-4085-a181-d080e129d86e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyInformationalVersion("1.0.0+ca70f6de36e09a039f2eba21d3c3ef1c418e01a4")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } 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; } } } public enum PintoEnemyType { Spider, Slime, Lootbug } public class JumpanyEnemy : NetworkBehaviour { public PintoEnemyType enemyType; public float speed = 5f; private float startX; private float distance; public PintoBoy pintoBoy; public UnityEvent<JumpanyEnemy> onDeath = new UnityEvent<JumpanyEnemy>(); public Animator animator; public bool paused = false; public bool killedPlayer = false; private AudioClip[] movementSounds; private float currentMovementSoundTimer = 0f; private int currentMovementSoundIndex = 0; public NetworkVariable<int> parentNetworkID = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private void Awake() { distance = 10f; animator = ((Component)this).GetComponent<Animator>(); } private void Update() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (pintoBoy.isTurnedOff) { return; } if (killedPlayer) { if (enemyType == PintoEnemyType.Spider) { ((Behaviour)animator).enabled = false; } return; } float num = speed * Time.deltaTime; Transform transform = ((Component)this).transform; transform.position += Vector3.left * num; distance -= num; if (distance < 0f) { onDeath.Invoke(this); } currentMovementSoundTimer -= Time.deltaTime; if (currentMovementSoundTimer < 0f) { pintoBoy.PlaySound(movementSounds[currentMovementSoundIndex]); currentMovementSoundIndex++; if (currentMovementSoundIndex >= movementSounds.Length) { currentMovementSoundIndex = 0; } currentMovementSoundTimer = movementSounds[currentMovementSoundIndex].length; } } private void OnTriggerEnter2D(Collider2D collision) { if (((Component)collision).gameObject.CompareTag("Player") && (Object)(object)pintoBoy != (Object)null) { pintoBoy.PlayerGotHit(); } } public void SetMovementSounds(AudioClip[] audioClips) { movementSounds = audioClips; currentMovementSoundTimer = movementSounds[0].length; } protected override void __initializeVariables() { if (parentNetworkID == null) { throw new Exception("JumpanyEnemy.parentNetworkID cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)parentNetworkID).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)parentNetworkID, "parentNetworkID"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)parentNetworkID); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "JumpanyEnemy"; } } public enum PintoBoyState { MainMenu, InGame, Paused, Lost } public enum FadeState { FadeOff, FadeOn, FadeIn, FadeOut } public class PintoBoy : GrabbableObject { private PintoBoyState gameState = PintoBoyState.MainMenu; private AudioSource audioSource; private Animator fadeAnim; private Transform mainMenu; private Animator mainMenuAnim; private float mainmenuTime = 2f; private float mainmenuTimer = 0f; private float mainmenuWaitTime = 1.5f; private float mainmenuWaitTimer = 0f; private string SelectedString = "Selected"; private string FadeString = "Fade"; private string DoAnimString = "DoAnim"; private Transform inGame; private Vector3 playerStart; private GameObject player; private Rigidbody2D playerRb; private Collider2D playerCol; private Animator playerAnim; private SpriteRenderer playerSprite; private int[] playerPositions = new int[4] { 0, 5, 10, 15 }; private Vector3 brackenStart; private GameObject bracken; private Animator brackenAnim; private Collider2D groundCol; private Animator groundAnim; private string InAirString = "InAir"; private string DeathString = "Death"; private string ResetString = "Reset"; private GameObject cam; private GameObject modelScreen; private Animator buttonAnim; private ScanNodeProperties scanNodeProperties; public float jumpHeight = 9.75f; public float fastFallSpeed = 15f; public float rayCastDistance = 0.5f; public float rayCastOffset = -0.05f; public bool jump = false; private bool isGrounded = false; private bool doOnce = false; private Transform paused; private Transform lost; private Transform playerSpawnpoint; private Transform topSpawnpoint; private Transform midSpawnpoint; private Transform bottomSpawnpoint; private TMP_Text scoreText; private TMP_Text endScreenText; public GameObject spiderPrefab; public GameObject lootbugPrefab; public GameObject slimePrefab; private float spiderSpeed = 2.5f; private float lootbugSpeed = 3f; private float slimeSpeed = 2f; private NetworkVariable<float> highScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private NetworkVariable<float> currentScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private float scoreIncreaseRate = 15f; private NetworkVariable<int> lives = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<int> screenId = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private float increaseSpeedAddition = 0.25f; private float increaseAdditionRate = 100f; private int speedAdditionMultiplier = 1; private int speedAdditionMultiplierDefault = 1; private int timesIncreased = 0; private float spawnEnemyEveryMin = 40f; private float spawnEnemyEveryMax = 100f; private float lastTimeSpawned = 0f; private List<JumpanyEnemy> enemies = new List<JumpanyEnemy>(); private string camString = "2D Cam/"; private bool invincible = false; private float invincibleTime = 2f; private float invincibleTimer = 0f; private bool dead; private bool deadHitGround; private bool deadAnimStarted; private bool endScreenShown; private float deathAnimTime = 2.5f; private float deathAnimTimer = 0f; private int deathAnimIndex = 0; public AudioClip acPlayerStep1; public AudioClip acPlayerStep2; public AudioClip acPlayerJump; public AudioClip acSnapNeck; public AudioClip acSnapNeckLand; public AudioClip acSpiderStep1; public AudioClip acSpiderStep2; public AudioClip acSpiderStep3; public AudioClip acSpiderStep4; public AudioClip acLootbugStep; public AudioClip acSlimeStep; public AudioClip acConfirm; public AudioClip acNewHighscore; public AudioClip acNoHighscore; public AudioClip acBackgroundSong; private float stepSoundTimer = 0f; private float stepSoundTime = 0.25f; private int stepSoundIndex = 0; private float backgroundMusicTimer = 0f; private float backgroundMusicTime = 0f; private bool firstPlay = true; private bool spawnScreen = true; private Material matRenderTex = null; private RenderTexture texRenderTex = null; public bool isTurnedOff = false; public bool isPaused = false; private Renderer rendModelScreen; private float batteryDischargeRate = 0.002f; private void Awake() { //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown audioSource = ((Component)this).GetComponent<AudioSource>(); acPlayerStep1 = Pinto_ModBase.GetAudioClip("21_walk1 (player step 1)"); acPlayerStep2 = Pinto_ModBase.GetAudioClip("22_walk2 (player step 2)"); acPlayerJump = Pinto_ModBase.GetAudioClip("23_ladder (player land)"); acSnapNeck = Pinto_ModBase.GetAudioClip("12_exchange (snap neck)"); acSnapNeckLand = Pinto_ModBase.GetAudioClip("67_knock (fall after neck snap)"); acSpiderStep1 = Pinto_ModBase.GetAudioClip("52_step1 (spider movement)"); acSpiderStep2 = Pinto_ModBase.GetAudioClip("53_step2 (spider movement)"); acSpiderStep3 = Pinto_ModBase.GetAudioClip("54_step3 (spider movement)"); acSpiderStep4 = Pinto_ModBase.GetAudioClip("55_step4 (spider movement)"); acLootbugStep = Pinto_ModBase.GetAudioClip("47_grass (lootbug movement)"); acSlimeStep = Pinto_ModBase.GetAudioClip("30_triangle (slime movement)"); acConfirm = Pinto_ModBase.GetAudioClip("59_confirm (start game)"); acNewHighscore = Pinto_ModBase.GetAudioClip("24_levelclear (new highscore)"); acNoHighscore = Pinto_ModBase.GetAudioClip("64_lose2 (no highscore)"); acBackgroundSong = Pinto_ModBase.GetAudioClip("danger_streets"); backgroundMusicTime = acBackgroundSong.length; base.mainObjectRenderer = ((Component)((Component)this).transform.Find("Model")).GetComponent<MeshRenderer>(); spiderPrefab = Pinto_ModBase.spiderPrefab; lootbugPrefab = Pinto_ModBase.lootbugPrefab; slimePrefab = Pinto_ModBase.slimePrefab; scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); base.useCooldown = 0.1f; base.grabbable = true; base.parentObject = ((Component)this).transform; base.grabbableToEnemies = true; scanNodeProperties.maxRange = 100; scanNodeProperties.minRange = 1; scanNodeProperties.requiresLineOfSight = true; scanNodeProperties.headerText = "PintoBoy"; scanNodeProperties.subText = "PintoBoy Subtext"; scanNodeProperties.creatureScanID = -1; scanNodeProperties.nodeType = 2; mainmenuWaitTimer = mainmenuWaitTime; modelScreen = ((Component)((Component)this).transform.Find("Model/Screen")).gameObject; buttonAnim = ((Component)((Component)this).transform.Find("Model/Button")).GetComponent<Animator>(); base.startFallingPosition = new Vector3(0f, 0f, 0f); base.targetFloorPosition = new Vector3(0f, 0f, 0f); base.insertedBattery = new Battery(false, 100f); ((GrabbableObject)this).EnableItemMeshes(true); } private void LateUpdate() { try { ((GrabbableObject)this).LateUpdate(); } catch (Exception ex) { Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)("Exception caught in PintoBoy LateUpdate: " + ex.Message)); Debug.Log((object)$"gameState: {gameState}"); Debug.Log((object)$"fadeAnim: {fadeAnim}"); Debug.Log((object)$"mainMenu: {mainMenu}"); Debug.Log((object)$"mainMenuAnim: {mainMenuAnim}"); Debug.Log((object)$"mainmenuTime: {mainmenuTime}"); Debug.Log((object)$"mainmenuTimer: {mainmenuTimer}"); Debug.Log((object)("SelectedString: " + SelectedString)); Debug.Log((object)("FadeString: " + FadeString)); Debug.Log((object)("DoAnimString: " + DoAnimString)); Debug.Log((object)$"inGame: {inGame}"); Debug.Log((object)$"player: {player}"); Debug.Log((object)$"playerRb: {playerRb}"); Debug.Log((object)$"playerCol: {playerCol}"); Debug.Log((object)$"groundCol: {groundCol}"); Debug.Log((object)$"playerAnim: {playerAnim}"); Debug.Log((object)("InAirString: " + InAirString)); Debug.Log((object)$"screen: {cam}"); Debug.Log((object)$"scanNodeProperties: {scanNodeProperties}"); Debug.Log((object)$"jumpHeight: {jumpHeight}"); Debug.Log((object)$"fastFallSpeed: {fastFallSpeed}"); Debug.Log((object)$"rayCastDistance: {rayCastDistance}"); Debug.Log((object)$"rayCastOffset: {rayCastOffset}"); Debug.Log((object)$"jump: {jump}"); Debug.Log((object)$"isGrounded: {isGrounded}"); Debug.Log((object)$"doOnce: {doOnce}"); Debug.Log((object)$"paused: {paused}"); Debug.Log((object)$"lost: {lost}"); Debug.Log((object)$"playerSpawnpoint: {playerSpawnpoint}"); Debug.Log((object)$"topSpawnpoint: {topSpawnpoint}"); Debug.Log((object)$"midSpawnpoint: {midSpawnpoint}"); Debug.Log((object)$"bottomSpawnpoint: {bottomSpawnpoint}"); Debug.Log((object)$"scoreText: {scoreText}"); Debug.Log((object)$"spiderPrefab: {spiderPrefab}"); Debug.Log((object)$"lootbugPrefab: {lootbugPrefab}"); Debug.Log((object)$"slimePrefab: {slimePrefab}"); Debug.Log((object)$"spiderSpeed: {spiderSpeed}"); Debug.Log((object)$"lootbugSpeed: {lootbugSpeed}"); Debug.Log((object)$"slimeSpeed: {slimeSpeed}"); Debug.Log((object)$"highScore: {highScore}"); Debug.Log((object)$"currentScore: {currentScore}"); Debug.Log((object)$"scoreIncreaseRate: {scoreIncreaseRate}"); Debug.Log((object)$"increaseSpeedAddition: {increaseSpeedAddition}"); Debug.Log((object)$"increaseAdditionRate: {increaseAdditionRate}"); Debug.Log((object)$"speedAdditionMultiplier: {speedAdditionMultiplier}"); Debug.Log((object)$"speedAdditionMultiplierDefault: {speedAdditionMultiplierDefault}"); Debug.Log((object)$"timesIncreased: {timesIncreased}"); Debug.Log((object)$"spawnEnemyEveryMin: {spawnEnemyEveryMin}"); Debug.Log((object)$"spawnEnemyEveryMax: {spawnEnemyEveryMax}"); Debug.Log((object)$"lastTimeSpawned: {lastTimeSpawned}"); Debug.Log((object)$"enemies Count: {enemies.Count}"); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); Debug.Log((object)""); } } private void VerifyScreen() { if ((Object)(object)cam != (Object)null) { Debug.Log((object)"Need to verify screen"); if (((Object)cam).name != "PintoBoy Screen " + screenId.Value) { cam = GameObject.Find("PintoBoy Screen " + screenId.Value); if ((Object)(object)cam == (Object)null) { Debug.Log((object)"no cam matching id. Spawning one"); SpawnScreen(); } if (!isTurnedOff) { Debug.Log((object)"cam found, setting render texture"); SetScreenToRenderTexture(); } } } else { Debug.Log((object)"verify: cam == null, spawning"); SpawnScreen(); } } private void Update() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0087: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (spawnScreen) { SpawnScreen(); spawnScreen = false; cam.transform.parent = null; cam.GetComponent<Camera>().orthographicSize = 2f; cam.transform.position = ((Component)this).transform.position + Vector3.down * 400f; cam.transform.rotation = Quaternion.identity; cam.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); if (cam.transform.position.x == 0f || cam.transform.position.z == 0f) { cam.transform.position = new Vector3(Random.Range(-500f, 500f), cam.transform.position.y, Random.Range(-500f, 500f)); } } if (isTurnedOff) { return; } Battery insertedBattery = base.insertedBattery; insertedBattery.charge -= batteryDischargeRate * Time.deltaTime; if (fadeAnim.GetBool(DoAnimString)) { fadeAnim.SetBool(DoAnimString, false); } switch (gameState) { case PintoBoyState.MainMenu: if (mainmenuWaitTimer > 0f) { mainmenuWaitTimer -= Time.deltaTime; } if (mainmenuTimer > 0f) { mainmenuTimer -= Time.deltaTime; } if (mainmenuTimer > 1f && !doOnce) { SetFade(FadeState.FadeOut); doOnce = true; } if (mainmenuTimer <= 1f && mainmenuTimer > 0f && doOnce) { mainmenuTimer = 0f; StartGame(); SetFade(FadeState.FadeIn); doOnce = false; } break; case PintoBoyState.InGame: InGameUpdate(); break; } if (jump) { ButtonPress(); jump = false; } } private void InGameUpdate() { //IL_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005c: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) if (endScreenShown) { return; } if (!deadAnimStarted) { RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(player.transform.position - rayCastOffset * Vector3.down), Vector2.down, rayCastDistance); if ((Object)(object)((RaycastHit2D)(ref val)).collider == (Object)(object)groundCol) { isGrounded = true; Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.green); playerAnim.SetBool(InAirString, false); deadHitGround = true; } else { isGrounded = false; Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.red); playerAnim.SetBool(InAirString, true); deadHitGround = false; } } if (dead) { if (deadHitGround) { PlayDeathAnim(); } if (deadAnimStarted) { deathAnimTimer -= Time.deltaTime; if (deathAnimTimer <= 0f) { deadAnimStarted = false; ShowEndScreen(); } else if (deathAnimTimer < deathAnimTime - 0.25f && deathAnimIndex == 0) { deathAnimIndex++; PlaySound(acSnapNeck); } else if (deathAnimTimer < deathAnimTime - 1.75f && deathAnimIndex == 1) { deathAnimIndex++; PlaySound(acSnapNeckLand); } } return; } if (((NetworkBehaviour)this).IsOwner) { NetworkVariable<float> obj = currentScore; obj.Value += scoreIncreaseRate * Time.deltaTime; } if (currentScore.Value > (float)speedAdditionMultiplier * increaseAdditionRate && speedAdditionMultiplier > timesIncreased) { timesIncreased++; speedAdditionMultiplier++; } if (((NetworkBehaviour)this).IsOwner && currentScore.Value > lastTimeSpawned + Random.Range(spawnEnemyEveryMin, spawnEnemyEveryMax)) { SpawnRandomEnemyServerRpc(); lastTimeSpawned = currentScore.Value; } scoreText.text = Mathf.Round(currentScore.Value).ToString(); if (player.transform.localPosition.y < playerStart.y - 0.5f || player.transform.localPosition.y > playerStart.y + 100f) { player.transform.localPosition = playerSpawnpoint.localPosition; } if (invincible) { invincibleTimer -= Time.deltaTime; if (invincibleTimer <= 0f) { invincible = false; ((Renderer)playerSprite).enabled = true; } else if (invincibleTimer % 0.25f < 0.05f) { ((Renderer)playerSprite).enabled = !((Renderer)playerSprite).enabled; } } if (lives.Value > -1) { player.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x + (float)playerPositions[lives.Value], player.transform.localPosition.y, 0f); bracken.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x - (float)(playerPositions[lives.Value] * 3), brackenStart.y, 0f); } else { Debug.Log((object)$"Lives less than 0: {lives}"); } if (isGrounded) { PlayStepSound(); } if (backgroundMusicTimer > 0f) { backgroundMusicTimer -= Time.deltaTime; return; } backgroundMusicTimer = backgroundMusicTime; PlaySound(acBackgroundSong); } [ServerRpc] private void SpawnRandomEnemyServerRpc() { //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)((NetworkBehaviour)this).__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(1674945273u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1674945273u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { switch (Random.Range(0, 3)) { case 0: SpawnSpider(); break; case 1: SpawnLootbug(); break; case 2: SpawnSlime(); break; } } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right) { ToggleOnOff(); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } base.isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.equippedUsableItemQE = true; ((GrabbableObject)this).ChangeOwnershipOfProp(base.playerHeldBy.playerClientId); } private JumpanyEnemy EnumToJumpanyEnemy(PintoEnemyType enemyType) { JumpanyEnemy result = new JumpanyEnemy(); switch (enemyType) { case PintoEnemyType.Spider: result = Pinto_ModBase.spiderPrefab.GetComponent<JumpanyEnemy>(); break; case PintoEnemyType.Slime: result = Pinto_ModBase.slimePrefab.GetComponent<JumpanyEnemy>(); break; case PintoEnemyType.Lootbug: result = Pinto_ModBase.lootbugPrefab.GetComponent<JumpanyEnemy>(); break; } return result; } private Transform EnumToEnemySpawnPoint(PintoEnemyType enemyType) { Transform result = null; switch (enemyType) { case PintoEnemyType.Spider: result = topSpawnpoint; break; case PintoEnemyType.Lootbug: result = midSpawnpoint; break; case PintoEnemyType.Slime: result = bottomSpawnpoint; break; } return result; } private AudioClip[] EnumToEnemySounds(PintoEnemyType enemyType) { AudioClip[] result = null; switch (enemyType) { case PintoEnemyType.Spider: result = (AudioClip[])(object)new AudioClip[4] { acSpiderStep1, acSpiderStep2, acSpiderStep3, acSpiderStep4 }; break; case PintoEnemyType.Slime: result = (AudioClip[])(object)new AudioClip[1] { acSlimeStep }; break; case PintoEnemyType.Lootbug: result = (AudioClip[])(object)new AudioClip[1] { acLootbugStep }; break; } return result; } [ServerRpc] private void SpawnEnemyServerRpc(float speed, string enemy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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 //IL_011b: 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)((NetworkBehaviour)this).__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(4145081944u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = enemy != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4145081944u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy); JumpanyEnemy jumpanyEnemy = SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType)); SpawnEnemyClientRpc(speed, enemy); } } [ClientRpc] private void SpawnEnemyClientRpc(float speed, string enemy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1642841649u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = enemy != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1642841649u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy); JumpanyEnemy jumpanyEnemy = SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType)); } } private JumpanyEnemy SpawnEnemy(JumpanyEnemy prefab, Transform position, float speed, PintoEnemyType enemy, AudioClip[] audioClips) { //IL_0003: 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) JumpanyEnemy jumpanyEnemy = Object.Instantiate<JumpanyEnemy>(prefab, position.position, Quaternion.identity, position); jumpanyEnemy.speed = speed + increaseSpeedAddition * (float)speedAdditionMultiplier; jumpanyEnemy.pintoBoy = this; jumpanyEnemy.onDeath.AddListener((UnityAction<JumpanyEnemy>)OnEnemyDeath); jumpanyEnemy.enemyType = enemy; jumpanyEnemy.SetMovementSounds(audioClips); enemies.Add(jumpanyEnemy); return jumpanyEnemy; } private void OnEnemyDeath(JumpanyEnemy enemy) { enemies.Remove(enemy); enemy.onDeath.RemoveListener((UnityAction<JumpanyEnemy>)OnEnemyDeath); Object.Destroy((Object)(object)((Component)enemy).gameObject); } private void SpawnSpider() { SpawnEnemyServerRpc(spiderSpeed, PintoEnemyType.Spider.ToString()); } private void SpawnLootbug() { SpawnEnemyServerRpc(lootbugSpeed, PintoEnemyType.Lootbug.ToString()); } private void SpawnSlime() { SpawnEnemyServerRpc(slimeSpeed, PintoEnemyType.Slime.ToString()); } private void SetFade(FadeState state) { switch (state) { case FadeState.FadeOff: fadeAnim.SetInteger(FadeString, 0); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeOn: fadeAnim.SetInteger(FadeString, 1); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeIn: fadeAnim.SetInteger(FadeString, 2); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeOut: fadeAnim.SetInteger(FadeString, 3); fadeAnim.SetBool(DoAnimString, true); break; } } private void ButtonPress() { buttonAnim.SetTrigger("Press"); if (isTurnedOff) { return; } switch (gameState) { case PintoBoyState.MainMenu: if (mainmenuWaitTimer <= 0f && mainmenuTimer <= 0f) { StartFromTitleScreen(); } break; case PintoBoyState.InGame: if (dead) { if (!endScreenShown) { ShowEndScreen(); } else { ShowTitleScreen(); } } else { Jump(); } break; case PintoBoyState.Paused: break; case PintoBoyState.Lost: break; } } private void StartFromTitleScreen() { mainMenuAnim.SetTrigger(SelectedString); mainmenuTimer = mainmenuTime; PlaySound(acConfirm); } private void ShowTitleScreen() { SwitchState(PintoBoyState.MainMenu); mainmenuWaitTimer = mainmenuWaitTime; } [ServerRpc] private void StartGameServerRpc() { //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)((NetworkBehaviour)this).__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(2416390264u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2416390264u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StartGame(); StartGameClientRpc(); } } [ClientRpc] private void StartGameClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1138543879u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1138543879u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StartGame(); } } } private void StartGame() { SwitchState(PintoBoyState.InGame); playerRb.bodyType = (RigidbodyType2D)0; speedAdditionMultiplier = speedAdditionMultiplierDefault; brackenAnim.SetTrigger(ResetString); playerAnim.SetTrigger(ResetString); ClearEnemies(); ((Behaviour)groundAnim).enabled = true; dead = false; endScreenText.text = ""; deadAnimStarted = false; endScreenShown = false; deathAnimTimer = 0f; if (((NetworkBehaviour)this).IsOwner) { lives.Value = 3; currentScore.Value = 0f; } timesIncreased = 0; lastTimeSpawned = 0f; deathAnimIndex = 0; firstPlay = false; backgroundMusicTimer = 0f; } private void ClearEnemies() { if (enemies.Count <= 0) { return; } foreach (JumpanyEnemy enemy in enemies) { Object.Destroy((Object)(object)((Component)enemy).gameObject); } enemies.Clear(); } private void ClearEnemiesExcept(JumpanyEnemy enemy) { if (enemies.Count <= 0) { return; } foreach (JumpanyEnemy enemy2 in enemies) { if (!((Object)(object)enemy2 == (Object)(object)enemy)) { Object.Destroy((Object)(object)((Component)enemy2).gameObject); enemies.Remove(enemy2); } } } [ServerRpc] private void SwitchStateServerRpc(PintoBoyState newState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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)((NetworkBehaviour)this).__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(3526165090u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<PintoBoyState>(ref newState, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3526165090u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SwitchState(newState); SwitchStateClientRpc(newState); } } [ClientRpc] private void SwitchStateClientRpc(PintoBoyState newState) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3560071642u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<PintoBoyState>(ref newState, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3560071642u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SwitchState(newState); } } } private void SwitchState(PintoBoyState newState) { switch (newState) { case PintoBoyState.MainMenu: ((Component)mainMenu).gameObject.SetActive(true); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(false); ((Component)lost).gameObject.SetActive(false); doOnce = false; break; case PintoBoyState.InGame: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(true); ((Component)paused).gameObject.SetActive(false); ((Component)lost).gameObject.SetActive(false); break; case PintoBoyState.Paused: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(true); ((Component)lost).gameObject.SetActive(false); break; case PintoBoyState.Lost: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(false); ((Component)lost).gameObject.SetActive(true); break; } gameState = newState; } private void Jump() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (isGrounded) { playerRb.velocity = new Vector2(0f, jumpHeight); PlaySound(acPlayerJump); } else { playerRb.velocity = new Vector2(0f, 0f - fastFallSpeed); PlaySound(acPlayerJump); } } private void TogglePause() { if (isTurnedOff) { UnPause(); } else { Pause(); } } private void Pause() { if (!isTurnedOff) { isPaused = true; SetScreenToOffTexture(); DisableAllAnimators(); audioSource.Stop(); } } private void UnPause() { if (isTurnedOff) { isPaused = false; EnableAllAnimators(); if (gameState == PintoBoyState.InGame && !dead) { audioSource.PlayOneShot(acBackgroundSong); } } } private void ToggleOnOff() { if (isTurnedOff) { TurnOn(); } else { TurnOff(); } } private void TurnOn() { if (!isTurnedOff) { isTurnedOff = true; SetScreenToOffTexture(); DisableAllAnimators(); audioSource.Stop(); } } private void TurnOff() { if (isTurnedOff) { isTurnedOff = false; SetScreenToRenderTexture(); EnableAllAnimators(); ClearEnemies(); ShowTitleScreen(); } } private void EnableAllAnimators() { ((Behaviour)groundAnim).enabled = true; ((Behaviour)brackenAnim).enabled = true; ((Behaviour)mainMenuAnim).enabled = true; ((Behaviour)playerAnim).enabled = true; ((Behaviour)fadeAnim).enabled = true; for (int i = 0; i < enemies.Count; i++) { ((Behaviour)enemies[i].animator).enabled = true; enemies[i].paused = true; } } private void DisableAllAnimators() { ((Behaviour)groundAnim).enabled = false; ((Behaviour)brackenAnim).enabled = false; ((Behaviour)mainMenuAnim).enabled = false; ((Behaviour)playerAnim).enabled = false; ((Behaviour)fadeAnim).enabled = false; for (int i = 0; i < enemies.Count; i++) { ((Behaviour)enemies[i].animator).enabled = false; enemies[i].paused = false; } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); ButtonPress(); Debug.Log((object)"Pinto Button pressed"); } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); Pause(); } public float Remap(float from, float fromMin, float fromMax, float toMin, float toMax) { return 0f; } public void PlayerGotHit() { if (((NetworkBehaviour)this).IsOwner && !invincible) { NetworkVariable<int> obj = lives; int value = obj.Value; obj.Value = value - 1; if (lives.Value <= 0) { DieServerRpc(); return; } invincible = true; invincibleTimer = invincibleTime; } } [ServerRpc] public void DieServerRpc() { //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)((NetworkBehaviour)this).__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(579636829u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 579636829u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Die(); DieClientRpc(); } } [ClientRpc] public void DieClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3060544190u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3060544190u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Die(); } } } public void Die() { //IL_004e: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)groundAnim).enabled = false; dead = true; for (int i = 0; i < enemies.Count; i++) { enemies[i].killedPlayer = true; } if (Mathf.Abs(player.transform.localPosition.x - playerSpawnpoint.localPosition.x) < 5f) { playerRb.velocity = new Vector2(0f, 0f); player.transform.localPosition = new Vector3(player.transform.localPosition.x, playerSpawnpoint.localPosition.y, 0f); } } public void PlayDeathAnim() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) player.transform.localPosition = playerSpawnpoint.localPosition; brackenAnim.SetTrigger(DeathString); playerAnim.SetTrigger(DeathString); deathAnimTimer = deathAnimTime; deadAnimStarted = true; deadHitGround = false; deathAnimIndex = 0; audioSource.Stop(); } private void ShowEndScreen() { if (currentScore.Value > highScore.Value) { endScreenText.text = "New Best!\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Last Best:\n" + $"{Mathf.Round(highScore.Value)}"; if (((NetworkBehaviour)this).IsOwner) { highScore.Value = currentScore.Value; } PlaySound(acNewHighscore); } else { endScreenText.text = "Score:\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Best:\n" + $"{Mathf.Round(highScore.Value)}"; PlaySound(acNoHighscore); } endScreenShown = true; } public void PlaySound(AudioClip clip) { audioSource.PlayOneShot(clip); } private void PlayStepSound() { stepSoundTimer -= Time.deltaTime; if (stepSoundTimer <= 0f) { stepSoundTimer = stepSoundTime; stepSoundIndex++; if (stepSoundIndex > 1) { stepSoundIndex = 0; } switch (stepSoundIndex) { case 0: PlaySound(acPlayerStep1); break; case 1: PlaySound(acPlayerStep2); break; } } } public void MakeScreenNOTSpawnable() { spawnScreen = false; } [ServerRpc] private void SpawnScreenServerRpc() { //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)((NetworkBehaviour)this).__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(2495713638u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2495713638u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.Log((object)"SpawnScreenServerRpc Called"); int currentId = Pinto_ModBase.Instance.Value.currentId; PintoBoy[] array = (PintoBoy[])(object)Object.FindObjectsOfType(typeof(PintoBoy)); for (int i = currentId; i < array.Length + currentId; i++) { Debug.Log((object)"SpawnScreenServerRpc Called"); array[i].screenId.Value = i; } Pinto_ModBase.Instance.Value.currentId += array.Length; SpawnScreenClientRpc(); } } [ClientRpc] private void SpawnScreenClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(491405224u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 491405224u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"SpawnScreenClientRpc Called"); SpawnScreen(); } } } private void SpawnScreen() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)cam != (Object)null)) { Debug.Log((object)"Spawning Screen"); cam = ((Component)((Component)this).transform.Find("2D Cam")).gameObject; if ((Object)(object)cam == (Object)null) { Debug.Log((object)"Screen in Pintoboy is null even after instantiate"); } SetScreenToRenderTexture(); fadeAnim = ((Component)cam.transform.Find("2D Scene/Fade")).GetComponent<Animator>(); mainMenu = cam.transform.Find("2D Scene/Main Menu"); mainMenuAnim = ((Component)cam.transform.Find("2D Scene/Main Menu/Main Menu Sprite")).GetComponent<Animator>(); inGame = cam.transform.Find("2D Scene/Game"); player = ((Component)cam.transform.Find("2D Scene/Game/PintoEmployee")).gameObject; playerStart = player.transform.localPosition; playerRb = player.GetComponent<Rigidbody2D>(); playerAnim = player.GetComponent<Animator>(); playerCol = player.GetComponent<Collider2D>(); playerSprite = player.GetComponent<SpriteRenderer>(); bracken = ((Component)cam.transform.Find("2D Scene/Game/Bracken")).gameObject; brackenAnim = bracken.GetComponent<Animator>(); brackenStart = bracken.transform.localPosition; groundCol = ((Component)cam.transform.Find("2D Scene/Game/RailingGround")).GetComponent<Collider2D>(); groundAnim = ((Component)groundCol).gameObject.GetComponent<Animator>(); scoreText = ((Component)cam.transform.Find("2D Scene/Game/UI/Score")).GetComponent<TMP_Text>(); endScreenText = ((Component)cam.transform.Find("2D Scene/Game/UI/Death Screen/Text")).GetComponent<TMP_Text>(); paused = cam.transform.Find("2D Scene/Paused"); lost = cam.transform.Find("2D Scene/Lost"); playerRb.bodyType = (RigidbodyType2D)1; topSpawnpoint = cam.transform.Find("2D Scene/Game/Top Spawnpoint"); midSpawnpoint = cam.transform.Find("2D Scene/Game/Mid Spawnpoint"); bottomSpawnpoint = cam.transform.Find("2D Scene/Game/Bottom Spawnpoint"); playerSpawnpoint = cam.transform.Find("2D Scene/Game/Player Spawnpoint"); SwitchState(PintoBoyState.MainMenu); ((Component)fadeAnim).gameObject.SetActive(true); endScreenText.text = ""; spawnScreen = false; } } private void SetScreenToRenderTexture() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown Debug.Log((object)"SetScreenRendTex: checking if texRenderTex null"); if ((Object)(object)texRenderTex == (Object)null) { Debug.Log((object)"SetScreenRendTex: texRenderTex is null. Setting"); texRenderTex = new RenderTexture(160, 160, 16); ((Object)texRenderTex).name = "PintoBoyScreen"; ((Texture)texRenderTex).filterMode = (FilterMode)0; cam.GetComponent<Camera>().targetTexture = texRenderTex; } Debug.Log((object)"SetScreenRendTex: checking if matRenderTex null"); if ((Object)(object)matRenderTex == (Object)null) { Debug.Log((object)"SetScreenRendTex: matRenderTex is null. Setting"); matRenderTex = Object.Instantiate<Material>(Pinto_ModBase.matOnScreen); matRenderTex.SetTexture("_MainTex", (Texture)(object)texRenderTex); matRenderTex.mainTexture = (Texture)(object)texRenderTex; } Debug.Log((object)"SetScreenRendTex: checking if rendModelScreen is null"); if ((Object)(object)rendModelScreen == (Object)null) { Debug.Log((object)"SetScreenRendTex: rendModelScreen is null"); rendModelScreen = modelScreen.GetComponent<Renderer>(); } Debug.Log((object)"SetScreenRendTex: setting rendModelScreen to matRenderTex"); rendModelScreen.material = matRenderTex; } private void SetScreenToOffTexture() { if ((Object)(object)rendModelScreen == (Object)null) { rendModelScreen = modelScreen.GetComponent<Renderer>(); } rendModelScreen.material = Pinto_ModBase.matOffScreen; } protected override void __initializeVariables() { if (highScore == null) { throw new Exception("PintoBoy.highScore cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)highScore).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)highScore, "highScore"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)highScore); if (currentScore == null) { throw new Exception("PintoBoy.currentScore cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)currentScore).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentScore, "currentScore"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentScore); if (lives == null) { throw new Exception("PintoBoy.lives cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)lives).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)lives, "lives"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)lives); if (screenId == null) { throw new Exception("PintoBoy.screenId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)screenId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)screenId, "screenId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)screenId); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PintoBoy() { //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 NetworkManager.__rpc_func_table.Add(1674945273u, new RpcReceiveHandler(__rpc_handler_1674945273)); NetworkManager.__rpc_func_table.Add(4145081944u, new RpcReceiveHandler(__rpc_handler_4145081944)); NetworkManager.__rpc_func_table.Add(1642841649u, new RpcReceiveHandler(__rpc_handler_1642841649)); NetworkManager.__rpc_func_table.Add(2416390264u, new RpcReceiveHandler(__rpc_handler_2416390264)); NetworkManager.__rpc_func_table.Add(1138543879u, new RpcReceiveHandler(__rpc_handler_1138543879)); NetworkManager.__rpc_func_table.Add(3526165090u, new RpcReceiveHandler(__rpc_handler_3526165090)); NetworkManager.__rpc_func_table.Add(3560071642u, new RpcReceiveHandler(__rpc_handler_3560071642)); NetworkManager.__rpc_func_table.Add(579636829u, new RpcReceiveHandler(__rpc_handler_579636829)); NetworkManager.__rpc_func_table.Add(3060544190u, new RpcReceiveHandler(__rpc_handler_3060544190)); NetworkManager.__rpc_func_table.Add(2495713638u, new RpcReceiveHandler(__rpc_handler_2495713638)); NetworkManager.__rpc_func_table.Add(491405224u, new RpcReceiveHandler(__rpc_handler_491405224)); } private static void __rpc_handler_1674945273(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; ((PintoBoy)(object)target).SpawnRandomEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4145081944(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_007c: 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_0097: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00c9: 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) 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!"); } return; } float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string enemy = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemy, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((PintoBoy)(object)target).SpawnEnemyServerRpc(speed, enemy); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_1642841649(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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string enemy = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemy, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PintoBoy)(object)target).SpawnEnemyClientRpc(speed, enemy); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2416390264(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; ((PintoBoy)(object)target).StartGameServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1138543879(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; ((PintoBoy)(object)target).StartGameClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3526165090(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_007c: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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 { PintoBoyState newState = default(PintoBoyState); ((FastBufferReader)(ref reader)).ReadValueSafe<PintoBoyState>(ref newState, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PintoBoy)(object)target).SwitchStateServerRpc(newState); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3560071642(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) { PintoBoyState newState = default(PintoBoyState); ((FastBufferReader)(ref reader)).ReadValueSafe<PintoBoyState>(ref newState, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PintoBoy)(object)target).SwitchStateClientRpc(newState); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_579636829(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; ((PintoBoy)(object)target).DieServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3060544190(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; ((PintoBoy)(object)target).DieClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2495713638(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; ((PintoBoy)(object)target).SpawnScreenServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_491405224(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; ((PintoBoy)(object)target).SpawnScreenClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PintoBoy"; } } namespace PintoMod { [BepInPlugin("Pinta.PintoBoy", "PintoBoy", "1.0.2")] public class Pinto_ModBase : BaseUnityPlugin { public const string MODGUID = "Pinta.PintoBoy"; public const string MODNAME = "PintoBoy"; public const string MODVERSION = "1.0.2"; private readonly Harmony harmony = new Harmony("Pinta.PintoBoy"); public ManualLogSource logger; public static ConfigEntry<float> config_PintoboyRarity; public static readonly Lazy<Pinto_ModBase> Instance = new Lazy<Pinto_ModBase>(() => new Pinto_ModBase()); public static GameObject pintoPrefab; public static Item pintoGrab; public static GameObject spiderPrefab; public static GameObject slimePrefab; public static GameObject lootbugPrefab; public static Material matOffScreen; public static Material matOnScreen; public static AssetBundle pintoBundle; public int currentId = 0; private static string audioPath = "assets/pintoboy/audio/"; private void Awake() { logger = Logger.CreateLogSource("Pinto Mod"); ConfigSetup(); LoadBundle(); SetVariables(); harmony.PatchAll(typeof(Pinto_ModBase)); 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); } } } Debug.Log((object)"Pintoboy initialized"); } private void ConfigSetup() { config_PintoboyRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Pintoboy Rarity", "Value", 25f, "How rare is the PintoBoy"); } private void SetVariables() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0064: 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_0082: Unknown result type (might be due to invalid IL or missing references) pintoGrab.canBeGrabbedBeforeGameStart = true; pintoGrab.isScrap = true; pintoGrab.canBeInspected = true; pintoGrab.allowDroppingAheadOfPlayer = true; pintoGrab.rotationOffset = new Vector3(0f, 0f, 0f); pintoGrab.positionOffset = new Vector3(0f, 0f, 0f); pintoGrab.restingRotation = new Vector3(-30f, 0f, 0f); pintoGrab.verticalOffset = -0.1f; pintoGrab.requiresBattery = true; pintoGrab.batteryUsage = 600f; pintoGrab.syncInteractLRFunction = true; NetworkPrefabs.RegisterNetworkPrefab(spiderPrefab); NetworkPrefabs.RegisterNetworkPrefab(slimePrefab); NetworkPrefabs.RegisterNetworkPrefab(lootbugPrefab); NetworkPrefabs.RegisterNetworkPrefab(pintoGrab.spawnPrefab); Items.RegisterScrap(pintoGrab, (int)config_PintoboyRarity.Value, (LevelTypes)(-1)); Debug.Log((object)("Scrapitems: " + Items.scrapItems.Count + ": " + Items.scrapItems[0].modName + " rarity:" + Items.scrapItems[0].rarity)); } private void LoadBundle() { try { pintoBundle = AssetBundle.LoadFromMemory(Resources.pintobund); if ((Object)(object)pintoBundle == (Object)null) { throw new Exception("Failed to load Pinto Bundle!"); } pintoPrefab = pintoBundle.LoadAsset<GameObject>("assets/pintoboy/pintoboy.prefab"); if ((Object)(object)pintoPrefab == (Object)null) { throw new Exception("Failed to load Pinto Prefab!"); } pintoGrab = pintoBundle.LoadAsset<Item>("assets/pintoboy/pintoboy.asset"); if ((Object)(object)pintoGrab == (Object)null) { throw new Exception("Failed to load Pinto Item!"); } PintoBoy pintoBoy = pintoGrab.spawnPrefab.AddComponent<PintoBoy>(); if ((Object)(object)pintoBoy == (Object)null) { throw new Exception("Failed to load Pinto Boy!"); } ((GrabbableObject)pintoBoy).itemProperties = pintoGrab; GameObject val = pintoBundle.LoadAsset<GameObject>("assets/pintoboy/2d/spider/spider.prefab"); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Spider Prefab Object!"); } val.AddComponent<JumpanyEnemy>(); spiderPrefab = val; if ((Object)(object)spiderPrefab == (Object)null) { throw new Exception("Failed to load Spider Prefab!"); } GameObject val2 = pintoBundle.LoadAsset<GameObject>("assets/pintoboy/2d/slime/slime.prefab"); if ((Object)(object)val2 == (Object)null) { throw new Exception("Failed to load Slime Prefab Object!"); } val2.AddComponent<JumpanyEnemy>(); slimePrefab = val2; if ((Object)(object)slimePrefab == (Object)null) { throw new Exception("Failed to load Slime Prefab!"); } GameObject val3 = pintoBundle.LoadAsset<GameObject>("assets/pintoboy/2d/loot bug/loot bug.prefab"); if ((Object)(object)val3 == (Object)null) { throw new Exception("Failed to load Lootbug Prefab Object!"); } val3.AddComponent<JumpanyEnemy>(); lootbugPrefab = val3; if ((Object)(object)lootbugPrefab == (Object)null) { throw new Exception("Failed to load Lootbug Prefab!"); } matOffScreen = pintoBundle.LoadAsset<Material>("assets/pintoboy/off screen.mat"); if ((Object)(object)matOffScreen == (Object)null) { throw new Exception("Failed to load off screen material!"); } matOnScreen = pintoBundle.LoadAsset<Material>("assets/pintoboy/Screen Mat.mat"); if ((Object)(object)matOnScreen == (Object)null) { throw new Exception("Failed to load Screen Mat material!"); } } catch (Exception ex) { throw new Exception(ex.Message); } } public static AudioClip GetAudioClip(string path) { AudioClip val = pintoBundle.LoadAsset<AudioClip>(audioPath + path + ".wav"); if ((Object)(object)val == (Object)null) { val = pintoBundle.LoadAsset<AudioClip>(audioPath + path + ".mp3"); } if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Audio Clip " + path + ". Full Path: " + audioPath + path); } return val; } [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "CollectNewScrapForThisRound")] public static void PintoBoyAddedToShip(GrabbableObject scrapObject) { if (scrapObject is PintoBoy) { PintoBoy pintoBoy = (PintoBoy)(object)scrapObject; pintoBoy.MakeScreenNOTSpawnable(); Debug.Log((object)"PintoBoy added to ship and screen not spawned"); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Pinto Mod"; public const string PLUGIN_NAME = "Pinto Mod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace PintoMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("PintoMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] pintobund { get { object @object = ResourceManager.GetObject("pintobund", resourceCulture); return (byte[])@object; } } internal static byte[] pintobund1 { get { object @object = ResourceManager.GetObject("pintobund1", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace PintoMod.Assets.Scripts { [HarmonyPatch(typeof(GrabbableObject))] public static class GrabbableObject_Patches { [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static void Start(GrabbableObject __instance) { if (((Object)__instance).name == "Pinto") { Debug.Log((object)"Instance is Pinto"); PintoBoy pintoBoy = (PintoBoy)(object)__instance; } } } [HarmonyPatch] public class NetworkHandler { private static GameObject pintoObject; [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void Init() { Debug.Log((object)"Pintoboy NetworkHandler Init starting"); Debug.Log((object)"Pintoboy NetworkHandler Init ending"); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkPrefab() { try { if (!NetworkManager.Singleton.IsServer) { } } catch { Pinto_ModBase.Instance.Value.logger.LogError((object)"Failed to instantiate network prefab!"); } } } } namespace Pinto Mod.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/Scopophobia/Scopophobia.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; 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 LethalLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Scopophobia; using Scopophobia.NetcodePatcher; using Scopophobia.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [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("Scopophobia")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds the Shy Guy (SCP-096) to Lethal Company. Fully custom animations and behavior. Model from SCP: Containment Breach..")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("Scopophobia")] [assembly: AssemblyTitle("Scopophobia")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [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; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } 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); } } } namespace ShyGuy.AI { public class ShyGuyAI : EnemyAI { private Transform localPlayerCamera; private Vector3 mainEntrancePosition; public Collider mainCollider; public AudioSource farAudio; public AudioSource footstepSource; public AudioClip screamSFX; public AudioClip panicSFX; public AudioClip crySFX; public AudioClip crySittingSFX; public AudioClip killPlayerSFX; [Header("Containment Breach Sounds")] public AudioClip screamSFX_CB; public AudioClip panicSFX_CB; public AudioClip crySFX_CB; public AudioClip killPlayerSFX_CB; [Header("Alpha Containment Breach Sounds")] public AudioClip screamSFX_ACB; public AudioClip panicSFX_ACB; public AudioClip crySFX_ACB; public AudioClip killPlayerSFX_ACB; [Header("Secret Laboratory Sounds")] public AudioClip screamSFX_SL; public AudioClip panicSFX_SL; public AudioClip crySFX_SL; public AudioClip killPlayerSFX_SL; public Material bloodyMaterial; public AISearchRoutine roamMap; public Transform shyGuyFace; private Vector3 spawnPosition; private Vector3 previousPosition; private int previousState = -1; private float roamWaitTime = 40f; private bool roamShouldSit; private bool sitting; private float lastRunSpeed; private float seeFaceTime; private float triggerTime; private float triggerDuration = 66.4f; private float timeToTrigger = 0.5f; private float lastInterval = Time.realtimeSinceStartup; private bool inKillAnimation; public List<PlayerControllerB> SCP096Targets = new List<PlayerControllerB>(); public override void Start() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Expected O, but got Unknown ((EnemyAI)this).Start(); triggerDuration = Config.triggerTime; Transform val = null; Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val2 = queue.Dequeue(); if (((Object)val2).name == "lefteye") { val = val2; break; } foreach (Transform item3 in val2) { Transform item = item3; queue.Enqueue(item); } } Transform val3 = null; queue = new Queue<Transform>(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val4 = queue.Dequeue(); if (((Object)val4).name == "righteye") { val3 = val4; break; } foreach (Transform item4 in val4) { Transform item2 = item4; queue.Enqueue(item2); } } if (!Config.hasGlowingEyes && (Object)(object)val != (Object)null && (Object)(object)val3 != (Object)null) { ((Component)val).gameObject.SetActive(false); ((Component)val3).gameObject.SetActive(false); } if (Config.bloodyTexture && (Object)(object)bloodyMaterial != (Object)null) { Transform val5 = ((Component)this).transform.Find("SCP096Model"); if ((Object)(object)val5 != (Object)null) { Transform val6 = val5.Find("tsg_placeholder"); if ((Object)(object)val6 != (Object)null) { SkinnedMeshRenderer component = ((Component)val6).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material = bloodyMaterial; } } } } switch (Config.soundPack) { case "SCPCB": screamSFX = screamSFX_CB; crySFX = crySFX_CB; crySittingSFX = crySFX_CB; panicSFX = panicSFX_CB; killPlayerSFX = killPlayerSFX_CB; break; case "SCPCBOld": screamSFX = screamSFX_ACB; crySFX = crySFX_ACB; crySittingSFX = crySFX_ACB; panicSFX = panicSFX_ACB; killPlayerSFX = killPlayerSFX_ACB; break; case "SecretLab": screamSFX = screamSFX_SL; crySFX = crySFX_SL; crySittingSFX = crySFX_SL; panicSFX = panicSFX_SL; killPlayerSFX = killPlayerSFX_SL; break; } localPlayerCamera = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform; spawnPosition = ((Component)this).transform.position; base.isOutside = ((Component)this).transform.position.y > -80f; mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, base.isOutside), default(NavMeshHit), 5f, -1); if (base.isOutside) { if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { ((EnemyAI)this).EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false); } } else if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } base.path1 = new NavMeshPath(); base.openDoorSpeedMultiplier = 450f; SetShyGuyInitialValues(); } private void CalculateAnimationSpeed() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; float num = ((Vector3)(ref val)).magnitude; if (num > 0f) { num = 1f; } lastRunSpeed = Mathf.Lerp(lastRunSpeed, num, 5f * Time.deltaTime); base.creatureAnimator.SetFloat("VelocityZ", lastRunSpeed); previousPosition = ((Component)this).transform.position; } public override void DoAIInterval() { //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0) { lastInterval = Time.realtimeSinceStartup; return; } if (base.isEnemyDead) { lastInterval = Time.realtimeSinceStartup; return; } if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex != 2) { ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } switch (base.currentBehaviourStateIndex) { case 0: { if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } else if (sitting) { base.agent.speed = 0f; } else { roamWaitTime -= Time.realtimeSinceStartup - lastInterval; base.openDoorSpeedMultiplier = 1f; base.agent.speed = 2.75f * Config.speedDocileMultiplier; } base.movingTowardsTargetPlayer = false; base.agent.stoppingDistance = 4f; base.addPlayerVelocityToDestination = 0f; PlayerControllerB targetPlayer2 = base.targetPlayer; if (roamWaitTime <= 20f && roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null) { ((EnemyAI)this).StopSearch(roamMap, true); lastInterval = Time.realtimeSinceStartup; } else if (roamWaitTime > 2.5f && roamWaitTime <= 15f && !roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null && roamShouldSit) { sitting = true; base.creatureAnimator.SetBool("Sitting", true); float time = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySittingSFX; base.creatureVoice.Play(); base.creatureVoice.time = time; lastInterval = Time.realtimeSinceStartup; } else if (!((Object)(object)base.targetPlayer != (Object)null) && (Object)(object)base.targetPlayer == (Object)null && !roamMap.inProgress && roamWaitTime <= 0f) { if (!sitting) { roamShouldSit = Random.Range(1, 5) == 1; roamWaitTime = Random.Range(25f, 32.5f); ((EnemyAI)this).StartSearch(spawnPosition, roamMap); lastInterval = Time.realtimeSinceStartup; break; } sitting = false; roamShouldSit = false; roamWaitTime = Random.Range(21f, 25f); base.creatureAnimator.SetBool("Sitting", false); float time2 = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); base.creatureVoice.time = time2; lastInterval = Time.realtimeSinceStartup; } break; } case 1: base.agent.speed = 0f; lastInterval = Time.realtimeSinceStartup; base.movingTowardsTargetPlayer = false; break; case 2: { base.agent.stoppingDistance = 0f; base.agent.avoidancePriority = 60; base.openDoorSpeedMultiplier = 450f; mainCollider.isTrigger = true; base.addPlayerVelocityToDestination = 1f; if (inKillAnimation) { base.agent.speed = 0f; } else { base.agent.speed = Mathf.Clamp(base.agent.speed + (Time.realtimeSinceStartup - lastInterval) * Config.speedRageMultiplier * 1.1f, 5f * Config.speedRageMultiplier, 14.75f * Config.speedRageMultiplier); } if (SCP096Targets.Count <= 0) { SitDown(); break; } PlayerControllerB targetPlayer = base.targetPlayer; float num = float.PositiveInfinity; foreach (PlayerControllerB sCP096Target in SCP096Targets) { bool flag = sCP096Target.isInsideFactory == !base.isOutside; bool flag2 = true; if (!Config.canExitFacility && !flag) { flag2 = false; } if (!sCP096Target.isPlayerDead && flag2) { if (((EnemyAI)this).PlayerIsTargetable(sCP096Target, false, true) && Vector3.Distance(((Component)sCP096Target).transform.position, ((Component)this).transform.position) < num) { num = Vector3.Magnitude(((Component)sCP096Target).transform.position - ((Component)this).transform.position); base.targetPlayer = sCP096Target; } } else { AddTargetToList((int)sCP096Target.actualClientId, remove: true); } } if ((Object)(object)base.targetPlayer != (Object)null) { base.creatureAnimator.SetFloat("DistanceToTarget", Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position)); if (roamMap.inProgress) { ((EnemyAI)this).StopSearch(roamMap, true); } if ((Object)(object)base.targetPlayer != (Object)(object)targetPlayer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } if (base.targetPlayer.isInsideFactory != !base.isOutside) { if (Vector3.Distance(((Component)this).transform.position, mainEntrancePosition) < 2f) { TeleportEnemy(RoundManager.FindMainEntrancePosition(true, !base.isOutside), !base.isOutside); base.agent.speed = 0f; } else { base.movingTowardsTargetPlayer = false; ((EnemyAI)this).SetDestinationToPosition(mainEntrancePosition, false); } } else { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } } else if (SCP096Targets.Count <= 0) { SitDown(); } break; } default: lastInterval = Time.realtimeSinceStartup; break; } } public void TeleportEnemy(Vector3 pos, bool setOutside) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) //IL_0058: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(pos, default(NavMeshHit), 5f, -1); if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = navMeshPosition; ((Behaviour)base.agent).enabled = true; } else { ((Component)this).transform.position = navMeshPosition; } base.serverPosition = navMeshPosition; SetEnemyOutside(setOutside); EntranceTeleport val = RoundManager.FindMainEntranceScript(setOutside); if (val.doorAudios != null && val.doorAudios.Length != 0) { val.entrancePointAudio.PlayOneShot(val.doorAudios[0]); WalkieTalkie.TransmitOneShotAudio(val.entrancePointAudio, val.doorAudios[0], 1f); } } public override void Update() { //IL_003d: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } CalculateAnimationSpeed(); bool flag = GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(shyGuyFace.position, Config.faceTriggerRange, 45, -1f); if (flag) { float num = Quaternion.Angle(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.rotation, shyGuyFace.rotation); if (!(num <= 145f)) { flag = false; } } if (flag) { seeFaceTime += Time.deltaTime; if (seeFaceTime >= Config.faceTriggerGracePeriod) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1.25f, true); if (!Config.hasMaxTargets || SCP096Targets.Count < Config.maxTargets) { AddTargetToList((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } if (base.currentBehaviourStateIndex == 0) { ((EnemyAI)this).SwitchToBehaviourState(1); } } } else { seeFaceTime = Mathf.Clamp(seeFaceTime - Time.deltaTime, 0f, timeToTrigger); if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1f, 30f, 60, -1f) && base.currentBehaviourStateIndex == 0) { if (!base.thisNetworkObject.IsOwner) { ((EnemyAI)this).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 10f) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.65f, true); } else { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.25f, true); } } } switch (base.currentBehaviourStateIndex) { case 0: if (previousState != 0) { SetShyGuyInitialValues(); previousState = 0; mainCollider.isTrigger = true; farAudio.volume = 0f; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); } if (!base.creatureVoice.isPlaying) { base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); } break; case 1: if (previousState != 1) { previousState = 1; sitting = false; mainCollider.isTrigger = true; base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", true); base.creatureVoice.Stop(); farAudio.volume = 0.275f; farAudio.PlayOneShot(panicSFX); base.agent.speed = 0f; triggerTime = triggerDuration; } triggerTime -= Time.deltaTime; if (triggerTime <= 0f) { ((EnemyAI)this).SwitchToBehaviourState(2); } break; case 2: mainCollider.isTrigger = true; if (previousState != 2) { mainCollider.isTrigger = true; previousState = 2; base.creatureAnimator.SetBool("Rage", true); base.creatureAnimator.SetBool("triggered", false); farAudio.Stop(); farAudio.volume = 0.4f; farAudio.clip = screamSFX; farAudio.Play(); } break; } ((EnemyAI)this).Update(); } public void SetEnemyOutside(bool outside = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) base.isOutside = outside; mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, outside), default(NavMeshHit), 5f, -1); if (outside) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } else { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } } public override void OnCollideWithPlayer(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>())) { return; } ((EnemyAI)this).OnCollideWithPlayer(other); if (!inKillAnimation && !base.isEnemyDead && base.currentBehaviourStateIndex == 2) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { inKillAnimation = true; ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation((int)val.playerClientId)); KillPlayerServerRpc((int)val.playerClientId); } } } [ServerRpc(RequireOwnership = false)] private void KillPlayerServerRpc(int playerId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2556963367u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2556963367u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { KillPlayerClientRpc(playerId); } } } [ClientRpc] private void KillPlayerClientRpc(int playerId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2298532976u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2298532976u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation(playerId)); } } } private IEnumerator killPlayerAnimation(int playerId) { inKillAnimation = true; PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[playerId]; if (base.isOutside && ((Component)this).transform.position.y < -80f) { SetEnemyOutside(); } else if (!base.isOutside && ((Component)this).transform.position.y > -80f) { SetEnemyOutside(outside: true); } int preAmount = SCP096Targets.Count; playerScript.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0); AddTargetToList(playerId, remove: true); base.creatureSFX.PlayOneShot(killPlayerSFX); base.creatureAnimator.SetInteger("TargetsLeft", preAmount - 1); base.creatureAnimator.SetTrigger("kill"); if (preAmount - 1 <= 0) { SitDown(); } if (Config.deathMakesBloody && (Object)(object)bloodyMaterial != (Object)null) { Transform model = ((Component)this).transform.Find("SCP096Model"); if ((Object)(object)model != (Object)null) { Transform modelMesh = model.Find("tsg_placeholder"); if ((Object)(object)modelMesh != (Object)null) { SkinnedMeshRenderer skinnedModel = ((Component)modelMesh).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)skinnedModel != (Object)null) { ((Renderer)skinnedModel).material = bloodyMaterial; } } } } yield return (object)new WaitForSeconds(1f); inKillAnimation = false; } public void SitDown() { ((EnemyAI)this).SwitchToBehaviourState(0); SitDownOnLocalClient(); SitDownServerRpc(); } [ServerRpc(RequireOwnership = false)] private void SitDownServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(652446748u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 652446748u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SitDownClientRpc(); } } } [ClientRpc] private void SitDownClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2536632143u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2536632143u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SitDownOnLocalClient(); } } } public void SitDownOnLocalClient() { sitting = true; roamWaitTime = Random.Range(45f, 50f); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", true); } public void AddTargetToList(int playerId, bool remove = false) { PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (!SCP096Targets.Contains(item)) { return; } } else if (SCP096Targets.Contains(item)) { return; } AddTargetToListOnLocalClient(playerId, remove); AddTargetToListServerRpc(playerId, remove); } [ServerRpc(RequireOwnership = false)] public void AddTargetToListServerRpc(int playerId, bool remove) { //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_0071: 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) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1207108010u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1207108010u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AddTargetToListClientRpc(playerId, remove); } } } [ClientRpc] public void AddTargetToListClientRpc(int playerId, bool remove) { //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_0071: 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) //IL_0090: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1413965488u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1413965488u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AddTargetToListOnLocalClient(playerId, remove); } } } public void AddTargetToListOnLocalClient(int playerId, bool remove) { PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (SCP096Targets.Contains(item)) { SCP096Targets.Remove(item); } } else if (!SCP096Targets.Contains(item)) { SCP096Targets.Add(item); } } private void SetShyGuyInitialValues() { mainCollider = ((Component)this).gameObject.GetComponentInChildren<Collider>(); farAudio = ((Component)((Component)this).transform.Find("FarAudio")).GetComponent<AudioSource>(); base.targetPlayer = null; inKillAnimation = false; SCP096Targets.Clear(); base.creatureAnimator.SetFloat("VelocityX", 0f); base.creatureAnimator.SetFloat("VelocityZ", 0f); base.creatureAnimator.SetFloat("DistanceToTarget", 999f); base.creatureAnimator.SetInteger("SitActionTimer", 0); base.creatureAnimator.SetInteger("TargetsLeft", 0); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", false); mainCollider.isTrigger = true; farAudio.volume = 0f; farAudio.Stop(); base.creatureVoice.Stop(); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ShyGuyAI() { //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 NetworkManager.__rpc_func_table.Add(2556963367u, new RpcReceiveHandler(__rpc_handler_2556963367)); NetworkManager.__rpc_func_table.Add(2298532976u, new RpcReceiveHandler(__rpc_handler_2298532976)); NetworkManager.__rpc_func_table.Add(652446748u, new RpcReceiveHandler(__rpc_handler_652446748)); NetworkManager.__rpc_func_table.Add(2536632143u, new RpcReceiveHandler(__rpc_handler_2536632143)); NetworkManager.__rpc_func_table.Add(1207108010u, new RpcReceiveHandler(__rpc_handler_1207108010)); NetworkManager.__rpc_func_table.Add(1413965488u, new RpcReceiveHandler(__rpc_handler_1413965488)); } private static void __rpc_handler_2556963367(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 playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).KillPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2298532976(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 playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((ShyGuyAI)(object)target).KillPlayerClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_652446748(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; ((ShyGuyAI)(object)target).SitDownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2536632143(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; ((ShyGuyAI)(object)target).SitDownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1207108010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).AddTargetToListServerRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1413965488(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((ShyGuyAI)(object)target).AddTargetToListClientRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ShyGuyAI"; } } } namespace Scopophobia { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public static ConfigEntry<bool> AppearsConfig; public static ConfigEntry<bool> HasGlowingEyesConfig; public static ConfigEntry<string> SoundPackConfig; public static ConfigEntry<bool> BloodyTextureConfig; public static ConfigEntry<bool> DeathMakesBloodyConfig; public static ConfigEntry<float> SpeedDocileMultiplierConfig; public static ConfigEntry<float> SpeedRageMultiplierConfig; public static ConfigEntry<int> SpawnRarityConfig; public static ConfigEntry<float> TriggerTimeConfig; public static ConfigEntry<float> FaceTriggerRangeConfig; public static ConfigEntry<float> FaceTriggerGracePeriodConfig; public static ConfigEntry<bool> HasMaxTargetsConfig; public static ConfigEntry<int> MaxTargetsConfig; public static ConfigEntry<bool> CanExitFacilityConfig; public static ConfigEntry<int> MaxSpawnCountConfig; public static ConfigEntry<bool> CanSpawnOutsideConfig; public static ConfigEntry<bool> SpawnOutsideHardPlanetsConfig; public static ConfigEntry<float> StartEnemySpawnCurveConfig; public static ConfigEntry<float> MidEnemySpawnCurveConfig; public static ConfigEntry<float> EndEnemySpawnCurveConfig; public static bool appears; public static bool hasGlowingEyes; public static string soundPack; public static bool bloodyTexture; public static bool deathMakesBloody; public static float speedDocileMultiplier; public static float speedRageMultiplier; public static int spawnRarity; public static float triggerTime; public static float faceTriggerRange; public static float faceTriggerGracePeriod; public static bool hasMaxTargets; public static int maxTargets; public static bool canExitFacility; public static bool canSpawnOutside; public static int maxSpawnCount; public static bool spawnsOutside; public static bool spawnOutsideHardPlanets; public static float startEnemySpawnCurve; public static float midEnemySpawnCurve; public static float endEnemySpawnCurve; public Config(ConfigFile cfg) { InitInstance(this); AppearsConfig = cfg.Bind<bool>("General", "Enable the Shy Guy", true, "Allows the Shy Guy to spawn in-game."); HasGlowingEyesConfig = cfg.Bind<bool>("Appearance", "Glowing Eyes", true, "Gives the Shy Guy glowing eyes similar to the Bracken/Flowerman."); BloodyTextureConfig = cfg.Bind<bool>("Appearance", "Bloody Texture", false, "Gives the Shy Guy his bloodier, original texture from SCP: Containment Breach."); DeathMakesBloodyConfig = cfg.Bind<bool>("Appearance", "Bloody Death", true, "Causes the Shy Guy's material to become bloody once getting his first kill. Useless if Bloody Texture is enabled lol"); SoundPackConfig = cfg.Bind<string>("Appearance", "Sound Pack (Curated, SCPCB, SCPCBOld, SecretLab)", "Curated", "Determines the sounds the Shy Guy uses. (SOME MAY NOT SYNC WELL WITH TRIGGER TIME) (Curated = Default, curated for the Lethal Company experience) (SCPCB = SCP-096 sounds from SCP: Containment Breach) (SCPCBOld = Old alpha SCP-096 sounds from SCP: Containment Breach) (SecretLab = SCP-096 sounds from SCP: Secret Laboratory)"); SpeedDocileMultiplierConfig = cfg.Bind<float>("Values", "Speed Multiplier (Docile)", 1f, "Determines the speed multiplier of the Shy Guy while docile."); SpeedRageMultiplierConfig = cfg.Bind<float>("Values", "Speed Multiplier (Rage)", 1f, "Determines the speed multiplier of the Shy Guy while enraged."); SpawnRarityConfig = cfg.Bind<int>("Values", "Spawn Rarity", 15, "Determines the spawn weight of the Shy Guy. Higher weights mean the Shy Guy is more likely appear. (just dont set this astronomically high)"); TriggerTimeConfig = cfg.Bind<float>("Values.Triggering", "Trigger Time", 66.4f, "Determines how long the Shy Guy must remain in the Triggered state to become fully enraged."); FaceTriggerRangeConfig = cfg.Bind<float>("Values.Triggering", "Face Trigger Range", 17.5f, "Determines the face's trigger radius."); FaceTriggerGracePeriodConfig = cfg.Bind<float>("Values.Triggering", "Face Trigger Grace Period", 0.5f, "Determines the grace period when you see the face of the Shy Guy before he becomes enraged."); HasMaxTargetsConfig = cfg.Bind<bool>("Values.Triggering", "Has Max Targets", false, "Determines if the Shy Guy has a maximum amount of targets."); MaxTargetsConfig = cfg.Bind<int>("Values.Triggering", "Max Targets", 32, "Determines the max amount of targets the Shy Guy can have. (requires HasMaxTargets)"); CanExitFacilityConfig = cfg.Bind<bool>("Values.Triggering", "Can Exit Facility", true, "Determines if the Shy Guy can exit the facility and into the outdoors (and vice versa) to attack its target."); MaxSpawnCountConfig = cfg.Bind<int>("Values.Spawning", "Max Spawn Count", 1, "Determines how many Shy Guy can spawn total."); CanSpawnOutsideConfig = cfg.Bind<bool>("Values.Spawning", "Can Spawn Outside", true, "Determines if the Shy Guy can spawn outside. "); SpawnOutsideHardPlanetsConfig = cfg.Bind<bool>("Values.Spawning", "Spawn Outside Only Hard Moons", true, "If set to true, the Shy Guy will only spawn outside on the highest-difficulty/modded moons."); StartEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "Start Spawn Curve", 0.2f, "Spawn curve for the Shy Guy when the day starts. (typically 0-1)"); MidEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "Midday Spawn Curve", 1f, "Spawn curve for the Shy Guy midday. (typically 0-1)"); EndEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "End of Day Spawn Curve", 0.75f, "Spawn curve for the Shy Guy at the end of day. (typically 0-1)"); appears = AppearsConfig.Value; hasGlowingEyes = HasGlowingEyesConfig.Value; bloodyTexture = BloodyTextureConfig.Value; deathMakesBloody = DeathMakesBloodyConfig.Value; soundPack = SoundPackConfig.Value; speedDocileMultiplier = SpeedDocileMultiplierConfig.Value; speedRageMultiplier = SpeedRageMultiplierConfig.Value; spawnRarity = SpawnRarityConfig.Value; triggerTime = TriggerTimeConfig.Value; faceTriggerRange = FaceTriggerRangeConfig.Value; faceTriggerGracePeriod = FaceTriggerGracePeriodConfig.Value; hasMaxTargets = HasMaxTargetsConfig.Value; maxTargets = MaxTargetsConfig.Value; canExitFacility = CanExitFacilityConfig.Value; maxSpawnCount = MaxSpawnCountConfig.Value; canSpawnOutside = CanSpawnOutsideConfig.Value; spawnOutsideHardPlanets = SpawnOutsideHardPlanetsConfig.Value; startEnemySpawnCurve = StartEnemySpawnCurveConfig.Value; midEnemySpawnCurve = MidEnemySpawnCurveConfig.Value; endEnemySpawnCurve = EndEnemySpawnCurveConfig.Value; } public static void RequestSync() { //IL_0029: 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("Scopophobia_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.logger.LogInfo((object)$"Config sync request received from client: {clientId}"); 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("Scopophobia_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //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) 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.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0025: 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) //IL_0030: 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("Scopophobia_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("Scopophobia_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [BepInPlugin("Scopophobia", "Scopophobia", "1.1.1")] public class ScopophobiaPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Scopophobia"); public static EnemyType shyGuy; public static AssetBundle Assets; public static bool spawnsOutside; public static SpawnableEnemyWithRarity maskedPrefab; public static ManualLogSource logger; public static SpawnableEnemyWithRarity shyPrefab; public static Config MyConfig { get; internal set; } internal Assembly assembly => Assembly.GetExecutingAssembly(); internal string GetFilePath(string path) { return assembly.Location.Replace(assembly.GetName().Name + ".dll", path); } private void LoadAssets() { try { Assets = AssetBundle.LoadFromFile(GetFilePath("scp096")); } catch (Exception arg) { logger.LogError((object)$"Failed to load asset bundle! {arg}"); } } private void Awake() { harmony.PatchAll(typeof(Config)); LoadAssets(); logger = ((BaseUnityPlugin)this).Logger; MyConfig = new Config(((BaseUnityPlugin)this).Config); ConfigEntry<bool> val = default(ConfigEntry<bool>); ((BaseUnityPlugin)this).Config.TryGetEntry<bool>("General", "Enable the Shy Guy", ref val); if (!val.Value) { return; } ConfigEntry<int> val2 = default(ConfigEntry<int>); ((BaseUnityPlugin)this).Config.TryGetEntry<int>("Values", "Spawn Rarity", ref val2); int num = val2?.Value ?? 15; shyGuy = Assets.LoadAsset<EnemyType>("ShyGuyDef.asset"); TerminalNode val3 = Assets.LoadAsset<TerminalNode>("ShyGuyTerminal.asset"); TerminalKeyword val4 = Assets.LoadAsset<TerminalKeyword>("ShyGuyKeyword.asset"); NetworkPrefabs.RegisterNetworkPrefab(shyGuy.enemyPrefab); Enemies.RegisterEnemy(shyGuy, num, (LevelTypes)(-1), (SpawnType)0, val3, val4); 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); } } } logger.LogInfo((object)"Scopophobia | SCP-096 has entered the facility. All remaining personnel proceed with caution."); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetShyGuyPrefabForLaterUse)); harmony.PatchAll(typeof(ShyGuySpawnSettings)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Scopophobia"; public const string PLUGIN_NAME = "Scopophobia"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace Scopophobia.Patches { [HarmonyPatch] internal class GetShyGuyPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { SelectableLevel[] array = ___moonsCatalogueList; SelectableLevel[] array2 = array; foreach (SelectableLevel val in array2) { foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { if (enemy.enemyType.enemyName == "Shy guy") { ScopophobiaPlugin.shyPrefab = enemy; } } } } } [HarmonyPatch(typeof(RoundManager))] internal class ShyGuySpawnSettings { public static string[] nonoOutside = new string[5] { "Level1Experimentation", "Level2Assurance", "Level3Vow", "Level4March", "Level7Offense" }; [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if (!Config.appears || ScopophobiaPlugin.shyPrefab == null) { return; } try { SpawnableEnemyWithRarity shyPrefab = ScopophobiaPlugin.shyPrefab; List<SpawnableEnemyWithRarity> enemies = ___currentLevel.Enemies; for (int i = 0; i < ___currentLevel.Enemies.Count; i++) { SpawnableEnemyWithRarity val = ___currentLevel.Enemies[i]; if (val.enemyType.enemyName == "Shy guy") { enemies.Remove(val); } } ___currentLevel.Enemies = enemies; shyPrefab.enemyType.PowerLevel = 3; shyPrefab.rarity = Config.spawnRarity; shyPrefab.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, Config.startEnemySpawnCurve), new Keyframe(0.5f, Config.midEnemySpawnCurve), new Keyframe(1f, Config.endEnemySpawnCurve) }); shyPrefab.enemyType.MaxCount = Config.maxSpawnCount; shyPrefab.enemyType.isOutsideEnemy = Config.canSpawnOutside; if (Config.canSpawnOutside & (!Config.spawnOutsideHardPlanets || !nonoOutside.Contains(___currentLevel.sceneName))) { ___currentLevel.OutsideEnemies.Add(shyPrefab); SelectableLevel val2 = ___currentLevel; val2.maxOutsideEnemyPowerCount += shyPrefab.enemyType.MaxCount * shyPrefab.enemyType.PowerLevel; } ___currentLevel.Enemies.Add(shyPrefab); } catch { } } } } namespace Scopophobia.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/SCPCBDunGen/SCPCBDunGen.dll
Decompiled 9 months agousing 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.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [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("SCPCBDunGen")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds the SCP Foundation Dungeon to Lethal Company.")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0+7416b5402cf0bbe5e2b8b44e0ac71bc766efcb06")] [assembly: AssemblyProduct("SCPCBDunGen")] [assembly: AssemblyTitle("SCPCBDunGen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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.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 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", "2.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SCPCBDunGen : BaseUnityPlugin { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] private static bool SetItemSpawnPoints(ref RuntimeDungeon ___dungeonGenerator) { if (((Object)___dungeonGenerator.Generator.DungeonFlow).name != "SCPFlow") { 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; } public static void AddConversions(SCP914Converter SCP914, List<Item> lItems, string sItem, IEnumerable<string> arROUGH, IEnumerable<string> arCOARSE, IEnumerable<string> arONETOONE, IEnumerable<string> arFINE, IEnumerable<string> arVERYFINE) { IEnumerable<string>[] array = new IEnumerable<string>[5] { arROUGH, arCOARSE, arONETOONE, arFINE, arVERYFINE }; Item val = lItems.Find((Item x) => x.itemName.ToLowerInvariant() == sItem); if ((Object)(object)val == (Object)null) { Instance.mls.LogError((object)("Failed to find item for conversion \"" + sItem + "\", skipping.")); return; } foreach (SCP914Converter.SCP914Setting value in Enum.GetValues(typeof(SCP914Converter.SCP914Setting))) { List<Item> list = new List<Item>(); foreach (string sItemName in array[(int)value]) { if (sItemName == "*") { list.Add(null); continue; } if (sItemName == "@") { list.Add(val); continue; } list.Add(lItems.Find((Item x) => x.itemName.ToLowerInvariant() == sItemName)); } SCP914.AddConversion(value, val, list); } } [HarmonyPatch("SpawnSyncedProps")] [HarmonyPostfix] private static void SCP914Configuration() { SCP914Converter sCP914Converter = Object.FindObjectOfType<SCP914Converter>(); if ((Object)(object)sCP914Converter == (Object)null) { Instance.mls.LogInfo((object)"No 914 room found."); return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { Instance.mls.LogError((object)"Failed to find StartOfRound object."); return; } List<Item> list = instance.allItemsList?.itemsList; if (list == null) { Instance.mls.LogError((object)"Failed to get item list from StartOfRound."); return; } if (list.Count == 0) { Instance.mls.LogError((object)"Item list was empty from StartOfRound."); return; } foreach (SCP914Conversion sCP914Conversion in Instance.SCP914Conversions) { AddConversions(sCP914Converter, list, sCP914Conversion.ItemName, sCP914Conversion.RoughResults, sCP914Conversion.CoarseResults, sCP914Conversion.OneToOneResults, sCP914Conversion.FineResults, sCP914Conversion.VeryFineResults); } } } private readonly Harmony harmony = new Harmony("SCPCBDunGen"); public static SCPCBDunGen Instance; public ManualLogSource mls; public static AssetBundle SCPCBAssets; private ConfigEntry<int> configSCPRarity; private ConfigEntry<string> configMoonsOld; private ConfigEntry<string> configMoons; private ConfigEntry<bool> configGuaranteedSCP; private ConfigEntry<int> configLengthOverride; private SCP914ConversionSet SCP914Conversions = new SCP914ConversionSet(); private void Awake() { //IL_07e7: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Expected O, but got Unknown //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Expected O, but got Unknown //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Expected O, but got Unknown //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0615: 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("SCPCBDunGen"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); SCPCBAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "scpcb_dungeon")); if ((Object)(object)SCPCBAssets == (Object)null) { mls.LogError((object)"Failed to load SCPCB Dungeon assets."); return; } DungeonFlow val = SCPCBAssets.LoadAsset<DungeonFlow>("assets/Mods/SCP/data/SCPFlow.asset"); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load SCP:CB Dungeon Flow."); return; } configSCPRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FoundationRarity", 100, new ConfigDescription("How rare it is for the foundation to be chosen. Higher values increases the chance of spawning the foundation. 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>())); configMoonsOld = ((BaseUnityPlugin)this).Config.Bind<string>("General", "FoundationMoons", "NULL", new ConfigDescription("OLD CONFIG SETTING, HAS NO EFFECT. Only here to clear the legacy config from updating.", (AcceptableValueBase)null, Array.Empty<object>())); configMoons = ((BaseUnityPlugin)this).Config.Bind<string>("General", "FoundationMoonsList", "Titan,Secret Labs", new ConfigDescription("The moon(s) that the foundation 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,Secret Labs@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 FoundationRarity 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>())); configGuaranteedSCP = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "FoundationGuaranteed", false, new ConfigDescription("OLD CONFIG SETTING, HAS NO EFFECT. Only here to clear the legacy config from updating.\nIf you want to effectively guarantee the foundation, use a weight of something like '99999'", (AcceptableValueBase)null, Array.Empty<object>())); configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "FoundationLengthOverride", -1, new ConfigDescription(string.Format("If not -1, overrides the foundation length to whatever you'd like. Adjusts how long/large the dungeon generates.\nBe *EXTREMELY* careful not to set this too high (anything too big on a moon with a high dungeon size multipier can cause catastrophic problems, like crashing your computer or worse)\nFor reference, the default value for the current version [{0}] is {1}. If it's too big, make this lower e.g. 6, if it's too small use something like 10 (or higher, but don't go too crazy with it).", "2.3.0", val.Length.Min), (AcceptableValueBase)null, Array.Empty<object>())); if (configMoonsOld.Value != "NULL") { mls.LogWarning((object)"Old config parameters detected for old moon setting; config has changed since 1.3.1, check the config and set FoundationMoons to NULL to suppress this warning (and change FoundationMoonsList if you want)"); } if (configGuaranteedSCP.Value) { mls.LogWarning((object)"Old config parameters detected for Guaranteed SCP; config has changed since 2.0.2, check the config and set GuaranteedSCP to false to suppress this warning (see uncapped FoundationRarity)"); } if (configLengthOverride.Value != -1) { mls.LogInfo((object)$"Foundation length override has been set to {configLengthOverride.Value}. Be careful with this value."); val.Length.Min = configLengthOverride.Value; val.Length.Max = configLengthOverride.Value; } ExtendedDungeonFlow val2 = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); val2.contentSourceName = "SCP Foundation Dungeon"; val2.dungeonFlow = val; val2.dungeonFirstTimeAudio = SCPCBAssets.LoadAsset<AudioClip>("assets/Mods/SCP/snd/Horror8.ogg"); val2.dungeonDefaultRarity = 0; int num = (configGuaranteedSCP.Value ? 99999 : configSCPRarity.Value); switch (configMoons.Value.ToLower()) { case "all": val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num)); val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered SCP dungeon for all moons."); break; case "vanilla": val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num)); mls.LogInfo((object)"Registered SCP dungeon for all vanilla moons."); break; case "modded": val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered SCP dungeon for all modded moons."); break; case "paid": val2.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num)); mls.LogInfo((object)"Registered SCP dungeon for all paid moons."); break; case "free": val2.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num)); mls.LogInfo((object)"Registered SCP dungeon for all free moons."); break; default: { mls.LogInfo((object)"Registering SCP 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 SCP 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 SCP dungeon for moon {array3[k]} at default rarity {num}"); list.Add(new StringWithRarity(array4[0], result)); } } val2.manualPlanetNameReferenceList = list; break; } } val2.dungeonSizeMin = 1f; val2.dungeonSizeMax = 3f; val2.dungeonSizeLerpPercentage = 0f; AssetBundleLoader.RegisterExtendedDungeonFlow(val2); foreach (string item in DiscoverConfiguredRecipeFiles()) { StreamReader streamReader = new StreamReader(item); string text = streamReader.ReadToEnd(); try { List<SCP914Conversion> list2 = JsonConvert.DeserializeObject<List<SCP914Conversion>>(text); foreach (SCP914Conversion item2 in list2) { if (SCP914Conversions.Contains(item2.ItemName.ToLowerInvariant())) { SCP914Conversions[item2.ItemName].RoughResults.AddRange(item2.RoughResults); SCP914Conversions[item2.ItemName].CoarseResults.AddRange(item2.CoarseResults); SCP914Conversions[item2.ItemName].OneToOneResults.AddRange(item2.OneToOneResults); SCP914Conversions[item2.ItemName].FineResults.AddRange(item2.FineResults); SCP914Conversions[item2.ItemName].VeryFineResults.AddRange(item2.VeryFineResults); } else { SCP914Conversions.Add(item2); } } mls.LogInfo((object)("Registed SCP 914 json file successfully: " + item)); } catch (JsonException val3) { JsonException val4 = val3; mls.LogError((object)("Failed to deserialize file: " + item + ". Exception: " + ((Exception)(object)val4).Message)); } } harmony.PatchAll(typeof(SCPCBDunGen)); harmony.PatchAll(typeof(RoundManagerPatch)); mls.LogInfo((object)"SCP:CB DunGen for Lethal Company [Version 2.3.0] successfully loaded."); } private IEnumerable<string> DiscoverConfiguredRecipeFiles() { return from filePath in (from pluginDirectory in Directory.GetDirectories(Paths.PluginPath) select Path.Join((ReadOnlySpan<char>)pluginDirectory, (ReadOnlySpan<char>)"badhamknibbs-scp914-recipes")).Where(Directory.Exists).SelectMany(Directory.GetFiles) where Path.GetExtension(filePath) == ".json" select filePath; } } public class SCP914InputStore : NetworkBehaviour { public List<GameObject> lContainedItems; private void OnTriggerEnter(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { Debug.Log((object)("SCPCB New thing entered input trigger: " + ((Object)((Component)other).gameObject).name + ".")); GrabbableObject component = ((Component)other).GetComponent<GrabbableObject>(); lContainedItems.Add(((Component)other).gameObject); } } private void OnTriggerExit(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { Debug.Log((object)("SCPCB Thing has left input trigger: " + ((Object)((Component)other).gameObject).name + ".")); lContainedItems.Remove(((Component)other).gameObject); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } 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 int iCurrentState = 0; private bool bActive = false; private Transform ScrapTransform; private RoundManager roundManager; private StartOfRound StartOfRound; private EnemyType MaskedType; private ManualLogSource mls; private void Awake() { mls = SCPCBDunGen.Instance.mls; } 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); } } private Dictionary<Item, List<Item>> GetItemMapping() { return arItemMappings[iCurrentState]; } private Vector3 GetRandomNavMeshPositionInCollider(Collider collider) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) 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, 10f, -1)) { return ((NavMeshHit)(ref val)).position; } 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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) //IL_0112: 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++) { mls.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) { mls.LogInfo((object)"Getting round manager"); roundManager = Object.FindObjectOfType<RoundManager>(); if ((Object)(object)roundManager == (Object)null) { mls.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) { mls.LogError((object)"SCPCB Failed to find props container."); yield break; } } List<NetworkObjectReference> lNetworkObjectReferences = new List<NetworkObjectReference>(); List<int> lScrapValues = new List<int>(); bool bChargeBatteries = iCurrentState > 1; Dictionary<Item, List<Item>> dcCurrentMapping = GetItemMapping(); mls.LogInfo((object)$"Contained item count: {InputStore.lContainedItems.Count}"); foreach (GameObject gameObject in InputStore.lContainedItems) { GrabbableObject grabbable = gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)grabbable != (Object)null) { ConvertItem(lNetworkObjectReferences, lScrapValues, dcCurrentMapping, grabbable); continue; } PlayerControllerB playerController = gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)playerController != (Object)null) { ConvertPlayer(playerController); } } mls.LogInfo((object)"Finished spawning scrap, syncing with clients"); SpawnItemsClientRpc(lNetworkObjectReferences.ToArray(), lScrapValues.ToArray(), bChargeBatteries); InputStore.lContainedItems.Clear(); yield return (object)new WaitForSeconds(7f); RefineFinishClientRpc(); bActive = false; } private void ConvertItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, Dictionary<Item, List<Item>> dcCurrentMapping, GrabbableObject grabbable) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) if (grabbable.isHeld) { return; } mls.LogInfo((object)("Found grabbable item " + ((Object)grabbable.itemProperties).name)); Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); GameObject val = null; NetworkObject val2 = null; GrabbableObject val3 = null; if (dcCurrentMapping.TryGetValue(grabbable.itemProperties, out var value)) { mls.LogInfo((object)"Mapping found"); Item val4 = value?[roundManager.AnomalyRandom.Next(value.Count)]; Object.Destroy((Object)(object)((Component)grabbable).gameObject); if ((Object)(object)val4 != (Object)null) { mls.LogInfo((object)"Conversion found"); val = Object.Instantiate<GameObject>(val4.spawnPrefab, randomNavMeshPositionInCollider, Quaternion.identity, ScrapTransform); val2 = val.GetComponent<NetworkObject>(); val3 = val.GetComponent<GrabbableObject>(); } } else { mls.LogInfo((object)"No conversion, making new item with new scrap value"); val = Object.Instantiate<GameObject>(grabbable.itemProperties.spawnPrefab, randomNavMeshPositionInCollider, Quaternion.identity, ScrapTransform); Object.Destroy((Object)(object)((Component)grabbable).gameObject); val2 = val.GetComponent<NetworkObject>(); val3 = val.GetComponent<GrabbableObject>(); } mls.LogInfo((object)"Preprocessing done"); if ((Object)(object)val3 == (Object)null) { mls.LogInfo((object)"Conversion was null, item is intended to be destroyed in process."); return; } Item itemProperties = val3.itemProperties; if (itemProperties.isScrap) { mls.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); mls.LogInfo((object)$"new scrap value: {num}"); lScrapValues.Add(num); } else { mls.LogInfo((object)"Item is not scrap, adding empty scrap value"); lScrapValues.Add(0); } val2.Spawn(true); lNetworkObjectReferences.Add(NetworkObjectReference.op_Implicit(val2)); } [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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0118: 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) { mls.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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_010b: 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) { mls.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0); } } [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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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) { mls.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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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) { mls.LogError((object)"Failed to find StartOfRound."); return; } } NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { mls.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) { mls.LogInfo((object)$"Found suit at index {num}"); } num++; } UnlockableItem val5 = StartOfRound.unlockablesList.unlockables[iSuitID]; if (val5 == null) { mls.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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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) { mls.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) { mls.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_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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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 maskedPlayerEnemy = ((Component)netObjMasked).GetComponent<MaskedPlayerEnemy>(); maskedPlayerEnemy.mimickingPlayer = playerController; maskedPlayerEnemy.SetSuit(playerController.currentSuitID); maskedPlayerEnemy.SetEnemyOutside(false); playerController.redirectToEnemy = (EnemyAI)(object)maskedPlayerEnemy; } } } [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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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) { mls.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0); 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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) { mls.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val2 = (PlayerControllerB)val; val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0); if ((Object)(object)StartOfRound == (Object)null) { StartOfRound = Object.FindObjectOfType<StartOfRound>(); if ((Object)(object)StartOfRound == (Object)null) { mls.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) { mls.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) { mls.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)) { mls.LogInfo((object)"Got network object for mask enemy"); MaskedPlayerEnemy component = ((Component)val4).GetComponent<MaskedPlayerEnemy>(); component.SetSuit(val2.currentSuitID); component.mimickingPlayer = val2; 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) mls.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()) { mls.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: mls.LogError((object)"Invalid SCP 914 setting when attempting to convert player."); break; } } 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 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)); } 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; } } 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 = false; private bool bDoorWaiting = false; 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.Instance.mls.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.Instance.mls.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.Instance.mls.LogInfo((object)"Enemy attempting to open door..."); float num = 0f; foreach (EnemyAICollisionDetect item in EnemiesInCollider) { EnemyAI mainScript = item.mainScript; if (!mainScript.isEnemyDead) { SCPCBDunGen.Instance.mls.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.Instance.mls.LogInfo((object)$"Highest multiplier is {num}."); if (num != 0f) { SCPCBDunGen.Instance.mls.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.Instance.mls.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.Instance.mls.LogInfo((object)"Opening door fast [CLIENT]."); bDoorWaiting = true; bDoorOpen = true; ButtonA.interactable = false; ButtonB.interactable = 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.Instance.mls.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; 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; } } protected internal override string __getTypeName() { return "SCPDoorMover"; } } public static class PluginInfo { public const string PLUGIN_GUID = "SCPCBDunGen"; public const string PLUGIN_NAME = "SCPCBDunGen"; public const string PLUGIN_VERSION = "2.3.0"; } }
plugins/SecretLabs.dll
Decompiled 9 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); } } } } }
plugins/SellBodies/SellBodies.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using CleaningCompany.Misc; using CleaningCompany.Monos; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SellBodies")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SellBodies")] [assembly: AssemblyTitle("SellBodies")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace CleaningCompany { [BepInPlugin("malco.sell_bodies", "Sell Bodies", "1.0.0")] [BepInDependency("evaisa.lethallib", "0.10.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("malco.sell_bodies"); private const string GUID = "malco.sell_bodies"; private const string NAME = "Sell Bodies"; private const string VERSION = "1.0.0"; private static string root = "Assets/CleaningAssets/"; private Dictionary<string, int> minBodyValues; private Dictionary<string, bool> BodiesToDrop; private Dictionary<string, int> maxBodyValues; private Dictionary<string, float> bodyWeights; private Dictionary<string, string> pathToName = new Dictionary<string, string> { { root + "HoarderItem.asset", "Hoarding bug" }, { root + "SpiderItem.asset", "Bunker Spider" }, { root + "ThumperItem.asset", "Crawler" }, { root + "CentipedeItem.asset", "Centipede" }, { root + "NutcrackerItem.asset", "Nutcracker" }, { root + "BrackenBodyItem.asset", "Flowerman" }, { root + "BaboonItem.asset", "Baboon hawk" }, { root + "MouthDogItem.asset", "MouthDog" } }; public Dictionary<string, Item> BodySpawns = new Dictionary<string, Item>(); public List<GameObject> tools = new List<GameObject>(); private AssetBundle bundle; public static Plugin instance; public static PluginConfig cfg { get; private set; } private void Awake() { cfg = new PluginConfig(((BaseUnityPlugin)this).Config); cfg.InitBindings(); 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); } } } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sellbodies"); bundle = AssetBundle.LoadFromFile(text); instance = this; ApplyConfig(); SetupScrap(); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sell Bodies is patched!"); } private void ApplyConfig() { bodyWeights = new Dictionary<string, float> { { root + "HoarderItem.asset", cfg.HOARDER_WEIGHT }, { root + "SpiderItem.asset", cfg.SPIDER_WEIGHT }, { root + "ThumperItem.asset", cfg.THUMPER_WEIGHT }, { root + "NutcrackerItem.asset", cfg.NUTCRACKER_WEIGHT }, { root + "CentipedeItem.asset", cfg.CENTIPEDE_WEIGHT }, { root + "BrackenBodyItem.asset", cfg.BRACKEN_WEIGHT }, { root + "BaboonItem.asset", cfg.BABOON_WEIGHT }, { root + "MouthDogItem.asset", cfg.MOUTHDOG_WEIGHT } }; maxBodyValues = new Dictionary<string, int> { { root + "HoarderItem.asset", cfg.HOARDER_MAX }, { root + "SpiderItem.asset", cfg.SPIDER_MAX }, { root + "ThumperItem.asset", cfg.THUMPER_MAX }, { root + "NutcrackerItem.asset", cfg.NUTCRACKER_MAX }, { root + "CentipedeItem.asset", cfg.CENTIPEDE_MAX }, { root + "BrackenBodyItem.asset", cfg.BRACKEN_MAX }, { root + "BaboonItem.asset", cfg.BABOON_MAX }, { root + "MouthDogItem.asset", cfg.MOUTHDOG_MAX } }; minBodyValues = new Dictionary<string, int> { { root + "HoarderItem.asset", cfg.HOARDER_MIN }, { root + "SpiderItem.asset", cfg.SPIDER_MIN }, { root + "ThumperItem.asset", cfg.THUMPER_MIN }, { root + "NutcrackerItem.asset", cfg.NUTCRACKER_MIN }, { root + "CentipedeItem.asset", cfg.CENTIPEDE_MIN }, { root + "BrackenBodyItem.asset", cfg.BRACKEN_MIN }, { root + "BaboonItem.asset", cfg.BABOON_MIN }, { root + "MouthDogItem.asset", cfg.MOUTHDOG_MIN } }; BodiesToDrop = new Dictionary<string, bool> { { root + "HoarderItem.asset", cfg.HOARDER }, { root + "SpiderItem.asset", cfg.SPIDER }, { root + "ThumperItem.asset", cfg.THUMPER }, { root + "NutcrackerItem.asset", cfg.NUTCRACKER }, { root + "CentipedeItem.asset", cfg.CENTIPEDE }, { root + "BrackenBodyItem.asset", cfg.BRACKEN }, { root + "BaboonItem.asset", cfg.BABOON }, { root + "MouthDogItem.asset", cfg.MOUTHDOG } }; } private void SetupScrap() { foreach (KeyValuePair<string, string> item in pathToName) { Item val = bundle.LoadAsset<Item>(item.Key); Utilities.FixMixerGroups(val.spawnPrefab); val.twoHanded = true; val.spawnPrefab.AddComponent<BodySyncer>(); val.maxValue = maxBodyValues[item.Key]; val.minValue = minBodyValues[item.Key]; val.weight = bodyWeights[item.Key]; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterItem(val); if (BodiesToDrop[item.Key]) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Set " + item.Value + " to drop " + val.itemName)); BodySpawns.Add(item.Value, val); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Disregarding " + val.itemName + " - disabled in config")); } } } } } namespace CleaningCompany.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatcher { private static ulong currentEnemy = 9999999uL; [HarmonyPostfix] [HarmonyPatch("KillEnemyServerRpc")] private static void SpawnScrapBody(EnemyAI __instance) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (currentEnemy != ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId && ((NetworkBehaviour)__instance).IsHost) { currentEnemy = ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId; string enemyName = __instance.enemyType.enemyName; if (Plugin.instance.BodySpawns.ContainsKey(enemyName)) { GameObject val = Object.Instantiate<GameObject>(Plugin.instance.BodySpawns[enemyName].spawnPrefab, ((Component)__instance).transform.position + Vector3.up, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); ((Component)__instance).GetComponent<NetworkObject>().Despawn(true); } } } } } namespace CleaningCompany.Monos { internal class BodySyncer : NetworkBehaviour { public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitToSync()); } ((NetworkBehaviour)this).OnNetworkSpawn(); } private IEnumerator WaitToSync() { yield return (object)new WaitForSeconds(1f); PhysicsProp prop = ((Component)this).GetComponent<PhysicsProp>(); int price = Random.Range(((GrabbableObject)prop).itemProperties.minValue, ((GrabbableObject)prop).itemProperties.maxValue); SyncDetailsClientRpc(price, new NetworkBehaviourReference((NetworkBehaviour)(object)prop)); } [ClientRpc] private void SyncDetailsClientRpc(int price, NetworkBehaviourReference netRef) { //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_0071: 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) //IL_0090: 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) 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(1512427331u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, price); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1512427331u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PhysicsProp val3 = default(PhysicsProp); ((NetworkBehaviourReference)(ref netRef)).TryGet<PhysicsProp>(ref val3, (NetworkManager)null); if ((Object)(object)val3 != (Object)null) { ((GrabbableObject)val3).scrapValue = price; ((GrabbableObject)val3).itemProperties.creditsWorth = price; ((Component)val3).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}"; Debug.Log((object)"Successfully synced body values"); } else { Debug.LogError((object)"Failed to resolve network reference!"); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BodySyncer() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1512427331u, new RpcReceiveHandler(__rpc_handler_1512427331)); } private static void __rpc_handler_1512427331(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_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) { int price = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref price); NetworkBehaviourReference netRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((BodySyncer)(object)target).SyncDetailsClientRpc(price, netRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BodySyncer"; } } } namespace CleaningCompany.Misc { public class PluginConfig { private readonly ConfigFile configFile; public bool SPIDER { get; set; } public bool THUMPER { get; set; } public bool NUTCRACKER { get; set; } public bool CENTIPEDE { get; set; } public bool HOARDER { get; set; } public bool BRACKEN { get; set; } public bool MOUTHDOG { get; set; } public bool BABOON { get; set; } public int SPIDER_MIN { get; set; } public int THUMPER_MIN { get; set; } public int NUTCRACKER_MIN { get; set; } public int CENTIPEDE_MIN { get; set; } public int HOARDER_MIN { get; set; } public int BRACKEN_MIN { get; set; } public int MOUTHDOG_MIN { get; set; } public int BABOON_MIN { get; set; } public int NUTCRACKER_MAX { get; set; } public int SPIDER_MAX { get; set; } public int THUMPER_MAX { get; set; } public int CENTIPEDE_MAX { get; set; } public int HOARDER_MAX { get; set; } public int BRACKEN_MAX { get; set; } public int MOUTHDOG_MAX { get; set; } public int BABOON_MAX { get; set; } public float NUTCRACKER_WEIGHT { get; set; } public float SPIDER_WEIGHT { get; set; } public float THUMPER_WEIGHT { get; set; } public float CENTIPEDE_WEIGHT { get; set; } public float HOARDER_WEIGHT { get; set; } public float BRACKEN_WEIGHT { get; set; } public float MOUTHDOG_WEIGHT { get; set; } public float BABOON_WEIGHT { get; set; } public PluginConfig(ConfigFile cfg) { configFile = cfg; } private T ConfigEntry<T>(string section, string key, T defaultVal, string description) { return configFile.Bind<T>(section, key, defaultVal, description).Value; } public void InitBindings() { CENTIPEDE_MIN = ConfigEntry("Body Values", "Min price of Centipede Bodies", 45, ""); CENTIPEDE_MAX = ConfigEntry("Body Values", "Max price of Centipede Bodies", 70, ""); HOARDER_MIN = ConfigEntry("Body Values", "Min price of Hoarding Bug Bodies", 55, ""); HOARDER_MAX = ConfigEntry("Body Values", "Max price of Hoarding Bug Bodies", 88, ""); SPIDER_MIN = ConfigEntry("Body Values", "Min price of Spider Bodies", 70, ""); SPIDER_MAX = ConfigEntry("Body Values", "Max price of Spider Bodies", 110, ""); THUMPER_MIN = ConfigEntry("Body Values", "Min price of Thumper Bodies", 120, ""); THUMPER_MAX = ConfigEntry("Body Values", "Max price of Thumper Bodies", 160, ""); NUTCRACKER_MIN = ConfigEntry("Body Values", "Min price of Nutcracker Bodies", 125, ""); NUTCRACKER_MAX = ConfigEntry("Body Values", "Max price of Nutcracker Bodies", 150, ""); BRACKEN_MAX = ConfigEntry("Body Values", "Max price of Bracken Bodies", 140, ""); BRACKEN_MIN = ConfigEntry("Body Values", "Min price of Bracken Bodies", 100, ""); BRACKEN_MAX = ConfigEntry("Body Values", "Max price of Baboon Hawk Bodies", 155, ""); BABOON_MIN = ConfigEntry("Body Values", "Min price of Baboon Hawk Bodies", 105, ""); MOUTHDOG_MAX = ConfigEntry("Body Values", "Max price of Eyeless Dog Bodies", 200, ""); MOUTHDOG_MIN = ConfigEntry("Body Values", "Min price of Eyeless Dog Bodies", 175, ""); CENTIPEDE = ConfigEntry("Body Weights", "Enable selling of centipede bodies", defaultVal: true, ""); HOARDER = ConfigEntry("Body Weights", "Enable selling of hoarder bodies", defaultVal: true, ""); SPIDER = ConfigEntry("Body Weights", "Enable selling of spider bodies", defaultVal: true, ""); THUMPER = ConfigEntry("Body Weights", "Enable selling of crawler / half / thumper bodies", defaultVal: true, ""); NUTCRACKER = ConfigEntry("Body Weights", "Enable selling of nutcracker bodies", defaultVal: true, ""); MOUTHDOG = ConfigEntry("Body Weights", "Enable selling of eyeless dog bodies", defaultVal: true, ""); BABOON = ConfigEntry("Body Weights", "Enable selling of baboon hawk bodies", defaultVal: true, ""); BRACKEN = ConfigEntry("Body Weights", "Enable selling of bracken bodies", defaultVal: true, ""); CENTIPEDE_WEIGHT = ConfigEntry("Body Weights", "Weight of Centipede Bodies", 1.65f, ""); HOARDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Hoarding Bug Bodies", 1.6f, ""); SPIDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Spider Bodies", 2.3f, ""); THUMPER_WEIGHT = ConfigEntry("Body Weights", "Weight of Thumper Bodies", 2.9f, ""); NUTCRACKER_WEIGHT = ConfigEntry("Body Weights", "Weight of Nutcracker Bodies", 2.9f, ""); MOUTHDOG_WEIGHT = ConfigEntry("Body Weights", "Weight of Eyeless Dog Bodies", 3f, ""); BABOON_WEIGHT = ConfigEntry("Body Weights", "Weight of Baboon Hawk Bodies", 2.5f, ""); BRACKEN_WEIGHT = ConfigEntry("Body Weights", "Weight of Bracken Bodies", 1.9f, ""); } } }
plugins/Skibidi.AI.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Animations.Rigging; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Skibidi.AI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Skibidi.AI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("597be394-0d5f-4dbb-ad1d-4d432b1b4802")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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 Skibidi.AI { public class SkibidiAI : JesterAI { private int prevState = 0; public TwoBoneIKConstraint headIK; public AudioClip tauntClip; private float flushTime; public override void Start() { ((JesterAI)this).Start(); Debug.Log((object)"Spawning le skibidi. beware."); } public virtual void EvtFlush() { Debug.Log((object)"Flushing!"); ((EnemyAI)this).SwitchToBehaviourState(0); } public override void Update() { if (((EnemyAI)this).isEnemyDead) { return; } switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: if (prevState != 0) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", true); ((EnemyAI)this).creatureVoice.Stop(true); ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).enemyType.stunSFX); flushTime = Time.time; } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 0f, Time.deltaTime * 5f); break; case 1: if (prevState != 1) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); base.farAudio.PlayOneShot(tauntClip); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; case 2: if (prevState != 2) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; } prevState = ((EnemyAI)this).currentBehaviourStateIndex; if (((EnemyAI)this).currentBehaviourStateIndex != 0 || !(Time.time - flushTime < 15f)) { ((JesterAI)this).Update(); ((EnemyAI)this).agent.speed = Mathf.Clamp(((EnemyAI)this).agent.speed, 0f, 7.5f); if (base.popUpTimer > 10f) { base.popUpTimer = 10f; } } } } public class SkibidiSFX : MonoBehaviour { public SkibidiAI enemy; public AudioClip brrClip; public AudioClip skibidiClip; public float skibidiRamp = 0f; public virtual void PlayBrrSFX() { if (skibidiRamp > 1f) { skibidiRamp = 1f; } ((JesterAI)enemy).farAudio.pitch = 1f + skibidiRamp; ((JesterAI)enemy).farAudio.PlayOneShot(brrClip); skibidiRamp += 0.02f; } public virtual void PlaySkibidiSFX() { ((JesterAI)enemy).farAudio.pitch = 1f; skibidiRamp = 0f; ((EnemyAI)enemy).creatureVoice.PlayOneShot(skibidiClip); } } }
plugins/Skibidi.dll
Decompiled 9 months agousing System; 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 LethalLib.Modules; using Microsoft.CodeAnalysis; using Skibidi.AI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("Skibidi")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Skibidi Toilet core")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Skibidi")] [assembly: AssemblyTitle("Skibidi")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [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 Skibidi { public static class Assets { public static string mainAssetBundleName = "skibidibundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(',')[0]; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName)) { MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } [BepInPlugin("rileyzzz.Skibidi", "Skibidi Toilet", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { Assets.PopulateAssets(); EnemyType val = Assets.MainAssetBundle.LoadAsset<EnemyType>("SkibidiDef"); TerminalNode val2 = Assets.MainAssetBundle.LoadAsset<TerminalNode>("SkibidiFile"); TerminalKeyword val3 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("Skibidi"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Type typeFromHandle = typeof(SkibidiAI); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Skibidi AI {typeFromHandle}"); Enemies.RegisterEnemy(val, 22, (LevelTypes)(-1), (SpawnType)0, val2, val3); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Skibidi is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Skibidi"; public const string PLUGIN_NAME = "Skibidi"; public const string PLUGIN_VERSION = "1.0.0"; } }
plugins/SkinwalkerMod.dll
Decompiled 9 months agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using Dissonance.Config; using HarmonyLib; using SkinwalkerMod.Properties; using Steamworks; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SkinwalkerMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SkinwalkerMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fd4979a2-cef0-46af-8bf8-97e630b11475")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } namespace SkinwalkerMod { internal class LogoManager : MonoBehaviour { private AssetBundle bundle; private readonly Logo[] logos = new Logo[6] { new Logo { fileName = "Teo", playerNames = new string[9] { "SAMMY", "paddy", "Ozias", "Teo", "Rugbug Redfern", "WuluKing", "Boolie", "TeaEditor", "FlashGamesNemesis" } }, new Logo { fileName = "OfflineTV", playerNames = new string[3] { "Masayoshi", "QUARTERJADE", "DisguisedToast" } }, new Logo { fileName = "Neuro", playerNames = new string[1] { "vedal" } }, new Logo { fileName = "Mogul", playerNames = new string[2] { "ludwig", "AirCoots" } }, new Logo { fileName = "Imp", playerNames = new string[1] { "camila" } }, new Logo { fileName = "Iron", playerNames = new string[1] { "ironmouse" } } }; private Image cachedHeader; private Image cachedLogoHeader; private void Awake() { try { bundle = AssetBundle.LoadFromMemory(Resources.logos); SceneManager.sceneLoaded += OnSceneLoaded; } catch (Exception ex) { SkinwalkerLogger.LogError("LogoManager Awake Error: " + ex.Message); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { try { if (!(((Scene)(ref scene)).name == "MainMenu")) { return; } cachedHeader = GameObject.Find("HeaderImage").GetComponent<Image>(); cachedLogoHeader = ((Component)GameObject.Find("Canvas/MenuContainer").transform.GetChild(0).GetChild(1)).GetComponent<Image>(); string value = SteamClient.Name.ToString(); Logo[] array = logos; foreach (Logo logo in array) { string[] playerNames = logo.playerNames; foreach (string text in playerNames) { if (text.Equals(value, StringComparison.OrdinalIgnoreCase)) { ((MonoBehaviour)this).StartCoroutine(I_ChangeLogo(bundle.LoadAsset<Sprite>("Assets/Logos/" + logo.fileName + ".png"))); return; } } } } catch (Exception ex) { SkinwalkerLogger.LogError("LogoManager OnSceneLoaded Error: " + ex.Message + ". If you launched in LAN mode, then this is just gonna happen, it doesn't break anything so don't worry about it."); } } private IEnumerator I_ChangeLogo(Sprite sprite) { for (int i = 0; i < 20; i++) { if ((Object)(object)cachedHeader == (Object)null) { break; } if ((Object)(object)cachedLogoHeader == (Object)null) { break; } SetHeaderImage(sprite); yield return null; } } private void SetHeaderImage(Sprite sprite) { if (!((Object)(object)sprite == (Object)null)) { cachedHeader.sprite = sprite; cachedLogoHeader.sprite = sprite; } } } internal class Logo { public string fileName; public string[] playerNames; } [BepInPlugin("RugbugRedfern.SkinwalkerMod", "Skinwalker Mod", "2.0.7")] internal class PluginLoader : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("RugbugRedfern.SkinwalkerMod"); private const string modGUID = "RugbugRedfern.SkinwalkerMod"; private const string modVersion = "2.0.7"; private static bool initialized; public static PluginLoader Instance { get; private set; } private void Awake() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown if (initialized) { return; } initialized = true; Instance = this; harmony.PatchAll(Assembly.GetExecutingAssembly()); 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); } } } SkinwalkerLogger.Initialize("RugbugRedfern.SkinwalkerMod"); SkinwalkerLogger.Log("SKINWALKER MOD STARTING UP 2.0.7"); SkinwalkerConfig.InitConfig(); SceneManager.sceneLoaded += SkinwalkerNetworkManagerHandler.ClientConnectInitializer; GameObject val = new GameObject("Skinwalker Mod"); val.AddComponent<SkinwalkerModPersistent>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); Logs.SetLogLevel((LogCategory)1, (LogLevel)4); Logs.SetLogLevel((LogCategory)3, (LogLevel)4); Logs.SetLogLevel((LogCategory)2, (LogLevel)4); GameObject val2 = new GameObject("Logo Manager"); val2.AddComponent<LogoManager>(); ((Object)val2).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val2); } public void BindConfig<T>(ref ConfigEntry<T> config, string section, string key, T defaultValue, string description = "") { config = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description); } } internal class SkinwalkerBehaviour : MonoBehaviour { private AudioSource audioSource; public const float PLAY_INTERVAL_MIN = 15f; public const float PLAY_INTERVAL_MAX = 40f; private const float MAX_DIST = 100f; private float nextTimeToPlayAudio; private EnemyAI ai; public void Initialize(EnemyAI ai) { this.ai = ai; audioSource = ai.creatureVoice; SetNextTime(); } private void Update() { if (Time.time > nextTimeToPlayAudio) { SetNextTime(); AttemptPlaySound(); } } private void AttemptPlaySound() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0127: 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) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) float num = -1f; if (Object.op_Implicit((Object)(object)ai) && !ai.isEnemyDead) { if (((Object)((Component)ai).gameObject).name == "DressGirl(Clone)") { DressGirlAI val = (DressGirlAI)ai; if ((Object)(object)val.hauntingPlayer != (Object)(object)StartOfRound.Instance.localPlayerController) { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not haunted) EnemyAI: " + (object)ai); return; } if (!val.staringInHaunt && !((EnemyAI)val).moveTowardsDestination) { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not visible) EnemyAI: " + (object)ai); return; } } Vector3 val2 = (StartOfRound.Instance.localPlayerController.isPlayerDead ? ((Component)StartOfRound.Instance.spectateCamera).transform.position : ((Component)StartOfRound.Instance.localPlayerController).transform.position); if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.localPlayerController == (Object)null || (num = Vector3.Distance(val2, ((Component)this).transform.position)) < 100f) { AudioClip sample = SkinwalkerModPersistent.Instance.GetSample(); if (Object.op_Implicit((Object)(object)sample)) { SkinwalkerLogger.Log(((Object)this).name + " played voice line 1"); audioSource.PlayOneShot(sample); } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line 0"); } } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (too far away) " + num); } } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (dead) EnemyAI: " + (object)ai); } } private void SetNextTime() { if (SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value <= 0f) { nextTimeToPlayAudio = Time.time + 100000000f; } else { nextTimeToPlayAudio = Time.time + Random.Range(15f, 40f) / SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value; } } private T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } return (T)(object)((val is T) ? val : null); } } internal class SkinwalkerConfig { public static ConfigEntry<bool> VoiceEnabled_BaboonHawk; public static ConfigEntry<bool> VoiceEnabled_Bracken; public static ConfigEntry<bool> VoiceEnabled_BunkerSpider; public static ConfigEntry<bool> VoiceEnabled_Centipede; public static ConfigEntry<bool> VoiceEnabled_CoilHead; public static ConfigEntry<bool> VoiceEnabled_EyelessDog; public static ConfigEntry<bool> VoiceEnabled_ForestGiant; public static ConfigEntry<bool> VoiceEnabled_GhostGirl; public static ConfigEntry<bool> VoiceEnabled_GiantWorm; public static ConfigEntry<bool> VoiceEnabled_HoardingBug; public static ConfigEntry<bool> VoiceEnabled_Hygrodere; public static ConfigEntry<bool> VoiceEnabled_Jester; public static ConfigEntry<bool> VoiceEnabled_Masked; public static ConfigEntry<bool> VoiceEnabled_Nutcracker; public static ConfigEntry<bool> VoiceEnabled_SporeLizard; public static ConfigEntry<bool> VoiceEnabled_Thumper; public static ConfigEntry<bool> VoiceEnabled_OtherEnemies; public static ConfigEntry<float> VoiceLineFrequency; public static void InitConfig() { PluginLoader.Instance.BindConfig(ref VoiceLineFrequency, "Voice Settings", "VoiceLineFrequency", 1f, "1 is the default, and voice lines will occur every " + 15f.ToString("0") + " to " + 40f.ToString("0") + " seconds per enemy. Setting this to 2 means they will occur twice as often, 0.5 means half as often, etc."); PluginLoader.Instance.BindConfig(ref VoiceEnabled_BaboonHawk, "Monster Voices", "Baboon Hawk", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Bracken, "Monster Voices", "Bracken", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_BunkerSpider, "Monster Voices", "Bunker Spider", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Centipede, "Monster Voices", "Centipede", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_CoilHead, "Monster Voices", "Coil Head", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_EyelessDog, "Monster Voices", "Eyeless Dog", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_ForestGiant, "Monster Voices", "Forest Giant", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_GhostGirl, "Monster Voices", "Ghost Girl", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_GiantWorm, "Monster Voices", "Giant Worm", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_HoardingBug, "Monster Voices", "Hoarding Bug", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Hygrodere, "Monster Voices", "Hygrodere", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Jester, "Monster Voices", "Jester", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Masked, "Monster Voices", "Masked", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Nutcracker, "Monster Voices", "Nutcracker", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_SporeLizard, "Monster Voices", "Spore Lizard", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Thumper, "Monster Voices", "Thumper", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_OtherEnemies, "Monster Voices", "Other Enemies (Including Modded)", defaultValue: true); SkinwalkerLogger.Log("VoiceEnabled_BaboonHawk" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BaboonHawk.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Bracken" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Bracken.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_BunkerSpider" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BunkerSpider.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Centipede" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Centipede.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_CoilHead" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_CoilHead.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_EyelessDog" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_EyelessDog.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_ForestGiant" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_ForestGiant.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_GhostGirl" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GhostGirl.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_GiantWorm" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GiantWorm.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_HoardingBug" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_HoardingBug.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Hygrodere" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Hygrodere.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Jester" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Jester.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Masked" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Masked.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Nutcracker" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Nutcracker.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_SporeLizard" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_SporeLizard.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Thumper" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Thumper.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_OtherEnemies" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_OtherEnemies.Value}]"); SkinwalkerLogger.Log("VoiceLineFrequency" + $" VALUE LOADED FROM CONFIG: [{VoiceLineFrequency.Value}]"); } } internal static class SkinwalkerLogger { internal static ManualLogSource logSource; public static void Initialize(string modGUID) { logSource = Logger.CreateLogSource(modGUID); } public static void Log(object message) { logSource.LogInfo(message); } public static void LogError(object message) { logSource.LogError(message); } public static void LogWarning(object message) { logSource.LogWarning(message); } } public class SkinwalkerModPersistent : MonoBehaviour { private string audioFolder; private List<AudioClip> cachedAudio = new List<AudioClip>(); private float nextTimeToCheckFolder = 30f; private float nextTimeToCheckEnemies = 30f; private const float folderScanInterval = 8f; private const float enemyScanInterval = 5f; public static SkinwalkerModPersistent Instance { get; private set; } private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Component)this).transform.position = Vector3.zero; SkinwalkerLogger.Log("Skinwalker Mod Object Initialized"); audioFolder = Path.Combine(Application.dataPath, "..", "Dissonance_Diagnostics"); EnableRecording(); if (!Directory.Exists(audioFolder)) { Directory.CreateDirectory(audioFolder); } } private void Start() { try { if (Directory.Exists(audioFolder)) { Directory.Delete(audioFolder, recursive: true); } } catch (Exception message) { SkinwalkerLogger.Log(message); } } private void OnApplicationQuit() { DisableRecording(); } private void EnableRecording() { DebugSettings.Instance.EnablePlaybackDiagnostics = true; DebugSettings.Instance.RecordFinalAudio = true; } private void Update() { if (Time.realtimeSinceStartup > nextTimeToCheckFolder) { nextTimeToCheckFolder = Time.realtimeSinceStartup + 8f; if (!Directory.Exists(audioFolder)) { SkinwalkerLogger.Log("Audio folder not present. Don't worry about it, it will be created automatically when you play with friends. (" + audioFolder + ")"); return; } string[] files = Directory.GetFiles(audioFolder); SkinwalkerLogger.Log($"Got audio file paths ({files.Length})"); string[] array = files; foreach (string path in array) { ((MonoBehaviour)this).StartCoroutine(LoadWavFile(path, delegate(AudioClip audioClip) { cachedAudio.Add(audioClip); })); } } if (!(Time.realtimeSinceStartup > nextTimeToCheckEnemies)) { return; } nextTimeToCheckEnemies = Time.realtimeSinceStartup + 5f; EnemyAI[] array2 = Object.FindObjectsOfType<EnemyAI>(true); EnemyAI[] array3 = array2; SkinwalkerBehaviour skinwalkerBehaviour = default(SkinwalkerBehaviour); foreach (EnemyAI val in array3) { SkinwalkerLogger.Log("IsEnemyEnabled " + ((Object)val).name + " " + IsEnemyEnabled(val)); if (IsEnemyEnabled(val) && !((Component)val).TryGetComponent<SkinwalkerBehaviour>(ref skinwalkerBehaviour)) { ((Component)val).gameObject.AddComponent<SkinwalkerBehaviour>().Initialize(val); } } } private bool IsEnemyEnabled(EnemyAI enemy) { if ((Object)(object)enemy == (Object)null) { return false; } return ((Object)((Component)enemy).gameObject).name switch { "MaskedPlayerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Masked.Value, "NutcrackerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Nutcracker.Value, "BaboonHawkEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BaboonHawk.Value, "Flowerman(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Bracken.Value, "SandSpider(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BunkerSpider.Value, "RedLocustBees(Clone)" => false, "Centipede(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Centipede.Value, "SpringMan(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_CoilHead.Value, "MouthDog(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_EyelessDog.Value, "ForestGiant(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_ForestGiant.Value, "DressGirl(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GhostGirl.Value, "SandWorm(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GiantWorm.Value, "HoarderBug(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_HoardingBug.Value, "Blob(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Hygrodere.Value, "JesterEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Jester.Value, "PufferEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_SporeLizard.Value, "Crawler(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Thumper.Value, "DocileLocustBees(Clone)" => false, "DoublewingedBird(Clone)" => false, _ => SkinwalkerNetworkManager.Instance.VoiceEnabled_OtherEnemies.Value, }; } internal IEnumerator LoadWavFile(string path, Action<AudioClip> callback) { UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)20); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { SkinwalkerLogger.Log("Loaded clip from path " + path); AudioClip audioClip = DownloadHandlerAudioClip.GetContent(www); if (audioClip.length > 0.9f) { callback(audioClip); } try { File.Delete(path); } catch (Exception e) { SkinwalkerLogger.LogWarning(e); } } } finally { ((IDisposable)www)?.Dispose(); } } private void DisableRecording() { DebugSettings.Instance.EnablePlaybackDiagnostics = false; DebugSettings.Instance.RecordFinalAudio = false; if (Directory.Exists(audioFolder)) { Directory.Delete(audioFolder, recursive: true); } } public AudioClip GetSample() { while (cachedAudio.Count > 200) { cachedAudio.RemoveAt(Random.Range(0, cachedAudio.Count)); } if (cachedAudio.Count > 0) { int index = Random.Range(0, cachedAudio.Count - 1); AudioClip result = cachedAudio[index]; cachedAudio.RemoveAt(index); return result; } return null; } public void ClearCache() { cachedAudio.Clear(); } } internal static class SkinwalkerNetworkManagerHandler { internal static void ClientConnectInitializer(Scene sceneName, LoadSceneMode sceneEnum) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (((Scene)(ref sceneName)).name == "SampleSceneRelay") { GameObject val = new GameObject("SkinwalkerNetworkManager"); val.AddComponent<NetworkObject>(); val.AddComponent<SkinwalkerNetworkManager>(); Debug.Log((object)"Initialized SkinwalkerNetworkManager"); } } } internal class SkinwalkerNetworkManager : NetworkBehaviour { public NetworkVariable<bool> VoiceEnabled_BaboonHawk = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Bracken = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_BunkerSpider = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Centipede = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_CoilHead = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_EyelessDog = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_ForestGiant = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_GhostGirl = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_GiantWorm = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_HoardingBug = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Hygrodere = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Jester = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Masked = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Nutcracker = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_SporeLizard = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Thumper = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_OtherEnemies = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<float> VoiceLineFrequency = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static SkinwalkerNetworkManager Instance { get; private set; } private void Awake() { Instance = this; if (GameNetworkManager.Instance.isHostingGame) { VoiceEnabled_BaboonHawk.Value = SkinwalkerConfig.VoiceEnabled_BaboonHawk.Value; VoiceEnabled_Bracken.Value = SkinwalkerConfig.VoiceEnabled_Bracken.Value; VoiceEnabled_BunkerSpider.Value = SkinwalkerConfig.VoiceEnabled_BunkerSpider.Value; VoiceEnabled_Centipede.Value = SkinwalkerConfig.VoiceEnabled_Centipede.Value; VoiceEnabled_CoilHead.Value = SkinwalkerConfig.VoiceEnabled_CoilHead.Value; VoiceEnabled_EyelessDog.Value = SkinwalkerConfig.VoiceEnabled_EyelessDog.Value; VoiceEnabled_ForestGiant.Value = SkinwalkerConfig.VoiceEnabled_ForestGiant.Value; VoiceEnabled_GhostGirl.Value = SkinwalkerConfig.VoiceEnabled_GhostGirl.Value; VoiceEnabled_GiantWorm.Value = SkinwalkerConfig.VoiceEnabled_GiantWorm.Value; VoiceEnabled_HoardingBug.Value = SkinwalkerConfig.VoiceEnabled_HoardingBug.Value; VoiceEnabled_Hygrodere.Value = SkinwalkerConfig.VoiceEnabled_Hygrodere.Value; VoiceEnabled_Jester.Value = SkinwalkerConfig.VoiceEnabled_Jester.Value; VoiceEnabled_Masked.Value = SkinwalkerConfig.VoiceEnabled_Masked.Value; VoiceEnabled_Nutcracker.Value = SkinwalkerConfig.VoiceEnabled_Nutcracker.Value; VoiceEnabled_SporeLizard.Value = SkinwalkerConfig.VoiceEnabled_SporeLizard.Value; VoiceEnabled_Thumper.Value = SkinwalkerConfig.VoiceEnabled_Thumper.Value; VoiceEnabled_OtherEnemies.Value = SkinwalkerConfig.VoiceEnabled_OtherEnemies.Value; VoiceLineFrequency.Value = SkinwalkerConfig.VoiceLineFrequency.Value; SkinwalkerLogger.Log("HOST SENDING CONFIG TO CLIENTS"); } SkinwalkerLogger.Log("SkinwalkerNetworkManager Awake"); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); SkinwalkerLogger.Log("SkinwalkerNetworkManager OnDestroy"); SkinwalkerModPersistent.Instance?.ClearCache(); } protected override void __initializeVariables() { if (VoiceEnabled_BaboonHawk == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BaboonHawk cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_BaboonHawk).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk, "VoiceEnabled_BaboonHawk"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk); if (VoiceEnabled_Bracken == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Bracken cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Bracken).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Bracken, "VoiceEnabled_Bracken"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Bracken); if (VoiceEnabled_BunkerSpider == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BunkerSpider cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_BunkerSpider).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider, "VoiceEnabled_BunkerSpider"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider); if (VoiceEnabled_Centipede == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Centipede cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Centipede).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Centipede, "VoiceEnabled_Centipede"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Centipede); if (VoiceEnabled_CoilHead == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_CoilHead cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_CoilHead).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_CoilHead, "VoiceEnabled_CoilHead"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_CoilHead); if (VoiceEnabled_EyelessDog == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_EyelessDog cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_EyelessDog).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_EyelessDog, "VoiceEnabled_EyelessDog"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_EyelessDog); if (VoiceEnabled_ForestGiant == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_ForestGiant cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_ForestGiant).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_ForestGiant, "VoiceEnabled_ForestGiant"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_ForestGiant); if (VoiceEnabled_GhostGirl == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GhostGirl cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_GhostGirl).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GhostGirl, "VoiceEnabled_GhostGirl"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GhostGirl); if (VoiceEnabled_GiantWorm == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GiantWorm cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_GiantWorm).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GiantWorm, "VoiceEnabled_GiantWorm"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GiantWorm); if (VoiceEnabled_HoardingBug == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_HoardingBug cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_HoardingBug).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_HoardingBug, "VoiceEnabled_HoardingBug"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_HoardingBug); if (VoiceEnabled_Hygrodere == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Hygrodere cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Hygrodere).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Hygrodere, "VoiceEnabled_Hygrodere"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Hygrodere); if (VoiceEnabled_Jester == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Jester cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Jester).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Jester, "VoiceEnabled_Jester"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Jester); if (VoiceEnabled_Masked == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Masked cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Masked).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Masked, "VoiceEnabled_Masked"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Masked); if (VoiceEnabled_Nutcracker == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Nutcracker cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Nutcracker).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Nutcracker, "VoiceEnabled_Nutcracker"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Nutcracker); if (VoiceEnabled_SporeLizard == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_SporeLizard cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_SporeLizard).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_SporeLizard, "VoiceEnabled_SporeLizard"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_SporeLizard); if (VoiceEnabled_Thumper == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Thumper cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Thumper).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Thumper, "VoiceEnabled_Thumper"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Thumper); if (VoiceEnabled_OtherEnemies == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_OtherEnemies cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_OtherEnemies).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies, "VoiceEnabled_OtherEnemies"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies); if (VoiceLineFrequency == null) { throw new Exception("SkinwalkerNetworkManager.VoiceLineFrequency cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceLineFrequency).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceLineFrequency, "VoiceLineFrequency"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceLineFrequency); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "SkinwalkerNetworkManager"; } } } namespace SkinwalkerMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("SkinwalkerMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] logos { get { object @object = ResourceManager.GetObject("logos", resourceCulture); return (byte[])@object; } } internal Resources() { } } }
plugins/SnatchingBracken.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using RuntimeNetcodeRPCValidator; using SnatchinBracken; using SnatchinBracken.Patches; using SnatchinBracken.Patches.data; using SnatchingBracken; using SnatchingBracken.Patches.dungeon; using SnatchingBracken.Patches.network; using SnatchingBracken.Patches.tasks; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SnatchingBracken")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SnatchingBracken")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("afcd9203-dbdd-4b28-85a1-fb12890f0d98")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace SnatchinBracken { [BepInPlugin("Ovchinikov.SnatchinBracken.Main", "SnatchinBracken", "1.3.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SnatchinBrackenBase : BaseUnityPlugin { private const string modGUID = "Ovchinikov.SnatchinBracken.Main"; private const string modName = "SnatchinBracken"; private const string modVersion = "1.3.7"; private static SnatchinBrackenBase _instance; private readonly Harmony harmony = new Harmony("Ovchinikov.SnatchinBracken.Main"); private static SnatchinBrackenBase instance; private NetcodeValidator netcodeValidator; internal ManualLogSource mls; public static SnatchinBrackenBase Instance => _instance; private void Awake() { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } if ((Object)(object)_instance == (Object)null) { _instance = this; } else if ((Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)this); return; } mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Main"); mls.LogInfo((object)"Enabling SnatchinBracken"); InitializeConfigValues(); harmony.PatchAll(typeof(SnatchinBrackenBase)); harmony.PatchAll(typeof(BrackenAIPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(TeleporterPatch)); harmony.PatchAll(typeof(LandminePatch)); harmony.PatchAll(typeof(TurretPatch)); harmony.PatchAll(typeof(PlayerPatch)); harmony.PatchAll(typeof(DungeonGenPatch)); harmony.PatchAll(typeof(StartOfRound)); netcodeValidator = new NetcodeValidator("Ovchinikov.SnatchinBracken.Main"); netcodeValidator.PatchAll(); netcodeValidator.BindToPreExistingObjectByBehaviour<FlowermanBinding, PlayerControllerB>(); mls.LogInfo((object)"Finished Enabling SnatchinBracken"); } private void InitializeConfigValues() { mls.LogInfo((object)"Parsing SnatchinBracken config"); if (AppDomain.CurrentDomain.GetAssemblies().Any((Assembly assembly) => assembly.GetName().Name.Equals("LethalConfig"))) { mls.LogInfo((object)"Found LethalConfigAPI, let's use that."); LethalConfigAPIHook.InitializeConfig(); } else { mls.LogInfo((object)"LethalConfigAPI not found, using built-in BepInEx config stuff."); ConfigEntry<bool> dropItemsOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Drop Items on Snatch", true, "Should players drop their items when a Bracken grabs them?"); SharedData.Instance.DropItems = dropItemsOption.Value; dropItemsOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DropItems = dropItemsOption.Value; } }; ConfigEntry<bool> turretOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Ignore Turrets on Snatch", true, "Should players be targetable when dragged?"); SharedData.Instance.IgnoreTurrets = turretOption.Value; turretOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.IgnoreTurrets = turretOption.Value; } }; ConfigEntry<bool> chaoticOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Brackens Behave More Naturally", false, "If enabled, Brackens will perform kills at unpredictable times after an initial drop. Otherwise, the Bracken either must be in distance of the favorite location, or hit the time limit."); SharedData.Instance.ChaoticTendencies = chaoticOption.Value; chaoticOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.ChaoticTendencies = chaoticOption.Value; } }; ConfigEntry<bool> allowDraggedTps = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Allow teleports to save dragged players", true, "Should players be able to be saved through teleportation?"); SharedData.Instance.AllowTeleports = allowDraggedTps.Value; allowDraggedTps.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.AllowTeleports = allowDraggedTps.Value; } }; ConfigEntry<bool> monstersIgnorePlayersOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Enemies Ignore Dragged Players", true, "Should players be ignored by other monsters while being dragged?"); SharedData.Instance.monstersIgnorePlayers = monstersIgnorePlayersOption.Value; monstersIgnorePlayersOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.monstersIgnorePlayers = monstersIgnorePlayersOption.Value; } }; ConfigEntry<bool> stuckForceKillOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Stuck Force Kill", false, "If enabled, Brackens will force kill when stuck at the same spot for at least 5 seconds."); SharedData.Instance.StuckForceKill = stuckForceKillOption.Value; stuckForceKillOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.StuckForceKill = stuckForceKillOption.Value; } }; ConfigEntry<bool> brackenRoomOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Force Set Favorite Location To Bracken Room", true, "If enabled, Brackens' favorite locations will be set to the Bracken room. The room sometimes doesn't spawn, so please don't be alarmed if they don't take you there if this is enabled."); SharedData.Instance.BrackenRoom = brackenRoomOption.Value; brackenRoomOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.BrackenRoom = brackenRoomOption.Value; } }; ConfigEntry<bool> mineOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Ignore Mines on Snatch", true, "Should players ignore Landmines while being dragged?"); SharedData.Instance.IgnoreMines = mineOption.Value; mineOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.IgnoreMines = mineOption.Value; } }; ConfigEntry<int> instaKillTimeEntry = ((BaseUnityPlugin)this).Config.Bind<int>("SnatchinBracken Settings", "Chance for Insta Kill", 0, "Percent chance for insta kill, 0 to disable."); SharedData.Instance.PercentChanceForInsta = instaKillTimeEntry.Value; instaKillTimeEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.PercentChanceForInsta = instaKillTimeEntry.Value; } }; ConfigEntry<int> brackenKillTimeEntry = ((BaseUnityPlugin)this).Config.Bind<int>("SnatchinBracken Settings", "Seconds Until Auto Kill", 15, "Time in seconds until Bracken automatically kills when grabbed. Range: 1-60 seconds."); SharedData.Instance.KillAtTime = brackenKillTimeEntry.Value; brackenKillTimeEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.KillAtTime = brackenKillTimeEntry.Value; } }; ConfigEntry<int> brackenNextAttemptEntry = ((BaseUnityPlugin)this).Config.Bind<int>("SnatchinBracken Settings", "Seconds Until Next Attempt", 5, "Time in seconds until Bracken is allowed to take another victim."); SharedData.Instance.SecondsBeforeNextAttempt = brackenNextAttemptEntry.Value; brackenNextAttemptEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.SecondsBeforeNextAttempt = brackenNextAttemptEntry.Value; } }; ConfigEntry<bool> doDamageOnIntervalEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Do Gradual Damage", false, "Should players be hurt gradually while being dragged?"); SharedData.Instance.DoDamageOnInterval = doDamageOnIntervalEntry.Value; doDamageOnIntervalEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DoDamageOnInterval = doDamageOnIntervalEntry.Value; } }; ConfigEntry<int> damageDealtProgressively = ((BaseUnityPlugin)this).Config.Bind<int>("SnatchinBracken Settings", "Damage Dealt At Interval", 5, "This only applies if you have \"Do Gradual Damage\" enabled. While dragged, every second this configured amount of damage will be dealt to the player."); SharedData.Instance.DamageDealtAtInterval = damageDealtProgressively.Value; damageDealtProgressively.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DamageDealtAtInterval = damageDealtProgressively.Value; } }; ConfigEntry<int> distanceAutoKillerEntry = ((BaseUnityPlugin)this).Config.Bind<int>("SnatchinBracken Settings", "Distance For Kill", 1, "How far should the Bracken be from its favorite spot to initiate a kill?"); SharedData.Instance.DistanceFromFavorite = distanceAutoKillerEntry.Value; distanceAutoKillerEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DistanceFromFavorite = distanceAutoKillerEntry.Value; } }; ConfigEntry<bool> instaKillOption = ((BaseUnityPlugin)this).Config.Bind<bool>("SnatchinBracken Settings", "Instakill When Alone", true, "Should players be instantly killed if they're alone?"); SharedData.Instance.InstantKillIfAlone = instaKillOption.Value; instaKillOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.InstantKillIfAlone = instaKillOption.Value; } }; } mls.LogInfo((object)"Config finished parsing"); } } } namespace SnatchinBracken.Patches { [HarmonyPatch(typeof(FlowermanAI))] internal class BrackenAIPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.FlowermanAI"; private static ManualLogSource mls; private static List<FlowermanAI> JustProcessed; static BrackenAIPatch() { JustProcessed = new List<FlowermanAI>(); mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.FlowermanAI"); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "ChooseFarthestNodeFromPosition")] private static void FarthestNodeAdjustment(EnemyAI __instance, ref Transform __result, Vector3 pos, bool avoidLineOfSight = false, int offset = 0, bool log = false) { //IL_0049: 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) FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val != null && Object.op_Implicit((Object)(object)SharedData.Instance.BrackenRoomPosition) && (Object)(object)__result != (Object)null && SharedData.Instance.BrackenRoom) { if (__instance.SetDestinationToPosition(SharedData.Instance.BrackenRoomPosition.position, true)) { __result = SharedData.Instance.BrackenRoomPosition; } else if (!__instance.SetDestinationToPosition(__result.position, true)) { } } } [HarmonyPostfix] [HarmonyPatch("Start")] private static void PostfixStart(FlowermanAI __instance) { if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) { ((Component)__instance).gameObject.AddComponent<FlowermanLocationTask>(); } if ((Object)(object)SharedData.Instance.BrackenRoomPosition != (Object)null && SharedData.Instance.BrackenRoom) { ((EnemyAI)__instance).favoriteSpot = SharedData.Instance.BrackenRoomPosition; } } [HarmonyPrefix] [HarmonyPatch("KillPlayerAnimationServerRpc")] private static bool PrefixKillPlayerAnimationServerRpc(FlowermanAI __instance, int playerObjectId) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return true; } if ((Object)(object)__instance == (Object)null) { return true; } if ((CountAlivePlayers() <= 1 && SharedData.Instance.InstantKillIfAlone) || RollForChance(SharedData.Instance.PercentChanceForInsta)) { return true; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObjectId]; if ((Object)(object)val == (Object)null) { return true; } if (SharedData.Instance.BindedDrags.ContainsKey(__instance)) { return false; } if (SharedData.Instance.BindedDrags.ContainsValue(val)) { return false; } if (SharedData.Instance.LastGrabbedTimeStamp.ContainsKey(__instance) && Time.time - SharedData.Instance.LastGrabbedTimeStamp[__instance] <= SharedData.Instance.SecondsBeforeNextAttempt) { return false; } if (SharedData.Instance.DropItems) { val.DropAllHeldItemsAndSync(); } else { DropDoubleHandedItem(val); } ((Component)val).GetComponent<FlowermanBinding>().PrepForBindingServerRpc(playerObjectId, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)val).GetComponent<FlowermanBinding>().BindPlayerServerRpc(playerObjectId, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)val).GetComponent<FlowermanBinding>().UpdateFavoriteSpotServerRpc(playerObjectId, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)val).GetComponent<FlowermanBinding>().MufflePlayerVoiceServerRpc(playerObjectId); FlowermanLocationTask component = ((Component)__instance).gameObject.GetComponent<FlowermanLocationTask>(); if ((Object)(object)component != (Object)null && !SharedData.Instance.DoDamageOnInterval) { component.StartCheckStuckCoroutine(__instance, val); } if (!SharedData.Instance.CoroutineStarted.ContainsKey(__instance) && SharedData.Instance.DoDamageOnInterval) { ((MonoBehaviour)__instance).StartCoroutine(DoGradualDamage(__instance, val, 1f, SharedData.Instance.DamageDealtAtInterval)); SharedData.Instance.CoroutineStarted[__instance] = true; } ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)__instance).IsServer) { ((EnemyAI)__instance).SwitchToBehaviourState(1); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(EnemyAI), "SetEnemyStunned")] private static void SetEnemyStunnedPrefix(EnemyAI __instance, bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val == null) { return; } if (SharedData.Instance.BindedDrags.ContainsKey(val)) { PlayerControllerB valueSafe = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, val); StopGradualDamageCoroutine(val, valueSafe); } if ((((NetworkBehaviour)val).IsHost || ((NetworkBehaviour)val).IsServer) && SharedData.Instance.BindedDrags.ContainsKey(val)) { mls.LogInfo((object)"Stunned bracken, dropping"); PlayerControllerB valueSafe2 = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, val); int valueSafe3 = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, valueSafe2); SharedData.UpdateTimestampNow(val, valueSafe2); FlowermanLocationTask component = ((Component)val).gameObject.GetComponent<FlowermanLocationTask>(); if ((Object)(object)component != (Object)null) { component.StopCheckStuckCoroutine(); } ManuallyDropPlayerOnHit(val, valueSafe2); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().UnbindPlayerServerRpc(valueSafe3, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().ResetEntityStatesServerRpc(valueSafe3, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().UnmufflePlayerVoiceServerRpc(valueSafe3); JustProcessed.Add(val); } } [HarmonyPostfix] [HarmonyPatch("HitEnemy")] private static void HitEnemyPostPatch(FlowermanAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer && JustProcessed.Contains(__instance)) { __instance.angerMeter = 0f; __instance.isInAngerMode = false; __instance.angerCheckInterval = 0f; JustProcessed.Remove(__instance); } } [HarmonyPrefix] [HarmonyPatch("HitEnemy")] private static void HitEnemyPrePatch(FlowermanAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { if (SharedData.Instance.BindedDrags.ContainsKey(__instance)) { PlayerControllerB valueSafe = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, __instance); StopGradualDamageCoroutine(__instance, valueSafe); } if ((((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) && SharedData.Instance.BindedDrags.ContainsKey(__instance)) { mls.LogInfo((object)"Hit bracken, dropping"); PlayerControllerB valueSafe2 = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, __instance); int valueSafe3 = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, valueSafe2); SharedData.UpdateTimestampNow(__instance, valueSafe2); FlowermanLocationTask component = ((Component)__instance).gameObject.GetComponent<FlowermanLocationTask>(); if ((Object)(object)component != (Object)null) { component.StopCheckStuckCoroutine(); } ManuallyDropPlayerOnHit(__instance, valueSafe2); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().UnbindPlayerServerRpc(valueSafe3, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().ResetEntityStatesServerRpc(valueSafe3, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)valueSafe2).gameObject.GetComponent<FlowermanBinding>().UnmufflePlayerVoiceServerRpc(valueSafe3); JustProcessed.Add(__instance); } } private static IEnumerator DoGradualDamage(FlowermanAI flowermanAI, PlayerControllerB player, float damageInterval, int damageAmount) { while (!player.isPlayerDead && (Object)(object)flowermanAI != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(flowermanAI)) { yield return (object)new WaitForSeconds(damageInterval); if (!player.isPlayerDead && (Object)(object)flowermanAI != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(flowermanAI)) { if (player.health - damageAmount <= 0) { StopGradualDamageCoroutine(flowermanAI, player); int id2 = SharedData.Instance.PlayerIDs[player]; SharedData.UpdateTimestampNow(flowermanAI, player); FinishKillAnimationNormally(flowermanAI, player, id2); } else { int id = SharedData.Instance.PlayerIDs[player]; ((Component)player).GetComponent<FlowermanBinding>().DamagePlayerServerRpc(id, damageAmount); } mls.LogInfo((object)$"Damage applied to player: {damageAmount}"); } else { StopGradualDamageCoroutine(flowermanAI, player); } } } private static void StopGradualDamageCoroutine(FlowermanAI flowermanAI, PlayerControllerB player) { if (SharedData.Instance.CoroutineStarted.ContainsKey(flowermanAI)) { ((MonoBehaviour)flowermanAI).StopCoroutine(DoGradualDamage(flowermanAI, player, 1f, SharedData.Instance.DamageDealtAtInterval)); SharedData.Instance.CoroutineStarted.Remove(flowermanAI); } } private static int CountAlivePlayers() { return StartOfRound.Instance.livingPlayers; } private static void ManuallyDropPlayerOnHit(FlowermanAI __instance, PlayerControllerB player) { player.inSpecialInteractAnimation = false; player.inAnimationWithEnemy = null; __instance.carryingPlayerBody = false; ((EnemyAI)__instance).creatureAnimator.SetBool("killing", false); ((EnemyAI)__instance).creatureAnimator.SetBool("carryingBody", false); __instance.angerMeter = 0f; __instance.isInAngerMode = false; ((EnemyAI)__instance).stunnedByPlayer = null; ((EnemyAI)__instance).stunNormalizedTimer = 0f; __instance.evadeStealthTimer = 0.1f; __instance.timesThreatened = 0; __instance.FinishKillAnimation(false); } [HarmonyPrefix] [HarmonyPatch("DropPlayerBody")] private static bool DropBodyPatch(FlowermanAI __instance) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return true; } if (!SharedData.Instance.BindedDrags.ContainsKey(__instance)) { return true; } if (!SharedData.Instance.ChaoticTendencies && !PrerequisiteKilling(__instance)) { return false; } PlayerControllerB valueSafe = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, __instance); int valueSafe2 = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, valueSafe); if ((Object)(object)valueSafe == (Object)null) { SharedData.Instance.BindedDrags.Remove(__instance); return true; } if (!SharedData.Instance.DoDamageOnInterval) { valueSafe.inSpecialInteractAnimation = false; ((Component)valueSafe).GetComponent<FlowermanBinding>().UnbindPlayerServerRpc(valueSafe2, ((NetworkBehaviour)__instance).NetworkObjectId); FlowermanLocationTask component = ((Component)__instance).gameObject.GetComponent<FlowermanLocationTask>(); if ((Object)(object)component != (Object)null) { component.StopCheckStuckCoroutine(); } __instance.carryingPlayerBody = false; __instance.bodyBeingCarried = null; ((EnemyAI)__instance).creatureAnimator.SetBool("carryingBody", false); FinishKillAnimationNormally(__instance, valueSafe, valueSafe2); } return false; } private static bool PrerequisiteKilling(FlowermanAI flowerman) { //IL_002d: 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) if (SharedData.Instance.LastGrabbedTimeStamp.ContainsKey(flowerman)) { float num = SharedData.Instance.LastGrabbedTimeStamp[flowerman]; float num2 = Vector3.Distance(((Component)flowerman).transform.position, ((EnemyAI)flowerman).favoriteSpot.position); if (Time.time - num >= SharedData.Instance.KillAtTime || num2 <= SharedData.Instance.DistanceFromFavorite) { return true; } } return false; } private static void FinishKillAnimationNormally(FlowermanAI __instance, PlayerControllerB playerControllerB, int playerId) { mls.LogInfo((object)"Bracken found good spot to kill, killing player."); ((EnemyAI)__instance).inSpecialAnimationWithPlayer = playerControllerB; playerControllerB.inSpecialInteractAnimation = true; __instance.KillPlayerAnimationClientRpc(playerId); } private static bool RollForChance(int percentChance) { if (percentChance == 0) { return false; } if (percentChance < 0 || percentChance > 100) { throw new ArgumentOutOfRangeException("percentChance", "Percent chance must be between 0 and 100."); } int num = SharedData.RandomInstance.Next(1, 101); return num <= percentChance; } private static void DropDoubleHandedItem(PlayerControllerB player, bool itemsFall = true, bool disconnecting = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (player.twoHanded) { player.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } } } [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.EnemyAI"; private static readonly ManualLogSource mls; static EnemyAIPatch() { mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.EnemyAI"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void FlowermanStart(EnemyAI __instance) { FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val != null) { SharedData.Instance.FlowermanIDs[((NetworkBehaviour)__instance).NetworkObjectId] = val; } } [HarmonyPrefix] [HarmonyPatch("Update")] private static void UpdatePatcher(EnemyAI __instance) { //IL_00b4: 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) FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val == null || !SharedData.Instance.BindedDrags.ContainsKey(val)) { return; } PlayerControllerB valueSafe = GeneralExtensions.GetValueSafe<FlowermanAI, PlayerControllerB>(SharedData.Instance.BindedDrags, val); if ((Object)(object)valueSafe == (Object)null) { return; } if (valueSafe.isPlayerDead) { UnbindPlayerAndBracken(valueSafe, val); return; } UpdatePosition(val, valueSafe); if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return; } int valueSafe2 = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, valueSafe); float num = SharedData.Instance.LastGrabbedTimeStamp[val]; float num2 = Vector3.Distance(((Component)__instance).transform.position, __instance.favoriteSpot.position); if ((Time.time - num >= SharedData.Instance.KillAtTime || num2 <= SharedData.Instance.DistanceFromFavorite) && !SharedData.Instance.DoDamageOnInterval) { SharedData.UpdateTimestampNow(val, valueSafe); UnbindPlayerAndBracken(valueSafe, val); FlowermanLocationTask component = ((Component)__instance).gameObject.GetComponent<FlowermanLocationTask>(); if ((Object)(object)component != (Object)null) { component.StopCheckStuckCoroutine(); } FinishKillAnimationNormally(val, valueSafe, valueSafe2); } } [HarmonyPrefix] [HarmonyPatch("MeetsStandardPlayerCollisionConditions")] private static bool OverrideCollisionCheck(EnemyAI __instance, Collider other, bool inKillAnimation = false, bool overrideIsInsideFactoryCheck = false) { if (!((NetworkBehaviour)__instance).IsHost) { return true; } FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val == null) { return true; } if (SharedData.Instance.LastGrabbedTimeStamp.ContainsKey(val) && Time.time - SharedData.Instance.LastGrabbedTimeStamp[val] <= SharedData.Instance.SecondsBeforeNextAttempt) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("TargetClosestPlayer")] private static bool ClosestPlayerPatch(FlowermanAI __instance) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return true; } return !SharedData.Instance.BindedDrags.ContainsKey(__instance); } [HarmonyPrefix] [HarmonyPatch("PlayerIsTargetable")] private static bool PlayerIsTargetablePatch(EnemyAI __instance, PlayerControllerB playerScript, bool cannotBeInShip = false) { if (SharedData.Instance.monstersIgnorePlayers) { FlowermanAI val = (FlowermanAI)(object)((__instance is FlowermanAI) ? __instance : null); if (val != null) { if (SharedData.Instance.LastGrabbedTimeStamp.ContainsKey(val) && Time.time - SharedData.Instance.LastGrabbedTimeStamp[val] <= SharedData.Instance.SecondsBeforeNextAttempt) { return false; } return !SharedData.Instance.BindedDrags.ContainsKey(val); } return !SharedData.Instance.BindedDrags.ContainsValue(playerScript); } return true; } private static void UpdatePosition(FlowermanAI __instance, PlayerControllerB player) { //IL_000d: 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_001e: 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_002f: Unknown result type (might be due to invalid IL or missing references) float num = -0.8f; Vector3 position = ((Component)__instance).transform.position + ((Component)__instance).transform.forward * num; ((Component)player).transform.position = position; } private static void UnbindPlayerAndBracken(PlayerControllerB player, FlowermanAI __instance) { if (!SharedData.Instance.PlayerIDs.ContainsKey(player)) { mls.LogInfo((object)"There isn't a player bound to this Bracken. That's strange."); return; } int valueSafe = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, player); player.inSpecialInteractAnimation = false; player.inAnimationWithEnemy = null; __instance.carryingPlayerBody = true; ((EnemyAI)__instance).creatureAnimator.SetBool("killing", false); ((EnemyAI)__instance).creatureAnimator.SetBool("carryingBody", false); ((EnemyAI)__instance).stunnedByPlayer = null; ((EnemyAI)__instance).stunNormalizedTimer = 0f; __instance.angerMeter = 0f; __instance.isInAngerMode = false; __instance.timesThreatened = 0; __instance.FinishKillAnimation(false); RemoveDictionaryReferences(__instance, player, valueSafe); } private static IEnumerator DoGradualDamage(FlowermanAI flowermanAI, PlayerControllerB player, float damageInterval, int damageAmount) { while (!player.isPlayerDead && (Object)(object)flowermanAI != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(flowermanAI)) { yield return (object)new WaitForSeconds(damageInterval); if (!player.isPlayerDead && (Object)(object)flowermanAI != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(flowermanAI)) { if (player.health - damageAmount <= 0) { StopGradualDamageCoroutine(flowermanAI, player); int id = SharedData.Instance.PlayerIDs[player]; SharedData.UpdateTimestampNow(flowermanAI, player); FinishKillAnimationNormally(flowermanAI, player, id); } else { DoDamage(player, damageAmount); } mls.LogInfo((object)$"Damage applied to player: {damageAmount}"); } } } private static void StopGradualDamageCoroutine(FlowermanAI flowermanAI, PlayerControllerB player) { if (SharedData.Instance.CoroutineStarted.ContainsKey(flowermanAI)) { ((MonoBehaviour)flowermanAI).StopCoroutine(DoGradualDamage(flowermanAI, player, 1f, SharedData.Instance.DamageDealtAtInterval)); SharedData.Instance.CoroutineStarted.Remove(flowermanAI); } } private static void DoDamage(PlayerControllerB player, int damageAmount) { //IL_000a: 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) player.DamagePlayer(damageAmount, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); } private static void RemoveDictionaryReferences(FlowermanAI __instance, PlayerControllerB player, int playerId) { SharedData.Instance.CoroutineStarted.Remove(__instance); ((Component)player).gameObject.GetComponent<FlowermanBinding>().UnbindPlayerServerRpc(playerId, ((NetworkBehaviour)__instance).NetworkObjectId); ((Component)player).gameObject.GetComponent<FlowermanBinding>().ResetEntityStatesServerRpc(playerId, ((NetworkBehaviour)__instance).NetworkObjectId); } private static void FinishKillAnimationNormally(FlowermanAI __instance, PlayerControllerB playerControllerB, int playerId) { ((EnemyAI)__instance).inSpecialAnimationWithPlayer = playerControllerB; playerControllerB.inSpecialInteractAnimation = true; __instance.KillPlayerAnimationClientRpc(playerId); } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { private const string modGUID = "Ovchinikov.SnatchinBracken.Landmine"; private static ManualLogSource mls; static LandminePatch() { mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Landmine"); } [HarmonyPrefix] [HarmonyPatch("OnTriggerEnter")] private static bool PrefixTriggerEntry(Landmine __instance, Collider other) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return true; } if (!SharedData.Instance.IgnoreMines) { return true; } FlowermanAI componentInParent = ((Component)other).gameObject.GetComponentInParent<FlowermanAI>(); if ((Object)(object)componentInParent != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(componentInParent)) { mls.LogInfo((object)"Bracken carrying a body triggered Mine, preventing."); return false; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && SharedData.Instance.BindedDrags.ContainsValue(component) && !component.isPlayerDead) { mls.LogInfo((object)"Player being dragged would've triggered Mine here, preventing."); return false; } return true; } [HarmonyPrefix] [HarmonyPatch("OnTriggerExit")] private static bool PostfixTriggerExit(Landmine __instance, Collider other) { if (!SharedData.Instance.IgnoreMines) { return true; } FlowermanAI componentInParent = ((Component)other).gameObject.GetComponentInParent<FlowermanAI>(); if ((Object)(object)componentInParent != (Object)null && SharedData.Instance.BindedDrags.ContainsKey(componentInParent)) { mls.LogInfo((object)"Bracken carrying a body triggered Mine, preventing."); return false; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && SharedData.Instance.BindedDrags.ContainsValue(component) && !component.isPlayerDead) { mls.LogInfo((object)"Player being dragged would've triggered Mine here, preventing."); return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class TeleporterPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.Teleporter"; private static ManualLogSource mls; static TeleporterPatch() { mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Teleporter"); } [HarmonyPrefix] [HarmonyPatch("TeleportPlayer")] private static bool PrefixTeleportPlayer(PlayerControllerB __instance, Vector3 pos, bool withRotation = false, float rot = 0f, bool allowInteractTrigger = false, bool enableController = true) { if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer) { return true; } if ((Object)(object)__instance == (Object)null) { return true; } if (SharedData.Instance.BindedDrags.ContainsValue(__instance)) { FlowermanAI val = SearchForCorrelatedFlowerman(__instance); if ((Object)(object)val != (Object)null) { if (!SharedData.Instance.AllowTeleports) { return false; } int playerId = SharedData.Instance.PlayerIDs[__instance]; SharedData.UpdateTimestampNow(val, __instance); ManuallyUnbindPlayer(val, __instance); ((Component)__instance).gameObject.GetComponent<FlowermanBinding>().ResetEntityStatesServerRpc(playerId, ((NetworkBehaviour)val).NetworkObjectId); ((Component)__instance).gameObject.GetComponent<FlowermanBinding>().UnbindPlayerServerRpc(playerId, ((NetworkBehaviour)val).NetworkObjectId); ((Component)__instance).gameObject.GetComponent<FlowermanBinding>().UnmufflePlayerVoiceServerRpc(playerId); } } return true; } private static FlowermanAI SearchForCorrelatedFlowerman(PlayerControllerB player) { foreach (KeyValuePair<FlowermanAI, PlayerControllerB> bindedDrag in SharedData.Instance.BindedDrags) { if (bindedDrag.Value.actualClientId == player.actualClientId) { return bindedDrag.Key; } } return null; } private static void ManuallyUnbindPlayer(FlowermanAI flowerman, PlayerControllerB player) { int valueSafe = GeneralExtensions.GetValueSafe<PlayerControllerB, int>(SharedData.Instance.PlayerIDs, player); player.inSpecialInteractAnimation = false; flowerman.carryingPlayerBody = false; ((EnemyAI)flowerman).creatureAnimator.SetBool("killing", false); ((EnemyAI)flowerman).creatureAnimator.SetBool("carryingBody", false); flowerman.FinishKillAnimation(false); ((EnemyAI)flowerman).stunnedByPlayer = null; ((EnemyAI)flowerman).stunNormalizedTimer = 0f; ((EnemyAI)flowerman).favoriteSpot = null; } } [HarmonyPatch(typeof(Turret))] internal class TurretPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.Turret"; private static ManualLogSource mls; static TurretPatch() { mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Turret"); } [HarmonyPostfix] [HarmonyPatch("CheckForPlayersInLineOfSight")] private static void PostfixCheckForPlayersInLineOfSight(Turret __instance, ref PlayerControllerB __result, float radius, bool angleRangeCheck) { if (SharedData.Instance.IgnoreTurrets && (Object)(object)__result != (Object)null && SharedData.Instance.BindedDrags.ContainsValue(__result)) { __result = null; } } } } namespace SnatchinBracken.Patches.data { internal class SharedData { private static SharedData _instance; private static Random _random = new Random(); public Dictionary<FlowermanAI, bool> CoroutineStarted = new Dictionary<FlowermanAI, bool>(); public Dictionary<PlayerControllerB, float> DroppedTimestamp = new Dictionary<PlayerControllerB, float>(); public static SharedData Instance => _instance ?? (_instance = new SharedData()); public static Random RandomInstance => _random; public Dictionary<FlowermanAI, PlayerControllerB> BindedDrags { get; } = new Dictionary<FlowermanAI, PlayerControllerB>(); public Dictionary<ulong, FlowermanAI> FlowermanIDs { get; } = new Dictionary<ulong, FlowermanAI>(); public Dictionary<PlayerControllerB, int> PlayerIDs { get; } = new Dictionary<PlayerControllerB, int>(); public Dictionary<int, PlayerControllerB> IDsToPlayerController { get; } = new Dictionary<int, PlayerControllerB>(); public Dictionary<FlowermanAI, float> LastGrabbedTimeStamp { get; } = new Dictionary<FlowermanAI, float>(); public bool DropItems { get; set; } public bool IgnoreTurrets { get; set; } public bool InstantKillIfAlone { get; set; } public bool IgnoreMines { get; set; } public bool AllowTeleports { get; set; } public bool ChaoticTendencies { get; set; } public bool DoDamageOnInterval { get; set; } public bool StuckForceKill { get; set; } public bool monstersIgnorePlayers { get; set; } public bool BrackenRoom { get; set; } public float KillAtTime { get; set; } public float SecondsBeforeNextAttempt { get; set; } public int DamageDealtAtInterval { get; set; } public int PercentChanceForInsta { get; set; } public float DistanceFromFavorite { get; set; } public Transform BrackenRoomPosition { get; set; } public static void UpdateTimestampNow(FlowermanAI flowermanAI, PlayerControllerB player) { Instance.LastGrabbedTimeStamp[flowermanAI] = Time.time; Instance.DroppedTimestamp[player] = Time.time; } public static void FlushDictionaries() { Instance.BindedDrags.Clear(); Instance.FlowermanIDs.Clear(); Instance.LastGrabbedTimeStamp.Clear(); Instance.CoroutineStarted.Clear(); Instance.DroppedTimestamp.Clear(); } } } namespace SnatchingBracken { internal class LethalConfigAPIHook { public static void InitializeConfig() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Expected O, but got Unknown //IL_0391: Expected O, but got Unknown //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Expected O, but got Unknown //IL_041c: Expected O, but got Unknown //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Expected O, but got Unknown //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_04a7: Expected O, but got Unknown //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Expected O, but got Unknown //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Expected O, but got Unknown //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Expected O, but got Unknown //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_059a: Expected O, but got Unknown //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Expected O, but got Unknown //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Expected O, but got Unknown //IL_0624: Expected O, but got Unknown //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Expected O, but got Unknown //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Expected O, but got Unknown LethalConfigManager.SetModDescription("A mod that alters the behavior of the Bracken. The Bracken pulls players into a new spot before performing a kill."); ConfigEntry<bool> dropItemsOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Drop Items on Snatch", true, "Should players drop their items when a Bracken grabs them?"); BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(dropItemsOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); SharedData.Instance.DropItems = dropItemsOption.Value; dropItemsOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DropItems = dropItemsOption.Value; } }; ConfigEntry<bool> turretOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Ignore Turrets on Snatch", true, "Should players be targetable when dragged?"); BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(turretOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); SharedData.Instance.IgnoreTurrets = turretOption.Value; turretOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.IgnoreTurrets = turretOption.Value; } }; ConfigEntry<bool> chaoticOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Brackens Behave More Naturally", false, "If enabled, Brackens will perform kills at unpredictable times after an initial drop. Otherwise, the Bracken either must be in distance of the favorite location, or hit the time limit."); BoolCheckBoxConfigItem val3 = new BoolCheckBoxConfigItem(chaoticOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3); SharedData.Instance.ChaoticTendencies = chaoticOption.Value; chaoticOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.ChaoticTendencies = chaoticOption.Value; } }; ConfigEntry<bool> stuckForceKillOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Stuck Force Kill", false, "If enabled, Brackens will force kill when stuck at the same spot for at least 5 seconds."); BoolCheckBoxConfigItem val4 = new BoolCheckBoxConfigItem(stuckForceKillOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); SharedData.Instance.StuckForceKill = stuckForceKillOption.Value; stuckForceKillOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.StuckForceKill = stuckForceKillOption.Value; } }; ConfigEntry<bool> brackenRoomOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Force Set Favorite Location To Bracken Room", true, "If enabled, Brackens' favorite locations will be set to the Bracken room. The room sometimes doesn't spawn, so please don't be alarmed if they don't take you there if this is enabled."); BoolCheckBoxConfigItem val5 = new BoolCheckBoxConfigItem(brackenRoomOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); SharedData.Instance.BrackenRoom = brackenRoomOption.Value; brackenRoomOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.BrackenRoom = brackenRoomOption.Value; } }; ConfigEntry<bool> allowDraggedTps = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Allow teleports to save dragged players", true, "Should players be able to be saved through teleportation?"); BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(allowDraggedTps); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); SharedData.Instance.AllowTeleports = allowDraggedTps.Value; allowDraggedTps.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.AllowTeleports = allowDraggedTps.Value; } }; ConfigEntry<bool> mineOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Ignore Mines on Snatch", true, "Should players ignore Landmines while being dragged?"); BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(mineOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); SharedData.Instance.IgnoreMines = mineOption.Value; mineOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.IgnoreMines = mineOption.Value; } }; ConfigEntry<bool> monstersIgnorePlayersOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Enemies Ignore Dragged Players", true, "Should players be ignored by other monsters while being dragged?"); BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(monstersIgnorePlayersOption); SharedData.Instance.monstersIgnorePlayers = monstersIgnorePlayersOption.Value; LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8); monstersIgnorePlayersOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.monstersIgnorePlayers = monstersIgnorePlayersOption.Value; } }; ConfigEntry<int> instaKillTimeEntry = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<int>("SnatchinBracken Settings", "Chance for Insta Kill", 0, "Percent chance for insta kill, 0 to disable."); IntSliderOptions val9 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val9).Min = 0; ((BaseRangeOptions<int>)val9).Max = 100; IntSliderOptions val10 = val9; IntSliderConfigItem val11 = new IntSliderConfigItem(instaKillTimeEntry, val10); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11); SharedData.Instance.PercentChanceForInsta = instaKillTimeEntry.Value; instaKillTimeEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.PercentChanceForInsta = instaKillTimeEntry.Value; } }; ConfigEntry<int> brackenKillTimeEntry = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<int>("SnatchinBracken Settings", "Seconds Until Auto Kill", 15, "Time in seconds until Bracken automatically kills when grabbed. Range: 1-60 seconds."); IntSliderOptions val12 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val12).Min = 1; ((BaseRangeOptions<int>)val12).Max = 60; IntSliderOptions val13 = val12; IntSliderConfigItem val14 = new IntSliderConfigItem(brackenKillTimeEntry, val13); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14); SharedData.Instance.KillAtTime = brackenKillTimeEntry.Value; brackenKillTimeEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.KillAtTime = brackenKillTimeEntry.Value; } }; ConfigEntry<int> brackenNextAttemptEntry = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<int>("SnatchinBracken Settings", "Seconds Until Next Attempt", 5, "Time in seconds until Bracken is allowed to take another victim."); IntSliderOptions val15 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val15).Min = 1; ((BaseRangeOptions<int>)val15).Max = 60; IntSliderOptions val16 = val15; IntSliderConfigItem val17 = new IntSliderConfigItem(brackenNextAttemptEntry, val16); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17); SharedData.Instance.SecondsBeforeNextAttempt = brackenNextAttemptEntry.Value; brackenNextAttemptEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.SecondsBeforeNextAttempt = brackenNextAttemptEntry.Value; } }; ConfigEntry<bool> doDamageOnIntervalEntry = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Do Gradual Damage", false, "Should players be hurt gradually while being dragged?"); BoolCheckBoxConfigItem val18 = new BoolCheckBoxConfigItem(doDamageOnIntervalEntry); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val18); SharedData.Instance.DoDamageOnInterval = doDamageOnIntervalEntry.Value; doDamageOnIntervalEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DoDamageOnInterval = doDamageOnIntervalEntry.Value; } }; ConfigEntry<int> damageDealtProgressively = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<int>("SnatchinBracken Settings", "Damage Dealt At Interval", 5, "This only applies if you have \"Do Gradual Damage\" enabled. While dragged, every second this configured amount of damage will be dealt to the player."); IntSliderOptions val19 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val19).Min = 1; ((BaseRangeOptions<int>)val19).Max = 100; IntSliderOptions val20 = val19; IntSliderConfigItem val21 = new IntSliderConfigItem(damageDealtProgressively, val20); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val21); SharedData.Instance.DamageDealtAtInterval = damageDealtProgressively.Value; damageDealtProgressively.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DamageDealtAtInterval = damageDealtProgressively.Value; } }; ConfigEntry<int> distanceAutoKillerEntry = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<int>("SnatchinBracken Settings", "Distance For Kill", 1, "How far should the Bracken be from its favorite spot to initiate a kill?"); IntSliderOptions val22 = new IntSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<int>)val22).Min = 1; ((BaseRangeOptions<int>)val22).Max = 60; IntSliderOptions val23 = val22; IntSliderConfigItem val24 = new IntSliderConfigItem(distanceAutoKillerEntry, val23); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val24); SharedData.Instance.DistanceFromFavorite = distanceAutoKillerEntry.Value; distanceAutoKillerEntry.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.DistanceFromFavorite = distanceAutoKillerEntry.Value; } }; ConfigEntry<bool> instaKillOption = ((BaseUnityPlugin)SnatchinBrackenBase.Instance).Config.Bind<bool>("SnatchinBracken Settings", "Instakill When Alone", true, "Should players be instantly killed if they're alone?"); BoolCheckBoxConfigItem val25 = new BoolCheckBoxConfigItem(instaKillOption); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val25); SharedData.Instance.InstantKillIfAlone = instaKillOption.Value; instaKillOption.SettingChanged += delegate { if (((NetworkBehaviour)HUDManager.Instance).IsHost || ((NetworkBehaviour)HUDManager.Instance).IsServer) { SharedData.Instance.InstantKillIfAlone = instaKillOption.Value; } }; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.Playerpatch"; private static ManualLogSource mls; static PlayerPatch() { mls = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Playerpatch"); } [HarmonyPrefix] [HarmonyPatch("IHittable.Hit")] private static bool HitOverride(PlayerControllerB __instance, int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX = false) { if (SharedData.Instance.BindedDrags.ContainsValue(__instance) || (SharedData.Instance.DroppedTimestamp.ContainsKey(__instance) && SharedData.Instance.DroppedTimestamp[__instance] + 1f >= Time.time)) { return false; } return true; } } } namespace SnatchingBracken.Patches.tasks { public class FlowermanLocationTask : MonoBehaviour { private Coroutine checkStuckCoroutine; private static ManualLogSource mls; static FlowermanLocationTask() { mls = Logger.CreateLogSource("Bracken Location Task"); } public void StartCheckStuckCoroutine(FlowermanAI flowermanAI, PlayerControllerB player) { checkStuckCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckIfStuck(flowermanAI, player)); } public void StopCheckStuckCoroutine() { if (checkStuckCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(checkStuckCoroutine); checkStuckCoroutine = null; } } private IEnumerator CheckIfStuck(FlowermanAI flowermanAI, PlayerControllerB player) { Vector3 lastPosition = ((Component)flowermanAI).transform.position; while ((Object)(object)flowermanAI != (Object)null) { yield return (object)new WaitForSeconds(5f); Vector3 currentPosition = ((Component)flowermanAI).transform.position; if (Vector3.Distance(lastPosition, currentPosition) <= 1f) { HandleStuckFlowerman(flowermanAI, player); } lastPosition = currentPosition; } } private void HandleStuckFlowerman(FlowermanAI flowermanAI, PlayerControllerB player) { Debug.Log((object)"FlowermanAI is stuck, handling..."); StopCheckStuckCoroutine(); SharedData.UpdateTimestampNow(flowermanAI, player); int num = SharedData.Instance.PlayerIDs[player]; ((EnemyAI)flowermanAI).inSpecialAnimationWithPlayer = player; player.inSpecialInteractAnimation = true; flowermanAI.KillPlayerAnimationClientRpc(num); } } } namespace SnatchingBracken.Patches.ship { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("ShipLeave")] private static void PrefixShipLeave(StartOfRoundPatch __instance) { SharedData.Instance.BrackenRoomPosition = null; SharedData.FlushDictionaries(); } } } namespace SnatchingBracken.Patches.network { public class FlowermanBinding : NetworkBehaviour { [ServerRpc(RequireOwnership = false)] public void BindPlayerServerRpc(int playerId, ulong flowermanId) { AddBindingsClientRpc(playerId, flowermanId); } [ServerRpc(RequireOwnership = false)] public void UnbindPlayerServerRpc(int playerId, ulong flowermanId) { RemoveBindingsClientRpc(playerId, flowermanId); } [ServerRpc(RequireOwnership = false)] public void ResetEntityStatesServerRpc(int playerId, ulong flowermanId) { ResetEntityStatesClientRpc(playerId, flowermanId); } [ServerRpc(RequireOwnership = false)] public void PrepForBindingServerRpc(int playerId, ulong flowermanId) { PrepForBindingClientRpc(playerId, flowermanId); } [ServerRpc(RequireOwnership = false)] public void UpdateFavoriteSpotServerRpc(int playerId, ulong flowermanId) { UpdateFavoriteSpotClientRpc(playerId, flowermanId); } [ServerRpc(RequireOwnership = false)] public void DamagePlayerServerRpc(int playerId, int damage) { DamagePlayerClientRpc(playerId, damage); } [ServerRpc(RequireOwnership = false)] public void MufflePlayerVoiceServerRpc(int playerId) { MufflePlayerVoiceClientRpc(playerId); } [ServerRpc(RequireOwnership = false)] public void UnmufflePlayerVoiceServerRpc(int playerId) { UnmufflePlayerVoiceClientRpc(playerId); } [ClientRpc] public void MufflePlayerVoiceClientRpc(int playerId) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val.currentVoiceChatAudioSource == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatAudioSource != (Object)null) { ((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f; OccludeAudio component = ((Component)val.currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); component.overridingLowPass = true; component.lowPassOverride = 500f; val.voiceMuffledByEnemy = true; } } [ClientRpc] public void UnmufflePlayerVoiceClientRpc(int playerId) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val.currentVoiceChatAudioSource == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatAudioSource != (Object)null) { ((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f; OccludeAudio component = ((Component)val.currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); component.overridingLowPass = false; component.lowPassOverride = 20000f; val.voiceMuffledByEnemy = false; } } [ClientRpc] public void DamagePlayerClientRpc(int playerId, int damage) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; val.DamagePlayer(damage, true, true, (CauseOfDeath)5, 0, false, default(Vector3)); } [ClientRpc] public void ResetEntityStatesClientRpc(int playerId, ulong flowermanId) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; FlowermanAI val2 = SharedData.Instance.FlowermanIDs[flowermanId]; val.inSpecialInteractAnimation = false; val.inAnimationWithEnemy = null; val2.carryingPlayerBody = false; ((EnemyAI)val2).creatureAnimator.SetBool("killing", false); ((EnemyAI)val2).creatureAnimator.SetBool("carryingBody", false); ((EnemyAI)val2).stunnedByPlayer = null; ((EnemyAI)val2).stunNormalizedTimer = 0f; val2.angerMeter = 0f; val2.isInAngerMode = false; val2.timesThreatened = 0; val2.evadeStealthTimer = 0.1f; ((EnemyAI)val2).inSpecialAnimationWithPlayer = null; ((EnemyAI)val2).inSpecialAnimation = false; ((EnemyAI)val2).isClientCalculatingAI = true; ((Behaviour)((EnemyAI)val2).agent).enabled = true; ((EnemyAI)val2).favoriteSpot = null; val2.FinishKillAnimation(false); } [ClientRpc] public void PrepForBindingClientRpc(int playerId, ulong flowermanId) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; FlowermanAI val2 = SharedData.Instance.FlowermanIDs[flowermanId]; ((EnemyAI)val2).creatureAnimator.SetBool("killing", false); ((EnemyAI)val2).creatureAnimator.SetBool("carryingBody", true); val2.carryingPlayerBody = true; val.inSpecialInteractAnimation = true; val2.inKillAnimation = false; ((EnemyAI)val2).targetPlayer = null; } [ClientRpc] public void UpdateFavoriteSpotClientRpc(int playerId, ulong flowermanId) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; FlowermanAI val2 = SharedData.Instance.FlowermanIDs[flowermanId]; Transform favoriteSpot = ((EnemyAI)val2).ChooseFarthestNodeFromPosition(((Component)val).transform.position, false, 0, false); ((EnemyAI)val2).favoriteSpot = favoriteSpot; } [ClientRpc] public void AddBindingsClientRpc(int playerId, ulong flowermanId) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; FlowermanAI key = SharedData.Instance.FlowermanIDs[flowermanId]; SharedData.Instance.BindedDrags[key] = val; SharedData.Instance.PlayerIDs[val] = playerId; SharedData.Instance.IDsToPlayerController[playerId] = val; SharedData.Instance.LastGrabbedTimeStamp[key] = Time.time; } [ClientRpc] public void RemoveBindingsClientRpc(int playerId, ulong flowermanID) { PlayerControllerB key = StartOfRound.Instance.allPlayerScripts[playerId]; FlowermanAI key2 = SharedData.Instance.FlowermanIDs[flowermanID]; SharedData.Instance.BindedDrags.Remove(key2); SharedData.Instance.LastGrabbedTimeStamp[key2] = Time.time; SharedData.Instance.DroppedTimestamp[key] = Time.time; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); } } } namespace SnatchingBracken.Patches.dungeon { [HarmonyPatch(typeof(DungeonGenerator))] internal class DungeonGenPatch { private const string modGUID = "Ovchinikov.SnatchinBracken.Dungeon"; private static ManualLogSource logger; static DungeonGenPatch() { logger = Logger.CreateLogSource("Ovchinikov.SnatchinBracken.Dungeon"); } [HarmonyPatch("ChangeStatus")] [HarmonyPostfix] public static void OnChangeStatus(DungeonGenerator __instance) { if ((Object)(object)__instance.CurrentDungeon == (Object)null) { logger.LogInfo((object)"CurrentDungeon is null"); } else if (__instance.CurrentDungeon.AllTiles == null) { logger.LogInfo((object)"AllTiles is null"); } Tile val = FindTileWithName(__instance.CurrentDungeon, "SmallRoom2"); if ((Object)(object)val != (Object)null) { SharedData.Instance.BrackenRoomPosition = ((Component)val).transform; logger.LogInfo((object)("We found the Bracken room tile at: " + ((Object)val).name)); } } public static Tile FindTileWithName(Dungeon dungeon, string nameContains) { if ((Object)(object)dungeon == (Object)null) { logger.LogError((object)"Dungeon is null"); return null; } foreach (Tile allTile in dungeon.AllTiles) { if (((Object)allTile).name.Contains(nameContains)) { return allTile; } } return null; } } }
plugins/VMechLight.dll
Decompiled 9 months agousing System; 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 GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using VMechLight.MonoBehaviors; [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("VMechLight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A manually power flashlight")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VMechLight")] [assembly: AssemblyTitle("VMechLight")] [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 VMechLight { [BepInPlugin("versus.dynamolight", "Dynamo Flashlight", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string GUID = "versus.dynamolight"; private const string NAME = "Dynamo Flashlight"; private const string VERSION = "1.0.0"; public static Plugin instance; public static AudioClip pull1; public static AudioClip pull2; private void Awake() { instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dynamolight"); AssetBundle val = AssetBundle.LoadFromFile(text); pull1 = val.LoadAsset<AudioClip>("Assets/DynamoLight/DynamoLight/pull1.mp3"); pull2 = val.LoadAsset<AudioClip>("Assets/DynamoLight/DynamoLight/pull2.mp3"); Item val2 = val.LoadAsset<Item>("Assets/DynamoLight/DynamoLight/DynamoLight.asset"); DynamoLight dynamoLight = val2.spawnPrefab.AddComponent<DynamoLight>(); ((GrabbableObject)dynamoLight).grabbable = true; ((GrabbableObject)dynamoLight).grabbableToEnemies = true; ((GrabbableObject)dynamoLight).itemProperties = val2; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 5, (LevelTypes)(-1)); TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>(); Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 25); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Dynamo Flashlight"); } } } namespace VMechLight.MonoBehaviors { internal class DynamoLight : GrabbableObject { public GameObject lightlow; public GameObject lightmid; public GameObject lighthigh; public float battery = 0f; public AudioSource source; public override void Start() { ((GrabbableObject)this).Start(); source = ((Component)this).GetComponent<AudioSource>(); lightlow = ((Component)((Component)this).transform.GetChild(1)).gameObject; lightmid = ((Component)((Component)this).transform.GetChild(2)).gameObject; lighthigh = ((Component)((Component)this).transform.GetChild(3)).gameObject; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy.sprintMeter >= 0.1f) { battery += 10f; PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.sprintMeter -= 0.1f; pullserver(); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 3f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } public override void Update() { ((GrabbableObject)this).Update(); flashlightserver(); } [ServerRpc] public void pullserver() { pullclient(); } [ClientRpc] public void pullclient() { if (battery <= 10f) { source.PlayOneShot(Plugin.pull1, 1f); } else if (battery > 10f) { source.PlayOneShot(Plugin.pull2, 1f); } } [ServerRpc] public void flashlightserver() { flashlightclient(); } [ClientRpc] public void flashlightclient() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (battery > 0f) { if (battery <= 20f) { battery -= 0.015f; } else if (battery > 20f) { battery -= 0.0075f; } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 1f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } if (battery > 0f && battery < 10f) { lightlow.SetActive(true); lightmid.SetActive(false); lighthigh.SetActive(false); base.useCooldown = 0.75f; } else if (battery > 10f && battery < 20f) { lightlow.SetActive(false); lightmid.SetActive(true); lighthigh.SetActive(false); base.useCooldown = 2f; } else if (battery > 20f && battery <= 30f) { lightlow.SetActive(false); lightmid.SetActive(false); lighthigh.SetActive(true); base.useCooldown = 15f; } else if (battery <= 0f) { lightlow.SetActive(false); lightmid.SetActive(false); lighthigh.SetActive(false); base.useCooldown = 0f; } if (battery > 30f) { battery = 30f; } } } }