Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EssentialMods v1.0.0
BepInEx/plugins/AlwaysHearWalkie.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCAlwaysHearWalkieMod.Patches; 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("AlwaysHearWalkie")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.4.3.0")] [assembly: AssemblyInformationalVersion("1.4.3+b44d9dd67954bb9cf96dd2ba0e84393e7774a6a0")] [assembly: AssemblyProduct("Always Hear Active Walkies")] [assembly: AssemblyTitle("AlwaysHearWalkie")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.3.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 BepInEx5.PluginTemplate { [BepInPlugin("suskitech.LCAlwaysHearActiveWalkie", "LC Always Hear Active Walkies", "1.4.3")] public class LCAlwaysHearWalkieMod : BaseUnityPlugin { public static ManualLogSource Log; private const string modGUID = "suskitech.LCAlwaysHearActiveWalkie"; private const string modName = "LC Always Hear Active Walkies"; private const string modVersion = "1.4.3"; private readonly Harmony harmony = new Harmony("suskitech.LCAlwaysHearActiveWalkie"); private static LCAlwaysHearWalkieMod Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = Logger.CreateLogSource("suskitech.LCAlwaysHearActiveWalkie"); Log.LogInfo((object)"\\ /"); Log.LogInfo((object)"/|\\"); Log.LogInfo((object)" |----|"); Log.LogInfo((object)" |[__]| Always Hear Active Walkies"); Log.LogInfo((object)" |. .| Version 1.4.3 Loaded"); Log.LogInfo((object)" |____|"); harmony.PatchAll(typeof(LCAlwaysHearWalkieMod)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(WalkieTalkiePatch)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "AlwaysHearWalkie"; public const string PLUGIN_NAME = "Always Hear Active Walkies"; public const string PLUGIN_VERSION = "1.4.3"; } } namespace LCAlwaysHearWalkieMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static float AudibleDistance = 20f; private static float throttleInterval = 0.35f; private static float throttle = 0f; private static float AverageDistanceToHeldWalkie = 2f; private static float WalkieRecordingRange = 20f; private static float PlayerToPlayerSpatialHearingRange = 20f; [HarmonyPatch("Update")] [HarmonyPostfix] private static void alwaysHearWalkieTalkiesPatch(ref bool ___holdingWalkieTalkie, ref PlayerControllerB __instance) { //IL_00d5: 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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0303: 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_0359: Unknown result type (might be due to invalid IL or missing references) throttle += Time.deltaTime; if (throttle < throttleInterval) { return; } throttle = 0f; if ((Object)(object)__instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead) { List<WalkieTalkie> list = new List<WalkieTalkie>(); List<WalkieTalkie> list2 = new List<WalkieTalkie>(); for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++) { float num = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, ((Component)__instance).transform.position); if (num <= AudibleDistance) { if (((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed) { list.Add(WalkieTalkie.allWalkieTalkies[i]); } } else { list2.Add(WalkieTalkie.allWalkieTalkies[i]); } } bool flag = list.Count > 0; if (flag != __instance.holdingWalkieTalkie) { ___holdingWalkieTalkie = flag; for (int j = 0; j < list2.Count; j++) { if (j < list.Count) { list2[j].thisAudio.Stop(); } } } if (!flag) { return; } } PlayerControllerB val = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead || !((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)) ? GameNetworkManager.Instance.localPlayerController : GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript); for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[k]; if ((!val2.isPlayerControlled && !val2.isPlayerDead) || (Object)(object)val2 == (Object)(object)GameNetworkManager.Instance.localPlayerController || val2.isPlayerDead || !val2.holdingWalkieTalkie) { continue; } float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position); float num3 = float.MaxValue; float num4 = float.MaxValue; for (int l = 0; l < WalkieTalkie.allWalkieTalkies.Count; l++) { if (!((GrabbableObject)WalkieTalkie.allWalkieTalkies[l]).isBeingUsed) { continue; } float num5 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l].target).transform.position, ((Component)val).transform.position); if (num5 < num4) { num4 = num5; } if (!WalkieTalkie.allWalkieTalkies[l].speakingIntoWalkieTalkie) { float num6 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l]).transform.position, ((Component)val2).transform.position); if (num6 < num3) { num3 = num6; } } } float num7 = Mathf.Min(1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num3), 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num4)); float num8 = 1f - Mathf.InverseLerp(0f, PlayerToPlayerSpatialHearingRange, num2); val2.voicePlayerState.Volume = Mathf.Max(num7, num8); if (val2.speakingToWalkieTalkie && num7 > num8) { makePlayerSoundWalkieTalkie(val2); } else { makePlayerSoundSpatial(val2); } } } private static void makePlayerSoundWalkieTalkie(PlayerControllerB playerController) { AudioSource currentVoiceChatAudioSource = playerController.currentVoiceChatAudioSource; AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>(); AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>(); OccludeAudio component3 = ((Component)currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); ((Behaviour)component2).enabled = true; ((Behaviour)component).enabled = true; component3.overridingLowPass = true; currentVoiceChatAudioSource.spatialBlend = 0f; playerController.currentVoiceChatIngameSettings.set2D = true; currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId]; currentVoiceChatAudioSource.bypassListenerEffects = false; currentVoiceChatAudioSource.bypassEffects = false; currentVoiceChatAudioSource.panStereo = (GameNetworkManager.Instance.localPlayerController.isPlayerDead ? 0f : 0.4f); component3.lowPassOverride = 4000f; component.lowpassResonanceQ = 3f; } private static void makePlayerSoundSpatial(PlayerControllerB playerController) { AudioSource currentVoiceChatAudioSource = playerController.currentVoiceChatAudioSource; AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>(); AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>(); OccludeAudio component3 = ((Component)currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); ((Behaviour)component2).enabled = false; ((Behaviour)component).enabled = true; component3.overridingLowPass = playerController.voiceMuffledByEnemy; currentVoiceChatAudioSource.spatialBlend = 1f; playerController.currentVoiceChatIngameSettings.set2D = false; currentVoiceChatAudioSource.bypassListenerEffects = false; currentVoiceChatAudioSource.bypassEffects = false; currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId]; component.lowpassResonanceQ = 1f; } } [HarmonyPatch(typeof(WalkieTalkie))] internal class WalkieTalkiePatch { [HarmonyPatch("EnableWalkieTalkieListening")] [HarmonyPrefix] private static bool alwaysHearWalkieTalkiesEnableWalkieTalkieListeningPatch(bool enable) { if (!enable) { return false; } return true; } } }
BepInEx/plugins/backrooms/Backrooms.dll
Decompiled 2 years 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"; } }
BepInEx/plugins/BetterEmotes.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("BetterEmotes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Alters the integration method of more emotes")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+e3ff4517c206bdccd05b90c2357af88493880c4c")] [assembly: AssemblyProduct("BetterEmotes")] [assembly: AssemblyTitle("BetterEmotes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterEmote { public class CustomAudioAnimationEvent : MonoBehaviour { private Animator animator; private AudioSource SoundsSource; public static AudioClip[] claps = (AudioClip[])(object)new AudioClip[2]; public PlayerControllerB player; private void Start() { animator = ((Component)this).GetComponent<Animator>(); SoundsSource = player.movementAudio; } public void PlayClapSound() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (player.performingEmote && (!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || animator.GetInteger("emoteNumber") == 4)) { bool flag = player.isInHangarShipRoom && player.playersManager.hangarDoorsClosed; RoundManager.Instance.PlayAudibleNoise(((Component)player).transform.position, 22f, 0.6f, 0, flag, 6); SoundsSource.pitch = Random.Range(0.59f, 0.79f); SoundsSource.PlayOneShot(claps[Random.Range(0, claps.Length)]); } } public void PlayFootstepSound() { if (player.performingEmote && (!((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || animator.GetInteger("emoteNumber") == 6)) { player.PlayFootstepLocal(); player.PlayFootstepServer(); } } } internal class EmotePatch { public enum Emotes { Dance = 1, Point, Middle_Finger, Clap, Shy, Griddy, Twerk, Salute } public static Keybinds keybinds; public static AssetBundle animationsBundle; public static AssetBundle animatorBundle; public static bool stopOnOuter = false; public static bool[] enabledList; public static string[] defaultKeyList; public static string emoteWheelKey = "<Keyboard>/v"; public static float griddySpeed = 0.5f; public static float emoteCooldown = 0.5f; private static CallbackContext context; public static RuntimeAnimatorController local; public static RuntimeAnimatorController others; private static int currentEmoteID; private static float movSpeed; public static bool incompatibleStuff; public static bool emoteWheelIsOpened; public static GameObject wheel; private static SelectionWheel selectionWheel; private static PlayerControllerB localPlayerController { get { StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance != (Object)null)) { return null; } return instance.localPlayerController; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void StartPostfix(PlayerControllerB __instance) { ((Component)((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel")).transform.Find("metarig")).gameObject.AddComponent<CustomAudioAnimationEvent>().player = __instance; movSpeed = __instance.movementSpeed; if (Object.FindObjectsOfType(typeof(SelectionWheel)).Length == 0) { GameObject obj = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesMenu.prefab"); GameObject gameObject = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject; if ((Object)(object)wheel != (Object)null) { Object.Destroy((Object)(object)wheel.gameObject); } wheel = Object.Instantiate<GameObject>(obj, gameObject.transform); selectionWheel = wheel.AddComponent<SelectionWheel>(); SelectionWheel.emoteNames = new string[Enum.GetNames(typeof(Emotes)).Length + 1]; string[] names = Enum.GetNames(typeof(Emotes)); foreach (string text in names) { SelectionWheel.emoteNames[(int)Enum.Parse(typeof(Emotes), text) - 1] = text; } } keybinds.MiddleFinger.performed += onEmoteKeyMiddleFinger; keybinds.Griddy.performed += onEmoteKeyGriddy; keybinds.Shy.performed += onEmoteKeyShy; keybinds.Clap.performed += onEmoteKeyClap; keybinds.Salute.performed += onEmoteKeySalute; keybinds.Twerk.performed += onEmoteKeyTwerk; keybinds.EmoteWheel.started += onEmoteKeyWheelStarted; keybinds.EmoteWheel.canceled += onEmoteKeyWheelCanceled; } [HarmonyPatch(typeof(PlayerControllerB), "OnDisable")] [HarmonyPostfix] public static void OnDisablePostfix(PlayerControllerB __instance) { if ((Object)(object)__instance == (Object)(object)localPlayerController) { keybinds.MiddleFinger.performed -= onEmoteKeyMiddleFinger; keybinds.Griddy.performed -= onEmoteKeyGriddy; keybinds.Shy.performed -= onEmoteKeyShy; keybinds.Clap.performed -= onEmoteKeyClap; keybinds.Salute.performed -= onEmoteKeySalute; keybinds.Twerk.performed -= onEmoteKeyTwerk; keybinds.EmoteWheel.started -= onEmoteKeyWheelStarted; keybinds.EmoteWheel.canceled -= onEmoteKeyWheelCanceled; keybinds.MiddleFinger.Disable(); keybinds.Griddy.Disable(); keybinds.Shy.Disable(); keybinds.Clap.Disable(); keybinds.Salute.Disable(); keybinds.Twerk.Disable(); keybinds.EmoteWheel.Disable(); } } public static void onEmoteKeyWheelStarted(CallbackContext context) { if (!emoteWheelIsOpened && !localPlayerController.isPlayerDead && !localPlayerController.inTerminalMenu && !localPlayerController.quickMenuManager.isMenuOpen) { emoteWheelIsOpened = true; Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; wheel.SetActive(emoteWheelIsOpened); localPlayerController.quickMenuManager.isMenuOpen = true; localPlayerController.disableLookInput = true; } } public static void onEmoteKeyWheelCanceled(CallbackContext context) { localPlayerController.quickMenuManager.isMenuOpen = false; localPlayerController.disableLookInput = false; if (selectionWheel.selectedEmoteID >= enabledList.Length) { if (selectionWheel.stopEmote) { localPlayerController.performingEmote = false; localPlayerController.StopPerformingEmoteServerRpc(); localPlayerController.timeSinceStartingEmote = 0f; } } else { CheckEmoteInput(enabledList[selectionWheel.selectedEmoteID], selectionWheel.selectedEmoteID, localPlayerController); } Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; emoteWheelIsOpened = false; wheel.SetActive(emoteWheelIsOpened); } public static void onEmoteKeyMiddleFinger(CallbackContext context) { onEmoteKeyPerformed(Emotes.Middle_Finger); } public static void onEmoteKeyGriddy(CallbackContext context) { onEmoteKeyPerformed(Emotes.Griddy); } public static void onEmoteKeyShy(CallbackContext context) { onEmoteKeyPerformed(Emotes.Shy); } public static void onEmoteKeyClap(CallbackContext context) { onEmoteKeyPerformed(Emotes.Clap); } public static void onEmoteKeySalute(CallbackContext context) { onEmoteKeyPerformed(Emotes.Salute); } public static void onEmoteKeyTwerk(CallbackContext context) { onEmoteKeyPerformed(Emotes.Twerk); } public static void onEmoteKeyPerformed(Emotes emote) { CheckEmoteInput(enabledList[(int)emote], (int)emote, localPlayerController); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePrefix(PlayerControllerB __instance) { if (!__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner) { __instance.playerBodyAnimator.runtimeAnimatorController = others; return; } if ((Object)(object)__instance.playerBodyAnimator != (Object)(object)local) { __instance.playerBodyAnimator.runtimeAnimatorController = local; } currentEmoteID = __instance.playerBodyAnimator.GetInteger("emoteNumber"); if (!incompatibleStuff) { __instance.movementSpeed = ((__instance.CheckConditionsForEmote() && currentEmoteID == 6 && __instance.performingEmote) ? (movSpeed * griddySpeed) : movSpeed); } } private static void CheckEmoteInput(bool enabled, int emoteID, PlayerControllerB player) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (enabled) { player.PerformEmote(context, emoteID); } } [HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")] [HarmonyPrefix] private static void PerformEmotePrefix(ref CallbackContext context, int emoteID, PlayerControllerB __instance) { currentEmoteID = emoteID; if (((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && __instance.CheckConditionsForEmote() && __instance.timeSinceStartingEmote >= emoteCooldown) { __instance.timeSinceStartingEmote = 0f; __instance.performingEmote = true; __instance.playerBodyAnimator.SetInteger("emoteNumber", emoteID); __instance.StartPerformingEmoteServerRpc(); } } [HarmonyPatch(typeof(PlayerControllerB), "CheckConditionsForEmote")] [HarmonyPrefix] private static bool prefixCheckConditions(ref bool __result, PlayerControllerB __instance) { if (currentEmoteID == 6) { __result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !__instance.isJumping && __instance.moveInputVector.x == 0f && !__instance.isSprinting && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu && !__instance.isTypingChat; return false; } return true; } } internal class InitGamePatch { [HarmonyPatch(typeof(InitializeGame), "Start")] [HarmonyPrefix] private static void StartPostfix() { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { BepInPlugin metadata = pluginInfo.Value.Metadata; if (metadata.GUID.Equals("com.malco.lethalcompany.moreshipupgrades") || metadata.GUID.Equals("Stoneman.LethalProgression")) { EmotePatch.incompatibleStuff = true; break; } } } } internal class Keybinds : LcInputActions { public InputAction MiddleFinger => base.Asset["Middle_Finger"]; public InputAction Clap => base.Asset["Clap"]; public InputAction Shy => base.Asset["Shy"]; public InputAction Griddy => base.Asset["Griddy"]; public InputAction Twerk => base.Asset["Twerk"]; public InputAction Salute => base.Asset["Salute"]; public InputAction EmoteWheel => base.Asset["EmoteWheel"]; public override void CreateInputActions(in InputActionMapBuilder builder) { ((LcInputActions)this).CreateInputActions(ref builder); string[] names = Enum.GetNames(typeof(EmotePatch.Emotes)); foreach (string text in names) { if ((int)Enum.Parse(typeof(EmotePatch.Emotes), text) > 2) { builder.NewActionBinding().WithActionId(text).WithActionType((InputActionType)1) .WithKbmPath(EmotePatch.defaultKeyList[(int)Enum.Parse(typeof(EmotePatch.Emotes), text)]) .WithBindingName(text) .Finish(); } } builder.NewActionBinding().WithActionId("EmoteWheel").WithActionType((InputActionType)1) .WithKbmPath(EmotePatch.emoteWheelKey) .WithBindingName("Emote Wheel") .Finish(); } } [BepInPlugin("BetterEmotes", "BetterEmotes", "1.1.1")] public class Plugin : BaseUnityPlugin { public static ManualLogSource StaticLogger; private Harmony _harmony; private void Awake() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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 StaticLogger = ((BaseUnityPlugin)this).Logger; StaticLogger.LogInfo((object)"BetterEmotes loading..."); EmotePatch.animationsBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BetterEmotes/animationsbundle")); EmotePatch.animatorBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "BetterEmotes/animatorbundle")); EmotePatch.local = (RuntimeAnimatorController)new AnimatorOverrideController(EmotePatch.animatorBundle.LoadAsset<RuntimeAnimatorController>("Assets/MoreEmotes/NEWmetarig.controller")); EmotePatch.others = EmotePatch.animatorBundle.LoadAsset<RuntimeAnimatorController>("Assets/MoreEmotes/NEWmetarigOtherPlayers.controller"); CustomAudioAnimationEvent.claps[0] = EmotePatch.animationsBundle.LoadAsset<AudioClip>("Assets/MoreEmotes/SingleClapEmote1.wav"); CustomAudioAnimationEvent.claps[1] = EmotePatch.animationsBundle.LoadAsset<AudioClip>("Assets/MoreEmotes/SingleClapEmote2.wav"); ConfigFile(); EmotePatch.keybinds = new Keybinds(); _harmony = new Harmony("BetterEmotes"); _harmony.PatchAll(typeof(InitGamePatch)); _harmony.PatchAll(typeof(EmotePatch)); StaticLogger.LogInfo((object)"BetterEmotes loaded"); } private void ConfigFile() { EmotePatch.enabledList = new bool[Enum.GetNames(typeof(EmotePatch.Emotes)).Length + 1]; EmotePatch.defaultKeyList = new string[Enum.GetNames(typeof(EmotePatch.Emotes)).Length + 1]; string[] names = Enum.GetNames(typeof(EmotePatch.Emotes)); foreach (string text in names) { if ((int)Enum.Parse(typeof(EmotePatch.Emotes), text) > 2) { ConfigEntry<string> val = ((BaseUnityPlugin)this).Config.Bind<string>("Emote Keys", text + " Key", $"<Keyboard>/{(int)Enum.Parse(typeof(EmotePatch.Emotes), text)}", "Default keybind for " + text + " emote"); EmotePatch.defaultKeyList[(int)Enum.Parse(typeof(EmotePatch.Emotes), text)] = val.Value; } ConfigEntry<bool> val2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled Emotes", "Enable " + text, true, "Toggle " + text + " emote key"); EmotePatch.enabledList[(int)Enum.Parse(typeof(EmotePatch.Emotes), text)] = val2.Value; } EmotePatch.emoteWheelKey = ((BaseUnityPlugin)this).Config.Bind<string>("Emote Keys", "Emote Wheel Key", "<Keyboard>/v", "Default keybind for the emote wheel").Value; EmotePatch.griddySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Emote Settings", "Griddy Speed", 0.5f, "Speed of griddy relative to regular speed").Value; EmotePatch.emoteCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Emote Settings", "Cooldown", 0.5f, "Time (in seconds) to wait before being able to switch emotes").Value; EmotePatch.stopOnOuter = ((BaseUnityPlugin)this).Config.Bind<bool>("Emote Settings", "Stop on outer", false, "Whether or not to stop emoting when mousing to outside the emote wheel").Value; } } internal class SelectionWheel : MonoBehaviour { public RectTransform selectionBlock; public bool stopEmote; public Text emoteInformation; public Text pageInformation; private int blocksNumber = 8; private int currentBlock = 1; public int pageNumber; public int selectedEmoteID; private float angle; private float pageCooldown = 0.1f; public GameObject[] Pages; public string selectedEmoteName; public float wheelMovementOffset = 3.3f; public static string[] emoteNames; public static string[] emoteKeybinds; private Vector2 center; private void OnEnable() { //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_025a: Unknown result type (might be due to invalid IL or missing references) center = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)); PlayerInput component = GameObject.Find("PlayerSettingsObject").GetComponent<PlayerInput>(); emoteKeybinds = new string[Enum.GetNames(typeof(EmotePatch.Emotes)).Length + 1]; emoteKeybinds[0] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote1", false), 0, (DisplayStringOptions)0); emoteKeybinds[1] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote2", false), 0, (DisplayStringOptions)0); emoteKeybinds[2] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.MiddleFinger, (DisplayStringOptions)0, (string)null); emoteKeybinds[3] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.Clap, (DisplayStringOptions)0, (string)null); emoteKeybinds[4] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.Shy, (DisplayStringOptions)0, (string)null); emoteKeybinds[5] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.Griddy, (DisplayStringOptions)0, (string)null); emoteKeybinds[7] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.Salute, (DisplayStringOptions)0, (string)null); emoteKeybinds[6] = InputActionRebindingExtensions.GetBindingDisplayString(EmotePatch.keybinds.Twerk, (DisplayStringOptions)0, (string)null); Cursor.visible = true; selectionBlock = ((Component)((Component)this).gameObject.transform.Find("SelectedEmote")).gameObject.GetComponent<RectTransform>(); ((Component)selectionBlock).gameObject.SetActive(false); GameObject gameObject = ((Component)((Component)this).gameObject.transform.Find("FunctionalContent")).gameObject; emoteInformation = ((Component)((Component)((Component)this).gameObject.transform.Find("Graphics")).gameObject.transform.Find("EmoteInfo")).GetComponent<Text>(); Pages = (GameObject[])(object)new GameObject[gameObject.transform.childCount]; pageInformation = ((Component)((Component)((Component)this).gameObject.transform.Find("Graphics")).gameObject.transform.Find("PageNumber")).GetComponent<Text>(); pageInformation.text = "Page " + Pages.Length + "/" + (pageNumber + 1); for (int i = 0; i < gameObject.transform.childCount; i++) { Pages[i] = ((Component)gameObject.transform.GetChild(i)).gameObject; } Mouse.current.WarpCursorPosition(center); } private void Update() { wheelSelection(); pageSelection(); if (((Component)selectionBlock).gameObject.activeSelf) { selectedEmoteID = currentBlock + Mathf.RoundToInt((float)(blocksNumber / 4)) + blocksNumber * pageNumber; } else { selectedEmoteID = emoteNames.Length + 2; } displayEmoteInfo(); } private void wheelSelection() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) if (!(Vector2.Distance(center, ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()) >= wheelMovementOffset)) { return; } Math.Abs(((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() - center.x); Math.Abs(((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() - center.y); float num = 235f; float num2 = 470f; bool num3 = Math.Pow(((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() - center.x, 2.0) + Math.Pow(((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() - center.y, 2.0) < Math.Pow(num, 2.0); bool flag = Math.Pow(((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() - center.x, 2.0) + Math.Pow(((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() - center.y, 2.0) >= Math.Pow(num2, 2.0); bool num4 = ((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() > center.x; bool flag2 = ((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() > center.y; int num5 = ((!num4) ? (flag2 ? 2 : 3) : (flag2 ? 1 : 4)); float num6 = (((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() - center.y) / (((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() - center.x); float num7 = 180 * (num5 - ((num5 <= 2) ? 1 : 2)); angle = Mathf.Atan(num6) * (180f / MathF.PI) + num7; if (angle == 90f) { angle = 270f; } else if (angle == 270f) { angle = 90f; } float num8 = 360 / blocksNumber; currentBlock = Mathf.RoundToInt((angle - num8 * 1.5f) / num8); if (num3) { ((Component)selectionBlock).gameObject.SetActive(false); return; } ((Component)selectionBlock).gameObject.SetActive(true); ((Transform)selectionBlock).localRotation = Quaternion.Euler(((Component)this).transform.rotation.z, ((Component)this).transform.rotation.y, num8 * (float)currentBlock); if (flag) { if (EmotePatch.stopOnOuter) { ((Component)selectionBlock).gameObject.SetActive(false); stopEmote = true; } else { stopEmote = false; } } } private void pageSelection() { pageInformation.text = "Page " + Pages.Length + "/" + (pageNumber + 1); if (pageCooldown > 0f) { pageCooldown -= Time.deltaTime; } else if (((InputControl<float>)(object)((Vector2Control)Mouse.current.scroll).y).ReadValue() != 0f) { GameObject[] pages = Pages; for (int i = 0; i < pages.Length; i++) { pages[i].SetActive(false); } int num = ((((InputControl<float>)(object)((Vector2Control)Mouse.current.scroll).y).ReadValue() > 0f) ? 1 : (-1)); if (pageNumber + 1 > Pages.Length - 1 && num > 0) { pageNumber = 0; } else if (pageNumber - 1 < 0 && num < 0) { pageNumber = Pages.Length - 1; } else { pageNumber += num; } Pages[pageNumber].SetActive(true); pageCooldown = 0.1f; } } private void displayEmoteInfo() { string text = ((selectedEmoteID > emoteKeybinds.Length) ? "" : emoteKeybinds[selectedEmoteID - 1]); string text2; if (selectedEmoteID <= Enum.GetValues(typeof(EmotePatch.Emotes)).Length) { EmotePatch.Emotes emotes = (EmotePatch.Emotes)selectedEmoteID; text2 = emotes.ToString().Replace("_", " "); } else { text2 = "EMPTY"; } emoteInformation.text = text2 + "\n[" + text.ToUpper() + "]"; } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterEmotes"; public const string PLUGIN_NAME = "BetterEmotes"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/CoilHeadStare.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TDP.CoilHeadStare.Patch; 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("CoilHeadStare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadStare")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")] [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 TDP.CoilHeadStare { [BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.0.3")] public class ModBase : BaseUnityPlugin { private const string modGUID = "TDP.CoilHeadStare"; private const string modName = "CoilHeadStare"; private const string modVersion = "1.0.3"; private Harmony harmony; internal static ModBase instance; internal ManualLogSource mls; public static ConfigEntry<float> config_timeUntilStare; public static ConfigEntry<float> config_maxStareDistance; public static ConfigEntry<float> config_turnHeadSpeed; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } else { Object.Destroy((Object)(object)this); } ConfigFile(); harmony = new Harmony("TDP.CoilHeadStare"); harmony.PatchAll(typeof(CoilHeadPatch)); mls = Logger.CreateLogSource("TDP.CoilHeadStare"); mls.LogInfo((object)"CoilHeadStare 1.0.3 loaded."); } private void ConfigFile() { config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)"); config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)"); config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player"); Stare.timeUntilStare = config_timeUntilStare.Value; Stare.maxStareDistance = config_maxStareDistance.Value; Stare.turnHeadSpeed = config_turnHeadSpeed.Value; } private void ConfigureDoorControls() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0041: 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 val = GameObject.Find("HangarDoorButtonPanel"); GameObject val2 = new GameObject("PlacementCollider"); val2.transform.SetParent(val.transform, false); BoxCollider val3 = val2.AddComponent<BoxCollider>(); val3.size = new Vector3(0.881444f, 0.147624f, 0.7243316f); val3.center = new Vector3(0.2525222f, 0.06033165f, -0.06168448f); PlaceableShipObject val4 = val2.AddComponent<PlaceableShipObject>(); val4.unlockableID = 1212; val4.parentObject = val.AddComponent<AutoParentToShip>(); val4.mainMesh = val.GetComponent<MeshFilter>(); val4.mainTransform = val.transform; val4.placeObjectCollider = (Collider)(object)val3; val4.yOffset = 0f; val4.AllowPlacementOnWalls = true; val2.AddComponent<AudioSource>(); } } } namespace TDP.CoilHeadStare.Patch { internal class CoilHeadPatch { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] private static void StartPostFix(EnemyAI __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (__instance is SpringManAI) { Debug.Log((object)"CoilHead found. Adding stare script."); Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>(); stare.Initialize((SpringManAI)__instance); } } } public class Stare : MonoBehaviour { private SpringManAI coilHeadInstance; public static float timeUntilStare; public static float maxStareDistance; public static float turnHeadSpeed; private Transform head; private float timeSinceMoving; private bool isTurningHead; private PlayerControllerB stareTarget; public void Initialize(SpringManAI instance) { Debug.Log((object)"Initializing Stare on Coilhead."); coilHeadInstance = instance; head = ((Component)coilHeadInstance).transform.GetChild(0).GetChild(2).GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(2) .GetChild(0) .GetChild(0) .GetChild(1); if (((Object)head).name != "springBone.002_end") { Debug.LogError((object)"CoilHeadStare could not find head transform. Destroying script."); Object.Destroy((Object)(object)this); } } private void Update() { //IL_0088: 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_0098: 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_00a4: 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_00f6: 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_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_0181: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coilHeadInstance == (Object)null) { return; } if ((Object)(object)head == (Object)null) { Debug.LogError((object)"CoilHeadStare head transform missing. Destroying script."); Object.Destroy((Object)(object)this); return; } if (!isTurningHead) { stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false); } if (!((Object)(object)stareTarget == (Object)null)) { Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position; float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position); if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f) { timeSinceMoving = 0f; } else { timeSinceMoving += Time.deltaTime; } if (timeSinceMoving > timeUntilStare) { isTurningHead = true; } else { isTurningHead = false; } if (isTurningHead) { head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f); } } } } }
BepInEx/plugins/Coroner.dll
Decompiled 2 years agousing System; 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.Xml.Linq; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Coroner.LCAPI; using GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using Microsoft.CodeAnalysis; using TMPro; 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("EliteMasterEric")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Rework the Performance Report with new info, including cause of death.")] [assembly: AssemblyFileVersion("1.5.3.0")] [assembly: AssemblyInformationalVersion("1.5.3+3f9dc5379bdbfe1ac1cf1b0df31bb040630db71f")] [assembly: AssemblyProduct("Coroner")] [assembly: AssemblyTitle("Coroner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.3.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 Coroner { public class AdvancedDeathTracker { public const int PLAYER_CAUSE_OF_DEATH_DROPSHIP = 300; private static readonly Dictionary<int, AdvancedCauseOfDeath> PlayerCauseOfDeath = new Dictionary<int, AdvancedCauseOfDeath>(); public static void ClearDeathTracker() { PlayerCauseOfDeath.Clear(); } public static void SetCauseOfDeath(int playerIndex, AdvancedCauseOfDeath causeOfDeath, bool broadcast = true) { PlayerCauseOfDeath[playerIndex] = causeOfDeath; if (broadcast) { DeathBroadcaster.BroadcastCauseOfDeath(playerIndex, causeOfDeath); } } public static void SetCauseOfDeath(int playerIndex, CauseOfDeath causeOfDeath, bool broadcast = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetCauseOfDeath(playerIndex, ConvertCauseOfDeath(causeOfDeath), broadcast); } public static void SetCauseOfDeath(PlayerControllerB playerController, CauseOfDeath causeOfDeath, bool broadcast = true) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SetCauseOfDeath((int)playerController.playerClientId, ConvertCauseOfDeath(causeOfDeath), broadcast); } public static void SetCauseOfDeath(PlayerControllerB playerController, AdvancedCauseOfDeath causeOfDeath, bool broadcast = true) { SetCauseOfDeath((int)playerController.playerClientId, causeOfDeath, broadcast); } public static AdvancedCauseOfDeath GetCauseOfDeath(int playerIndex) { PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerIndex]; return GetCauseOfDeath(playerController); } public static AdvancedCauseOfDeath GetCauseOfDeath(PlayerControllerB playerController) { if (!PlayerCauseOfDeath.ContainsKey((int)playerController.playerClientId)) { Plugin.Instance.PluginLogger.LogDebug($"Player {playerController.playerClientId} has no custom cause of death stored! Using fallback..."); return GuessCauseOfDeath(playerController); } Plugin.Instance.PluginLogger.LogDebug($"Player {playerController.playerClientId} has custom cause of death stored! {PlayerCauseOfDeath[(int)playerController.playerClientId]}"); return PlayerCauseOfDeath[(int)playerController.playerClientId]; } public static AdvancedCauseOfDeath GuessCauseOfDeath(PlayerControllerB playerController) { //IL_0041: 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: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (playerController.isPlayerDead) { if (IsHoldingJetpack(playerController)) { if ((int)playerController.causeOfDeath == 2) { return AdvancedCauseOfDeath.Player_Jetpack_Gravity; } if ((int)playerController.causeOfDeath == 3) { return AdvancedCauseOfDeath.Player_Jetpack_Blast; } } return ConvertCauseOfDeath(playerController.causeOfDeath); } return AdvancedCauseOfDeath.Unknown; } public static bool IsHoldingJetpack(PlayerControllerB playerController) { GrabbableObject currentlyHeldObjectServer = playerController.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer == (Object)null) { return false; } GameObject gameObject = ((Component)currentlyHeldObjectServer).gameObject; if ((Object)(object)gameObject == (Object)null) { return false; } GrabbableObject component = gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null) { return false; } if (component is JetpackItem) { return true; } return false; } public static AdvancedCauseOfDeath ConvertCauseOfDeath(CauseOfDeath causeOfDeath) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //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) //IL_003b: Expected I4, but got Unknown return (int)causeOfDeath switch { 0 => AdvancedCauseOfDeath.Unknown, 1 => AdvancedCauseOfDeath.Bludgeoning, 2 => AdvancedCauseOfDeath.Gravity, 3 => AdvancedCauseOfDeath.Blast, 4 => AdvancedCauseOfDeath.Strangulation, 5 => AdvancedCauseOfDeath.Suffocation, 6 => AdvancedCauseOfDeath.Mauling, 7 => AdvancedCauseOfDeath.Gunshots, 8 => AdvancedCauseOfDeath.Crushing, 9 => AdvancedCauseOfDeath.Drowning, 10 => AdvancedCauseOfDeath.Abandoned, 11 => AdvancedCauseOfDeath.Electrocution, _ => AdvancedCauseOfDeath.Unknown, }; } public static string StringifyCauseOfDeath(CauseOfDeath causeOfDeath) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return StringifyCauseOfDeath(ConvertCauseOfDeath(causeOfDeath), Plugin.RANDOM); } public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath) { return StringifyCauseOfDeath(causeOfDeath, Plugin.RANDOM); } public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath, Random random) { string[] array = SelectCauseOfDeath(causeOfDeath); if (array.Length > 1 && (!causeOfDeath.HasValue || !Plugin.Instance.PluginConfig.ShouldUseSeriousDeathMessages())) { return array[random.Next(array.Length)]; } return array[0]; } public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath) { if (!causeOfDeath.HasValue) { return LanguageHandler.GetValuesByTag("FunnyNote"); } return causeOfDeath switch { AdvancedCauseOfDeath.Bludgeoning => LanguageHandler.GetValuesByTag("DeathBludgeoning"), AdvancedCauseOfDeath.Gravity => LanguageHandler.GetValuesByTag("DeathGravity"), AdvancedCauseOfDeath.Blast => LanguageHandler.GetValuesByTag("DeathBlast"), AdvancedCauseOfDeath.Strangulation => LanguageHandler.GetValuesByTag("DeathStrangulation"), AdvancedCauseOfDeath.Suffocation => LanguageHandler.GetValuesByTag("DeathSuffocation"), AdvancedCauseOfDeath.Mauling => LanguageHandler.GetValuesByTag("DeathMauling"), AdvancedCauseOfDeath.Gunshots => LanguageHandler.GetValuesByTag("DeathGunshots"), AdvancedCauseOfDeath.Crushing => LanguageHandler.GetValuesByTag("DeathCrushing"), AdvancedCauseOfDeath.Drowning => LanguageHandler.GetValuesByTag("DeathDrowning"), AdvancedCauseOfDeath.Abandoned => LanguageHandler.GetValuesByTag("DeathAbandoned"), AdvancedCauseOfDeath.Electrocution => LanguageHandler.GetValuesByTag("DeathElectrocution"), AdvancedCauseOfDeath.Kicking => LanguageHandler.GetValuesByTag("DeathKicking"), AdvancedCauseOfDeath.Enemy_Bracken => LanguageHandler.GetValuesByTag("DeathEnemyBracken"), AdvancedCauseOfDeath.Enemy_EyelessDog => LanguageHandler.GetValuesByTag("DeathEnemyEyelessDog"), AdvancedCauseOfDeath.Enemy_ForestGiant => LanguageHandler.GetValuesByTag("DeathEnemyForestGiant"), AdvancedCauseOfDeath.Enemy_CircuitBees => LanguageHandler.GetValuesByTag("DeathEnemyCircuitBees"), AdvancedCauseOfDeath.Enemy_GhostGirl => LanguageHandler.GetValuesByTag("DeathEnemyGhostGirl"), AdvancedCauseOfDeath.Enemy_EarthLeviathan => LanguageHandler.GetValuesByTag("DeathEnemyEarthLeviathan"), AdvancedCauseOfDeath.Enemy_BaboonHawk => LanguageHandler.GetValuesByTag("DeathEnemyBaboonHawk"), AdvancedCauseOfDeath.Enemy_Jester => LanguageHandler.GetValuesByTag("DeathEnemyJester"), AdvancedCauseOfDeath.Enemy_CoilHead => LanguageHandler.GetValuesByTag("DeathEnemyCoilHead"), AdvancedCauseOfDeath.Enemy_SnareFlea => LanguageHandler.GetValuesByTag("DeathEnemySnareFlea"), AdvancedCauseOfDeath.Enemy_Hygrodere => LanguageHandler.GetValuesByTag("DeathEnemyHygrodere"), AdvancedCauseOfDeath.Enemy_HoarderBug => LanguageHandler.GetValuesByTag("DeathEnemyHoarderBug"), AdvancedCauseOfDeath.Enemy_SporeLizard => LanguageHandler.GetValuesByTag("DeathEnemySporeLizard"), AdvancedCauseOfDeath.Enemy_BunkerSpider => LanguageHandler.GetValuesByTag("DeathEnemyBunkerSpider"), AdvancedCauseOfDeath.Enemy_Thumper => LanguageHandler.GetValuesByTag("DeathEnemyThumper"), AdvancedCauseOfDeath.Enemy_MaskedPlayer_Wear => LanguageHandler.GetValuesByTag("DeathEnemyMaskedPlayerWear"), AdvancedCauseOfDeath.Enemy_MaskedPlayer_Victim => LanguageHandler.GetValuesByTag("DeathEnemyMaskedPlayerVictim"), AdvancedCauseOfDeath.Enemy_Nutcracker_Kicked => LanguageHandler.GetValuesByTag("DeathEnemyNutcrackerKicked"), AdvancedCauseOfDeath.Enemy_Nutcracker_Shot => LanguageHandler.GetValuesByTag("DeathEnemyNutcrackerShot"), AdvancedCauseOfDeath.Player_Jetpack_Gravity => LanguageHandler.GetValuesByTag("DeathPlayerJetpackGravity"), AdvancedCauseOfDeath.Player_Jetpack_Blast => LanguageHandler.GetValuesByTag("DeathPlayerJetpackBlast"), AdvancedCauseOfDeath.Player_Murder_Melee => LanguageHandler.GetValuesByTag("DeathPlayerMurderMelee"), AdvancedCauseOfDeath.Player_Murder_Shotgun => LanguageHandler.GetValuesByTag("DeathPlayerMurderShotgun"), AdvancedCauseOfDeath.Player_Quicksand => LanguageHandler.GetValuesByTag("DeathPlayerQuicksand"), AdvancedCauseOfDeath.Player_StunGrenade => LanguageHandler.GetValuesByTag("DeathPlayerStunGrenade"), AdvancedCauseOfDeath.Other_DepositItemsDesk => LanguageHandler.GetValuesByTag("DeathOtherDepositItemsDesk"), AdvancedCauseOfDeath.Other_Dropship => LanguageHandler.GetValuesByTag("DeathOtherItemDropship"), AdvancedCauseOfDeath.Other_Landmine => LanguageHandler.GetValuesByTag("DeathOtherLandmine"), AdvancedCauseOfDeath.Other_Turret => LanguageHandler.GetValuesByTag("DeathOtherTurret"), AdvancedCauseOfDeath.Other_Lightning => LanguageHandler.GetValuesByTag("DeathOtherLightning"), _ => LanguageHandler.GetValuesByTag("DeathUnknown"), }; } internal static void SetCauseOfDeath(PlayerControllerB playerControllerB, object enemy_BaboonHawk) { throw new NotImplementedException(); } } public enum AdvancedCauseOfDeath { Unknown, Bludgeoning, Gravity, Blast, Strangulation, Suffocation, Mauling, Gunshots, Crushing, Drowning, Abandoned, Electrocution, Kicking, Enemy_BaboonHawk, Enemy_Bracken, Enemy_CircuitBees, Enemy_CoilHead, Enemy_EarthLeviathan, Enemy_EyelessDog, Enemy_ForestGiant, Enemy_GhostGirl, Enemy_Hygrodere, Enemy_Jester, Enemy_SnareFlea, Enemy_SporeLizard, Enemy_HoarderBug, Enemy_Thumper, Enemy_BunkerSpider, Enemy_MaskedPlayer_Wear, Enemy_MaskedPlayer_Victim, Enemy_Nutcracker_Kicked, Enemy_Nutcracker_Shot, Player_Jetpack_Gravity, Player_Jetpack_Blast, Player_Quicksand, Player_Murder_Melee, Player_Murder_Shotgun, Player_StunGrenade, Other_Landmine, Other_Turret, Other_Lightning, Other_DepositItemsDesk, Other_Dropship } internal class DeathBroadcaster { private const string SIGNATURE_DEATH = "com.elitemastereric.coroner.death"; public static void Initialize() { if (Plugin.Instance.IsLCAPIPresent) { DeathBroadcasterLCAPI.Initialize(); } else { Plugin.Instance.PluginLogger.LogInfo("LC_API is not present! Skipping registration..."); } } public static void BroadcastCauseOfDeath(int playerId, AdvancedCauseOfDeath causeOfDeath) { AttemptBroadcast(BuildDataCauseOfDeath(playerId, causeOfDeath), "com.elitemastereric.coroner.death"); } private static string BuildDataCauseOfDeath(int playerId, AdvancedCauseOfDeath causeOfDeath) { string text = playerId.ToString(); int num = (int)causeOfDeath; return text + "|" + num; } private static void AttemptBroadcast(string data, string signature) { if (Plugin.Instance.IsLCAPIPresent) { DeathBroadcasterLCAPI.AttemptBroadcast(data, signature); } else { Plugin.Instance.PluginLogger.LogInfo("LC_API is not present! Skipping broadcast..."); } } } internal class LanguageHandler { public const string DEFAULT_LANGUAGE = "en"; public static readonly string[] AVAILABLE_LANGUAGES = new string[4] { "en", "ru", "nl", "fr" }; public const string TAG_FUNNY_NOTES = "FunnyNote"; public const string TAG_UI_NOTES = "UINotes"; public const string TAG_UI_DEATH = "UICauseOfDeath"; public const string TAG_DEATH_GENERIC_BLUDGEONING = "DeathBludgeoning"; public const string TAG_DEATH_GENERIC_GRAVITY = "DeathGravity"; public const string TAG_DEATH_GENERIC_BLAST = "DeathBlast"; public const string TAG_DEATH_GENERIC_STRANGULATION = "DeathStrangulation"; public const string TAG_DEATH_GENERIC_SUFFOCATION = "DeathSuffocation"; public const string TAG_DEATH_GENERIC_MAULING = "DeathMauling"; public const string TAG_DEATH_GENERIC_GUNSHOTS = "DeathGunshots"; public const string TAG_DEATH_GENERIC_CRUSHING = "DeathCrushing"; public const string TAG_DEATH_GENERIC_DROWNING = "DeathDrowning"; public const string TAG_DEATH_GENERIC_ABANDONED = "DeathAbandoned"; public const string TAG_DEATH_GENERIC_ELECTROCUTION = "DeathElectrocution"; public const string TAG_DEATH_GENERIC_KICKING = "DeathKicking"; public const string TAG_DEATH_ENEMY_BRACKEN = "DeathEnemyBracken"; public const string TAG_DEATH_ENEMY_EYELESS_DOG = "DeathEnemyEyelessDog"; public const string TAG_DEATH_ENEMY_FOREST_GIANT = "DeathEnemyForestGiant"; public const string TAG_DEATH_ENEMY_CIRCUIT_BEES = "DeathEnemyCircuitBees"; public const string TAG_DEATH_ENEMY_GHOST_GIRL = "DeathEnemyGhostGirl"; public const string TAG_DEATH_ENEMY_EARTH_LEVIATHAN = "DeathEnemyEarthLeviathan"; public const string TAG_DEATH_ENEMY_BABOON_HAWK = "DeathEnemyBaboonHawk"; public const string TAG_DEATH_ENEMY_JESTER = "DeathEnemyJester"; public const string TAG_DEATH_ENEMY_COILHEAD = "DeathEnemyCoilHead"; public const string TAG_DEATH_ENEMY_SNARE_FLEA = "DeathEnemySnareFlea"; public const string TAG_DEATH_ENEMY_HYGRODERE = "DeathEnemyHygrodere"; public const string TAG_DEATH_ENEMY_HOARDER_BUG = "DeathEnemyHoarderBug"; public const string TAG_DEATH_ENEMY_SPORE_LIZARD = "DeathEnemySporeLizard"; public const string TAG_DEATH_ENEMY_BUNKER_SPIDER = "DeathEnemyBunkerSpider"; public const string TAG_DEATH_ENEMY_THUMPER = "DeathEnemyThumper"; public const string TAG_DEATH_ENEMY_MASKED_PLAYER_WEAR = "DeathEnemyMaskedPlayerWear"; public const string TAG_DEATH_ENEMY_MASKED_PLAYER_VICTIM = "DeathEnemyMaskedPlayerVictim"; public const string TAG_DEATH_ENEMY_NUTCRACKER_KICKED = "DeathEnemyNutcrackerKicked"; public const string TAG_DEATH_ENEMY_NUTCRACKER_SHOT = "DeathEnemyNutcrackerShot"; public const string TAG_DEATH_PLAYER_JETPACK_GRAVITY = "DeathPlayerJetpackGravity"; public const string TAG_DEATH_PLAYER_JETPACK_BLAST = "DeathPlayerJetpackBlast"; public const string TAG_DEATH_PLAYER_MURDER_MELEE = "DeathPlayerMurderMelee"; public const string TAG_DEATH_PLAYER_MURDER_SHOTGUN = "DeathPlayerMurderShotgun"; public const string TAG_DEATH_PLAYER_QUICKSAND = "DeathPlayerQuicksand"; public const string TAG_DEATH_PLAYER_STUN_GRENADE = "DeathPlayerStunGrenade"; public const string TAG_DEATH_OTHER_DEPOSIT_ITEMS_DESK = "DeathOtherDepositItemsDesk"; public const string TAG_DEATH_OTHER_ITEM_DROPSHIP = "DeathOtherItemDropship"; public const string TAG_DEATH_OTHER_LANDMINE = "DeathOtherLandmine"; public const string TAG_DEATH_OTHER_TURRET = "DeathOtherTurret"; public const string TAG_DEATH_OTHER_LIGHTNING = "DeathOtherLightning"; public const string TAG_DEATH_UNKNOWN = "DeathUnknown"; private static XDocument languageData; public static void Initialize() { Plugin.Instance.PluginLogger.LogInfo("Coroner Language Support: " + Plugin.Instance.PluginConfig.GetSelectedLanguage()); ValidateLanguage(Plugin.Instance.PluginConfig.GetSelectedLanguage()); LoadLanguageData(Plugin.Instance.PluginConfig.GetSelectedLanguage()); } private static void ValidateLanguage(string languageCode) { if (!AVAILABLE_LANGUAGES.Contains(languageCode)) { Plugin.Instance.PluginLogger.LogWarning("Coroner Unknown language code: " + languageCode); Plugin.Instance.PluginLogger.LogWarning("Coroner There may be issues loading language data."); } } private static void LoadLanguageData(string languageCode) { try { languageData = XDocument.Load(Plugin.AssemblyDirectory + "/Strings_" + languageCode + ".xml"); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Coroner Error loading language data: " + ex.Message); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); if (languageCode != "en") { LoadLanguageData("en"); } } } public static string GetLanguageList() { return "(" + string.Join(", ", AVAILABLE_LANGUAGES) + ")"; } public static string GetValueByTag(string tag) { return languageData.Descendants(tag).FirstOrDefault()?.Attribute("text")?.Value; } public static string[] GetValuesByTag(string tag) { IEnumerable<XElement> source = languageData.Descendants(tag); IEnumerable<string> source2 = source.Select((XElement item) => item.Attribute("text")?.Value); IEnumerable<string> source3 = source2.Where((string item) => item != null); return source3.ToArray(); } } public static class PluginInfo { public const string PLUGIN_ID = "Coroner"; public const string PLUGIN_NAME = "Coroner"; public const string PLUGIN_AUTHOR = "EliteMasterEric"; public const string PLUGIN_VERSION = "1.5.3"; public const string PLUGIN_GUID = "com.elitemastereric.coroner"; } [BepInPlugin("com.elitemastereric.coroner", "Coroner", "1.5.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static readonly Random RANDOM = new Random(); public PluginLogger PluginLogger; public PluginConfig PluginConfig; public bool IsLCAPIPresent = false; public static Plugin Instance { get; private set; } public static string AssemblyDirectory { get { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uriBuilder = new UriBuilder(codeBase); string path = Uri.UnescapeDataString(uriBuilder.Path); return Path.GetDirectoryName(path); } } private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Instance = this; PluginLogger = new PluginLogger(((BaseUnityPlugin)this).Logger, (LogLevel)16); Harmony val = new Harmony("com.elitemastereric.coroner"); val.PatchAll(); PluginLogger.LogInfo("Plugin Coroner (com.elitemastereric.coroner) is loaded!"); LoadConfig(); LanguageHandler.Initialize(); QueryLCAPI(); DeathBroadcaster.Initialize(); } private void QueryLCAPI() { PluginLogger.LogInfo("Checking for LC_API..."); if (Chainloader.PluginInfos.ContainsKey("LC_API")) { Chainloader.PluginInfos.TryGetValue("LC_API", out var value); if (value == null) { PluginLogger.LogError("Detected LC_API, but could not get plugin info!"); IsLCAPIPresent = false; } else { PluginLogger.LogInfo("LCAPI is present! " + value.Metadata.GUID + ":" + value.Metadata.Version); IsLCAPIPresent = true; } } else { PluginLogger.LogInfo("LCAPI is not present."); IsLCAPIPresent = false; } } private void LoadConfig() { PluginConfig = new PluginConfig(); PluginConfig.BindConfig(((BaseUnityPlugin)this).Config); } } public class PluginLogger { private ManualLogSource manualLogSource; private LogLevel logLevel; public PluginLogger(ManualLogSource manualLogSource, LogLevel logLevel = 16) { //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) this.manualLogSource = manualLogSource; this.logLevel = logLevel; } public void LogFatal(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)logLevel >= 1) { manualLogSource.LogFatal(data); } } public void LogError(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)logLevel >= 2) { manualLogSource.LogError(data); } } public void LogWarning(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)logLevel >= 4) { manualLogSource.LogWarning(data); } } public void LogMessage(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)logLevel >= 8) { manualLogSource.LogMessage(data); } } public void LogInfo(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)logLevel >= 16) { manualLogSource.LogInfo(data); } } public void LogDebug(object data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 if ((int)logLevel >= 32) { manualLogSource.LogDebug(data); } } } public class PluginConfig { private ConfigEntry<bool> DisplayCauseOfDeath; private ConfigEntry<bool> SeriousDeathMessages; private ConfigEntry<bool> DisplayFunnyNotes; private ConfigEntry<bool> DeathReplacesNotes; private ConfigEntry<string> LanguagePicker; public void BindConfig(ConfigFile _config) { DisplayCauseOfDeath = _config.Bind<bool>("General", "DisplayCauseOfDeath", true, "Display the cause of death in the player notes."); SeriousDeathMessages = _config.Bind<bool>("General", "SeriousDeathMessages", false, "Cause of death messages are more to-the-point."); DisplayFunnyNotes = _config.Bind<bool>("General", "DisplayFunnyNotes", true, "Display a random note when the player has no notes."); DeathReplacesNotes = _config.Bind<bool>("General", "DeathReplacesNotes", true, "True to replace notes when the player dies, false to append."); LanguagePicker = _config.Bind<string>("Language", "LanguagePicker", "en", "Select a language to use " + LanguageHandler.GetLanguageList()); } public bool ShouldDisplayCauseOfDeath() { return DisplayCauseOfDeath.Value; } public bool ShouldUseSeriousDeathMessages() { return SeriousDeathMessages.Value; } public bool ShouldDisplayFunnyNotes() { return DisplayFunnyNotes.Value; } public bool ShouldDeathReplaceNotes() { return DeathReplacesNotes.Value; } public string GetSelectedLanguage() { return LanguagePicker.Value; } } } namespace Coroner.Patch { [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("KillPlayer")] internal class PlayerControllerBKillPlayerPatch { public static void Prefix(PlayerControllerB __instance, ref CauseOfDeath causeOfDeath) { try { if ((int)causeOfDeath == 300) { Plugin.Instance.PluginLogger.LogDebug("Player died from item dropship! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Other_Dropship); causeOfDeath = (CauseOfDeath)8; } else if (__instance.isSinking && (int)causeOfDeath == 5) { Plugin.Instance.PluginLogger.LogDebug("Player died of suffociation while sinking in quicksand! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Quicksand); } else if ((int)causeOfDeath != 3) { Plugin.Instance.PluginLogger.LogDebug("Player is dying! No cause of death registered in hook..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in PlayerControllerBKillPlayerPatch.Prefix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(DepositItemsDesk))] [HarmonyPatch("AnimationGrabPlayer")] internal class DepositItemsDeskAnimationGrabPlayerPatch { public static void Postfix(int playerID) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after tentacle devouring..."); PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerID]; Plugin.Instance.PluginLogger.LogDebug("Player is dying! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(playerController, AdvancedCauseOfDeath.Other_DepositItemsDesk); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in DepositItemsDeskAnimationGrabPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(JesterAI))] [HarmonyPatch("killPlayerAnimation")] internal class JesterAIKillPlayerAnimationPatch { public static void Postfix(int playerId) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after Jester mauling..."); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_Jester); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in JesterAIKillPlayerAnimationPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(SandWormAI))] [HarmonyPatch("EatPlayer")] internal class SandWormAIEatPlayerPatch { public static void Postfix(PlayerControllerB playerScript) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after Sand Worm devouring..."); if ((Object)(object)playerScript == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(playerScript, AdvancedCauseOfDeath.Enemy_EarthLeviathan); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in SandWormAIEatPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(RedLocustBees))] [HarmonyPatch("BeeKillPlayerOnLocalClient")] internal class RedLocustBeesBeeKillPlayerOnLocalClientPatch { public static void Postfix(int playerId) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after Circuit Bee electrocution..."); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (val.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_CircuitBees); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in RedLocustBeesBeeKillPlayerOnLocalClientPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(DressGirlAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class DressGirlAIOnCollideWithPlayerPatch { public static void Postfix(DressGirlAI __instance) { try { Plugin.Instance.PluginLogger.LogDebug("Processing Ghost Girl player collision..."); if ((Object)(object)__instance.hauntingPlayer == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after collision!"); } else if (__instance.hauntingPlayer.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance.hauntingPlayer, AdvancedCauseOfDeath.Enemy_GhostGirl); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in DressGirlAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(FlowermanAI))] [HarmonyPatch("killAnimation")] internal class FlowermanAIKillAnimationPatch { public static void Postfix(FlowermanAI __instance) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after Bracken snapping neck..."); if ((Object)(object)((EnemyAI)__instance).inSpecialAnimationWithPlayer == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after snapping neck!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(((EnemyAI)__instance).inSpecialAnimationWithPlayer, AdvancedCauseOfDeath.Enemy_Bracken); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in FlowermanAIKillAnimationPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(ForestGiantAI))] [HarmonyPatch("EatPlayerAnimation")] internal class ForestGiantAIEatPlayerAnimationPatch { public static void Postfix(PlayerControllerB playerBeingEaten) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after Forest Giant devouring..."); if ((Object)(object)playerBeingEaten == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(playerBeingEaten, AdvancedCauseOfDeath.Enemy_ForestGiant); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in ForestGiantAIEatPlayerAnimationPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(MouthDogAI))] [HarmonyPatch("KillPlayer")] internal class MouthDogAIKillPlayerPatch { public static void Postfix(int playerId) { try { Plugin.Instance.PluginLogger.LogDebug("Accessing state after dog devouring..."); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_EyelessDog); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in MouthDogAIKillPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(CentipedeAI))] [HarmonyPatch("DamagePlayerOnIntervals")] internal class CentipedeAIDamagePlayerOnIntervalsPatch { public static void Postfix(CentipedeAI __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 try { Plugin.Instance.PluginLogger.LogDebug("Handling Snare Flea damage..."); if ((Object)(object)__instance.clingingToPlayer == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player being clung to!"); } else if (__instance.clingingToPlayer.isPlayerDead && (int)__instance.clingingToPlayer.causeOfDeath == 5) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance.clingingToPlayer, AdvancedCauseOfDeath.Enemy_SnareFlea); } else if (__instance.clingingToPlayer.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player somehow died while attacked by Snare Flea! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in CentipedeAIDamagePlayerOnIntervalsPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(BaboonBirdAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class BaboonBirdAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Baboon Hawk damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_BaboonHawk); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in BaboonBirdAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch("DamagePlayerFromOtherClientClientRpc")] internal class PlayerControllerBDamagePlayerFromOtherClientClientRpcPatch { public static void Postfix(PlayerControllerB __instance) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 try { Plugin.Instance.PluginLogger.LogDebug("Handling friendly fire damage..."); if ((Object)(object)__instance == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access victim after death!"); } else if (__instance.isPlayerDead) { if ((int)__instance.causeOfDeath == 1) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Melee); } else if ((int)__instance.causeOfDeath == 6) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Melee); } else if ((int)__instance.causeOfDeath == 7) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Shotgun); } else { Plugin.Instance.PluginLogger.LogWarning("Player was killed by someone else but we don't know how! " + ((object)(CauseOfDeath)(ref __instance.causeOfDeath)).ToString()); } } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in PlayerControllerBDamagePlayerFromOtherClientClientRpcPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(PufferAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class PufferAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Spore Lizard damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_SporeLizard); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in PufferAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(SpringManAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class SpringManAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Coil Head damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_CoilHead); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in SpringManAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(BlobAI))] [HarmonyPatch("SlimeKillPlayerEffectServerRpc")] internal class BlobAISlimeKillPlayerEffectServerRpcPatch { public static void Postfix(int playerKilled) { try { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerKilled]; if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (val.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_Hygrodere); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in BlobAISlimeKillPlayerEffectServerRpcPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(HoarderBugAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class HoarderBugAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Hoarder Bug damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_HoarderBug); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in HoarderBugAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(CrawlerAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class CrawlerAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Thumper damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_Thumper); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in CrawlerAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(SandSpiderAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class SandSpiderAIOnCollideWithPlayerPatch { public static void Postfix(Collider other) { try { Plugin.Instance.PluginLogger.LogDebug("Handling Bunker Spider damage..."); PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (component.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_BunkerSpider); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in SandSpiderAIOnCollideWithPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] [HarmonyPatch("LegKickPlayer")] internal class NutcrackerEnemyAILegKickPlayerPatch { public static void Postfix(int playerId) { try { Plugin.Instance.PluginLogger.LogDebug("Nutcracker kicked a player to death!"); PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerId]; Plugin.Instance.PluginLogger.LogDebug("Player is dying! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(playerController, AdvancedCauseOfDeath.Enemy_Nutcracker_Kicked); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in NutcrackerEnemyAILegKickPlayerPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(ShotgunItem))] [HarmonyPatch("ShootGun")] internal class ShotgunItemShootGunPatch { public static void Postfix(ShotgunItem __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 try { Plugin.Instance.PluginLogger.LogDebug("Handling shotgun shot..."); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access local player after shotgun shot!"); } else if (localPlayerController.isPlayerDead && (int)localPlayerController.causeOfDeath == 7) { if (((GrabbableObject)__instance).isHeldByEnemy) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Enemy_Nutcracker_Shot); } else { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Player_Murder_Shotgun); } } else if (localPlayerController.isPlayerDead) { Plugin.Instance.PluginLogger.LogWarning("Player died while attacked by shotgun? Skipping... " + ((object)(CauseOfDeath)(ref localPlayerController.causeOfDeath)).ToString()); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in ShotgunItemShootGunPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] [HarmonyPatch("killAnimation")] internal class MaskedPlayerEnemykillAnimationPatch { public static void Postfix(MaskedPlayerEnemy __instance) { try { Plugin.Instance.PluginLogger.LogDebug("Masked Player killed someone..."); PlayerControllerB inSpecialAnimationWithPlayer = ((EnemyAI)__instance).inSpecialAnimationWithPlayer; if ((Object)(object)inSpecialAnimationWithPlayer == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); return; } Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(inSpecialAnimationWithPlayer, AdvancedCauseOfDeath.Enemy_MaskedPlayer_Victim); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in MaskedPlayerEnemykillAnimationPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(HauntedMaskItem))] [HarmonyPatch("FinishAttaching")] internal class HauntedMaskItemFinishAttachingPatch { public static void Postfix(HauntedMaskItem __instance) { try { Plugin.Instance.PluginLogger.LogDebug("Masked Player killed someone..."); PlayerControllerB value = Traverse.Create((object)__instance).Field("previousPlayerHeldBy").GetValue<PlayerControllerB>(); if ((Object)(object)value == (Object)null) { Plugin.Instance.PluginLogger.LogWarning("Could not access player after death!"); } else if (value.isPlayerDead) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(value, AdvancedCauseOfDeath.Enemy_MaskedPlayer_Wear); } else { Plugin.Instance.PluginLogger.LogDebug("Player is somehow still alive! Skipping..."); } } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in HauntedMaskItemFinishAttachingPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(ExtensionLadderItem))] [HarmonyPatch("StartLadderAnimation")] internal class ExtensionLadderItemStartLadderAnimationPatch { public static void Postfix(ExtensionLadderItem __instance) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) try { Plugin.Instance.PluginLogger.LogDebug("Extension ladder started animation! Modifying kill trigger..."); GameObject gameObject = ((Component)__instance).gameObject; if ((Object)(object)gameObject == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch GameObject from ExtensionLadderItem."); } Transform val = gameObject.transform.Find("AnimContainer/MeshContainer/LadderMeshContainer/BaseLadder/LadderSecondPart/KillTrigger"); if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillTrigger Transform from ExtensionLadderItem."); } GameObject gameObject2 = ((Component)val).gameObject; if ((Object)(object)gameObject2 == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillTrigger GameObject from ExtensionLadderItem."); } KillLocalPlayer component = gameObject2.GetComponent<KillLocalPlayer>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillLocalPlayer from KillTrigger GameObject."); } component.causeOfDeath = (CauseOfDeath)8; } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in ExtensionLadderItemStartLadderAnimationPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(ItemDropship))] [HarmonyPatch("Start")] internal class ItemDropshipStartPatch { public static void Postfix(ItemDropship __instance) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) try { Plugin.Instance.PluginLogger.LogDebug("Item dropship spawned! Modifying kill trigger..."); GameObject gameObject = ((Component)__instance).gameObject; if ((Object)(object)gameObject == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch GameObject from ItemDropship."); } Transform val = gameObject.transform.Find("ItemShip/KillTrigger"); if ((Object)(object)val == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillTrigger Transform from ItemDropship."); } GameObject gameObject2 = ((Component)val).gameObject; if ((Object)(object)gameObject2 == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillTrigger GameObject from ItemDropship."); } KillLocalPlayer component = gameObject2.GetComponent<KillLocalPlayer>(); if ((Object)(object)component == (Object)null) { Plugin.Instance.PluginLogger.LogError("Could not fetch KillLocalPlayer from KillTrigger GameObject."); } component.causeOfDeath = (CauseOfDeath)300; } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in ItemDropshipStartPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } } [HarmonyPatch(typeof(Turret))] [HarmonyPatch("Update")] public class TurretUpdatePatch { public static void Postfix(Turret __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if ((int)__instance.turretMode == 2) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isPlayerDead && (int)localPlayerController.causeOfDeath == 7) { Plugin.Instance.PluginLogger.LogDebug("Player is now dead! Setting special cause of death..."); AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Other_Turret); } } } } [HarmonyPatch(typeof(Landmine))] [HarmonyPatch("SpawnExplosion")] public class LandmineSpawnExplosionPatch { private const string KILL_PLAYER_SIGNATURE = "Void KillPlayer(UnityEngine.Vector3, Boolean, CauseOfDeath, Int32)"; private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase method) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); List<CodeInstruction> list2 = BuildInstructionsToInsert(method); if (list2 == null) { Plugin.Instance.PluginLogger.LogError("Could not build instructions to insert in LandmineSpawnExplosionPatch! Safely aborting..."); return instructions; } int num = -1; for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Callvirt && val.operand.ToString() == "Void KillPlayer(UnityEngine.Vector3, Boolean, CauseOfDeath, Int32)") { num = i; break; } } if (num == -1) { Plugin.Instance.PluginLogger.LogError("Could not find PlayerControllerB.KillPlayer call in LandmineSpawnExplosionPatch! Safely aborting..."); return instructions; } Plugin.Instance.PluginLogger.LogInfo("Injecting patch into Landmine.SpawnExplosion..."); list.InsertRange(num, list2); Plugin.Instance.PluginLogger.LogInfo("Done."); return list; } private static List<CodeInstruction> BuildInstructionsToInsert(MethodBase method) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); int num = 2; IList<LocalVariableInfo> localVariables = method.GetMethodBody().LocalVariables; LocalVariableInfo localVariableInfo = null; for (int i = 0; i < localVariables.Count; i++) { LocalVariableInfo localVariableInfo2 = localVariables[i]; if (localVariableInfo2.LocalType == typeof(PlayerControllerB)) { if (localVariableInfo != null) { Plugin.Instance.PluginLogger.LogError("Found multiple PlayerControllerB local variables in LandmineSpawnExplosionPatch!"); return null; } localVariableInfo = localVariableInfo2; break; } } list.Add(new CodeInstruction(OpCodes.Ldloc_S, (object)localVariableInfo.LocalIndex)); list.Add(new CodeInstruction(OpCodes.Ldarg, (object)num)); list.Add(new CodeInstruction(OpCodes.Call, (object)typeof(LandmineSpawnExplosionPatch).GetMethod("RewriteCauseOfDeath"))); return list; } public static void RewriteCauseOfDeath(PlayerControllerB targetPlayer, float killRange) { AdvancedCauseOfDeath causeOfDeath = AdvancedCauseOfDeath.Blast; if (killRange == 5f) { causeOfDeath = AdvancedCauseOfDeath.Player_Jetpack_Blast; } else if (killRange == 5.7f) { causeOfDeath = AdvancedCauseOfDeath.Other_Landmine; } else if (killRange == 2.4f) { causeOfDeath = AdvancedCauseOfDeath.Other_Lightning; } AdvancedDeathTracker.SetCauseOfDeath(targetPlayer, causeOfDeath); } } [HarmonyPatch(typeof(HUDManager))] [HarmonyPatch("FillEndGameStats")] internal class HUDManagerFillEndGameStatsPatch { private const string EMPTY_NOTES = "Notes: \n"; public static void Postfix(HUDManager __instance) { try { OverridePerformanceReport(__instance); } catch (Exception ex) { Plugin.Instance.PluginLogger.LogError("Error in HUDManagerFillEndGameStatsPatch.Postfix: " + ex); Plugin.Instance.PluginLogger.LogError(ex.StackTrace); } } private static Random BuildSyncedRandom() { int randomMapSeed = StartOfRound.Instance.randomMapSeed; Plugin.Instance.PluginLogger.LogDebug("Syncing randomization to map seed: '" + randomMapSeed + "'"); return new Random(randomMapSeed); } private static void OverridePerformanceReport(HUDManager __instance) { Plugin.Instance.PluginLogger.LogDebug("Applying Coroner patches to player notes..."); Random random = BuildSyncedRandom(); for (int i = 0; i < __instance.statsUIElements.playerNotesText.Length; i++) { PlayerControllerB val = __instance.playersManager.allPlayerScripts[i]; if (!val.disconnectedMidGame && !val.isPlayerDead && !val.isPlayerControlled) { Plugin.Instance.PluginLogger.LogInfo("Player " + i + " is not controlled by a player. Skipping..."); continue; } TextMeshProUGUI val2 = __instance.statsUIElements.playerNotesText[i]; if (val.isPlayerDead) { if (Plugin.Instance.PluginConfig.ShouldDisplayCauseOfDeath()) { if (Plugin.Instance.PluginConfig.ShouldDeathReplaceNotes()) { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " is dead! Replacing notes with Cause of Death..."); ((TMP_Text)val2).text = LanguageHandler.GetValueByTag("UICauseOfDeath") + "\n"; } else { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " is dead! Appending notes with Cause of Death..."); } AdvancedCauseOfDeath causeOfDeath = AdvancedDeathTracker.GetCauseOfDeath(val); ((TMP_Text)val2).text = ((TMP_Text)val2).text + "* " + AdvancedDeathTracker.StringifyCauseOfDeath(causeOfDeath, random) + "\n"; } else { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " is dead, but Config says leave it be..."); } } else if (((TMP_Text)val2).text == "Notes: \n") { if (Plugin.Instance.PluginConfig.ShouldDisplayFunnyNotes()) { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " has no notes! Injecting something funny..."); ((TMP_Text)val2).text = LanguageHandler.GetValueByTag("UINotes") + "\n"; ((TMP_Text)val2).text = ((TMP_Text)val2).text + "* " + AdvancedDeathTracker.StringifyCauseOfDeath(null, random) + "\n"; } else { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " has no notes, but Config says leave it be..."); } } else { Plugin.Instance.PluginLogger.LogInfo("[REPORT] Player " + i + " has notes, don't override them..."); } } AdvancedDeathTracker.ClearDeathTracker(); } } } namespace Coroner.LCAPI { internal class DeathBroadcasterLCAPI { private const string SIGNATURE_DEATH = "com.elitemastereric.coroner.death"; public static void Initialize() { Plugin.Instance.PluginLogger.LogDebug("Initializing DeathBroadcaster..."); if (Plugin.Instance.IsLCAPIPresent) { Plugin.Instance.PluginLogger.LogDebug("LC_API is present! Registering signature..."); Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(OnBroadcastString)); } else { Plugin.Instance.PluginLogger.LogError("LC_API is not present! Why did you try to register the DeathBroadcaster?"); } } private static void OnBroadcastString(string data, string signature) { if (signature == "com.elitemastereric.coroner.death") { Plugin.Instance.PluginLogger.LogDebug("Broadcast has been received from LC_API!"); string[] array = data.Split('|'); int playerIndex = int.Parse(array[0]); int num = int.Parse(array[1]); AdvancedCauseOfDeath advancedCauseOfDeath = (AdvancedCauseOfDeath)num; Plugin.Instance.PluginLogger.LogDebug("Player " + playerIndex + " died of " + AdvancedDeathTracker.StringifyCauseOfDeath((AdvancedCauseOfDeath?)advancedCauseOfDeath)); AdvancedDeathTracker.SetCauseOfDeath(playerIndex, advancedCauseOfDeath, broadcast: false); } } public static void AttemptBroadcast(string data, string signature) { if (Plugin.Instance.IsLCAPIPresent) { Plugin.Instance.PluginLogger.LogDebug("LC_API is present! Broadcasting..."); Networking.Broadcast(data, signature); } else { Plugin.Instance.PluginLogger.LogDebug("LC_API is not present! Skipping broadcast..."); } } } }
BepInEx/plugins/HelmetCamera.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; 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("HelmetCamera")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HelmetCamera")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b99c4d46-5f13-47b3-a5af-5e3f37772e77")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HelmetCamera { [BepInPlugin("RickArg.lethalcompany.helmetcameras", "Helmet_Cameras", "2.1.5")] public class PluginInit : BaseUnityPlugin { public static Harmony _harmony; public static ConfigEntry<int> config_isHighQuality; public static ConfigEntry<int> config_renderDistance; public static ConfigEntry<int> config_cameraFps; private void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown config_isHighQuality = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "monitorResolution", 0, "Low FPS affection. High Quality mode. 0 - vanilla (48x48), 1 - vanilla+ (128x128), 2 - mid quality (256x256), 3 - high quality (512x512), 4 - Very High Quality (1024x1024)"); config_renderDistance = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "renderDistance", 20, "Low FPS affection. Render distance for helmet camera."); config_cameraFps = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "cameraFps", 30, "Very high FPS affection. FPS for helmet camera. To increase YOUR fps, you should low cameraFps value."); _harmony = new Harmony("HelmetCamera"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Helmet_Cameras is loaded with version 2.1.5!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"--------Helmet camera patch done.---------"); } } public static class PluginInfo { public const string PLUGIN_GUID = "RickArg.lethalcompany.helmetcameras"; public const string PLUGIN_NAME = "Helmet_Cameras"; public const string PLUGIN_VERSION = "2.1.5"; } public class Plugin : MonoBehaviour { private RenderTexture renderTexture; private bool isMonitorChanged = false; private GameObject helmetCameraNew; private bool isSceneLoaded = false; private bool isCoroutineStarted = false; private int currentTransformIndex; private int resolution = 0; private int renderDistance = 50; private float cameraFps = 30f; private float elapsed; private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown resolution = PluginInit.config_isHighQuality.Value; renderDistance = PluginInit.config_renderDistance.Value; cameraFps = PluginInit.config_cameraFps.Value; switch (resolution) { case 0: renderTexture = new RenderTexture(48, 48, 24); break; case 1: renderTexture = new RenderTexture(128, 128, 24); break; case 2: renderTexture = new RenderTexture(256, 256, 24); break; case 3: renderTexture = new RenderTexture(512, 512, 24); break; case 4: renderTexture = new RenderTexture(1024, 1024, 24); break; } } public void Start() { //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_0031: 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_004a: 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) isCoroutineStarted = false; while ((Object)(object)helmetCameraNew == (Object)null) { helmetCameraNew = new GameObject("HelmetCamera"); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "MainMenu") { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "InitScene") { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "InitSceneLaunchOptions") { isSceneLoaded = true; Debug.Log((object)"[HELMET_CAMERAS] Starting coroutine..."); ((MonoBehaviour)this).StartCoroutine(LoadSceneEnter()); return; } } } isSceneLoaded = false; isMonitorChanged = false; } private IEnumerator LoadSceneEnter() { Debug.Log((object)"[HELMET_CAMERAS] 5 seconds for init mode... Please wait..."); yield return (object)new WaitForSeconds(5f); isCoroutineStarted = true; if ((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") != (Object)null) { Debug.Log((object)"[HELMET_CAMERAS] Ship camera founded..."); if (!isMonitorChanged) { ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube").GetComponent<MeshRenderer>()).materials[2].mainTexture = ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture; ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)renderTexture; helmetCameraNew.AddComponent<Camera>(); ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false; helmetCameraNew.GetComponent<Camera>().targetTexture = renderTexture; helmetCameraNew.GetComponent<Camera>().cullingMask = 20649983; helmetCameraNew.GetComponent<Camera>().farClipPlane = renderDistance; helmetCameraNew.GetComponent<Camera>().nearClipPlane = 0.55f; isMonitorChanged = true; Debug.Log((object)"[HELMET_CAMERAS] Monitors were changed..."); Debug.Log((object)"[HELMET_CAMERAS] Turning off vanilla internal ship camera"); ((Behaviour)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").GetComponent<Camera>()).enabled = false; } } } public void Update() { //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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_0100: 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_0119: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_01c5: 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_01de: Unknown result type (might be due to invalid IL or missing references) bool flag = isSceneLoaded && isCoroutineStarted; if (flag && StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { helmetCameraNew.SetActive(true); elapsed += Time.deltaTime; if (elapsed > 1f / cameraFps) { elapsed = 0f; ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = true; } else { ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false; } GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript"); currentTransformIndex = val.GetComponent<ManualCameraRenderer>().targetTransformIndex; TransformAndName val2 = val.GetComponent<ManualCameraRenderer>().radarTargets[currentTransformIndex]; if (!val2.isNonPlayer) { try { helmetCameraNew.transform.SetPositionAndRotation(val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").position + new Vector3(0f, 0f, 0f), val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").rotation * Quaternion.Euler(0f, 0f, 0f)); DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>(); for (int i = 0; i < array.Length; i++) { if (array[i].playerScript.playerUsername == val2.name) { helmetCameraNew.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").position, ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").rotation * Quaternion.Euler(0f, 0f, 0f)); } } return; } catch (NullReferenceException) { Debug.Log((object)"[HELMET_CAMERAS] ERROR NULL REFERENCE"); return; } } helmetCameraNew.transform.SetPositionAndRotation(val2.transform.position + new Vector3(0f, 1.6f, 0f), val2.transform.rotation * Quaternion.Euler(0f, -90f, 0f)); } else if (flag && !StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { helmetCameraNew.SetActive(false); } } } } namespace HelmetCamera.Patches { [HarmonyPatch] internal class HelmetCamera { public static void InitCameras() { GameObject val = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera"); val.AddComponent<Plugin>(); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] public static void InitCamera(ref ManualCameraRenderer __instance) { InitCameras(); } } }
BepInEx/plugins/IntroTweaks.dll
Decompiled 2 years 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 BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using IntroTweaks.Core; using IntroTweaks.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("IntroTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Seamless skipping of Lethal Company intro/menu screens.")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+0b6c70043c8db3a782b2540891c448250f722beb")] [assembly: AssemblyProduct("IntroTweaks")] [assembly: AssemblyTitle("IntroTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 IntroTweaks { [BepInPlugin("io.github.IntroTweaks", "IntroTweaks", "1.4.0")] public class Plugin : BaseUnityPlugin { internal static string SelectedMode; private Harmony patcher; internal static ManualLogSource Logger { get; private set; } public static PluginConfig Config { get; private set; } private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Config = new PluginConfig(((BaseUnityPlugin)this).Config); if (!PluginEnabled(logDisabled: true)) { return; } if (Config.SKIP_SPLASH_SCREENS) { SkipSplashScreen(); } Config.InitBindings(); SelectedMode = Config.AUTO_SELECT_MODE.ToLower(); try { patcher = new Harmony("io.github.IntroTweaks"); patcher.PatchAll(); Logger.LogInfo((object)"Plugin loaded."); } catch (Exception ex) { Logger.LogError((object)ex); } } public bool PluginEnabled(bool logDisabled = false) { bool pLUGIN_ENABLED = Config.PLUGIN_ENABLED; if (!pLUGIN_ENABLED && logDisabled) { Logger.LogInfo((object)"IntroTweaks disabled globally."); } return pLUGIN_ENABLED; } private void SkipSplashScreen() { Logger.LogDebug((object)"Skipping splash screens. Ew."); Task.Factory.StartNew(delegate { do { SplashScreen.Stop((StopBehavior)0); } while (Time.realtimeSinceStartup < 10f); }); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "IntroTweaks"; public const string PLUGIN_NAME = "IntroTweaks"; public const string PLUGIN_VERSION = "1.4.0"; } } namespace IntroTweaks.Utils { internal class DisplayUtil { public static List<DisplayInfo> Displays { get; private set; } = new List<DisplayInfo>(); internal static void Move(int displayIndex) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) Screen.GetDisplayLayout(Displays); int num = Displays.IndexOf(Screen.mainWindowDisplayInfo); if (displayIndex != num) { MoveWindowAsync(displayIndex); } } private static async void MoveWindowAsync(int index) { await MoveWindowTask(index); } private static async Task MoveWindowTask(int index) { if (index >= Displays.Count) { await Task.CompletedTask; Plugin.Logger.LogDebug((object)"Display index out of bounds for current layout!"); return; } DisplayInfo val = Displays[index]; Vector2Int zero = Vector2Int.zero; if ((int)Screen.fullScreenMode != 3) { ((Vector2Int)(ref zero)).x = ((Vector2Int)(ref zero)).x + val.width / 2; ((Vector2Int)(ref zero)).y = ((Vector2Int)(ref zero)).y + val.height / 2; } AsyncOperation operation = Screen.MoveMainWindowTo(ref val, zero); while (operation.progress < 1f) { await Task.Yield(); } Plugin.Logger.LogDebug((object)("Game moved to display: " + Displays[index].name)); } } internal class RectUtil { internal static void ResetAnchoredPos(RectTransform rect) { //IL_0001: 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) rect.anchoredPosition = Vector2.zero; rect.anchoredPosition3D = Vector3.zero; } internal static void ResetPivot(RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rect.pivot = Vector2.zero; } internal static void ResetSizeDelta(RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rect.sizeDelta = Vector2.zero; } internal static void EditOffsets(RectTransform rect, Vector2 max, Vector2 min) { //IL_0001: 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) rect.offsetMax = max; rect.offsetMin = min; } internal static void EditAnchors(RectTransform rect, Vector2 max, Vector2 min) { //IL_0001: 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) rect.anchorMax = max; rect.anchorMin = min; } internal static void AnchorToBottom(RectTransform rect) { //IL_000b: 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) //IL_002b: 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) EditAnchors(rect, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f)); ResetAnchoredPos(rect); ((Transform)rect).rotation = Quaternion.identity; ((Transform)rect).position = new Vector3(Plugin.Config.VERSION_TEXT_X, Plugin.Config.VERSION_TEXT_Y, -37f); } } } namespace IntroTweaks.Patches { [HarmonyPatch(typeof(InitializeGame))] internal class InitializeGamePatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void DisableBootAnimation(ref bool __runOriginal) { int gAME_STARTUP_DISPLAY = Plugin.Config.GAME_STARTUP_DISPLAY; if (gAME_STARTUP_DISPLAY >= 0) { DisplayUtil.Move(gAME_STARTUP_DISPLAY); } if (Plugin.Config.SKIP_BOOT_ANIMATION) { SceneManager.LoadScene("MainMenu"); __runOriginal = false; } } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { public static Color32 DARK_ORANGE = new Color32((byte)175, (byte)115, (byte)0, byte.MaxValue); public static int gameVer { get; private set; } public static TextMeshProUGUI versionText { get; private set; } [HarmonyPrefix] [HarmonyPatch("Awake")] private static bool ReplaceVersionText(MenuManager __instance) { if (Plugin.Config.CUSTOM_VERSION_TEXT) { GameObject menuButtons = __instance.menuButtons; GameObject val = ((menuButtons != null) ? ((Component)menuButtons.transform.parent.Find("VersionNum")).gameObject : null); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Logger.LogError((object)"Failed to find original version text object."); } try { GameObject val2 = Object.Instantiate<GameObject>(val, __instance.menuButtons.transform); val.SetActive(false); ((Object)val2).name = "VersionNumberText"; versionText = InitTextMesh(val2.GetComponent<TextMeshProUGUI>()); RectUtil.AnchorToBottom(val2.GetComponent<RectTransform>()); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error creating custom version text!\n{arg}"); } } return true; } [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPatch(MenuManager __instance) { //IL_017b: 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_01dc: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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) try { if (Plugin.Config.FIX_MENU_PANELS) { FixPanelAlignment(__instance.menuButtons); FixPanelAlignment(FindInParent(__instance.menuButtons, "LobbyHostSettings")); FixPanelAlignment(FindInParent(__instance.menuButtons, "LobbyList")); FixPanelAlignment(FindInParent(__instance.menuButtons, "LoadingScreen")); ((Component)__instance.HostSettingsScreen.transform.Find("Image")).gameObject.SetActive(false); } GameObject[] buttons = (GameObject[])(object)new GameObject[7] { __instance.joinCrewButtonContainer, __instance.lanButtonContainer, GetButton(__instance.menuButtons, "HostButton"), GetButton(__instance.menuButtons, "SettingsButton"), GetButton(__instance.menuButtons, "Credits"), GetButton(__instance.menuButtons, "QuitButton"), GetButton(__instance.menuButtons, "ModSettingsButton") }; if (Plugin.Config.ALIGN_MENU_BUTTONS) { AlignButtons(buttons); } if (Plugin.Config.REMOVE_CREDITS_BUTTON) { RemoveCreditsButton(buttons); } bool changeRenderMode = Plugin.Config.FIX_MENU_CANVAS; GameObject val = GameObject.Find("GlobalScale"); if (Object.op_Implicit((Object)(object)val)) { changeRenderMode = false; val.GetComponentInParent<Canvas>().pixelPerfect = true; GameObject gameObject = ((Component)val.transform.Find("CosmeticsScreen")).gameObject; Transform transform = ((Component)gameObject.transform.Find("SpinAreaButton")).transform; transform.localScale = new Vector3(0.48f, 0.55f, 0.46f); transform.position = new Vector3(421.65f, 245.7f, 200f); Transform transform2 = FindInParent(gameObject, "ActivateButton").transform; Transform transform3 = ((Component)gameObject.transform.Find("ExitButton")).transform; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(424.06f, 241.65f, 166.2f); Vector3 position = (transform2.position = val2); transform3.position = position; transform3.SetAsLastSibling(); ((Component)gameObject.transform.Find("CosmeticsHolderBorder")).transform.localScale = new Vector3(2.4f, 2.1f, 1f); Transform transform4 = ((Component)__instance.menuButtons.transform.Find("HeaderImage")).transform; transform4.localScale = new Vector3(5f, 5f, 5f); Vector3 position2 = default(Vector3); ((Vector3)(ref position2))..ctor(1093.05f, 647.79f, -35.33f); transform4.position = position2; } TweakCanvasSettings(__instance.menuButtons, changeRenderMode); } catch (Exception ex) { Plugin.Logger.LogError((object)ex); } if (Plugin.Config.REMOVE_NEWS_PANEL) { __instance.NewsPanel.SetActive(false); } if (Plugin.Config.REMOVE_LAN_WARNING) { __instance.lanWarningContainer.SetActive(false); } if (Plugin.Config.REMOVE_LAUNCHED_IN_LAN) { TextMeshProUGUI launchedInLanModeText = __instance.launchedInLanModeText; GameObject val4 = ((launchedInLanModeText != null) ? ((Component)((TMP_Text)launchedInLanModeText).transform).gameObject : null); if (Object.op_Implicit((Object)(object)val4)) { val4.SetActive(false); } } if (Plugin.Config.AUTO_SELECT_HOST) { __instance.ClickHostButton(); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch(MenuManager __instance) { if (Plugin.Config.CUSTOM_VERSION_TEXT) { ((TMP_Text)versionText).text = ((TMP_Text)versionText).text.Replace("$VERSION", gameVer.ToString()); GameObject gameObject = ((Component)((TMP_Text)versionText).transform).gameObject; if (!gameObject.activeSelf && __instance.menuButtons.activeSelf) { gameObject.SetActive(true); } } } [HarmonyPrefix] [HarmonyPatch("ClickHostButton")] private static void DisableMenuOnHost(MenuManager __instance) { __instance.menuButtons.SetActive(false); if (Plugin.Config.CUSTOM_VERSION_TEXT) { ((Component)((TMP_Text)versionText).transform).gameObject.SetActive(false); } } private static TextMeshProUGUI InitTextMesh(TextMeshProUGUI tmp) { int gameVersionNum = GameNetworkManager.Instance.gameVersionNum; gameVer = Mathf.Abs(Plugin.Config.VERSION_TEXT_FORMAT.ToLower().Equals("short") ? (gameVersionNum - 16440) : gameVersionNum); ((TMP_Text)tmp).text = Plugin.Config.VERSION_TEXT; ((TMP_Text)tmp).fontSize = Mathf.Clamp(Plugin.Config.VERSION_TEXT_SIZE, 10f, 40f); ((TMP_Text)tmp).alignment = (TextAlignmentOptions)514; TweakTextSettings(tmp); return tmp; } private static void TweakTextSettings(TextMeshProUGUI tmp, bool overflow = true, bool wordWrap = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (overflow) { ((TMP_Text)tmp).overflowMode = (TextOverflowModes)0; } ((TMP_Text)tmp).enableWordWrapping = wordWrap; ((TMP_Text)tmp).faceColor = DARK_ORANGE; } private static void TweakCanvasSettings(GameObject panel, bool changeRenderMode) { Canvas componentInParent = panel.GetComponentInParent<Canvas>(); componentInParent.pixelPerfect = true; if (changeRenderMode) { componentInParent.renderMode = (RenderMode)0; } } private static void FixPanelAlignment(GameObject panel) { //IL_001c: 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) RectTransform component = panel.GetComponent<RectTransform>(); RectUtil.ResetSizeDelta(component); RectUtil.ResetAnchoredPos(component); RectUtil.EditOffsets(component, new Vector2(-20f, -25f), new Vector2(20f, 25f)); FixScale(panel); Plugin.Logger.LogDebug((object)"Fixed menu panel alignment."); } internal static void FixScale(GameObject obj) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) obj.transform.localScale = new Vector3(1.02f, 1.06f, 1.02f); } private static void RemoveCreditsButton(IEnumerable<GameObject> buttons) { //IL_005d: 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_008b: 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_0098: 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_00aa: Unknown result type (might be due to invalid IL or missing references) GameObject obj = buttons.First((GameObject b) => ((Object)b).name == "QuitButton"); GameObject val = buttons.First((GameObject b) => ((Object)b).name == "Credits"); val.SetActive(false); obj.transform.position = val.transform.position; foreach (GameObject button in buttons) { if (!((Object)(object)button == (Object)(object)val)) { Vector3 position = button.transform.position; button.transform.position = new Vector3(position.x, position.y - 10f, position.z); } } Plugin.Logger.LogDebug((object)"Removed credits button"); } private static void AlignButtons(IEnumerable<GameObject> buttons) { //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_006a: 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_0085: 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_00e1: 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) Vector3 localPosition = ((Transform)buttons.First((GameObject b) => ((Object)b).name == "HostButton").GetComponent<RectTransform>()).localPosition; foreach (GameObject button in buttons) { if (Object.op_Implicit((Object)(object)button)) { RectTransform component = button.GetComponent<RectTransform>(); int num = (Plugin.Config.REMOVE_CREDITS_BUTTON ? 20 : (-5)); ((Transform)component).localPosition = new Vector3(localPosition.x + 20f, ((Transform)component).localPosition.y + (float)num, localPosition.z); TextMeshProUGUI componentInChildren = button.GetComponentInChildren<TextMeshProUGUI>(); FixScale(((Component)componentInChildren).gameObject); TweakTextSettings(componentInChildren); ((TMP_Text)componentInChildren).fontSize = 15f; ((TMP_Text)componentInChildren).wordSpacing = ((TMP_Text)componentInChildren).wordSpacing - 25f; RectTransform component2 = ((Component)componentInChildren).gameObject.GetComponent<RectTransform>(); RectUtil.ResetAnchoredPos(component2); RectUtil.ResetSizeDelta(component2); RectUtil.EditOffsets(component2, Vector2.zero, new Vector2(5f, 0f)); } } Plugin.Logger.LogDebug((object)"Aligned menu buttons."); } private static GameObject GetButton(GameObject panel, string name) { try { return ((Component)panel.transform.Find(name)).gameObject; } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error getting button: {name}\n{arg}"); return null; } } private static GameObject FindInParent(GameObject child, string name) { Transform parent = child.transform.parent; try { return ((Component)parent.Find(name)).gameObject; } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error finding '{name}' in parent: {((Object)parent).name}\n{arg}"); return null; } } } [HarmonyPatch(typeof(PreInitSceneScript))] internal class PreSceneInitPatch { [HarmonyPrefix] [HarmonyPatch("SkipToFinalSetting")] private static bool DisableTransition(PreInitSceneScript __instance) { bool playerHasFinishedSetup = IngamePlayerSettings.Instance.settings.playerHasFinishedSetup; if (playerHasFinishedSetup) { ((Component)__instance.blackTransition).gameObject.SetActive(false); } return playerHasFinishedSetup; } [HarmonyPostfix] [HarmonyPatch("Start")] private static void SkipToOnline(PreInitSceneScript __instance, ref bool ___choseLaunchOption) { if (!Plugin.SelectedMode.Equals("off")) { CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)__instance.LaunchSettingsPanels, (Action<GameObject>)delegate(GameObject panel) { panel.SetActive(false); }); __instance.currentLaunchSettingPanel = 0; ((TMP_Text)__instance.headerText).text = ""; ((Component)__instance.blackTransition).gameObject.SetActive(false); __instance.continueButton.gameObject.SetActive(false); ___choseLaunchOption = true; __instance.mainAudio.PlayOneShot(__instance.selectSFX); IngamePlayerSettings.Instance.SetPlayerFinishedLaunchOptions(); IngamePlayerSettings.Instance.SaveChangedSettings(); if (!IngamePlayerSettings.Instance.encounteredErrorDuringSave) { SceneManager.LoadScene(Plugin.SelectedMode.Equals("online") ? "InitScene" : "InitSceneLANMode"); } } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPrefix] [HarmonyPatch("PlayFirstDayShipAnimation")] private static bool DisableSpeaker() { return !Plugin.Config.DISABLE_FIRST_DAY_SFX; } } } namespace IntroTweaks.Core { public class PluginConfig { public struct Category { public static Category GENERAL => new Category("0 >> General << 0"); public static Category INTRO_TWEAKS => new Category("1 >> Intro << 1"); public static Category MENU_TWEAKS => new Category("2 >> Main Menu << 2"); public static Category VERSION_TEXT => new Category("3 >> Custom Version Text << 3"); public static Category MISC => new Category("4 >> Miscellaneous << 4"); public string Value { get; private set; } private Category(string value) { Value = value; } } [NonSerialized] private readonly ConfigFile configFile; public bool PLUGIN_ENABLED { get; private set; } public bool SKIP_SPLASH_SCREENS { get; private set; } public bool SKIP_BOOT_ANIMATION { get; private set; } public string AUTO_SELECT_MODE { get; private set; } public bool AUTO_SELECT_HOST { get; private set; } public bool ALIGN_MENU_BUTTONS { get; private set; } public bool FIX_MENU_CANVAS { get; private set; } public bool FIX_MENU_PANELS { get; private set; } public bool REMOVE_LAN_WARNING { get; private set; } public bool REMOVE_LAUNCHED_IN_LAN { get; private set; } public bool REMOVE_NEWS_PANEL { get; private set; } public bool REMOVE_CREDITS_BUTTON { get; private set; } public bool CUSTOM_VERSION_TEXT { get; private set; } public string VERSION_TEXT { get; private set; } public string VERSION_TEXT_FORMAT { get; private set; } public float VERSION_TEXT_SIZE { get; private set; } public float VERSION_TEXT_X { get; private set; } public float VERSION_TEXT_Y { get; private set; } public bool DISABLE_FIRST_DAY_SFX { get; private set; } public int GAME_STARTUP_DISPLAY { get; private set; } public PluginConfig(ConfigFile cfg) { configFile = cfg; PLUGIN_ENABLED = NewEntry("bEnabled", defaultVal: true, "Enable or disable the plugin globally."); SKIP_SPLASH_SCREENS = NewEntry(Category.INTRO_TWEAKS, "bSkipSplashScreens", defaultVal: true, "Skips those pesky Unity and Zeekers startup logos!"); } private T NewEntry<T>(string key, T defaultVal, string desc) { return NewEntry(Category.GENERAL, key, defaultVal, desc); } private T NewEntry<T>(Category category, string key, T defaultVal, string desc) { return configFile.Bind<T>(category.Value, key, defaultVal, desc).Value; } public void InitBindings() { SKIP_BOOT_ANIMATION = NewEntry(Category.INTRO_TWEAKS, "bSkipBootAnimation", defaultVal: true, "If the loading animation (booting OS) should be skipped."); AUTO_SELECT_MODE = NewEntry(Category.INTRO_TWEAKS, "sAutoSelectMode", "ONLINE", "Which mode to automatically enter into after the splash screen.\nValid options: ONLINE, LAN, OFF"); AUTO_SELECT_HOST = NewEntry(Category.INTRO_TWEAKS, "bAutoSelectHost", defaultVal: false, "Whether the 'Host' button is automatically selected when the Online/LAN menu loads."); ALIGN_MENU_BUTTONS = NewEntry(Category.MENU_TWEAKS, "bAlignMenuButtons", defaultVal: true, "If the main menu buttons should align with each other."); FIX_MENU_CANVAS = NewEntry(Category.MENU_TWEAKS, "bFixMenuCanvas", defaultVal: true, "Whether the main menu canvas should have its settings corrected.\nMay cause overlapping issues, only turn it on if you aren't using other menu mods."); FIX_MENU_PANELS = NewEntry(Category.MENU_TWEAKS, "bFixMenuPanels", defaultVal: true, "The main menu panels (host, servers, loading screen) all have anchoring, offset and sizing issues.\nThis option helps solve them and improve the look of the menu.\n\nMAY BREAK SOME MODS."); REMOVE_LAN_WARNING = NewEntry(Category.MENU_TWEAKS, "bRemoveLanWarning", defaultVal: true, "Hides the warning popup when hosting a LAN session."); REMOVE_LAUNCHED_IN_LAN = NewEntry(Category.MENU_TWEAKS, "bRemoveLaunchedInLanText", defaultVal: true, "Hides the 'Launched in LAN mode' text below the Quit button."); REMOVE_NEWS_PANEL = NewEntry(Category.MENU_TWEAKS, "bRemoveNewsPanel", defaultVal: false, "Hides the panel that displays news such as game updates."); REMOVE_CREDITS_BUTTON = NewEntry(Category.MENU_TWEAKS, "bRemoveCreditsButton", defaultVal: true, "Hides the 'Credits' button on the main menu. The other buttons are automatically adjusted."); CUSTOM_VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "bCustomVersionText", defaultVal: true, "Whether to replace the game's version text with a custom alternative."); VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "sVersionText", "v$VERSION\n[MODDED]", "Replace the game's version text with this custom text in the main menu.\nTo insert the version number, use the $VERSION syntax. E.g. Ver69 would be Ver$VERSION"); VERSION_TEXT_FORMAT = NewEntry(Category.VERSION_TEXT, "sVersionTextFormat", "FULL", "Determines how to display game version number.\nValid options: FULL, SHORT"); VERSION_TEXT_SIZE = NewEntry(Category.VERSION_TEXT, "fVersionTextSize", 20f, "The font size of the version text. Min = 10, Max = 40."); VERSION_TEXT_X = NewEntry(Category.VERSION_TEXT, "fVersionTextXPos", 1089.6f, "The position on the horizontal axis where the version text should be placed.\nPositive = Right, Negative = Left"); VERSION_TEXT_Y = NewEntry(Category.VERSION_TEXT, "fVersionTextYPos", 554.1f, "The position on the vertical axis where the version text should be placed.\nPositive = Up, Negative = Down"); DISABLE_FIRST_DAY_SFX = NewEntry(Category.MISC, "bDisableFirstDaySFX", defaultVal: false, "Toggles the first day ship speaker SFX."); GAME_STARTUP_DISPLAY = NewEntry(Category.MISC, "iGameStartupDisplay", 0, "The index of the monitor to display the game on when starting.\nYou can find these indexes in your Windows display settings.\nDefaults to 0 (main monitor)."); } } internal static class Metadata { public const string GUID = "io.github.IntroTweaks"; public const string NAME = "IntroTweaks"; public const string VERSION = "1.4.0"; } }
BepInEx/plugins/LethalCompanyMonitorMod.dll
Decompiled 2 years 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyMonitorMod.ConfigModel; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; [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("LethalCompanyMonitorMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A plugin that let's you fast switch to a player's cam while using the radar built in the in-game Terminal")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1+669f32eefe44abf3aaa76ab120fc6f705c6684ec")] [assembly: AssemblyProduct("LethalCompanyMonitorMod")] [assembly: AssemblyTitle("LethalCompanyMonitorMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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 LethalCompanyMonitorMod { public class Configs { public static readonly ConfigModel<Key> PreviousPlayerCam = new ConfigModel<Key>((Key)61, "Get previous player's cam", "PrevPCam", "HotKeys"); public static readonly ConfigModel<Key> NextPlayerCam = new ConfigModel<Key>((Key)62, "Get next player's cam", "NextPCam", "HotKeys"); public static readonly ConfigModel<Key>[] AllBinds = new ConfigModel<Key>[2] { PreviousPlayerCam, NextPlayerCam }; } [BepInPlugin("krystall9.FastSwitchPlayerViewInRadar", "FastSwitchPlayerViewInRadar", "1.3.1")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { internal static InputActionAsset Asset; internal static string keyMappingPath = Application.persistentDataPath + "/switch_radar_cam.txt"; internal static Dictionary<string, string> defaultKeys = new Dictionary<string, string>(); internal static Plugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static bool ViewMonitorSubmitted { get; set; } = false; internal static int CurrentlyViewingPlayer { get; set; } = 0; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; defaultKeys.Add("Previous Cam", "/Keyboard/LeftArrow"); defaultKeys.Add("Next Cam", "/Keyboard/RightArrow"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"krystall9.FastSwitchPlayerViewInRadar plugin has been loaded!"); } public static void SetAsset(string previousCam, string nextCam) { Asset = InputActionAsset.FromJson("\r\n {\r\n \"maps\" : [\r\n {\r\n \"name\" : \"FastSwitchPlayerViewInRadar\",\r\n \"actions\": [\r\n {\"name\": \"Previous Cam\", \"type\" : \"button\"},\r\n {\"name\": \"Next Cam\", \"type\" : \"button\"}\r\n ],\r\n \"bindings\" : [\r\n {\"path\" : \"" + previousCam + "\", \"action\": \"Previous Cam\"},\r\n {\"path\" : \"" + nextCam + "\", \"action\": \"Next Cam\"}\r\n ]\r\n }\r\n ]\r\n }"); } } public static class PluginStaticInfo { public const string PLUGIN_GUID = "krystall9.FastSwitchPlayerViewInRadar"; public const string PLUGIN_NAME = "FastSwitchPlayerViewInRadar"; public const string PLUGIN_VERSION = "1.3.1"; } public static class PluginInfo { public const string PLUGIN_GUID = "LethalCompanyMonitorMod"; public const string PLUGIN_NAME = "LethalCompanyMonitorMod"; public const string PLUGIN_VERSION = "1.3.1"; } } namespace LethalCompanyMonitorMod.Patch { [HarmonyPatch(typeof(IngamePlayerSettings))] public class IngamePlayerSettingsPatch { [HarmonyPatch("CompleteRebind")] [HarmonyPrefix] public static void Rebind(IngamePlayerSettings __instance) { //IL_005b: 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_00c1: 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) string name = __instance.rebindingOperation.action.name; Plugin.Log.LogInfo((object)("Method - Rebind | Rebinding " + name)); if (!(name == "Previous Cam")) { if (name == "Next Cam") { string text = File.ReadAllText(Plugin.keyMappingPath); string contents = text.Trim().Split('\n')[0] + "\n" + __instance.rebindingOperation.action.controls[0].path; File.WriteAllText(Plugin.keyMappingPath, contents); } } else { string text = File.ReadAllText(Plugin.keyMappingPath); string contents = __instance.rebindingOperation.action.controls[0].path + "\n" + text.Trim().Split('\n')[1]; File.WriteAllText(Plugin.keyMappingPath, contents); } if (File.Exists(Plugin.keyMappingPath)) { string text = File.ReadAllText(Plugin.keyMappingPath); string previousCam = text.Trim().Split('\n')[0]; string nextCam = text.Trim().Split('\n')[1]; Plugin.SetAsset(previousCam, nextCam); } else { Plugin.SetAsset(Plugin.defaultKeys["Previous Cam"], Plugin.defaultKeys["Next Cam"]); } } } [HarmonyPatch(typeof(KepRemapPanel))] public class KeyRemapPanelPatch { [HarmonyPatch("LoadKeybindsUI")] [HarmonyPrefix] public static void LoadBindings(ref KepRemapPanel __instance) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown List<string> list = new List<string>(); if (!File.Exists(Plugin.keyMappingPath)) { string contents = Plugin.defaultKeys["Previous Cam"] + "\n" + Plugin.defaultKeys["Next Cam"]; File.WriteAllText(Plugin.keyMappingPath, contents); } else { string contents = File.ReadAllText(Plugin.keyMappingPath); list = contents.Trim().Split('\n').ToList(); } foreach (RemappableKey remappableKey in __instance.remappableKeys) { if (remappableKey.ControlName == "Radar Previous Cam" || remappableKey.ControlName == "Radar Next Cam") { return; } } if (list.Count > 0) { Plugin.SetAsset(list[0], list[1]); } else { Plugin.SetAsset(Plugin.defaultKeys["Previous Cam"], Plugin.defaultKeys["Next Cam"]); } foreach (KeyValuePair<string, string> defaultKey in Plugin.defaultKeys) { RemappableKey val = new RemappableKey(); Plugin.Log.LogInfo((object)("Method - LoadBindings | Loading Keybindings for " + defaultKey.Key)); string key = defaultKey.Key; if (!(key == "Previous Cam")) { if (key == "Next Cam") { InputActionReference currentInput = InputActionReference.Create(Plugin.Asset.FindAction(defaultKey.Key, false)); val.ControlName = "Radar Next Cam"; val.currentInput = currentInput; } } else { InputActionReference currentInput = InputActionReference.Create(Plugin.Asset.FindAction(defaultKey.Key, false)); val.ControlName = "Radar Previous Cam"; val.currentInput = currentInput; } __instance.remappableKeys.Add(val); } } } [HarmonyPatch(typeof(RadarBoosterItem))] public class RadarBoosterPatch { [HarmonyPatch("RemoveBoosterFromRadar")] [HarmonyPostfix] public static void RemovingUnusedRadar(ref RadarBoosterItem __instance) { ManualCameraRenderer mapScreen = Object.FindObjectOfType<StartOfRound>().mapScreen; Plugin.Log.LogInfo((object)("Method - RemovingUnusedRadar | Current cam target name: " + __instance.radarBoosterName)); Plugin.Log.LogInfo((object)("Method - RemovingUnusedRadar | " + __instance.radarBoosterName + " removed")); Plugin.Log.LogInfo((object)"Method - RemovingUnusedRadar | Updating camera target"); for (int i = 0; i < mapScreen.radarTargets.Count; i++) { if (mapScreen.radarTargets.Count <= Plugin.CurrentlyViewingPlayer || mapScreen.radarTargets[Plugin.CurrentlyViewingPlayer] == null) { Plugin.CurrentlyViewingPlayer = i; continue; } mapScreen.SwitchRadarTargetAndSync(Plugin.CurrentlyViewingPlayer); Plugin.Log.LogInfo((object)("Method - RemovingUnusedRadar | Currently targeting " + mapScreen.radarTargets[Plugin.CurrentlyViewingPlayer].name)); break; } } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { [HarmonyPatch("ParsePlayerSentence")] [HarmonyPostfix] private static void HandleSentence(Terminal __instance, TerminalNode __result) { if (__instance.terminalInUse && !Plugin.ViewMonitorSubmitted && string.Compare(((Object)__result).name, "ViewInsideShipCam 1", ignoreCase: true) == 0) { Plugin.ViewMonitorSubmitted = true; } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void HandleTerminalCameraNode(Terminal __instance) { if (!__instance.terminalInUse) { return; } List<string> list = new List<string>(); if (File.Exists(Plugin.keyMappingPath)) { list = File.ReadAllText(Plugin.keyMappingPath).Trim().Split('\n') .ToList(); } if ((Object)(object)Plugin.Asset == (Object)null || !Plugin.Asset.enabled) { if ((Object)(object)Plugin.Asset == (Object)null) { Plugin.Log.LogInfo((object)"Method - HandleTerminalCameraNode | InputActionAsset not yet created"); if (File.Exists(Plugin.keyMappingPath)) { Plugin.SetAsset(list[0], list[1]); } else { Plugin.SetAsset(Plugin.defaultKeys["Previous Cam"], Plugin.defaultKeys["Next Cam"]); } Plugin.Log.LogInfo((object)"Method - HandleTerminalCameraNode | InputActionAsset created successfully"); } if ((Object)(object)Plugin.Asset != (Object)null) { Plugin.Log.LogInfo((object)"Method - HandleTerminalCameraNode | InputActionAsset not yet enabled"); Plugin.Asset.Enable(); Plugin.Log.LogInfo((object)"Method - HandleTerminalCameraNode | InputActionAsset enabled successfully"); } } if (!Plugin.ViewMonitorSubmitted) { return; } try { InputAction val = ((IEnumerable<InputAction>)Plugin.Asset).Where((InputAction x) => x.WasPressedThisFrame()).FirstOrDefault(); if (val == null && val == null) { return; } int num = Plugin.CurrentlyViewingPlayer; ManualCameraRenderer mapScreen = Object.FindObjectOfType<StartOfRound>().mapScreen; int count = mapScreen.radarTargets.Count; Plugin.Log.LogInfo((object)$"Method - HandleTerminalCameraNode | Currently Max Spectable Players: {count}"); PlayerControllerB val2 = null; RadarBoosterItem val3 = null; for (int i = 0; i < mapScreen.radarTargets.Count; i++) { string name = val.name; if (!(name == "Previous Cam")) { if (name == "Next Cam") { num = GetRadarTargetIndex(num, mapScreen.radarTargets.Count, isIndexPlusOne: true); Plugin.Log.LogInfo((object)$"Method - HandleTerminalCameraNode | Current Index: {num}"); } } else { num = GetRadarTargetIndex(num, mapScreen.radarTargets.Count); Plugin.Log.LogInfo((object)$"Method - HandleTerminalCameraNode | Current Index: {num}"); } if (mapScreen.radarTargets[num] == null) { Plugin.Log.LogInfo((object)$"Method - HandleTerminalCameraNode | The player at the Index: {num} cannot be spectated. Getting the next player"); continue; } GameObject gameObject = ((Component)mapScreen.radarTargets[num].transform).gameObject; gameObject.TryGetComponent<PlayerControllerB>(ref val2); if ((Object)(object)val2 != (Object)null && (val2.isPlayerControlled || val2.isPlayerDead)) { break; } if ((Object)(object)val2 == (Object)null || !val2.isPlayerControlled) { gameObject.TryGetComponent<RadarBoosterItem>(ref val3); if ((Object)(object)val3 != (Object)null && val3.radarEnabled) { break; } } } if (count > num && mapScreen.radarTargets[num] != null) { string text = ""; text = ((!((Object)(object)val3 != (Object)null)) ? val2.playerUsername : val3.radarBoosterName); Plugin.Log.LogInfo((object)("Method - HandleTerminalCameraNode | Switching cam to " + text)); mapScreen.SwitchRadarTargetAndSync(num); } Plugin.CurrentlyViewingPlayer = num; val2 = null; val3 = null; } catch (Exception ex) { Plugin.Log.LogInfo((object)("Method - HandleTerminalCameraNode| Error: " + ex.Message)); } } public static int GetRadarTargetIndex(int index, int loopableItemsCount, bool isIndexPlusOne = false) { if (isIndexPlusOne) { return (index < loopableItemsCount - 1) ? (index + 1) : 0; } return (index > 0) ? (index - 1) : (loopableItemsCount - 1); } } } namespace LethalCompanyMonitorMod.ConfigModel { public class ConfigModel<T> { public T DefaultValue { get; set; } public string Description { get; set; } public string Key { get; set; } public string Section { get; set; } public ConfigEntry<T> ConfigEntry { get; set; } public ConfigModel(T defaultValue, string description, string key, string section) { DefaultValue = defaultValue; Description = description; Key = key; Section = section; } } }
BepInEx/plugins/LethalPresents.dll
Decompiled 2 years 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 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: AssemblyCompany("LethalPresents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("LethalPresents mod")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3")] [assembly: AssemblyProduct("LethalPresents")] [assembly: AssemblyTitle("LethalPresents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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.3")] public class LethalPresentsPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalPresents"); private static bool isHost; private static SelectableLevel currentLevel; 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 void Awake() { mls = Logger.CreateLogSource("LethalPresents"); mls.LogInfo((object)"Plugin LethalPresents is loaded!"); loadConfig(); harmony.PatchAll(typeof(LethalPresentsPlugin)); } 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 [WIP]").Value; ShouldSpawnTurrets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShouldSpawnTurrets", true, "Add turrets to the spawn pool [WIP]").Value; } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] private static void setIsHost() { isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel) { currentLevel = ___currentLevel; 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 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(e.enemyType.enemyName) ? IsAllowlist : (!IsAllowlist)).ToList(); List<SpawnableEnemyWithRarity> list2 = currentLevel.OutsideEnemies.Where((SpawnableEnemyWithRarity e) => disabledEnemies.Contains(e.enemyType.enemyName) ? 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); } [HarmonyPatch(typeof(GiftBoxItem), "OpenGiftBoxServerRpc")] [HarmonyPrefix] private static void spawnRandomEntity(GiftBoxItem __instance) { //IL_00ef: 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)__instance).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } int value = Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue<int>(); mls.LogInfo((object)("IsServer:" + networkManager.IsServer + " IsHost:" + networkManager.IsHost + " __rpc_exec_stage:" + value)); if (value == 1 && isHost) { int num = Random.Range(1, 100); mls.LogInfo((object)("Player's fortune:" + num)); if (num < spawnChance) { chooseAndSpawnEnemy(((GrabbableObject)__instance).isInFactory, ((Component)__instance).transform.position, ((Component)Traverse.Create((object)__instance).Field("previousPlayerHeldBy").GetValue<PlayerControllerB>()).transform.position); } } } 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.3"; } }
BepInEx/plugins/Mimics.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyMimics.Properties; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Mimics")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that adds mimics to Lethal Company")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0")] [assembly: AssemblyProduct("Mimics")] [assembly: AssemblyTitle("Mimics")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.0.0")] [module: UnverifiableCode] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace LethalCompanyMimics.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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("LethalCompanyMimics.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[] mimicdoor { get { object @object = ResourceManager.GetObject("mimicdoor", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace Mimics { [BepInPlugin("x753.Mimics", "Mimics", "2.3.0")] public class Mimics : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(MimicNetworkerPrefab); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartOfRound __instance) { //IL_010d: 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_011d: 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_012c: Expected O, but got Unknown //IL_013b: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown if (((NetworkBehaviour)__instance).IsServer && (Object)(object)MimicNetworker.Instance == (Object)null) { GameObject val = Object.Instantiate<GameObject>(MimicNetworkerPrefab); val.GetComponent<NetworkObject>().Spawn(true); MimicNetworker.SpawnWeight0.Value = SpawnRates[0]; MimicNetworker.SpawnWeight1.Value = SpawnRates[1]; MimicNetworker.SpawnWeight2.Value = SpawnRates[2]; MimicNetworker.SpawnWeight3.Value = SpawnRates[3]; MimicNetworker.SpawnWeight4.Value = SpawnRates[4]; MimicNetworker.SpawnWeightMax.Value = SpawnRates[5]; MimicNetworker.SpawnRateDynamic.Value = DynamicSpawnRate; Terminal val2 = Object.FindObjectOfType<Terminal>(); MimicCreatureID = val2.enemyFiles.Count; MimicFile.creatureFileID = MimicCreatureID; val2.enemyFiles.Add(MimicFile); TerminalKeyword val3 = val2.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val4 = new TerminalKeyword { word = "mimics", isVerb = false, defaultVerb = val3 }; List<CompatibleNoun> list = val3.compatibleNouns.ToList(); list.Add(new CompatibleNoun { noun = val4, result = MimicFile }); val3.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val2.terminalNodes.allKeywords.ToList(); list2.Add(val4); val2.terminalNodes.allKeywords = list2.ToArray(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SetExitIDs")] [HarmonyPostfix] private static void SetExitIDsPatch(ref RoundManager __instance, Vector3 mainEntrancePosition) { //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_0299: 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_02ac: 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_055c: Unknown result type (might be due to invalid IL or missing references) //IL_055e: 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_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: 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_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_032f: 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_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: 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) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040e: 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_0421: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Expected O, but got Unknown //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_0979: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) MimicDoor.allMimics = new List<MimicDoor>(); int num = 0; Dungeon currentDungeon = __instance.dungeonGenerator.Generator.CurrentDungeon; if (!((Object)currentDungeon.DungeonFlow).name.StartsWith("Level1") && !((Object)currentDungeon.DungeonFlow).name.StartsWith("Level2")) { return; } int num2 = 0; int[] array = new int[6] { MimicNetworker.SpawnWeight0.Value, MimicNetworker.SpawnWeight1.Value, MimicNetworker.SpawnWeight2.Value, MimicNetworker.SpawnWeight3.Value, MimicNetworker.SpawnWeight4.Value, MimicNetworker.SpawnWeightMax.Value }; int num3 = 0; int[] array2 = array; foreach (int num4 in array2) { num3 += num4; } Random random = new Random(StartOfRound.Instance.randomMapSeed + 753); int num5 = random.Next(0, num3); int num6 = 0; for (int j = 0; j < array.Length; j++) { if (num5 < array[j] + num6) { num2 = j; break; } num6 += array[j]; } if (num2 == 5) { num2 = 999; } EntranceTeleport[] array3 = Object.FindObjectsOfType<EntranceTeleport>(false); int num7 = (array3.Length - 2) / 2; if (MimicNetworker.SpawnRateDynamic.Value && num2 < num7 && num7 > 1) { num2 += random.Next(0, 2); } if (MimicNetworker.SpawnRateDynamic.Value && currentDungeon.AllTiles.Count > 100) { num2 += random.Next(0, 2); } List<Doorway> list = new List<Doorway>(); Bounds val2 = default(Bounds); foreach (Tile allTile in currentDungeon.AllTiles) { foreach (Doorway unusedDoorway in allTile.UnusedDoorways) { if (unusedDoorway.HasDoorPrefabInstance || (Object)(object)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true) == (Object)null) { continue; } GameObject gameObject = ((Component)((Component)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; if (!((Object)gameObject).name.StartsWith("AlleyExitDoorContainer") || gameObject.activeSelf) { continue; } bool flag = false; Matrix4x4 val = Matrix4x4.TRS(((Component)unusedDoorway).transform.position, ((Component)unusedDoorway).transform.rotation, new Vector3(1f, 1f, 1f)); ((Bounds)(ref val2))..ctor(new Vector3(0f, 1.5f, 5.5f), new Vector3(2f, 6f, 8f)); ((Bounds)(ref val2)).center = ((Matrix4x4)(ref val)).MultiplyPoint3x4(((Bounds)(ref val2)).center); Collider[] array4 = Physics.OverlapBox(((Bounds)(ref val2)).center, ((Bounds)(ref val2)).extents, ((Component)unusedDoorway).transform.rotation, LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" })); Collider[] array5 = array4; int num8 = 0; if (num8 < array5.Length) { Collider val3 = array5[num8]; flag = true; } if (flag) { continue; } foreach (Tile allTile2 in currentDungeon.AllTiles) { if (!((Object)(object)allTile == (Object)(object)allTile2)) { Vector3 origin = ((Component)unusedDoorway).transform.position + 5f * ((Component)unusedDoorway).transform.forward; Bounds val4 = UnityUtil.CalculateProxyBounds(((Component)allTile2).gameObject, true, Vector3.up); Ray val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.up; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("Catwalk") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || (((Object)allTile2).name.Contains("StartRoom") && !((Object)allTile2).name.Contains("Manor")))) { flag = true; } val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.down; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("MediumRoomHallway1B") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || ((Object)allTile2).name.Contains("StartRoom"))) { flag = true; } } } if (!flag) { list.Add(unusedDoorway); } } } Shuffle(list, StartOfRound.Instance.randomMapSeed); List<Vector3> list2 = new List<Vector3>(); foreach (Doorway item in list) { if (num >= num2) { break; } bool flag2 = false; Vector3 val6 = ((Component)item).transform.position + 5f * ((Component)item).transform.forward; foreach (Vector3 item2 in list2) { if (Vector3.Distance(val6, item2) < 4f) { flag2 = true; break; } } if (flag2) { continue; } list2.Add(val6); GameObject gameObject2 = ((Component)((Component)((Component)item).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; GameObject val7 = Object.Instantiate<GameObject>(MimicPrefab, ((Component)item).transform); val7.transform.position = gameObject2.transform.position; MimicDoor component = val7.GetComponent<MimicDoor>(); component.scanNode.creatureScanID = MimicCreatureID; AudioSource[] componentsInChildren = val7.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val8 in componentsInChildren) { val8.volume = MimicVolume / 100f; val8.outputAudioMixerGroup = StartOfRound.Instance.ship3DAudio.outputAudioMixerGroup; } if (SpawnRates[5] == 9753 && num == 0) { val7.transform.position = new Vector3(-7f, 0f, -10f); } MimicDoor.allMimics.Add(component); component.mimicIndex = num; num++; GameObject gameObject3 = ((Component)((Component)item).transform.GetChild(0)).gameObject; gameObject3.SetActive(false); Bounds bounds = ((Collider)component.frameBox).bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = ((Collider)component.frameBox).bounds; Collider[] array6 = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, Quaternion.identity); foreach (Collider val9 in array6) { if (((Object)((Component)val9).gameObject).name.Contains("Shelf")) { ((Component)val9).gameObject.SetActive(false); } } Light componentInChildren = gameObject2.GetComponentInChildren<Light>(true); ((Component)componentInChildren).transform.parent.SetParent(val7.transform); MeshRenderer[] componentsInChildren2 = val7.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array7 = componentsInChildren2; foreach (MeshRenderer val10 in array7) { Material[] materials = ((Renderer)val10).materials; foreach (Material val11 in materials) { val11.shader = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.shader; val11.renderQueue = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.renderQueue; } } component.interactTrigger.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)component.interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)component.TouchMimic); if (MimicPerfection) { continue; } component.interactTrigger.timeToHold = 0.9f; if (!ColorBlindMode) { if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.490566f, 0.1226415f, 0.1302275f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.4339623f, 0.1043965f, 0.1150277f); componentInChildren.colorTemperature = 1250f; } else { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.5f, 0.1580188f, 0.1657038f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(43f / 106f, 0.1358579f, 0.1393619f); componentInChildren.colorTemperature = 1300f; } } else if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { component.interactTrigger.timeToHold = 1.1f; } else { component.interactTrigger.timeToHold = 1f; } if (!EasyMode) { continue; } Random random2 = new Random(StartOfRound.Instance.randomMapSeed + num); switch (random2.Next(0, 4)) { case 0: if (!ColorBlindMode) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); } else { component.interactTrigger.timeToHold = 1.5f; } break; case 1: component.interactTrigger.hoverTip = "Feed : [LMB]"; component.interactTrigger.holdTip = "Feed : [LMB]"; break; case 2: component.interactTrigger.hoverIcon = component.LostFingersIcon; break; case 3: component.interactTrigger.holdTip = "DIE : [LMB]"; component.interactTrigger.timeToHold = 0.5f; break; default: component.interactTrigger.hoverTip = "BUG, REPORT TO DEVELOPER"; break; } } } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { private static FieldInfo SprayHit = typeof(SprayPaintItem).GetField("sprayHit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("SprayPaintClientRpc")] [HarmonyPostfix] private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot) { //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) RaycastHit val = (RaycastHit)SprayHit.GetValue(__instance); if ((Object)(object)((RaycastHit)(ref val)).collider != (Object)null && ((Object)((RaycastHit)(ref val)).collider).name == "MimicSprayCollider") { MimicDoor component = ((Component)((Component)((RaycastHit)(ref val)).collider).transform.parent.parent).GetComponent<MimicDoor>(); component.sprayCount++; if (component.sprayCount > 9) { MimicNetworker.Instance.MimicAddAnger(1, component.mimicIndex); } } } } [HarmonyPatch(typeof(LockPicker))] internal class LockPickerPatch { private static FieldInfo RayHit = typeof(LockPicker).GetField("hit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void ItemActivatePatch(LockPicker __instance, bool used, bool buttonDown = true) { //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) //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) RaycastHit val = (RaycastHit)RayHit.GetValue(__instance); if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((object)(RaycastHit)(ref val)).Equals((object)default(RaycastHit)) && !((Object)(object)((RaycastHit)(ref val)).transform.parent == (Object)null)) { Transform parent = ((RaycastHit)(ref val)).transform.parent; if (((Object)parent).name.StartsWith("MimicDoor")) { MimicNetworker.Instance.MimicLockPick(__instance, ((Component)parent).GetComponent<MimicDoor>().mimicIndex); } } } } private const string modGUID = "x753.Mimics"; private const string modName = "Mimics"; private const string modVersion = "2.3.0"; private readonly Harmony harmony = new Harmony("x753.Mimics"); private static Mimics Instance; public static GameObject MimicPrefab; public static GameObject MimicNetworkerPrefab; public static TerminalNode MimicFile; public static int MimicCreatureID; public static int[] SpawnRates; public static bool MimicPerfection; public static bool EasyMode; public static bool ColorBlindMode; public static float MimicVolume; public static bool DynamicSpawnRate; private void Awake() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.mimicdoor); MimicPrefab = val.LoadAsset<GameObject>("Assets/MimicDoor.prefab"); MimicNetworkerPrefab = val.LoadAsset<GameObject>("Assets/MimicNetworker.prefab"); MimicFile = val.LoadAsset<TerminalNode>("Assets/MimicFile.asset"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Mimics is loaded!"); SpawnRates = new int[6] { ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Zero Mimics", 23, "Weight of zero mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "One Mimic", 69, "Weight of one mimic spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Two Mimics", 7, "Weight of two mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Three Mimics", 1, "Weight of three mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Four Mimics", 0, "Weight of four mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Mimics", 0, "Weight of maximum mimics spawning").Value }; DynamicSpawnRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn Rate", "Dynamic Spawn Rate", true, "Increases mimic spawn rate based on dungeon size and the number of instances of the real thing.").Value; MimicPerfection = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Perfect Mimics", false, "Select this if you want mimics to be the exact same color as the real thing. Overrides all difficulty settings.").Value; EasyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Easy Mode", false, "Each mimic will have one of several possible imperfections to help you tell if it's a mimic.").Value; ColorBlindMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Color Blind Mode", false, "Replaces all color differences with another way to differentiate mimics.").Value; MimicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SFX Volume", 100, "Volume of the mimic's SFX (0-100)").Value; if (MimicVolume < 0f) { MimicVolume = 0f; } if (MimicVolume > 100f) { MimicVolume = 100f; } ((BaseUnityPlugin)this).Config.Bind<int>("Difficulty", "Difficulty Level", 0, "This is an old setting, ignore it."); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Difficulty", "Difficulty Level"].Definition); ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Five Mimics", 0, "This is an old setting, ignore it."); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Spawn Rate", "Five Mimics"].Definition); ((BaseUnityPlugin)this).Config.Save(); 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 void Shuffle<T>(IList<T> list, int seed) { Random random = new Random(seed); int num = list.Count; while (num > 1) { num--; int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public class MimicNetworker : NetworkBehaviour { public static MimicNetworker Instance; public static NetworkVariable<int> SpawnWeight0 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight1 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight2 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight3 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight4 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeightMax = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<bool> SpawnRateDynamic = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private void Awake() { Instance = this; } public void MimicAttack(int playerId, int mimicIndex, bool ownerOnly = false) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicAttackServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicAttackClientRpc(int playerId, int mimicIndex) { //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(2885019175u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2885019175u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].Attack(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAttackServerRpc(int playerId, int mimicIndex) { //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(1024971481u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1024971481u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } } } public void MimicAddAnger(int amount, int mimicIndex) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } else { Instance.MimicAddAngerServerRpc(amount, mimicIndex); } } [ClientRpc] public void MimicAddAngerClientRpc(int amount, int mimicIndex) { //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(1137632670u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1137632670u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].AddAnger(amount)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAddAngerServerRpc(int amount, int mimicIndex) { //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(669208889u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 669208889u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } } } public void MimicLockPick(LockPicker lockPicker, int mimicIndex, bool ownerOnly = false) { int playerId = (int)((GrabbableObject)lockPicker).playerHeldBy.playerClientId; if (((NetworkBehaviour)this).IsOwner) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicLockPickServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicLockPickClientRpc(int playerId, int mimicIndex) { //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(3716888238u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3716888238u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].MimicLockPick(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicLockPickServerRpc(int playerId, int mimicIndex) { //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(1897916243u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1897916243u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } } } protected override void __initializeVariables() { if (SpawnWeight0 == null) { throw new Exception("MimicNetworker.SpawnWeight0 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight0).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight0, "SpawnWeight0"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight0); if (SpawnWeight1 == null) { throw new Exception("MimicNetworker.SpawnWeight1 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight1).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight1, "SpawnWeight1"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight1); if (SpawnWeight2 == null) { throw new Exception("MimicNetworker.SpawnWeight2 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight2).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight2, "SpawnWeight2"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight2); if (SpawnWeight3 == null) { throw new Exception("MimicNetworker.SpawnWeight3 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight3).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight3, "SpawnWeight3"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight3); if (SpawnWeight4 == null) { throw new Exception("MimicNetworker.SpawnWeight4 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight4).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight4, "SpawnWeight4"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight4); if (SpawnWeightMax == null) { throw new Exception("MimicNetworker.SpawnWeightMax cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeightMax).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeightMax, "SpawnWeightMax"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeightMax); if (SpawnRateDynamic == null) { throw new Exception("MimicNetworker.SpawnRateDynamic cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnRateDynamic).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnRateDynamic, "SpawnRateDynamic"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnRateDynamic); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MimicNetworker() { //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(2885019175u, new RpcReceiveHandler(__rpc_handler_2885019175)); NetworkManager.__rpc_func_table.Add(1024971481u, new RpcReceiveHandler(__rpc_handler_1024971481)); NetworkManager.__rpc_func_table.Add(1137632670u, new RpcReceiveHandler(__rpc_handler_1137632670)); NetworkManager.__rpc_func_table.Add(669208889u, new RpcReceiveHandler(__rpc_handler_669208889)); NetworkManager.__rpc_func_table.Add(3716888238u, new RpcReceiveHandler(__rpc_handler_3716888238)); NetworkManager.__rpc_func_table.Add(1897916243u, new RpcReceiveHandler(__rpc_handler_1897916243)); } private static void __rpc_handler_2885019175(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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAttackClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1024971481(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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAttackServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1137632670(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) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAddAngerClientRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_669208889(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) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAddAngerServerRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3716888238(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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicLockPickClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1897916243(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) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicLockPickServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MimicNetworker"; } } public class MimicDoor : MonoBehaviour { public GameObject playerTarget; public BoxCollider frameBox; public Sprite LostFingersIcon; public Animator mimicAnimator; public GameObject grabPoint; public InteractTrigger interactTrigger; public ScanNodeProperties scanNode; public int anger; public bool angering; public int sprayCount; private bool attacking; public static List<MimicDoor> allMimics; public int mimicIndex; private static MethodInfo RetractClaws = typeof(LockPicker).GetMethod("RetractClaws", BindingFlags.Instance | BindingFlags.NonPublic); public void TouchMimic(PlayerControllerB player) { if (!attacking) { MimicNetworker.Instance.MimicAttack((int)player.playerClientId, mimicIndex); } } public IEnumerator Attack(int playerId) { attacking = true; interactTrigger.interactable = false; PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId]; mimicAnimator.SetTrigger("Attack"); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)frameBox).transform.position); if (num < 8f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } yield return (object)new WaitForSeconds(0.2f); if (((NetworkBehaviour)player).IsOwner && Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position) < 8.75f) { player.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 4f)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = grabPoint.transform; player.deadBody.attachedLimb = player.deadBody.bodyParts[5]; player.deadBody.matchPositionExactly = true; for (int i = 0; i < player.deadBody.bodyParts.Length; i++) { ((Component)player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1); } } yield return (object)new WaitForSeconds(2f); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = null; player.deadBody.attachedLimb = null; player.deadBody.matchPositionExactly = false; ((Component)((Component)player.deadBody).transform.GetChild(0)).gameObject.SetActive(false); player.deadBody = null; } yield return (object)new WaitForSeconds(4.5f); attacking = false; interactTrigger.interactable = true; } public IEnumerator MimicLockPick(int playerId) { if (angering || attacking) { yield break; } LockPicker lockPicker = default(LockPicker); ref LockPicker reference = ref lockPicker; GrabbableObject currentlyHeldObjectServer = StartOfRound.Instance.allPlayerScripts[playerId].currentlyHeldObjectServer; reference = (LockPicker)(object)((currentlyHeldObjectServer is LockPicker) ? currentlyHeldObjectServer : null); if ((Object)(object)lockPicker == (Object)null) { yield break; } attacking = true; interactTrigger.interactable = false; AudioSource component = ((Component)lockPicker).GetComponent<AudioSource>(); component.PlayOneShot(lockPicker.placeLockPickerClips[Random.Range(0, lockPicker.placeLockPickerClips.Length)]); lockPicker.armsAnimator.SetBool("mounted", true); lockPicker.armsAnimator.SetBool("picking", true); component.Play(); component.pitch = Random.Range(0.94f, 1.06f); lockPicker.isOnDoor = true; lockPicker.isPickingLock = true; ((GrabbableObject)lockPicker).grabbable = false; if (((NetworkBehaviour)lockPicker).IsOwner) { ((GrabbableObject)lockPicker).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)MimicNetworker.Instance).NetworkObject, ((Component)this).transform.position + ((Component)this).transform.up * 1.5f - ((Component)this).transform.forward * 1.15f, true); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => !((GrabbableObject)lockPicker).isHeld || Time.timeSinceLevelLoad - startTime > 10f)); ((Component)lockPicker).transform.localEulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, ((Component)this).transform.eulerAngles.y + 90f, ((Component)this).transform.eulerAngles.z); yield return (object)new WaitForSeconds(5f); RetractClaws.Invoke(lockPicker, null); ((Component)lockPicker).transform.SetParent((Transform)null); ((GrabbableObject)lockPicker).startFallingPosition = ((Component)lockPicker).transform.position; ((GrabbableObject)lockPicker).FallToGround(false); ((GrabbableObject)lockPicker).grabbable = true; yield return (object)new WaitForSeconds(1f); anger = 3; attacking = false; interactTrigger.interactable = false; PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } else { interactTrigger.interactable = true; } } public IEnumerator AddAnger(int amount) { if (angering || attacking) { yield break; } angering = true; anger += amount; if (anger == 1) { Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger == 2) { interactTrigger.holdTip = "DIE : [LMB]"; interactTrigger.timeToHold = 0.25f; Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger > 2) { PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } } sprayCount = 0; angering = false; } } public class MimicCollider : MonoBehaviour, IHittable { public MimicDoor mimic; void IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { MimicNetworker.Instance.MimicAddAnger(force, mimic.mimicIndex); } } public class MimicListener : MonoBehaviour, INoiseListener { public MimicDoor mimic; private int tolerance = 100; void INoiseListener.DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //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) if ((noiseLoudness >= 0.9f || noiseID == 101158) && Vector3.Distance(noisePosition, ((Component)mimic).transform.position) < 5f) { switch (noiseID) { case 75: tolerance--; break; case 5: tolerance -= 15; break; case 101158: tolerance -= 35; break; default: tolerance -= 30; break; } if (tolerance <= 0) { tolerance = 100; MimicNetworker.Instance.MimicAddAnger(1, mimic.mimicIndex); } } } } }
BepInEx/plugins/MoreBlood.dll
Decompiled 2 years 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."); } } }
BepInEx/plugins/MoreItems.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreItems.Patches; [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("MoreItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreItems")] [assembly: AssemblyTitle("MoreItems")] [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 MoreItems { [BepInPlugin("MoreItems", "MoreItems", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("MoreItems"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreItems is loaded!"); harmony.PatchAll(typeof(StartOfRoundPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "MoreItems"; public const string PLUGIN_NAME = "MoreItems"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MoreItems.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private const int newMaxItemCapacity = 999; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void IncreaseShipItemCapacity(ref int ___maxShipItemCapacity) { ___maxShipItemCapacity = 999; Logger.CreateLogSource("MoreItems").LogInfo((object)$"Maximum amount of items that can be saved set to {999}."); } } }
BepInEx/plugins/MoreSuits.dll
Decompiled 2 years 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; } }
BepInEx/plugins/QuickRestart.dll
Decompiled 2 years 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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; [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("QuickRestart")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a395cfe8aac0ee2687d75817f75fae451f729511")] [assembly: AssemblyProduct("QuickRestart")] [assembly: AssemblyTitle("QuickRestart")] [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 QuickRestart { [BepInPlugin("QuickRestart", "QuickRestart", "1.0.0")] public class Plugin : BaseUnityPlugin { public static bool verifying; private ConfigEntry<bool> overrideConfirmation; public static bool bypassConfirm; private Harmony harmony; private static MethodInfo chat; private void Awake() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown overrideConfirmation = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Override Confirmation", false, "Ignore the confirmation step of restarting."); bypassConfirm = overrideConfirmation.Value; harmony = new Harmony("QuickRestart"); harmony.PatchAll(); chat = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"QuickRestart loaded!"); } public static void SendChatMessage(string message) { chat?.Invoke(HUDManager.Instance, new object[2] { message, "" }); HUDManager.Instance.lastChatMessage = ""; } public static void ConfirmRestart() { verifying = true; SendChatMessage("Are you sure? Type CONFIRM or DENY."); } public static void AcceptRestart(StartOfRound manager) { SendChatMessage("Restart confirmed."); verifying = false; int[] array = new int[4] { manager.gameStats.daysSpent, manager.gameStats.scrapValueCollected, manager.gameStats.deaths, manager.gameStats.allStepsTaken }; manager.FirePlayersAfterDeadlineClientRpc(array, false); } public static void DeclineRestart() { SendChatMessage("Restart aborted."); verifying = false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "QuickRestart"; public const string PLUGIN_NAME = "QuickRestart"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace QuickRestart.Patches { [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public class SubmitChat { private static bool Prefix(HUDManager __instance, ref CallbackContext context) { if (!((CallbackContext)(ref context)).performed) { return true; } if (string.IsNullOrEmpty(__instance.chatTextField.text)) { return true; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return true; } StartOfRound playersManager = localPlayerController.playersManager; if ((Object)(object)playersManager == (Object)null) { return true; } string text = __instance.chatTextField.text; if (Plugin.verifying) { if (text.ToLower() == "confirm") { ResetTextbox(__instance, localPlayerController); if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel) { Plugin.SendChatMessage("Cannot restart, ship must be in orbit."); return false; } Plugin.AcceptRestart(playersManager); return false; } if (text.ToLower() == "deny") { ResetTextbox(__instance, localPlayerController); Plugin.DeclineRestart(); return false; } return true; } if (text == "/restart") { ResetTextbox(__instance, localPlayerController); if (!GameNetworkManager.Instance.isHostingGame) { Plugin.SendChatMessage("Only the host can restart."); return false; } if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel) { Plugin.SendChatMessage("Cannot restart, ship must be in orbit."); return false; } if (Plugin.bypassConfirm) { Plugin.AcceptRestart(playersManager); } else { Plugin.ConfirmRestart(); } return false; } return true; } private static void ResetTextbox(HUDManager manager, PlayerControllerB local) { local.isTypingChat = false; manager.chatTextField.text = ""; EventSystem.current.SetSelectedGameObject((GameObject)null); manager.PingHUDElement(manager.Chat, 2f, 1f, 0.2f); ((Behaviour)manager.typingIndicator).enabled = false; } } }
BepInEx/plugins/Ryokune.CompatibilityChecker.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using CompatibilityChecker.MonoBehaviours; using CompatibilityChecker.Netcode; using CompatibilityChecker.Patches; using CompatibilityChecker.Utils; using HarmonyLib; using Newtonsoft.Json; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Ryokune")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Lethal Company Library that lets you know which mods a modded server has.")] [assembly: AssemblyFileVersion("1.1.6.0")] [assembly: AssemblyInformationalVersion("1.1.6")] [assembly: AssemblyProduct("CompatibilityChecker")] [assembly: AssemblyTitle("Ryokune.CompatibilityChecker")] [assembly: AssemblyVersion("1.1.6.0")] namespace CompatibilityChecker { [BepInPlugin("Ryokune.CompatibilityChecker", "CompatibilityChecker", "1.1.6")] [BepInProcess("Lethal Company.exe")] public class ModNotifyBase : BaseUnityPlugin { public static ModNotifyBase instance; public static ManualLogSource Logger; private readonly Harmony harmony = new Harmony("Ryokune.CompatibilityChecker"); public static Dictionary<string, PluginInfo> ModList = new Dictionary<string, PluginInfo>(); public static string ModListString; public static string[] ModListArray; public static bool loadedMods; public static string seperator = "/@/"; public static string Text; public static TMP_InputField searchInputField; private static IEnumerator JoinLobby(SteamId lobbyId, SteamLobbyManager lobbyManager) { //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) bool found = false; Logger.LogWarning((object)"Getting Lobby"); Task<Lobby?> joinTask = SteamMatchmaking.JoinLobbyAsync(lobbyId); yield return (object)new WaitUntil((Func<bool>)(() => joinTask.IsCompleted)); if (joinTask.Result.HasValue) { Logger.LogWarning((object)"Getting Lobby Value"); Lobby lobby = joinTask.Result.Value; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref lobby)).GetData("vers"))) { LobbySlot.JoinLobbyAfterVerifying(lobby, ((Lobby)(ref lobby)).Id); found = true; Logger.LogWarning((object)"Success!"); } lobby = default(Lobby); } else { Logger.LogWarning((object)"Failed to join lobby."); } if (!found) { lobbyManager.LoadServerList(); } else if ((Object)(object)searchInputField != (Object)null) { searchInputField.text = ""; Text = ""; } } private static void OnEndEdit(string newValue) { //IL_001c: 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) Text = newValue; SteamLobbyManager val = Object.FindObjectOfType<SteamLobbyManager>(); if (ulong.TryParse(newValue, out var result)) { SteamId val2 = default(SteamId); val2.Value = result; CoroutineHandler.Instance.NewCoroutine(JoinLobby(SteamId.op_Implicit(result), val)); } else { val.LoadServerList(); } } private static IEnumerator displayCopied(TextMeshProUGUI textMesh) { string oldtext = ((TMP_Text)textMesh).text; if (GameNetworkManager.Instance.currentLobby.HasValue) { ((TMP_Text)textMesh).text = "(Copied to clipboard!)"; Lobby value = GameNetworkManager.Instance.currentLobby.Value; SteamId id2 = ((Lobby)(ref value)).Id; string id = (GUIUtility.systemCopyBuffer = ((object)(SteamId)(ref id2)).ToString()); Logger.LogWarning((object)("Lobby code copied to clipboard: " + id)); } else { ((TMP_Text)textMesh).text = "Can't get Lobby code!"; } yield return (object)new WaitForSeconds(1.2f); ((TMP_Text)textMesh).text = oldtext; } private static void sceneLoad(Scene sceneName, LoadSceneMode load) { //IL_0155: 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_0169: 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_01a9: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown if (((Scene)(ref sceneName)).name == "MainMenu") { GameObject val = GameObject.Find("/Canvas/MenuContainer/LobbyList/JoinCode"); if ((Object)(object)val != (Object)null) { try { GameObject val2 = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent); val2.SetActive(true); searchInputField = val2.GetComponent<TMP_InputField>(); ((Selectable)searchInputField).interactable = true; ((TMP_Text)((Component)searchInputField.placeholder).gameObject.GetComponent<TextMeshProUGUI>()).text = "Search or Enter a room code..."; searchInputField.onEndEdit = new SubmitEvent(); searchInputField.onEndTextSelection = new TextSelectionEvent(); searchInputField.onSubmit = new SubmitEvent(); ((UnityEvent<string>)(object)searchInputField.onSubmit).AddListener((UnityAction<string>)OnEndEdit); } catch (Exception ex) { Logger.LogError((object)ex); } } } else { if (!(((Scene)(ref sceneName)).name == "SampleSceneRelay")) { return; } GameObject val3 = GameObject.Find("/Systems/UI/Canvas/QuickMenu/MainButtons/Resume"); if ((Object)(object)val3 != (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(val3.gameObject, val3.transform.parent); RectTransform component = val4.GetComponent<RectTransform>(); component.anchoredPosition += new Vector2(0f, 182f); TextMeshProUGUI LobbyCodeTextMesh = val4.GetComponentInChildren<TextMeshProUGUI>(); ((TMP_Text)LobbyCodeTextMesh).text = "> Lobby Code"; Button component2 = val4.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { CoroutineHandler.Instance.NewCoroutine(displayCopied(LobbyCodeTextMesh)); }); } } } private void Awake() { SceneManager.sceneLoaded += sceneLoad; if ((Object)(object)instance == (Object)null) { instance = this; Logger = ((BaseUnityPlugin)this).Logger; } CoroutineHandler.Instance.NewCoroutine(ThunderstoreAPI.Initialize()); Logger.LogInfo((object)"Plugin Ryokune.CompatibilityChecker is loaded!"); Logger.LogInfo((object)"Modded servers with CompatibilityChecker will now notify you what mods are needed."); harmony.PatchAll(typeof(ModNotifyBase)); harmony.PatchAll(typeof(PlayerJoinNetcode)); harmony.PatchAll(typeof(SteamLobbyManagerPatch)); } public static IEnumerator InitializeModsCoroutine() { yield return (object)new WaitUntil((Func<bool>)(() => ThunderstoreAPI.Packages != null)); ModList = Chainloader.PluginInfos; StringBuilder messageBuilder = new StringBuilder(); MenuManager menuManager = Object.FindObjectOfType<MenuManager>(); PlayerJoinNetcode.old = ((((Component)((TMP_Text)menuManager.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta != Vector2.zero) ? ((Component)((TMP_Text)menuManager.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta : PlayerJoinNetcode.old); int i = 0; int count = ModList.Count(); menuManager.menuNotification.SetActive(true); foreach (PluginInfo info in ModList.Values) { i++; ((TMP_Text)menuManager.menuNotificationText).text = $"Loading mods {i}/{count}"; ((TMP_Text)menuManager.menuNotificationButtonText).text = null; ((Component)((TMP_Text)menuManager.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta = Vector2.zero; string noSpace = Regex.Replace(info.Metadata.Name, "[\\s\\-_]", ""); Package package = ThunderstoreAPI.GetPackage(noSpace, info); if (package != null) { Logger.LogInfo((object)$"[{info.Metadata.GUID}] Found package: {info.Metadata.Name}[{info.Metadata.Version}]\n\t\tDATA:\n\t\t--NAME: {package.FullName}\n\t\t--LINK: {package.PackageUrl}"); if (VersionUtil.ConvertToNumber(package.Versions[0].VersionNumber) > VersionUtil.ConvertToNumber(info.Metadata.Version.ToString())) { messageBuilder.AppendLine($"\n\t\t--Mod {info.Metadata.Name} [{info.Metadata.GUID}] v{info.Metadata.Version} does not equal the latest release!"); messageBuilder.AppendLine("\t\t--Latest version: v" + package.Versions[0].VersionNumber); messageBuilder.AppendLine("\t\t--Link: " + package.PackageUrl); messageBuilder.AppendLine("\t\t--Full mod name: " + package.FullName); messageBuilder.AppendLine("\t\t--(If this is wrong, please ignore this.)"); } } if (package?.Categories.Contains("Server-side") ?? false) { if (package.Name == "CompatibilityChecker" && package.Versions[0].VersionNumber != "1.1.6") { string warning = "Current CompatibilityChecker v1.1.6 does not equal latest release v" + package.Versions[0].VersionNumber + "!\nPlease update to the latest version of CompatibilityChecker!!!"; Logger.LogWarning((object)warning); Object.FindObjectOfType<MenuManager>().DisplayMenuNotification(warning, (string)null); } ModListString += $"{info.Metadata.Name}[{info.Metadata.Version}]{seperator}"; } else if (package == null) { Logger.LogWarning((object)$"Couldn't find package: {info.Metadata.Name}[{info.Metadata.Version}]\n\t\t[{info.Metadata.GUID}]"); ModListString += $"{info.Metadata.GUID}[{info.Metadata.Version}]{seperator}"; } yield return null; } if (messageBuilder.Length != 0) { Logger.LogWarning((object)messageBuilder.ToString()); } ModListString = ModListString.Remove(ModListString.Length - 3, 3); ModListArray = ModListString.Split(seperator); Logger.LogWarning((object)$"Server-sided Mod List Count: {ModListArray.Count()}"); menuManager.menuNotification.SetActive(false); loadedMods = true; } } public static class PluginInfo { public const string PLUGIN_GUID = "Ryokune.CompatibilityChecker"; public const string PLUGIN_NAME = "CompatibilityChecker"; public const string PLUGIN_VERSION = "1.1.6"; } } namespace CompatibilityChecker.Utils { [Serializable] public class Package { [JsonProperty("name")] public string Name; [JsonProperty("full_name")] public string FullName; [JsonProperty("owner")] public string Owner; [JsonProperty("package_url")] public string PackageUrl; [JsonProperty("categories")] public string[] Categories; [JsonProperty("versions")] public Version[] Versions; public long TotalDownloads; [JsonProperty("is_deprecated")] public bool IsDeprecated; } [Serializable] public class Version { [JsonProperty("name")] public string Name; [JsonProperty("full_name")] public string FullName; [JsonProperty("version_number")] public string VersionNumber; [JsonProperty("download_url")] public Uri DownloadUrl; [JsonProperty("downloads")] public long Downloads; [JsonProperty("website_url")] public Uri WebsiteUrl; } public static class ThunderstoreAPI { private const string ApiBaseUrl = "https://thunderstore.io/c/lethal-company/api/v1/package/"; private static List<Package> packages; public static List<Package> Packages => packages; public static async Task InitializeThunderstorePackagesAsync(Action onComplete) { try { using HttpClient httpClient = new HttpClient(); packages = JsonConvert.DeserializeObject<List<Package>>(await httpClient.GetStringAsync("https://thunderstore.io/c/lethal-company/api/v1/package/")); ModNotifyBase.Logger.LogInfo((object)$"ThunderstoreAPI Initialized! Got packages: {packages.Count()}"); foreach (Package pack in packages) { Version[] versions = pack.Versions; foreach (Version ver in versions) { pack.TotalDownloads += ver.Downloads; } } } catch (Exception ex2) { Exception ex = ex2; ModNotifyBase.Logger.LogError((object)("Failed to initialize Thunderstore packages. Error: " + ex.Message)); } onComplete?.Invoke(); } public static bool IsSimilar(string s1, string s2) { string pattern = string.Join(".*?", s2.ToCharArray()); Match match = Regex.Match(s1, pattern); if (match.Success) { return match.Success; } int[,] array = new int[s1.Length + 1, s2.Length + 1]; for (int i = 0; i <= s1.Length; i++) { for (int j = 0; j <= s2.Length; j++) { if (i == 0) { array[i, j] = j; } else if (j == 0) { array[i, j] = i; } else { array[i, j] = Math.Min(Math.Min(array[i - 1, j] + 1, array[i, j - 1] + 1), array[i - 1, j - 1] + ((s1[i - 1] != s2[j - 1]) ? 1 : 0)); } } } int num = Math.Max(s1.Length, s2.Length); int num2 = array[s1.Length, s2.Length]; double num3 = 1.0 - (double)num2 / (double)num; return num3 > 0.54; } private static bool IsMatchingName(Package package, string searchString) { string[] array = Regex.Split(package.Name, "(?<=[a-z])(?=[A-Z])|[\\s_\\-]"); string[] searchStringSplit = Regex.Split(searchString, "(?<=[a-z])(?=[A-Z])|[\\s_\\-]"); int num = ((array.Length > searchStringSplit.Length) ? (searchStringSplit.Length / 2) : (array.Length / 2)); int num2 = array.Count((string token) => searchStringSplit.Contains<string>(token, StringComparer.OrdinalIgnoreCase)); return num2 >= num; } private static bool IsMatchingName(Package package, string searchString, string owner) { string[] source = Regex.Split(Regex.Replace(package.Name, "[\\s_]+(\\w)", (Match m) => m.Groups[1].Value.ToUpper()).Replace(" ", ""), "(?<=[a-z])(?=[A-Z])"); string[] searchStringNameTokens = Regex.Split(searchString, "(?<=[a-z])(?=[A-Z])"); int num = 2; int num2 = source.Count((string token) => searchStringNameTokens.Contains<string>(token, StringComparer.OrdinalIgnoreCase)); return num2 >= num && owner.Contains(package.Owner, StringComparison.OrdinalIgnoreCase); } public static List<Package> GetPackages(string searchString) { return Packages?.Where((Package package) => IsMatchingName(package, searchString)).ToList(); } public static List<Package> GetPackages(string searchString, string owner) { return Packages?.Where((Package package) => IsMatchingName(package, searchString, owner)).ToList(); } public static Package GetPackage(string searchString) { Package package = null; foreach (Package package2 in Packages) { if (package2.IsDeprecated) { continue; } string text = Regex.Replace(package2.Name, "[\\s\\-_]", ""); if (text.Equals(searchString, StringComparison.OrdinalIgnoreCase) || searchString.Contains(text, StringComparison.OrdinalIgnoreCase) || text.Contains(searchString, StringComparison.OrdinalIgnoreCase)) { if (package == null) { package = package2; } if (package2.TotalDownloads >= package?.TotalDownloads) { package = package2; } } } return package; } public static Package GetPackage(string searchString, PluginInfo info) { Package result = null; bool flag = false; foreach (Package package in Packages) { if (package.IsDeprecated) { continue; } if (info.Metadata.GUID.Split(".").Contains(package.Owner)) { flag = true; } string text = Regex.Replace(package.Name, "[\\s\\-_]", ""); if (text.Equals(searchString, StringComparison.OrdinalIgnoreCase) || text.Equals(info.Metadata.Name, StringComparison.OrdinalIgnoreCase) || text.Equals(info.Metadata.GUID, StringComparison.OrdinalIgnoreCase)) { if (flag) { return package; } result = package; } if (searchString.Contains(text, StringComparison.OrdinalIgnoreCase) || text.Contains(searchString, StringComparison.OrdinalIgnoreCase) || text.Contains(info.Metadata.Name, StringComparison.OrdinalIgnoreCase) || text.Contains(info.Metadata.GUID, StringComparison.OrdinalIgnoreCase)) { result = package; } if (IsSimilar(package.Name, searchString)) { result = package; } } return result; } public static IEnumerator Initialize(Action onComplete = null) { yield return InitializeThunderstorePackagesAsync(onComplete); } } internal static class VersionUtil { public static int ConvertToNumber(string version) { string s = version.Replace(".", ""); if (int.TryParse(s, out var result)) { return result; } ModNotifyBase.Logger.LogError((object)("Error parsing version: " + version)); return 0; } } } namespace CompatibilityChecker.Patches { internal class SteamLobbyManagerPatch { [HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")] [HarmonyPostfix] [HarmonyAfter(new string[] { "me.swipez.melonloader.morecompany" })] public static void loadserverListPatch(ref SteamLobbyManager __instance, ref Lobby[] ___currentLobbyList) { CoroutineHandler.Instance.NewCoroutine(BetterCompatibility(__instance)); } public static IEnumerator BetterCompatibility(SteamLobbyManager lobbyManager) { yield return (object)new WaitUntil((Func<bool>)(() => ((Transform)((Component)lobbyManager.levelListContainer).GetComponent<RectTransform>()).childCount - 1 != 0 && ((Transform)((Component)lobbyManager.levelListContainer).GetComponent<RectTransform>()).childCount - 1 == Object.FindObjectsOfType(typeof(LobbySlot)).Length && !GameNetworkManager.Instance.waitingForLobbyDataRefresh)); int i = 0; float lobbySlotPositionOffset = 0f; try { LobbySlot[] array = (LobbySlot[])(object)Object.FindObjectsOfType(typeof(LobbySlot)); foreach (LobbySlot slot in array) { i++; Transform obj = ((Component)slot).transform.Find("JoinButton"); GameObject JoinButton = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)JoinButton != (Object)null) { GameObject CopyCodeButton = Object.Instantiate<GameObject>(JoinButton, JoinButton.transform.parent); CopyCodeButton.SetActive(true); RectTransform rectTransform = CopyCodeButton.GetComponent<RectTransform>(); if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition -= new Vector2(78f, 0f); ((TMP_Text)CopyCodeButton.GetComponentInChildren<TextMeshProUGUI>()).text = "Code"; Button ButtonComponent = CopyCodeButton.GetComponent<Button>(); if ((Object)(object)ButtonComponent != (Object)null) { ButtonComponent.onClick = new ButtonClickedEvent(); ((UnityEvent)ButtonComponent.onClick).AddListener((UnityAction)delegate { string text2 = (GUIUtility.systemCopyBuffer = ((object)(SteamId)(ref slot.lobbyId)).ToString()); ModNotifyBase.Logger.LogInfo((object)("Lobby code copied to clipboard: " + text2)); }); } } } Lobby lobby = slot.thisLobby; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref lobby)).GetData("mods")) && !((TMP_Text)slot.LobbyName).text.Contains("[Checker]")) { ((TMP_Text)slot.LobbyName).text = ((TMP_Text)slot.LobbyName).text + " [Checker]"; } if (!Utility.IsNullOrWhiteSpace(ModNotifyBase.Text) && !((TMP_Text)slot.LobbyName).text.Contains(ModNotifyBase.Text, StringComparison.OrdinalIgnoreCase)) { i--; Object.DestroyImmediate((Object)(object)((Component)slot).gameObject); } else { ((Component)slot).gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, lobbySlotPositionOffset); lobbySlotPositionOffset -= 42f; lobby = default(Lobby); } } RectTransform rect = ((Component)lobbyManager.levelListContainer).GetComponent<RectTransform>(); float newWidth = rect.sizeDelta.x; float newHeight = Mathf.Max(0f, (float)i * 42f); rect.SetSizeWithCurrentAnchors((Axis)0, newWidth); rect.SetSizeWithCurrentAnchors((Axis)1, newHeight); } catch (Exception err) { ModNotifyBase.Logger.LogError((object)err); } } [HarmonyPatch(typeof(SteamLobbyManager), "loadLobbyListAndFilter")] [HarmonyAfter(new string[] { "me.swipez.melonloader.morecompany" })] [HarmonyPrefix] public static bool loadLobbyPrefixPatch(ref SteamLobbyManager __instance, ref Lobby[] ___currentLobbyList, ref float ___lobbySlotPositionOffset, ref IEnumerator __result) { __result = modifiedLoadLobbyIEnumerator(__instance, ___currentLobbyList, ___lobbySlotPositionOffset); return false; } public static IEnumerator modifiedLoadLobbyIEnumerator(SteamLobbyManager __instance, Lobby[] ___currentLobbyList, float ___lobbySlotPositionOffset) { string[] offensiveWords = new string[21] { "nigger", "faggot", "n1g", "nigers", "cunt", "pussies", "pussy", "minors", "chink", "buttrape", "molest", "rape", "coon", "negro", "beastiality", "cocks", "cumshot", "ejaculate", "pedophile", "furfag", "necrophilia" }; for (int i = 0; i < ___currentLobbyList.Length; i++) { Lobby currentLobby = ___currentLobbyList[i]; Friend[] blockedUsers = SteamFriends.GetBlocked().ToArray(); if (blockedUsers != null) { Friend[] array = blockedUsers; for (int j = 0; j < array.Length; j++) { Friend blockedUser = array[j]; if (((Lobby)(ref currentLobby)).IsOwnedBy(blockedUser.Id)) { } } } string lobbyName = ((Lobby)(ref currentLobby)).GetData("name"); bool lobbyModded = !Utility.IsNullOrWhiteSpace(((Lobby)(ref currentLobby)).GetData("mods")); if (!Utility.IsNullOrWhiteSpace(lobbyName)) { string lobbyNameLowercase = lobbyName.ToLower(); if (__instance.censorOffensiveLobbyNames) { string[] array2 = offensiveWords; foreach (string word in array2) { if (lobbyNameLowercase.Contains(word)) { } } } GameObject gameObject = Object.Instantiate<GameObject>(__instance.LobbySlotPrefab, __instance.levelListContainer); gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, ___lobbySlotPositionOffset); ___lobbySlotPositionOffset -= 42f; LobbySlot componentInChildren = gameObject.GetComponentInChildren<LobbySlot>(); ((TMP_Text)componentInChildren.LobbyName).text = lobbyName + " " + (lobbyModded ? "[Checker]" : ""); ((TMP_Text)componentInChildren.playerCount).text = $"{((Lobby)(ref currentLobby)).MemberCount} / 4"; componentInChildren.lobbyId = ((Lobby)(ref currentLobby)).Id; componentInChildren.thisLobby = currentLobby; } currentLobby = default(Lobby); } yield break; } } } namespace CompatibilityChecker.Netcode { [HarmonyPatch] internal class PlayerJoinNetcode { private static string[] serverModList = null; public static Vector2 old = Vector2.zero; public static IEnumerator SetLobbyData(Lobby lobby) { //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) if (GameNetworkManager.Instance.currentLobby.HasValue) { ((Lobby)(ref lobby)).SetData("mods", ModNotifyBase.ModListString); ModNotifyBase.Logger.LogInfo((object)("Set " + ((Lobby)(ref lobby)).GetData("name") + " mods to: " + ModNotifyBase.ModListString)); } yield break; } [HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated")] [HarmonyPrefix] public static bool OnLobbyCreated(ref GameNetworkManager __instance, Result result, ref Lobby lobby) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((int)result == 1) { CoroutineHandler.Instance.NewCoroutine(SetLobbyData(lobby)); } return true; } [HarmonyPatch(typeof(GameNetworkManager), "StartHost")] [HarmonyPrefix] public static bool StartHost(ref GameNetworkManager __instance) { if (!ModNotifyBase.loadedMods) { CoroutineHandler.Instance.NewCoroutine(Connect()); CoroutineHandler.Instance.NewCoroutine(ModNotifyBase.InitializeModsCoroutine()); return false; } return true; } public static IEnumerator Connect() { yield return (object)new WaitUntil((Func<bool>)(() => ModNotifyBase.loadedMods)); GameNetworkManager.Instance.StartHost(); } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] [HarmonyPrefix] public static bool IsJoinable(ref Lobby lobby) { string data = ((Lobby)(ref lobby)).GetData("mods"); if (!Utility.IsNullOrWhiteSpace(data)) { serverModList = data.Split(ModNotifyBase.seperator); ModNotifyBase.Logger.LogWarning((object)(((Lobby)(ref lobby)).GetData("name") + " returned:")); try { string[] array = serverModList; foreach (string input in array) { string text = Regex.Replace(input, "\\[([\\d.]+)\\]", ""); string text2 = (Regex.Match(input, "\\[([\\d.]+)\\]").Groups[1].Value ?? "") ?? "No version number found"; string text3 = ""; if (Chainloader.PluginInfos.ContainsKey(text)) { PluginInfo obj = Chainloader.PluginInfos[text]; object obj2; if (obj == null) { obj2 = null; } else { BepInPlugin metadata = obj.Metadata; obj2 = ((metadata == null) ? null : metadata.Version?.ToString()); } text3 = (string)obj2; } string text4 = text; string text5 = ((!Utility.IsNullOrWhiteSpace(text3) && !Utility.IsNullOrWhiteSpace(text2) && !VersionUtil.ConvertToNumber(text2).Equals(VersionUtil.ConvertToNumber(text3))) ? (" (May be incompatible with your version v" + text3 + ")") : ""); Package package = ThunderstoreAPI.GetPackage(text); if (package != null) { text4 = Regex.Replace(input, "\\[([\\d.]+)\\]", "") + " v" + text2 + text5; } ModNotifyBase.Logger.LogWarning((object)text4); } } catch (Exception ex) { ModNotifyBase.Logger.LogError((object)ex); } } return true; } [HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")] [HarmonyPostfix] public static void JoinLobbyPostfix() { if (ModNotifyBase.ModList.Count == 0) { CoroutineHandler.Instance.NewCoroutine(ModNotifyBase.InitializeModsCoroutine()); } } [HarmonyPatch(typeof(MenuManager), "SetLoadingScreen")] [HarmonyPostfix] public static void SetLoadingScreenPatch(ref MenuManager __instance, ref RoomEnter result, ref bool isLoading, ref string overrideMessage) { //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_002b: 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_008b: 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_0115: 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_01b0: Unknown result type (might be due to invalid IL or missing references) if (old == Vector2.zero) { old = ((Component)((TMP_Text)__instance.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta; } if ((int)result != 5 || !Utility.IsNullOrWhiteSpace(overrideMessage)) { ((Component)((TMP_Text)__instance.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta = old; return; } ((Component)((TMP_Text)__instance.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta = old; Package package = ThunderstoreAPI.GetPackage("CompatibilityChecker"); bool flag = VersionUtil.ConvertToNumber(package.Versions[0].VersionNumber) > VersionUtil.ConvertToNumber("1.1.6"); string text = (flag ? ("New CompatibilityChecker update is available! v" + package.Versions[0].VersionNumber + " != 1.1.6") : "[ Close ]"); if (flag & !isLoading) { ((Component)((TMP_Text)__instance.menuNotificationButtonText).transform.parent).GetComponent<RectTransform>().sizeDelta = new Vector2(256.375f, 58.244f); } if (ModNotifyBase.ModList.Count == 0) { CoroutineHandler.Instance.NewCoroutine(ModNotifyBase.InitializeModsCoroutine()); } if (Utility.IsNullOrWhiteSpace(overrideMessage) && Utility.IsNullOrWhiteSpace(GameNetworkManager.Instance.disconnectionReasonMessage) && !isLoading) { if (serverModList == null) { __instance.DisplayMenuNotification("Failed to join Modded Crew!\n Missing mods:\nCan't display: Host does not have CompatibilityChecker!", text); } else { GameNetworkManager instance = GameNetworkManager.Instance; object obj; if (instance == null) { obj = null; } else { Lobby value = instance.currentLobby.Value; obj = ((Lobby)(ref value)).GetData("name"); } string text2 = (string)obj; string[] array = serverModList.Except(ModNotifyBase.ModListArray).ToArray(); string[] array2 = ModNotifyBase.ModListArray.Except(serverModList).ToArray(); string text3 = ((array == null || array.Length == 0) ? "None..?" : string.Join("\n", array)); string text4 = ((array2 == null || array2.Length == 0) ? "None." : string.Join("\n\t\t", array2)); __instance.DisplayMenuNotification("Modded crew\n(Check logs/console for links)!\n Missing mods:\n" + text3, text); ModNotifyBase.Logger.LogError((object)("\nMissing server-sided mods from lobby \"" + text2 + "\":")); string[] array3 = array; foreach (string text5 in array3) { string text6 = text5; Package package2 = ThunderstoreAPI.GetPackage(text5); if (package2 != null) { string text7 = (Regex.Match(text5, "\\[([\\d.]+)\\]").Success ? ("v" + Regex.Match(text5, "\\[([\\d.]+)\\]").Value) : "No version number found"); text6 = string.Format("\n\t--Name: {0}\n\t--Link: {1}\n\t--Version: {2}\n\t--Downloads: {3}\n\t--Categories: [{4}]", text5, package2.PackageUrl, text7, package2.Versions[0].Downloads, string.Join(", ", package2.Categories)); } ModNotifyBase.Logger.LogError((object)text6); } ModNotifyBase.Logger.LogWarning((object)("Mods \"" + text2 + "\" may not be compatible with:\n\t\t" + text4)); serverModList = null; } } if (flag) { ModNotifyBase.Logger.LogWarning((object)("NEW VERSION OF COMPATIBILITY CHECKER IS AVAILABE. PLEASE UPDATE TO " + package.Versions[0].VersionNumber)); } } [HarmonyPatch(typeof(MenuManager), "connectionTimeOut")] [HarmonyPostfix] public static void timeoutPatch() { //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) if (GameNetworkManager.Instance.currentLobby.HasValue && serverModList == null) { Lobby value = GameNetworkManager.Instance.currentLobby.Value; serverModList = ((Lobby)(ref value)).GetData("mods")?.Split(ModNotifyBase.seperator); } } [HarmonyPatch(typeof(GameNetworkManager), "Singleton_OnClientConnectedCallback")] [HarmonyPostfix] public static void ConnectCallbackPatch() { //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_005d: Unknown result type (might be due to invalid IL or missing references) Lobby? currentLobby = GameNetworkManager.Instance.currentLobby; if ((Object)(object)StartOfRound.Instance != (Object)null && currentLobby.HasValue) { Lobby value = currentLobby.Value; if (Utility.IsNullOrWhiteSpace(((Lobby)(ref value)).GetData("mods"))) { ModNotifyBase.Logger.LogInfo((object)"Setting lobbys mods"); CoroutineHandler.Instance.NewCoroutine(SetLobbyData(currentLobby.Value)); } } } } } namespace CompatibilityChecker.MonoBehaviours { internal class CoroutineHandler : MonoBehaviour { private static CoroutineHandler instance; private List<Type> runningCoroutines = new List<Type>(); public static CoroutineHandler Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("CoroutineHandler"); instance = val.AddComponent<CoroutineHandler>(); Object.DontDestroyOnLoad((Object)(object)val); } return instance; } } public void NewCoroutine(IEnumerator coroutine) { if (!IsCoroutineRunning(coroutine.GetType())) { runningCoroutines.Add(coroutine.GetType()); ((MonoBehaviour)this).StartCoroutine(ExecuteCoroutine(coroutine)); } else { ModNotifyBase.Logger.LogWarning((object)("Coroutine " + coroutine.GetType().FullName + " is already running")); } } private bool IsCoroutineRunning(Type coroutine) { return runningCoroutines.Any((Type runningCoroutine) => runningCoroutine == coroutine); } private IEnumerator ExecuteCoroutine(IEnumerator coroutine) { yield return ((MonoBehaviour)this).StartCoroutine(coroutine); runningCoroutines.Remove(coroutine.GetType()); } } public class SearchBox : MonoBehaviour { private TMP_InputField searchInputField; private GameObject canvas; public string Text = ""; public void Awake() { ModNotifyBase.Logger.LogInfo((object)"SearchBox: I have awoken"); } public void Start() { ModNotifyBase.Logger.LogInfo((object)"SearchBox: Start method called"); LoadCanvas(); } private void LoadCanvas() { canvas = GameObject.Find("/Canvas/MenuContainer/LobbyList"); if ((Object)(object)canvas == (Object)null) { ModNotifyBase.Logger.LogError((object)"SearchBox: Canvas not found. Make sure the hierarchy and names are correct."); return; } ModNotifyBase.Logger.LogInfo((object)"SearchBox: Canvas found. Creating search box."); CreateSearchBox(); } private void CreateSearchBox() { //IL_0018: 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_0071: 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_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) ModNotifyBase.Logger.LogInfo((object)"SearchBox: Creating search box"); searchInputField = CreateInputField("Search..", Vector2.zero); ((UnityEvent<string>)(object)searchInputField.onEndEdit).AddListener((UnityAction<string>)OnEndEdit); RectTransform component = ((Component)searchInputField).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(200f, 30f); component.anchoredPosition = new Vector2(0f, 0f); component.anchoredPosition = new Vector2(canvas.GetComponent<RectTransform>().sizeDelta.x / 2f, canvas.GetComponent<RectTransform>().sizeDelta.y / 2f); ((Component)searchInputField).transform.SetParent(canvas.transform, false); ((Component)searchInputField).gameObject.SetActive(false); ((Component)searchInputField).gameObject.SetActive(true); } private TMP_InputField CreateInputField(string placeholder, Vector2 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: 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_0046: Expected O, but got Unknown //IL_007d: 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_009d: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI component = GameObject.Find("/Canvas/MenuContainer/LobbyList/ListPanel/ListHeader").GetComponent<TextMeshProUGUI>(); GameObject val = new GameObject("SearchInputField"); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchoredPosition = position; TMP_InputField val3 = val.AddComponent<TMP_InputField>(); ((Selectable)val3).interactable = true; GameObject val4 = new GameObject("Placeholder"); val4.transform.SetParent(val.transform, false); TextMeshProUGUI val5 = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val5).text = placeholder; ((TMP_Text)val5).font = ((TMP_Text)component).font; ((Graphic)val5).color = ((Graphic)component).color; val3.placeholder = (Graphic)(object)val5; GameObject val6 = new GameObject("Text"); val6.transform.SetParent(val.transform, false); TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val7).font = ((TMP_Text)component).font; ((Graphic)val7).color = ((Graphic)component).color; val3.textComponent = (TMP_Text)(object)val7; RectTransform component2 = ((Component)val3).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(200f, 30f); component2.anchoredPosition = new Vector2(0f, 0f); return val3; } private void OnEndEdit(string newValue) { Text = newValue; ModNotifyBase.Logger.LogInfo((object)("SearchBox: Search Value Changed - " + newValue)); SteamLobbyManager val = Object.FindObjectOfType<SteamLobbyManager>(); val.LoadServerList(); } } }
BepInEx/plugins/ShipLoot.dll
Decompiled 2 years 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShipLoot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ShipLoot")] [assembly: AssemblyCopyright("Copyright © tinyhoot 2023")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.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 ShipLoot { [BepInPlugin("com.github.tinyhoot.ShipLoot", "ShipLoot", "1.0")] internal class ShipLoot : BaseUnityPlugin { public const string GUID = "com.github.tinyhoot.ShipLoot"; public const string NAME = "ShipLoot"; public const string VERSION = "1.0"; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.github.tinyhoot.ShipLoot").PatchAll(Assembly.GetExecutingAssembly()); } } } namespace ShipLoot.Patches { [HarmonyPatch] internal class HudManagerPatcher { private static GameObject _totalCounter; private static TextMeshProUGUI _textMesh; private static float _displayTimeLeft; private const float DisplayTime = 5f; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] private static void OnScan(HUDManager __instance, CallbackContext context) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((CallbackContext)(ref context)).performed && __instance.CanPlayerScan() && !(__instance.playerPingingScan > -0.5f) && (StartOfRound.Instance.inShipPhase || GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)) { if (!Object.op_Implicit((Object)(object)_totalCounter)) { CopyValueCounter(); } float num = CalculateLootValue(); ((TMP_Text)_textMesh).text = $"SHIP: ${num:F0}"; _displayTimeLeft = 5f; if (!_totalCounter.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShipLootCoroutine()); } } } private static IEnumerator ShipLootCoroutine() { _totalCounter.SetActive(true); while (_displayTimeLeft > 0f) { float displayTimeLeft = _displayTimeLeft; _displayTimeLeft = 0f; yield return (object)new WaitForSeconds(displayTimeLeft); } _totalCounter.SetActive(false); } private static float CalculateLootValue() { List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>() where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem" select obj).ToList(); ShipLoot.Log.LogDebug((object)"Calculating total ship scrap value."); CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap) { ShipLoot.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}"); }); return list.Sum((GrabbableObject scrap) => scrap.scrapValue); } private static void CopyValueCounter() { //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_0076: 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_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!Object.op_Implicit((Object)(object)val)) { ShipLoot.Log.LogError((object)"Failed to find ValueCounter object to copy!"); } _totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false); _totalCounter.transform.Translate(0f, 1f, 0f); Vector3 localPosition = _totalCounter.transform.localPosition; _totalCounter.transform.localPosition = new Vector3(localPosition.x + 50f, -50f, localPosition.z); _textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>(); } } }
BepInEx/plugins/SkinwalkerMod.dll
Decompiled 2 years 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.Configuration; using BepInEx.Logging; using Dissonance.Config; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; 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("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; [BepInPlugin("RugbugRedfern.SkinwalkerMod", "Skinwalker Mod", "1.0.8")] internal class PluginLoader : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("RugbugRedfern.SkinwalkerMod"); private const string modGUID = "RugbugRedfern.SkinwalkerMod"; private const string modVersion = "1.0.8"; private static bool initialized; public static PluginLoader Instance { get; private set; } private void Awake() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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 1.0.8"); 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); } 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() { //IL_0077: 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) if (!(Time.time > nextTimeToPlayAudio)) { return; } SetNextTime(); float num = -1f; if (Object.op_Implicit((Object)(object)ai) && !ai.isEnemyDead) { if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((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<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); 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("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, _ => true, }; } 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() { if (cachedAudio.Count > 0) { int index = Random.Range(0, cachedAudio.Count - 1); AudioClip result = cachedAudio[index]; cachedAudio.RemoveAt(index); return result; } while (cachedAudio.Count > 200) { cachedAudio.RemoveAt(0); } 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<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; 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 (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"; } }
BepInEx/plugins/YippeeMod.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using YippeeMod.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("YippeeMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("YippeeMod")] [assembly: AssemblyTitle("YippeeMod")] [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 YippeeMod { [BepInPlugin("sunnobunno.YippeeMod", "Yippee tbh mod", "1.2.2")] public class YippeeModBase : BaseUnityPlugin { private const string modGUID = "sunnobunno.YippeeMod"; private const string modName = "Yippee tbh mod"; private const string modVersion = "1.2.2"; private readonly Harmony harmony = new Harmony("sunnobunno.YippeeMod"); private static YippeeModBase? Instance; internal ManualLogSource? mls; internal static AudioClip[]? newSFX; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("sunnobunno.YippeeMod"); mls.LogInfo((object)"sunnobunno.YippeeMod is loading."); string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "YippeeMod.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "yippeesound"; AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3"); harmony.PatchAll(typeof(HoarderBugPatch)); mls.LogInfo((object)"sunnobunno.YippeeMod is loaded. Yippee!!!"); } } } namespace YippeeMod.Patches { [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX) { AudioClip[] newSFX = YippeeModBase.newSFX; ___chitterSFX = newSFX; } } }