Decompiled source of CEO TEAK PACK v1.0.2
BepInEx/plugins/3rdPerson.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using _3rdPerson.Helper; [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("3rdPerson")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("3rdPerson")] [assembly: AssemblyTitle("3rdPerson")] [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 _3rdPerson { [BepInPlugin("verity.3rdperson", "3rd Person", "1.1.0")] public class Plugin : BaseUnityPlugin { public static readonly Harmony Harmony = new Harmony("verity.3rdperson"); public static ManualLogSource LogSource = null; public static ConfigEntry<string> KeybindEntry = null; public static ConfigEntry<string> OrbitKeybindEntry = null; public static ConfigEntry<float> OrbitSpeedEntry = null; public static ConfigEntry<float> Distance = null; public static ConfigEntry<float> RightOffset = null; public static ConfigEntry<float> UpOffset = null; public static ConfigEntry<bool> MoreCompanyCosmetics = null; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown GameObject val = new GameObject("3rdPerson"); val.AddComponent<PluginLoader>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); LogSource = ((BaseUnityPlugin)this).Logger; LogSource.LogInfo((object)"3rd Person Mod Loaded."); KeybindEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Camera Settings", "Keybind", "c", "The keybind used to toggle third person."); Distance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Distance", 2f, "Distance of the camera from the player."); RightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Right-Offset", 0.6f, "Offset of the camera to the right from the player."); UpOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Up-Offset", 0.1f, "Offset of the camera upwards from the player."); OrbitKeybindEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Orbit Settings", "Keybind", "<Mouse>/middleButton", "The keybind used to 'orbit' around the player."); OrbitSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Orbit Settings", "Orbit-Speed", 75f, "The speed/sensitivity of the orbiting."); MoreCompanyCosmetics = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Support", "MoreCompany-Cosmetic-Support", false, "Displays MoreCompany Cosmetics in third person, this can mess with first person visibility if you have glasses on."); } } public class PluginLoader : MonoBehaviour { private void Start() { LocalPlayer localPlayer = ((Component)this).gameObject.AddComponent<LocalPlayer>(); ((Object)localPlayer).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)localPlayer); Keybinding keybinding = ((Component)this).gameObject.AddComponent<Keybinding>(); ((Object)keybinding).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)keybinding); ThirdPersonCamera thirdPersonCamera = ((Component)this).gameObject.AddComponent<ThirdPersonCamera>(); ((Object)thirdPersonCamera).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)thirdPersonCamera); Hooks.Init(); } } } namespace _3rdPerson.Helper { public static class Hooks { private class HarmonyHooks { private static bool _previousState; public static void MenuOpenedHook() { _previousState = ThirdPersonCamera.ViewState; if (LocalPlayer.IsActive() && ThirdPersonCamera.ViewState) { LocalPlayer.GetController().quickMenuManager.isMenuOpen = false; ThirdPersonCamera.Toggle(); } } public static void MenuClosedHook() { if (LocalPlayer.IsActive() && _previousState) { LocalPlayer.GetController().inTerminalMenu = false; ThirdPersonCamera.Toggle(); } } public static void MoreCompanyHook() { //IL_0074: 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) CosmeticApplication val = Object.FindObjectOfType<CosmeticApplication>(); if (CosmeticRegistry.locallySelectedCosmetics.Count <= 0 || val.spawnedCosmetics.Count > 0) { return; } foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { val.ApplyCosmetic(locallySelectedCosmetic, true); } foreach (CosmeticInstance spawnedCosmetic in val.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; SetAllChildrenLayer(((Component)spawnedCosmetic).transform, 29); } } private static void SetAllChildrenLayer(Transform transform, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((Component)transform).gameObject.layer = layer; foreach (Transform item in transform) { SetAllChildrenLayer(item, layer); } } public static bool PlayerInputHook() { if (ThirdPersonCamera.ViewState) { return !Keybinding.orbitAction.IsPressed(); } return true; } public static void KillPlayerHook() { if (ThirdPersonCamera.ViewState) { ThirdPersonCamera.Toggle(); } } } public static void Init() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown MethodInfo method = typeof(QuickMenuManager).GetMethod("OpenQuickMenu"); MethodInfo method2 = typeof(HarmonyHooks).GetMethod("MenuOpenedHook"); Plugin.Harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Open Menu Hooked."); MethodInfo method3 = typeof(QuickMenuManager).GetMethod("CloseQuickMenu"); MethodInfo method4 = typeof(HarmonyHooks).GetMethod("MenuClosedHook"); Plugin.Harmony.Patch((MethodBase)method3, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Close Menu Hooked."); MethodInfo method5 = typeof(Terminal).GetMethod("BeginUsingTerminal"); MethodInfo method6 = typeof(HarmonyHooks).GetMethod("MenuOpenedHook"); Plugin.Harmony.Patch((MethodBase)method5, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Open Terminal Hooked."); MethodInfo method7 = typeof(Terminal).GetMethod("QuitTerminal"); MethodInfo method8 = typeof(HarmonyHooks).GetMethod("MenuClosedHook"); Plugin.Harmony.Patch((MethodBase)method7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Close Terminal Hooked."); MethodInfo method9 = typeof(PlayerControllerB).GetMethod("PlayerLookInput", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method10 = typeof(HarmonyHooks).GetMethod("PlayerInputHook"); Plugin.Harmony.Patch((MethodBase)method9, new HarmonyMethod(method10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Player Look Input Hooked."); MethodInfo method11 = typeof(PlayerControllerB).GetMethod("KillPlayer"); MethodInfo method12 = typeof(HarmonyHooks).GetMethod("KillPlayerHook"); Plugin.Harmony.Patch((MethodBase)method11, new HarmonyMethod(method12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Player Killed Hooked."); if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && Plugin.MoreCompanyCosmetics.Value) { MethodInfo method13 = typeof(HUDManager).GetMethod("AddPlayerChatMessageClientRpc", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method14 = typeof(HarmonyHooks).GetMethod("MoreCompanyHook"); Plugin.Harmony.Patch((MethodBase)method13, (HarmonyMethod)null, new HarmonyMethod(method14), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"MoreCompany Cosmetics Added."); } Plugin.LogSource.LogInfo((object)"Hooks Initialized."); } } public class Keybinding : MonoBehaviour { public static InputAction orbitAction; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown InputAction val = new InputAction((string)null, (InputActionType)0, "<Keyboard>/" + Plugin.KeybindEntry.Value, (string)null, (string)null, (string)null); val.performed += KeyPressed; val.Enable(); orbitAction = new InputAction("MouseLeftClick", (InputActionType)0, Plugin.OrbitKeybindEntry.Value ?? "", (string)null, (string)null, (string)null); orbitAction.Enable(); } private void KeyPressed(CallbackContext obj) { ThirdPersonCamera.Toggle(); } private void OnEnable() { Plugin.LogSource.LogInfo((object)("Keybinding Initialized, Current Keybind " + Plugin.KeybindEntry.Value + ".")); } } public class LocalPlayer : MonoBehaviour { private static PlayerControllerB? _playerController; public void OnEnable() { Plugin.LogSource.LogInfo((object)"Local Player Caching Initialized."); } private void Update() { if (GameNetworkManager.Instance != null) { _playerController = GameNetworkManager.Instance.localPlayerController; } } public static bool IsActive() { if ((Object)(object)_playerController != (Object)null) { return !_playerController.isPlayerDead; } return false; } public static PlayerControllerB GetController() { return _playerController; } } public class ThirdPersonCamera : MonoBehaviour { private static Camera _camera; public static bool ViewState; public static Camera GetCamera => _camera; private void Awake() { _camera = ((Component)this).gameObject.AddComponent<Camera>(); ((Object)_camera).hideFlags = (HideFlags)61; _camera.fieldOfView = 66f; _camera.nearClipPlane = 0.1f; _camera.cullingMask = 557520895; if (Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { _camera.cullingMask = 557520887; } ((Behaviour)_camera).enabled = false; Object.DontDestroyOnLoad((Object)(object)_camera); } private void OnEnable() { Plugin.LogSource.LogInfo((object)"Third Person Camera Initialized."); } private void Update() { if (!LocalPlayer.IsActive() || LocalPlayer.GetController().quickMenuManager.isMenuOpen || LocalPlayer.GetController().inTerminalMenu || LocalPlayer.GetController().isPlayerDead) { return; } if (Object.FindObjectsOfType<CentipedeAI>().Any((CentipedeAI centipede) => (Object)(object)centipede.clingingToPlayer != (Object)null && centipede.clingingToPlayer.playerClientId == NetworkManager.Singleton.LocalClientId)) { Plugin.LogSource.LogInfo((object)"Centipede On Player!"); if (ViewState) { Toggle(); } } else if (!Keybinding.orbitAction.IsPressed()) { ThirdPersonUpdate(); } else { ThirdPersonOrbitUpdate(); } } private void ThirdPersonUpdate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) Camera gameplayCamera = LocalPlayer.GetController().gameplayCamera; Vector3 val = ((Component)gameplayCamera).transform.forward * -1f; Vector3 val2 = ((Component)gameplayCamera).transform.TransformDirection(Vector3.right) * Plugin.RightOffset.Value; Vector3 val3 = Vector3.up * Plugin.UpOffset.Value; float value = Plugin.Distance.Value; ((Component)_camera).transform.position = ((Component)gameplayCamera).transform.position + val * value + val2 + val3; ((Component)_camera).transform.rotation = Quaternion.LookRotation(((Component)gameplayCamera).transform.forward); } private void ThirdPersonOrbitUpdate() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) MovementActions movement = LocalPlayer.GetController().playerActions.Movement; Vector2 val = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>() * (0.008f * (float)IngamePlayerSettings.Instance.settings.lookSensitivity); if (IngamePlayerSettings.Instance.settings.invertYAxis) { val.y *= -1f; } ((Component)_camera).transform.Rotate(Vector3.right, val.y * Plugin.OrbitSpeedEntry.Value * Time.deltaTime); ((Component)_camera).transform.RotateAround(((Component)LocalPlayer.GetController().gameplayCamera).transform.position, Vector3.up, val.x * Plugin.OrbitSpeedEntry.Value * Time.deltaTime); float value = Plugin.Distance.Value; ((Component)_camera).transform.position = ((Component)LocalPlayer.GetController().gameplayCamera).transform.position - ((Component)_camera).transform.forward * value; } public static void Toggle() { if (!LocalPlayer.IsActive() || LocalPlayer.GetController().isTypingChat || LocalPlayer.GetController().quickMenuManager.isMenuOpen || LocalPlayer.GetController().inTerminalMenu || LocalPlayer.GetController().isPlayerDead) { return; } ViewState = !ViewState; GameObject val = GameObject.Find("Systems/UI/Canvas/Panel/"); Canvas component = GameObject.Find("Systems/UI/Canvas/").GetComponent<Canvas>(); if (ViewState) { if (!Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { ((Renderer)LocalPlayer.GetController().thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; } val.SetActive(false); component.worldCamera = _camera; component.renderMode = (RenderMode)0; GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel/").SetActive(false); ((Renderer)LocalPlayer.GetController().thisPlayerModelArms).enabled = false; ((Behaviour)LocalPlayer.GetController().gameplayCamera).enabled = false; ((Behaviour)_camera).enabled = true; } else { if (!Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { ((Renderer)LocalPlayer.GetController().thisPlayerModel).shadowCastingMode = (ShadowCastingMode)3; } val.SetActive(true); component.worldCamera = GameObject.Find("UICamera").GetComponent<Camera>(); component.renderMode = (RenderMode)1; GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel/").SetActive(true); ((Renderer)LocalPlayer.GetController().thisPlayerModelArms).enabled = true; ((Behaviour)LocalPlayer.GetController().gameplayCamera).enabled = true; ((Behaviour)_camera).enabled = false; } } } }
BepInEx/plugins/AlwaysHearWalkie.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using 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/BetterStamina.dll
Decompiled 10 months 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.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BetterStamina.Config; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterStamina")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterStamina")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1c42022e-b386-4342-baf0-67de1b7529e2")] [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 BetterStamina { [BepInPlugin("FlipMods.BetterStamina", "BetterStamina", "1.3.2")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("BetterStamina"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterStamina loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } public static void LogError(string message) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.BetterStamina"; public const string PLUGIN_NAME = "BetterStamina"; public const string PLUGIN_VERSION = "1.3.2"; } } namespace BetterStamina.Patches { [HarmonyPatch] public class PlayerPatcher { private static float currentSprintMeter; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] public static void UpdateStaminaPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void UpdateStaminaPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f); } else if (num > 0f) { __instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f); } } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] public static void LateUpdatePrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] public static void LateUpdateStaminaPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f); } else if (num > 0f) { __instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f); } } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPrefix] public static void JumpPerformedPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPostfix] public static void JumpPerformedPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(new float[1] { currentSprintMeter + num * ConfigSync.instance.jumpStaminaConsumptionMultiplier }); } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SpoofWeightValuesUpdate(IEnumerable<CodeInstruction> instructions) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public); MethodInfo method = typeof(PlayerPatcher).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field) { list[i] = new CodeInstruction(OpCodes.Call, (object)method); list.RemoveAt(i - 1); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SpoofWeightValuesLateUpdate(IEnumerable<CodeInstruction> instructions) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public); MethodInfo method = typeof(PlayerPatcher).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field) { list[i] = new CodeInstruction(OpCodes.Call, (object)method); list.RemoveAt(i - 1); } } return list.AsEnumerable(); } public static float GetAdjustedWeight() { return Mathf.Max(((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null) ? (StartOfRound.Instance.localPlayerController.carryWeight * ConfigSync.instance.carryWeightPenaltyMultiplier) : 1f, 1f); } } } namespace BetterStamina.Config { [Serializable] public static class ConfigSettings { public static ConfigEntry<float> staminaRegenMultiplierConfig; public static ConfigEntry<float> staminaConsumptionMultiplierConfig; public static ConfigEntry<float> jumpStaminaConsumptionMultiplierConfig; public static ConfigEntry<float> carryWeightPenaltyMultiplierConfig; public static ConfigEntry<float> movementSpeedMultiplierConfig; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); staminaRegenMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaRegenMultiplier", 1.5f, "Multiplier for how fast your stamina regens."); staminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina drains while sprinting."); jumpStaminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "JumpStaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina jumping consumes."); carryWeightPenaltyMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "CarryWeightPenaltyMultiplier", 0.5f, "Multiplier for how much your speed/stamina consumption are affected by weight."); movementSpeedMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "MovementSpeedMultiplier", 1f, "Player movement speed multiplier."); } } [Serializable] [HarmonyPatch] public class ConfigSync { public static ConfigSync defaultConfig; public static ConfigSync instance; public static PlayerControllerB localPlayerController; public static bool isSynced = false; private static float defaultMovementSpeed = 4.6f; public float staminaRegenMultiplier = 1f; public float staminaConsumptionMultiplier = 1f; public float jumpStaminaConsumptionMultiplier = 1f; public float carryWeightPenaltyMultiplier = 1f; public float movementSpeedMultiplier = 1f; public static void BuildDefaultConfigSync() { instance = new ConfigSync(); } public static void BuildServerConfigSync() { if (defaultConfig == null) { defaultConfig = new ConfigSync(); defaultConfig.staminaRegenMultiplier = ConfigSettings.staminaRegenMultiplierConfig.Value; defaultConfig.staminaConsumptionMultiplier = ConfigSettings.staminaConsumptionMultiplierConfig.Value; defaultConfig.jumpStaminaConsumptionMultiplier = ConfigSettings.jumpStaminaConsumptionMultiplierConfig.Value; defaultConfig.carryWeightPenaltyMultiplier = ConfigSettings.carryWeightPenaltyMultiplierConfig.Value; defaultConfig.movementSpeedMultiplier = ConfigSettings.movementSpeedMultiplierConfig.Value; instance = defaultConfig; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void InitializeLocalPlayer(PlayerControllerB __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown localPlayerController = __instance; if (NetworkManager.Singleton.IsServer) { BuildServerConfigSync(); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnRequestConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest)); OnLocalClientConfigSync(); } else { isSynced = false; BuildDefaultConfigSync(); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync)); RequestConfigSync(); } } public static void RequestConfigSync() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.Log("Sending config sync request to server."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } else { Plugin.LogError("Failed to send config sync request."); } } public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Plugin.Log("Receiving config sync request from client with id: " + clientId + ". Sending config sync to client."); byte[] array = SerializeConfigToByteArray(instance); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } } public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader) { //IL_0014: 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) if (((FastBufferReader)(ref reader)).TryBeginRead(4)) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Log("Receiving config sync from server."); byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); instance = DeserializeFromByteArray(data); OnLocalClientConfigSync(); } else { Plugin.LogError("Error receiving sync from server."); } } else { Plugin.LogError("Error receiving bytes length."); } } public static void OnLocalClientConfigSync() { localPlayerController.movementSpeed = defaultMovementSpeed * instance.movementSpeedMultiplier; isSynced = true; } public static byte[] SerializeConfigToByteArray(ConfigSync config) { BinaryFormatter binaryFormatter = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, config); return memoryStream.ToArray(); } public static ConfigSync DeserializeFromByteArray(byte[] data) { MemoryStream serializationStream = new MemoryStream(data); BinaryFormatter binaryFormatter = new BinaryFormatter(); return (ConfigSync)binaryFormatter.Deserialize(serializationStream); } } }
BepInEx/plugins/BoomBoxNoPower.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using BoomBoxNoPower.Patches; using HarmonyLib; 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("BoomBoxNoPower")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BoomBoxNoPower")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bd269fc6-abd7-4d33-b4d7-77be24732c49")] [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 BoomBoxNoPower { [BepInPlugin("BoomBox.BoomBoxNoPower", "Boombox No Power", "1.0.0.0")] public class BoomBoxModBase : BaseUnityPlugin { private const string modGUID = "BoomBox.BoomBoxNoPower"; private const string modName = "Boombox No Power"; private const string modVersion = "1.0.0.0"; private static BoomBoxModBase instance; private readonly Harmony harmony = new Harmony("BoomBox.BoomBoxNoPower"); internal ManualLogSource logger; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)instance != (Object)null) { instance = this; } logger = Logger.CreateLogSource("BoomBox.BoomBoxNoPower"); logger.LogInfo((object)"Boombox No Power has awoken"); harmony.PatchAll(typeof(BoomBoxModBase)); harmony.PatchAll(typeof(BoomBoxPatch)); } } } namespace BoomBoxNoPower.Patches { [HarmonyPatch(typeof(BoomboxItem))] internal class BoomBoxPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PatchBattery(ref Item ___itemProperties) { ___itemProperties.requiresBattery = false; } } }
BepInEx/plugins/CompanyExecutive.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TerminalApi; using TerminalApi.Events; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SoulWIthMae")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+baa4b8edc3a25a899520149443b1032fbd9a9b6f")] [assembly: AssemblyProduct("CompanyExecutive")] [assembly: AssemblyTitle("CompanyExecutive")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.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 CompanyExecutive { [BepInPlugin("SoulWithMae.CompanyExecutive", "CompanyExecutive", "3.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigEntry<bool> Enabled; public static ConfigEntry<int> MoneyToGive; public static ConfigEntry<bool> ConsistentGive; public static ConfigEntry<bool> OverrideMoney; private readonly Harmony _harmony = new Harmony("CompanyExecutive"); private void Awake() { Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "If the mod is enabled or not"); MoneyToGive = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MoneyToGive", 1000000, "The amount of money to give."); ConsistentGive = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ConsistentGive", true, "Whether to give more money on each day or not."); OverrideMoney = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OverrideMoney", true, "Whether to override the starting money or just add to it."); _harmony.PatchAll(typeof(TerminalPatch)); TerminalConfig.Init(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CompanyExecutive is loaded!"); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Thingy(Terminal __instance, ref int ___groupCredits) { if (!Plugin.Enabled.Value) { return; } if (!Plugin.ConsistentGive.Value) { if (TimeOfDay.Instance.daysUntilDeadline == 3 && TimeOfDay.Instance.profitQuota == 130) { if (Plugin.OverrideMoney.Value) { ___groupCredits = Plugin.MoneyToGive.Value; } else { ___groupCredits += Plugin.MoneyToGive.Value; } } } else if (Plugin.OverrideMoney.Value) { ___groupCredits = Plugin.MoneyToGive.Value; } else { ___groupCredits += Plugin.MoneyToGive.Value; } } } public static class TerminalConfig { [CompilerGenerated] private static class <>O { public static TerminalParseSentenceEventHandler <0>__OnCommandSent; } public static void Init() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown TerminalApi.AddCommand("executive toggle", "Toggled pref.\n", (string)null, true); TerminalApi.AddCommand("executive consistent", "Toggled pref.\n", (string)null, true); TerminalApi.AddCommand("executive override", "Toggled pref.\n", (string)null, true); TerminalApi.AddCommand("executive give", "Added money to account.\n", (string)null, true); object obj = <>O.<0>__OnCommandSent; if (obj == null) { TerminalParseSentenceEventHandler val = OnCommandSent; <>O.<0>__OnCommandSent = val; obj = (object)val; } Events.TerminalParsedSentence += (TerminalParseSentenceEventHandler)obj; } private static void OnCommandSent(object sender, TerminalParseSentenceEventArgs e) { Terminal val = Object.FindObjectOfType<Terminal>(); if (e.SubmittedText.Contains("executive toggle")) { Plugin.Enabled.Value = !Plugin.Enabled.Value; } if (e.SubmittedText.Contains("executive consistent")) { Plugin.ConsistentGive.Value = !Plugin.ConsistentGive.Value; } if (e.SubmittedText.Contains("executive override")) { Plugin.OverrideMoney.Value = !Plugin.OverrideMoney.Value; } if (e.SubmittedText.Contains("executive give")) { if (Plugin.OverrideMoney.Value) { val.groupCredits = Plugin.MoneyToGive.Value; } else { val.groupCredits += Plugin.MoneyToGive.Value; } } } } public static class PluginInfo { public const string PLUGIN_GUID = "CompanyExecutive"; public const string PLUGIN_NAME = "CompanyExecutive"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/Coroner/Coroner.dll
Decompiled 10 months 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/CustomBoomboxFix.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; [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("CustomBoomboxFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CustomBoomboxFix")] [assembly: AssemblyTitle("CustomBoomboxFix")] [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 CustomBoomboxFix { [BepInPlugin("CustomBoomboxFix", "CustomBoomboxFix", "1.0.0")] public class Plugin : BaseUnityPlugin { private string CustomSongsPluginPath => Path.Combine(Paths.PluginPath, "Custom Songs"); private string TargetPath => Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CustomBoomboxFix is loaded!"); CreatePluginCustomSongsFolder(); DeleteAllFilesInTargetPath(); SearchAndCopyCustomSongs(); CopyMusicFiles(); } private void CreatePluginCustomSongsFolder() { if (!Directory.Exists(CustomSongsPluginPath)) { Directory.CreateDirectory(CustomSongsPluginPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Created 'Custom Songs' folder in plugin directory."); } } private void CopyMusicFiles() { if (!Directory.Exists(TargetPath)) { Directory.CreateDirectory(TargetPath); } IEnumerable<string> enumerable = Directory.GetFiles(CustomSongsPluginPath, "*.mp3").Concat(Directory.GetFiles(CustomSongsPluginPath, "*.wav")); foreach (string item in enumerable) { string fileName = Path.GetFileName(item); string text = Path.Combine(TargetPath, fileName); if (!File.Exists(text)) { File.Copy(item, text); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied " + fileName + " to Boombox Music folder.")); } } } private void DeleteAllFilesInTargetPath() { try { if (Directory.Exists(TargetPath)) { string[] files = Directory.GetFiles(TargetPath); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Deleting files in '" + TargetPath + "'...")); string[] array = files; foreach (string path in array) { File.Delete(path); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Deleted files in '" + TargetPath + "'")); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Target path '" + TargetPath + "' does not exist.")); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("An error occurred while trying to delete files: " + ex.Message)); } } private void SearchAndCopyCustomSongs() { string[] directories = Directory.GetDirectories(Paths.PluginPath); string[] array = directories; foreach (string path in array) { string text = Path.Combine(path, "Custom Songs"); if (!Directory.Exists(text)) { continue; } IEnumerable<string> enumerable = Directory.GetFiles(text, "*.mp3").Concat(Directory.GetFiles(text, "*.wav")); foreach (string item in enumerable) { string fileName = Path.GetFileName(item); string text2 = Path.Combine(TargetPath, fileName); if (!File.Exists(text2)) { File.Copy(item, text2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Copied " + fileName + " from " + text + " to Boombox Music folder.")); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "CustomBoomboxFix"; public const string PLUGIN_NAME = "CustomBoomboxFix"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/CustomBoomboxTracks.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CustomBoomboxTracks.Configuration; using CustomBoomboxTracks.Managers; using CustomBoomboxTracks.Utilities; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [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("CustomBoomboxTracks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0")] [assembly: AssemblyProduct("CustomBoomboxTracks")] [assembly: AssemblyTitle("CustomBoomboxTracks")] [assembly: AssemblyVersion("1.4.0.0")] namespace CustomBoomboxTracks { [BepInPlugin("com.steven.lethalcompany.boomboxmusic", "Custom Boombox Music", "1.4.0")] public class BoomboxPlugin : BaseUnityPlugin { private const string GUID = "com.steven.lethalcompany.boomboxmusic"; private const string NAME = "Custom Boombox Music"; private const string VERSION = "1.4.0"; private static BoomboxPlugin Instance; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) Instance = this; LogInfo("Loading..."); AudioManager.GenerateFolders(); Config.Init(); new Harmony("com.steven.lethalcompany.boomboxmusic").PatchAll(); LogInfo("Loading Complete!"); } internal static void LogDebug(string message) { Instance.Log(message, (LogLevel)32); } internal static void LogInfo(string message) { Instance.Log(message, (LogLevel)16); } internal static void LogWarning(string message) { Instance.Log(message, (LogLevel)4); } internal static void LogError(string message) { Instance.Log(message, (LogLevel)2); } internal static void LogError(Exception ex) { Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2); } private void Log(string message, LogLevel logLevel) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.Log(logLevel, (object)message); } } } namespace CustomBoomboxTracks.Utilities { public class SharedCoroutineStarter : MonoBehaviour { private static SharedCoroutineStarter _instance; public static Coroutine StartCoroutine(IEnumerator routine) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("Shared Coroutine Starter").AddComponent<SharedCoroutineStarter>(); Object.DontDestroyOnLoad((Object)(object)_instance); } return ((MonoBehaviour)_instance).StartCoroutine(routine); } } } namespace CustomBoomboxTracks.Patches { [HarmonyPatch(typeof(BoomboxItem), "PocketItem")] internal class BoomboxItem_PocketItem { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); bool flag = false; for (int i = 0; i < list.Count; i++) { if (!flag) { if (list[i].opcode == OpCodes.Call) { flag = true; } continue; } if (list[i].opcode == OpCodes.Ret) { break; } list[i].opcode = OpCodes.Nop; } return list; } } [HarmonyPatch(typeof(BoomboxItem), "Start")] internal class BoomboxItem_Start { private static void Postfix(BoomboxItem __instance) { if (AudioManager.FinishedLoading) { AudioManager.ApplyClips(__instance); return; } AudioManager.OnAllSongsLoaded += delegate { AudioManager.ApplyClips(__instance); }; } } [HarmonyPatch(typeof(BoomboxItem), "StartMusic")] internal class BoomboxItem_StartMusic { private static void Postfix(BoomboxItem __instance, bool startMusic) { if (startMusic) { BoomboxPlugin.LogInfo("Playing " + ((Object)__instance.boomboxAudio.clip).name); } } } [HarmonyPatch(typeof(StartOfRound), "Awake")] internal class StartOfRound_Awake { private static void Prefix() { AudioManager.Load(); } } } namespace CustomBoomboxTracks.Managers { internal static class AudioManager { private static string[] allSongPaths; private static List<AudioClip> clips = new List<AudioClip>(); private static bool firstRun = true; private static bool finishedLoading = false; private static readonly string directory = Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music"); public static bool FinishedLoading => finishedLoading; public static bool HasNoSongs => allSongPaths.Length == 0; public static event Action OnAllSongsLoaded; public static void GenerateFolders() { Directory.CreateDirectory(directory); BoomboxPlugin.LogInfo("Created directory at " + directory); } public static void Load() { if (!firstRun) { return; } firstRun = false; allSongPaths = Directory.GetFiles(directory); if (allSongPaths.Length == 0) { BoomboxPlugin.LogWarning("No songs found!"); return; } BoomboxPlugin.LogInfo("Preparing to load AudioClips..."); List<Coroutine> list = new List<Coroutine>(); string[] array = allSongPaths; for (int i = 0; i < array.Length; i++) { Coroutine item = SharedCoroutineStarter.StartCoroutine(LoadAudioClip(array[i])); list.Add(item); } SharedCoroutineStarter.StartCoroutine(WaitForAllClips(list)); } private static IEnumerator LoadAudioClip(string filePath) { BoomboxPlugin.LogInfo("Loading " + filePath + "!"); if ((int)GetAudioType(filePath) == 0) { BoomboxPlugin.LogError("Failed to load AudioClip from " + filePath + "\nUnsupported file extension!"); yield break; } UnityWebRequest loader = UnityWebRequestMultimedia.GetAudioClip(filePath, GetAudioType(filePath)); if (Config.StreamFromDisk) { DownloadHandler downloadHandler = loader.downloadHandler; ((DownloadHandlerAudioClip)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null)).streamAudio = true; } loader.SendWebRequest(); while (!loader.isDone) { yield return null; } if (loader.error != null) { BoomboxPlugin.LogError("Error loading clip from path: " + filePath + "\n" + loader.error); BoomboxPlugin.LogError(loader.error); yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(loader); if (Object.op_Implicit((Object)(object)content) && (int)content.loadState == 2) { BoomboxPlugin.LogInfo("Loaded " + filePath); ((Object)content).name = Path.GetFileName(filePath); clips.Add(content); } else { BoomboxPlugin.LogError("Failed to load clip at: " + filePath + "\nThis might be due to an mismatch between the audio codec and the file extension!"); } } private static IEnumerator WaitForAllClips(List<Coroutine> coroutines) { foreach (Coroutine coroutine in coroutines) { yield return coroutine; } clips.Sort((AudioClip first, AudioClip second) => ((Object)first).name.CompareTo(((Object)second).name)); finishedLoading = true; AudioManager.OnAllSongsLoaded?.Invoke(); AudioManager.OnAllSongsLoaded = null; } public static void ApplyClips(BoomboxItem __instance) { BoomboxPlugin.LogInfo("Applying clips!"); if (Config.UseDefaultSongs) { __instance.musicAudios = __instance.musicAudios.Concat(clips).ToArray(); } else { __instance.musicAudios = clips.ToArray(); } BoomboxPlugin.LogInfo($"Total Clip Count: {__instance.musicAudios.Length}"); } private static AudioType GetAudioType(string path) { string text = Path.GetExtension(path).ToLower(); switch (text) { case ".wav": return (AudioType)20; case ".ogg": return (AudioType)14; case ".mp3": return (AudioType)13; default: BoomboxPlugin.LogError("Unsupported extension type: " + text); return (AudioType)0; } } } } namespace CustomBoomboxTracks.Configuration { internal static class Config { private const string CONFIG_FILE_NAME = "boombox.cfg"; private static ConfigFile _config; private static ConfigEntry<bool> _useDefaultSongs; private static ConfigEntry<bool> _streamAudioFromDisk; public static bool UseDefaultSongs { get { if (!_useDefaultSongs.Value) { return AudioManager.HasNoSongs; } return true; } } public static bool StreamFromDisk => _streamAudioFromDisk.Value; public static void Init() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown BoomboxPlugin.LogInfo("Initializing config..."); _config = new ConfigFile(Path.Combine(Paths.ConfigPath, "boombox.cfg"), true); _useDefaultSongs = _config.Bind<bool>("Config", "Use Default Songs", false, "Include the default songs in the rotation."); _streamAudioFromDisk = _config.Bind<bool>("Config", "Stream Audio From Disk", false, "Requires less memory and takes less time to load, but prevents playing the same song twice at once."); BoomboxPlugin.LogInfo("Config initialized!"); } private static void PrintConfig() { BoomboxPlugin.LogInfo($"Use Default Songs: {_useDefaultSongs.Value}"); BoomboxPlugin.LogInfo($"Stream From Disk: {_streamAudioFromDisk}"); } } }
BepInEx/plugins/EmployeeAssignments.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using PersonalAssignments.AssignmentLogic; using PersonalAssignments.Components; using PersonalAssignments.Data; using PersonalAssignments.Network; using PersonalAssignments.UI; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EmployeeAssignments")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("PersonalAssignments")] [assembly: AssemblyFileVersion("1.0.9.0")] [assembly: AssemblyInformationalVersion("1.0.9")] [assembly: AssemblyProduct("EmployeeAssignments")] [assembly: AssemblyTitle("EmployeeAssignments")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.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 PersonalAssignments { [BepInPlugin("EmployeeAssignments", "EmployeeAssignments", "1.0.9")] public class Plugin : BaseUnityPlugin { private static bool Initialized; public static ManualLogSource Log { get; private set; } private void Start() { Initialize(); } private void OnDestroy() { Initialize(); } private void Initialize() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; if (!Initialized) { Initialized = true; GameObject val = new GameObject("PersonalAssignmentManager"); Object.DontDestroyOnLoad((Object)(object)val); PersonalAssignmentManager personalAssignmentManager = val.AddComponent<PersonalAssignmentManager>(); personalAssignmentManager.Config = new PAConfig(((BaseUnityPlugin)this).Config); val.AddComponent<KillableEnemiesOutput>(); val.AddComponent<UpdateChecker>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin EmployeeAssignments is loaded!"); } } } [Serializable] public enum AssignmentType { CollectScrapItem, KillMonster, RepairValve } [Serializable] public struct Assignment { public string Name; public string UID; public byte ID; public string BodyText; public string ShortText; public string TargetText; public string FailureReason; public int CashReward; public int XPReward; public AssignmentType Type; public ulong PlayerId; public ulong[] TargetIds; public int TargetsComplete; public Vector3 FixedTargetPosition; } public static class Assignments { public static readonly Assignment[] All = new Assignment[3] { new Assignment { Name = "SCRAP RETRIEVAL", UID = "collect_scrap", BodyText = "YOU MUST COLLECT THE FOLLOWING SCRAP ITEM: [{0}] IT WILL BE MARKED AS [ASSIGNMENT TARGET]", ShortText = "FIND THE [{0}] MARKED 'ASSIGNMENT TARGET'", FailureReason = "ANOTHER EMPLOYEE COLLECTED THE ITEM", CashReward = 100, XPReward = 0, Type = AssignmentType.CollectScrapItem, TargetIds = new ulong[1] }, new Assignment { Name = "HUNT & KILL", UID = "hunt_kill", BodyText = "YOU MUST HUNT AND KILL THE FOLLOWING ENEMY: [{0}] IT WILL BE MARKED AS [ASSIGNMENT TARGET]", ShortText = "FIND AND KILL THE [{0}]", FailureReason = "THE ENEMY WAS NOT KILLED", CashReward = 200, XPReward = 0, Type = AssignmentType.KillMonster, TargetIds = new ulong[1] }, new Assignment { Name = "REPAIR VALVE", UID = "repair_valve", BodyText = "YOU MUST FIND AND REPAIR THE BROKEN VALVE", ShortText = "FIND AND REPAIR THE BROKEN VALVE", TargetText = "BROKEN VALVE", FailureReason = "THE BROKEN VALVE WAS NOT FIXED", CashReward = 100, XPReward = 0, Type = AssignmentType.RepairValve, TargetIds = new ulong[1] } }; public static Assignment GetAssignment(string guid) { Assignment[] all = All; for (int i = 0; i < all.Length; i++) { Assignment result = all[i]; if (result.UID == guid) { return result; } } return default(Assignment); } } public class PersonalAssignmentManager : MonoBehaviour { private readonly List<IAssignmentLogic> _assignmentLogic = new List<IAssignmentLogic>(); private NetworkUtils _networkUtils; private AssignmentUI _assignmentUI; private PAContext _context; private GameContext _gameContext; private int _maxAssignedPlayers = 20; private int _minAssignedPlayers = 1; public PAConfig Config; private Coroutine _lootValueSyncRoutine; private WaitForSecondsRealtime _rewardValueSyncDelay = new WaitForSecondsRealtime(1f); private void Log(string log) { Plugin.Log.LogInfo((object)log); } public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _context = new PAContext(); _assignmentUI = new GameObject("UI").AddComponent<AssignmentUI>(); ((Component)_assignmentUI).transform.SetParent(((Component)this).transform); _networkUtils = ((Component)this).gameObject.AddComponent<NetworkUtils>(); NetworkUtils networkUtils = _networkUtils; networkUtils.OnNetworkData = (Action<string, byte[]>)Delegate.Combine(networkUtils.OnNetworkData, new Action<string, byte[]>(OnNetworkData)); NetworkUtils networkUtils2 = _networkUtils; networkUtils2.OnDisconnect = (Action)Delegate.Combine(networkUtils2.OnDisconnect, new Action(OnDisconnect)); _gameContext = new GameContext(); GameStateSync gameStateSync = ((Component)this).gameObject.AddComponent<GameStateSync>(); gameStateSync.Inject(_gameContext, _networkUtils); GameContext gameContext = _gameContext; gameContext.GameStateChanged = (Action<GameStateEnum>)Delegate.Combine(gameContext.GameStateChanged, new Action<GameStateEnum>(GameStateChanged)); InstallAssignmentLogic(); } private void InstallAssignmentLogic() { _assignmentLogic.Add(new CollectScrapLogic(_context)); _assignmentLogic.Add(new HuntAndKillLogic(_context)); _assignmentLogic.Add(new RepairValveLogic(_context)); } public void Start() { _maxAssignedPlayers = Config.MaxAssignedPlayers.Value; _minAssignedPlayers = Config.MinAssignedPlayers.Value; _context.AssignAllPlayers = Config.AssignAllPlayers.Value; _context.AllPlayersComplete = Config.AllPlayersCanComplete.Value; Assignments.All[0].CashReward = Config.ScrapRetrievalReward.Value; Assignments.All[2].CashReward = Config.BrokenValveReward.Value; _context.ParseStringArray(ref _context.EnemyWhitelist, Config.HuntAndKillWhitelist); _context.ParseStringArray(ref _context.AssignmentWhitelist, Config.AssignmentWhiteList); _context.ParseIntArray(ref _context.AssignmentWeights, Config.AssignmentWeights); _context.ParseIntArray(ref _context.EnemyWeights, Config.HuntAndKillWeights); _context.ParseIntArray(ref _context.EnemyRewards, Config.HuntAndKillRewards); } private void OnDisconnect() { HandleResetEvent(); } private void SendNetworkEvent<T>(T netEvent) where T : IPAEvent { string s = JsonUtility.ToJson((object)netEvent); byte[] bytes = Encoding.UTF8.GetBytes(s); _networkUtils.SendToAll(netEvent.TAG, bytes); } private void OnNetworkData(string tag, byte[] data) { if (tag.StartsWith("PA-")) { string @string = Encoding.UTF8.GetString(data); Log("Incoming data " + tag + " " + @string); switch (tag) { case "PA-Reset": HandleResetEvent(); break; case "PA-Allocation": { AssignmentEvent assignmentEvent2 = JsonUtility.FromJson<AssignmentEvent>(@string); HandleAllocationEvent(assignmentEvent2); break; } case "PA-Complete": { CompleteEvent assignmentEvent = JsonUtility.FromJson<CompleteEvent>(@string); HandleCompleteEvent(assignmentEvent); break; } case "PA-Failed": { FailedEvent failedEvent = JsonUtility.FromJson<FailedEvent>(@string); HandleFailedEvent(failedEvent); break; } } } } private void HandleResetEvent() { _context.AssignmentsGenerated = false; _context.CurrentAssignment = null; _context.ActiveAssignments.Clear(); _context.CompletedAssignments.Clear(); _assignmentUI.ClearAssignment(); } private void HandleAllocationEvent(AssignmentEvent assignmentEvent) { Assignment assignment = Assignments.GetAssignment(assignmentEvent.AssignmentUID); assignment.PlayerId = assignmentEvent.PlayerId; assignment.TargetIds = assignmentEvent.TargetIds; assignment.CashReward = assignmentEvent.RewardValue; assignment.TargetText = assignmentEvent.TargetName; assignment.ID = assignmentEvent.AssignmentID; bool flag = assignment.PlayerId == NetworkManager.Singleton.LocalClientId; bool flag2 = _assignmentLogic[(int)assignment.Type].HandleAllocationEvent(ref assignment, flag); if (flag && flag2) { _context.CurrentAssignment = assignment; ShowAssignment(_context.CurrentAssignment.Value); } else { Log($"Assignment not assigned to local player: (ForLocalPlayer){flag} | (SetupComplete){flag2}"); } } private void HandleCompleteEvent(CompleteEvent assignmentEvent) { Assignment assignment = Assignments.GetAssignment(assignmentEvent.AssignmentUID); assignment.CashReward = assignmentEvent.RewardValue; assignment.TargetIds = assignmentEvent.TargetIds; assignment.PlayerId = assignmentEvent.PlayerId; assignment.ID = assignmentEvent.AssignmentID; bool flag = _context.CurrentAssignment.HasValue && _context.CurrentAssignment.Value.ID == assignmentEvent.AssignmentID && assignment.PlayerId == NetworkManager.Singleton.LocalClientId; _assignmentLogic[(int)assignment.Type].CompleteAssignment(ref assignment, flag); if (flag) { CompleteAssignment(); } } private void HandleFailedEvent(FailedEvent failedEvent) { if (_context.CurrentAssignment.HasValue && _context.CurrentAssignment.Value.ID == failedEvent.AssignmentID && failedEvent.PlayerId == NetworkManager.Singleton.LocalClientId) { FailAssignment(failedEvent.Reason); } } private void GameStateChanged(GameStateEnum state) { switch (state) { case GameStateEnum.MainMenu: HandleResetEvent(); break; case GameStateEnum.Orbit: ShipTookOff(); break; case GameStateEnum.CompanyHQ: HandleResetEvent(); break; case GameStateEnum.Level: LandedOnMoon(); if (NetworkManager.Singleton.IsHost) { GenerateAssignments(); } break; } } public void LandedOnMoon() { } public void ShipTookOff() { ClearAllAssignments(); } private void ClearAllAssignments() { SendNetworkEvent(default(ResetEvent)); } public void Update() { if (_gameContext.GameState != GameStateEnum.Level) { return; } if (_context.CurrentAssignment.HasValue) { _assignmentUI.SetAssignment(_context.CurrentAssignment.Value); } if (NetworkManager.Singleton.IsHost) { if (_context.ActiveAssignments.Count > 0) { CheckCompleted(); } if (_lootValueSyncRoutine == null && _context.SyncedRewardValues.Count > 0) { _lootValueSyncRoutine = ((MonoBehaviour)this).StartCoroutine(SyncLootValues()); } } } private IEnumerator SyncLootValues() { yield return _rewardValueSyncDelay; for (int i = _context.SyncedRewardValues.Count - 1; i >= 0; i--) { if ((Object)(object)_context.SyncedRewardValues[i].Item1 == (Object)null) { _context.SyncedRewardValues.RemoveAt(i); } } if (_context.SyncedRewardValues.Count > 0) { List<NetworkObjectReference> references = new List<NetworkObjectReference>(); List<int> values = new List<int>(); foreach (var item in _context.SyncedRewardValues) { references.Add(NetworkObjectReference.op_Implicit(item.Item1)); values.Add(item.Item2); } RoundManager.Instance.SyncScrapValuesClientRpc(references.ToArray(), values.ToArray()); } _lootValueSyncRoutine = null; } private void GenerateAssignments() { int num = 0; _context.CompletedAssignments.Clear(); _context.ActiveAssignments.Clear(); _context.ExcludeTargetIds.Clear(); IReadOnlyList<ulong> connectedClientsIds = NetworkManager.Singleton.ConnectedClientsIds; int num2 = Mathf.Max(_minAssignedPlayers, Mathf.Min(_maxAssignedPlayers, RoundManager.Instance.playersManager.connectedPlayersAmount / 2)); List<int> list = new List<int>(); for (int i = 0; i < connectedClientsIds.Count; i++) { list.Add(i); } num2 = Mathf.Min(num2, list.Count); if (_context.AssignAllPlayers) { num2 = list.Count; } Log($"Starting assignment generation for {num2} players"); byte b = 0; for (int j = 0; j < num2; j++) { b++; int index = Random.Range(0, list.Count); int index2 = list[index]; int num3 = Utils.WeightedRandom(_context.AssignmentWeights); Assignment assignment = Assignments.GetAssignment(_context.AssignmentWhitelist[num3]); if (!string.IsNullOrEmpty(assignment.UID)) { assignment.PlayerId = connectedClientsIds[index2]; assignment.ID = b; bool flag = _assignmentLogic[(int)assignment.Type].ServerSetupAssignment(ref assignment); if (!flag && num < 5) { j--; Log($"trying to find another assignment {connectedClientsIds[index2]}"); num++; } else if (flag) { Log($"created assignment for player {connectedClientsIds[index2]}"); AssignmentEvent assignmentEvent = default(AssignmentEvent); assignmentEvent.PlayerId = connectedClientsIds[index2]; assignmentEvent.AssignmentUID = _context.AssignmentWhitelist[num3]; assignmentEvent.TargetIds = assignment.TargetIds; assignmentEvent.RewardValue = assignment.CashReward; assignmentEvent.TargetName = assignment.TargetText; assignmentEvent.AssignmentID = b; AssignmentEvent netEvent = assignmentEvent; SendNetworkEvent(netEvent); _context.ActiveAssignments.Add(assignment); list.RemoveAt(index); } } } _context.AssignmentsGenerated = true; Log("Finishing assignment generation"); } private void CheckCompleted() { bool wasPressedThisFrame = ((ButtonControl)Keyboard.current.oKey).wasPressedThisFrame; bool wasPressedThisFrame2 = ((ButtonControl)Keyboard.current.pKey).wasPressedThisFrame; for (int num = _context.ActiveAssignments.Count - 1; num >= 0; num--) { Assignment assignment = _context.ActiveAssignments[num]; AssignmentState assignmentState = _assignmentLogic[(int)assignment.Type].CheckCompletion(ref assignment); if (assignmentState != 0) { _context.ActiveAssignments.RemoveAt(num); _context.CompletedAssignments.Add(assignment); } switch (assignmentState) { case AssignmentState.Complete: SendNetworkEvent(new CompleteEvent { PlayerId = assignment.PlayerId, AssignmentUID = assignment.UID, TargetIds = assignment.TargetIds, RewardValue = assignment.CashReward, AssignmentID = assignment.ID }); break; case AssignmentState.Failed: SendNetworkEvent(new FailedEvent { PlayerId = assignment.PlayerId, Reason = assignment.FailureReason, AssignmentID = assignment.ID }); break; } } } private void ShowAssignment(Assignment assignment) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown if (!((Object)(object)HUDManager.Instance == (Object)null)) { DialogueSegment[] array = (DialogueSegment[])(object)new DialogueSegment[1] { new DialogueSegment { speakerText = "ASSIGNMENT:" + assignment.Name, bodyText = "YOU HAVE BEEN SELECTED BY THE COMPANY FOR ASSIGNMENT, " + string.Format(assignment.BodyText, assignment.TargetText), waitTime = 10f } }; _assignmentUI.SetAssignment(assignment); HUDManager.Instance.ReadDialogue(array); } } private void CompleteAssignment() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (_context.CurrentAssignment.HasValue) { DialogueSegment[] array = (DialogueSegment[])(object)new DialogueSegment[1] { new DialogueSegment { speakerText = "ASSIGNMENT COMPLETE", bodyText = "YOU HAVE COMPLETED THE ASSIGNMENT, WELL DONE. THE COMPANY VALUES YOUR LOYALTY", waitTime = 5f } }; _assignmentUI.ClearAssignment(); HUDManager.Instance.ReadDialogue(array); _context.CurrentAssignment = null; } } private void FailAssignment(string reason) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004f: Expected O, but got Unknown if (_context.CurrentAssignment.HasValue) { DialogueSegment[] array = (DialogueSegment[])(object)new DialogueSegment[1] { new DialogueSegment { speakerText = "ASSIGNMENT FAILED", bodyText = "YOU FAILED TO COMPLETE THE ASSIGNMENT. REASON: " + reason, waitTime = 5f } }; _assignmentUI.ClearAssignment(); HUDManager.Instance.ReadDialogue(array); _context.CurrentAssignment = null; } } } public static class Utils { private const float EASE_IN_OUT_MAGIC1 = 1.7f; private const float EASE_IN_OUT_MAGIC2 = 2.5500002f; public static float EaseInOutBack(float x) { return (x < 0.5f) ? (MathF.Pow(2f * x, 2f) * (7.1000004f * x - 2.5500002f) / 2f) : ((MathF.Pow(2f * x - 2f, 2f) * (3.5500002f * (x * 2f - 2f) + 2.5500002f) + 2f) / 2f); } public static int WeightedRandom(int[] weights) { int num = 0; for (int i = 0; i < weights.Length; i++) { num += weights[i]; } int num2 = Random.Range(0, num); int num3 = 0; for (int j = 0; j < weights.Length; j++) { num3 += weights[j]; if (num3 >= num2) { return j; } } return 0; } } public static class PluginInfo { public const string PLUGIN_GUID = "EmployeeAssignments"; public const string PLUGIN_NAME = "EmployeeAssignments"; public const string PLUGIN_VERSION = "1.0.9"; } } namespace PersonalAssignments.UI { public class AssignmentUI : MonoBehaviour { private enum State { Showing, Shown, Hiding, Hidden } private readonly Color NONE_TEXT_COLOR = new Color(1f, 0.8277124f, 0.5235849f, 0.3254902f); private readonly Color BG_COLOR = new Color(1f, 0.6916346f, 0.259434f, 1f); private readonly Color TITLE_COLOR = new Color(1f, 0.9356132f, 0.8160377f, 1f); private readonly Color TEXT_COLOR = new Color(0.3584906f, 0.2703371f, 0f, 1f); private const float SHOW_SPEED = 1f; private const float HIDE_SPEED = 2f; private readonly Vector2 SHOW_POSITION = new Vector2(-50f, -350f); private readonly Vector2 HIDE_POSITION = new Vector2(500f, -350f); private Canvas _canvas; private GameObject _noneText; private RectTransform _assignment; private Text _assignmentTitle; private Text _assignmentText; private Font _font; private QuickMenuManager _menuManager; private State _state; private float _animationProgress; public Assignment? _activeAssignment; private void Awake() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: 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) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0342: 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_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); _state = State.Hidden; ((Component)this).gameObject.layer = 5; _font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); _canvas = new GameObject("Canvas").AddComponent<Canvas>(); ((Component)_canvas).transform.SetParent(((Component)this).transform); _canvas.sortingOrder = -100; _canvas.renderMode = (RenderMode)0; RectTransform component = ((Component)_canvas).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(1920f, 1080f); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.zero; component.pivot = Vector2.zero / 2f; CanvasScaler val = ((Component)_canvas).gameObject.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.screenMatchMode = (ScreenMatchMode)2; val.referenceResolution = new Vector2(1920f, 1080f); _noneText = new GameObject("NoneText"); Text val2 = _noneText.AddComponent<Text>(); val2.fontSize = 20; val2.font = _font; val2.fontStyle = (FontStyle)1; val2.text = "NO ASSIGNMENT ACTIVE"; ((Graphic)val2).color = NONE_TEXT_COLOR; val2.alignment = (TextAnchor)4; RectTransform component2 = _noneText.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component); component2.pivot = Vector2.one; component2.anchorMin = Vector2.one; component2.anchorMax = Vector2.one; component2.anchoredPosition = new Vector2(-70f, -360f); component2.sizeDelta = new Vector2(310f, 50f); CanvasGroup val3 = new GameObject("AssignmentPanel").AddComponent<CanvasGroup>(); val3.alpha = 0.5f; Image val4 = ((Component)val3).gameObject.AddComponent<Image>(); ((Graphic)val4).color = BG_COLOR; _assignment = ((Component)val3).gameObject.GetComponent<RectTransform>(); ((Transform)_assignment).SetParent((Transform)(object)component); _assignment.pivot = Vector2.one; _assignment.anchorMin = Vector2.one; _assignment.anchorMax = Vector2.one; _assignment.anchoredPosition = new Vector2(-50f, -350f); _assignment.sizeDelta = new Vector2(350f, 80f); _assignmentTitle = new GameObject("Title").AddComponent<Text>(); _assignmentTitle.font = _font; _assignmentTitle.fontSize = 20; _assignmentTitle.fontStyle = (FontStyle)1; _assignmentTitle.text = "NO ASSIGNMENT ACTIVE"; ((Graphic)_assignmentTitle).color = TITLE_COLOR; _assignmentTitle.alignment = (TextAnchor)0; RectTransform component3 = ((Component)_assignmentTitle).gameObject.GetComponent<RectTransform>(); ((Transform)component3).SetParent((Transform)(object)_assignment); component3.pivot = new Vector2(0.5f, 1f); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = Vector2.one; component3.anchoredPosition = new Vector2(0f, -10f); component3.sizeDelta = new Vector2(-40f, 100f); _assignmentText = new GameObject("Text").AddComponent<Text>(); _assignmentText.font = _font; _assignmentText.fontSize = 16; _assignmentText.fontStyle = (FontStyle)1; _assignmentText.text = "NO ASSIGNMENT ACTIVE"; ((Graphic)_assignmentText).color = TEXT_COLOR; _assignmentText.alignment = (TextAnchor)6; RectTransform component4 = ((Component)_assignmentText).gameObject.GetComponent<RectTransform>(); ((Transform)component4).SetParent((Transform)(object)_assignment); component4.pivot = new Vector2(0.5f, 0.5f); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = Vector2.one; component4.anchoredPosition = new Vector2(0f, -10f); component4.sizeDelta = new Vector2(-40f, -40f); } public void SetAssignment(Assignment assignment) { if (_state == State.Hidden || _state == State.Hiding) { ChangeState(State.Showing); _activeAssignment = assignment; _assignmentTitle.text = assignment.Name; _assignmentText.text = string.Format(assignment.ShortText, assignment.TargetText); } } public void ClearAssignment(bool force = false) { if (force || _state == State.Shown || _state == State.Showing) { ChangeState(State.Hiding); _activeAssignment = null; } } private void ChangeState(State state) { _state = state; _animationProgress = 0f; } private void PanelAnimation() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (_state == State.Shown || _state == State.Hidden) { return; } if (_animationProgress >= 1f) { _state++; return; } float num = 1f; if (_state == State.Hiding) { num = 2f; } _animationProgress += num * Time.deltaTime; float num2 = _animationProgress; if (_state == State.Hiding) { num2 = 1f - num2; } _assignment.anchoredPosition = Vector2.Lerp(HIDE_POSITION, SHOW_POSITION, Utils.EaseInOutBack(num2)); } private void Update() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) PanelAnimation(); bool flag = (Object)(object)GameNetworkManager.Instance?.localPlayerController != (Object)null && !GameNetworkManager.Instance.localPlayerController.isPlayerDead; if ((Object)(object)_menuManager == (Object)null) { flag = false; _menuManager = Object.FindAnyObjectByType<QuickMenuManager>(); } else { flag &= !_menuManager.isMenuOpen; } if (_activeAssignment.HasValue && _activeAssignment.Value.FixedTargetPosition != Vector3.zero) { float num = Vector3.Distance(_activeAssignment.Value.FixedTargetPosition, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position); _assignmentText.text = string.Format(_activeAssignment.Value.ShortText, _activeAssignment.Value.TargetText) + $" {(int)num}m"; } ((Component)_assignment).gameObject.SetActive(_state != State.Hidden); _noneText.SetActive(!_activeAssignment.HasValue); ((Behaviour)_canvas).enabled = flag; } } } namespace PersonalAssignments.Network { [Serializable] public struct NetworkMessage { public string MessageTag; public ulong TargetId; public Hash128 Checksum; public byte[] Data; } public class NetworkUtils : MonoBehaviour { public Action<string, byte[]> OnNetworkData; public Action OnDisconnect; public Action OnConnect; private bool _initialized; private bool _connected; public bool IsConnected => _connected; private void Initialize() { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && NetworkManager.Singleton.CustomMessagingManager != null) { _initialized = true; Debug.Log((object)"[Network Transport] Initialized"); } } private void UnInitialize() { if (_connected) { Disconnected(); } _initialized = false; } private void Connected() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown NetworkManager.Singleton.CustomMessagingManager.OnUnnamedMessage += new UnnamedMessageDelegate(OnMessageEvent); OnConnect?.Invoke(); _connected = true; Debug.Log((object)"[Network Transport] Connected"); } private void Disconnected() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if (((singleton != null) ? singleton.CustomMessagingManager : null) != null) { NetworkManager.Singleton.CustomMessagingManager.OnUnnamedMessage -= new UnnamedMessageDelegate(OnMessageEvent); } OnDisconnect?.Invoke(); _connected = false; Debug.Log((object)"[Network Transport] Disconnected"); } public void Update() { if (!_initialized) { Initialize(); } else if ((Object)(object)NetworkManager.Singleton == (Object)null) { UnInitialize(); } else if (!_connected && NetworkManager.Singleton.IsConnectedClient) { Connected(); } else if (_connected && !NetworkManager.Singleton.IsConnectedClient) { Disconnected(); } } private void OnMessageEvent(ulong clientId, FastBufferReader reader) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0070: Unknown result type (might be due to invalid IL or missing references) Hash128 val = default(Hash128); string text = ""; NetworkMessage networkMessage = default(NetworkMessage); try { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); Debug.Log((object)$"[Network Transport] Incoming message from {clientId} {text}"); networkMessage = JsonUtility.FromJson<NetworkMessage>(text); val = Hash128.Compute<byte>(networkMessage.Data); } catch (Exception ex) { Debug.LogException(ex); } if (!(val == default(Hash128)) && ((Hash128)(ref val)).CompareTo(val) == 0) { OnNetworkData?.Invoke(networkMessage.MessageTag, networkMessage.Data); } } public void SendToAll(string tag, byte[] data) { if (!_initialized) { return; } foreach (var (num2, val2) in NetworkManager.Singleton.ConnectedClients) { SendTo(val2.ClientId, tag, data); } } public void SendTo(ulong clientId, string tag, byte[] data) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!_initialized) { return; } NetworkMessage networkMessage = default(NetworkMessage); networkMessage.MessageTag = tag; networkMessage.TargetId = clientId; networkMessage.Data = data; networkMessage.Checksum = Hash128.Compute<byte>(data); NetworkMessage networkMessage2 = networkMessage; string text = JsonUtility.ToJson((object)networkMessage2); byte[] bytes = Encoding.UTF8.GetBytes(text); int writeSize = FastBufferWriter.GetWriteSize(text, false); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(writeSize + 1, (Allocator)2, -1); FastBufferWriter val2 = val; try { ((FastBufferWriter)(ref val)).WriteValueSafe(text, false); Debug.Log((object)$"[Network Transport] Sending message to {clientId} {text}"); NetworkManager.Singleton.CustomMessagingManager.SendUnnamedMessage(clientId, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val2)).Dispose(); } } } } namespace PersonalAssignments.Data { public interface IPAEvent { string TAG { get; } } [Serializable] public struct AssignmentEvent : IPAEvent { public byte AssignmentID; public ulong PlayerId; public string AssignmentUID; public int RewardValue; public ulong[] TargetIds; public string TargetName; public string TAG => "PA-Allocation"; } [Serializable] public struct CompleteEvent : IPAEvent { public byte AssignmentID; public ulong PlayerId; public string AssignmentUID; public int RewardValue; public ulong[] TargetIds; public string TAG => "PA-Complete"; } [Serializable] public struct FailedEvent : IPAEvent { public byte AssignmentID; public ulong PlayerId; public string Reason; public string TAG => "PA-Failed"; } [Serializable] [StructLayout(LayoutKind.Sequential, Size = 1)] public struct ResetEvent : IPAEvent { public string TAG => "PA-Reset"; } public class GameContext { private GameStateEnum _gameState; public Action<GameStateEnum> GameStateChanged; public GameStateEnum GameState { get { return _gameState; } set { if (value != _gameState) { _gameState = value; GameStateChanged?.Invoke(value); } } } } public enum GameStateEnum { MainMenu, Orbit, CompanyHQ, Level } public class PAConfig { public readonly ConfigEntry<int> MaxAssignedPlayers; public readonly ConfigEntry<int> MinAssignedPlayers; public readonly ConfigEntry<bool> AssignAllPlayers; public readonly ConfigEntry<int> ScrapRetrievalReward; public readonly ConfigEntry<string> HuntAndKillWhitelist; public readonly ConfigEntry<string> HuntAndKillWeights; public readonly ConfigEntry<string> HuntAndKillRewards; public readonly ConfigEntry<int> BrokenValveReward; public readonly ConfigEntry<bool> AllPlayersCanComplete; public readonly ConfigEntry<string> AssignmentWhiteList; public readonly ConfigEntry<string> AssignmentWeights; public PAConfig(ConfigFile configFile) { MaxAssignedPlayers = configFile.Bind<int>("0_HostOnly.0_General", "MaxAssignedPlayers", 10, "The maximum number of players that can be assigned each round."); MinAssignedPlayers = configFile.Bind<int>("0_HostOnly.0_General", "MinAssignedPlayers", 1, "The minimum number of players that can be assigned each round."); AssignAllPlayers = configFile.Bind<bool>("0_HostOnly.0_General", "AssignAllPlayers", false, "When this is true all connected players will always get an assignment each time you land."); AllPlayersCanComplete = configFile.Bind<bool>("0_HostOnly.0_General", "AllPlayersCanComplete", false, "All players can complete someone elses assignment and it will not fail for the owner"); AssignmentWhiteList = configFile.Bind<string>("0_HostOnly.0_General", "AssignmentWhiteList", "collect_scrap,hunt_kill,repair_valve", "All allowed Assignments"); AssignmentWeights = configFile.Bind<string>("0_HostOnly.0_General", "AssignmentWeights", "50,25,25", "Weights for allowed assignments"); ScrapRetrievalReward = configFile.Bind<int>("0_HostOnly.1_ScrapRetrieval", "AssignmentReward", 100, "The reward for completing a Scrap Retrieval Assignment"); HuntAndKillWhitelist = configFile.Bind<string>("0_HostOnly.2_HuntAndKill", "EnemyWhitelist", "Centipede,Bunker Spider,Hoarding bug,Crawler", "The EnemyNames that are allowed to spawn"); HuntAndKillRewards = configFile.Bind<string>("0_HostOnly.2_HuntAndKill", "EnemyRewards", "100,200,100,200", "The reward for completing a Hunt And KillReward Assignment for each enemy in the whitelist"); HuntAndKillWeights = configFile.Bind<string>("0_HostOnly.2_HuntAndKill", "EnemyWeights", "50,25,50,25", "Spawn Weights for each enemy in the whitelist"); BrokenValveReward = configFile.Bind<int>("0_HostOnly.3_BrokenValve", "AssignmentReward", 100, "The reward for completing a Broken Valve Assignment"); } } public class PAContext { public bool AssignmentsGenerated; public readonly List<Assignment> ActiveAssignments = new List<Assignment>(); public readonly List<Assignment> CompletedAssignments = new List<Assignment>(); public readonly List<ulong> ExcludeTargetIds = new List<ulong>(); public readonly List<(NetworkObject, int)> SyncedRewardValues = new List<(NetworkObject, int)>(); public string[] EnemyWhitelist = new string[0]; public int[] EnemyWeights = new int[0]; public int[] EnemyRewards = new int[0]; public string[] AssignmentWhitelist = new string[0]; public int[] AssignmentWeights = new int[0]; public Assignment? CurrentAssignment; public bool AssignAllPlayers; public bool AllPlayersComplete; public void ParseStringArray(ref string[] array, ConfigEntry<string> data) { string[] array2 = GetConfigValue(data).Split(',', StringSplitOptions.RemoveEmptyEntries); array = new string[array2.Length]; for (int i = 0; i < array2.Length; i++) { array[i] = array2[i].TrimEnd(',').TrimStart(','); } } public void ParseIntArray(ref int[] array, ConfigEntry<string> data) { string[] array2 = GetConfigValue(data).Split(',', StringSplitOptions.RemoveEmptyEntries); array = new int[array2.Length]; for (int i = 0; i < array2.Length; i++) { string s = array2[i].TrimEnd(',').TrimStart(','); if (int.TryParse(s, out var result)) { array[i] = result; } else { array[i] = 0; } } } private string GetConfigValue(ConfigEntry<string> data) { string text = data.Value; if (string.IsNullOrWhiteSpace(text)) { text = (string)((ConfigEntryBase)data).DefaultValue; } return text; } } public static class PAEventTags { public const string PREFIX = "PA-"; public const string RESET = "PA-Reset"; public const string ALLOCATION = "PA-Allocation"; public const string COMPLETE = "PA-Complete"; public const string FAILED = "PA-Failed"; } } namespace PersonalAssignments.Components { public class GameStateSync : MonoBehaviour { private const string COMPANY_BUILDING_SCENE = "CompanyBuilding"; private GameContext _gameContext; private NetworkUtils _networkUtils; private bool _hasLanded; public void Inject(GameContext gameContext, NetworkUtils networkUtils) { _gameContext = gameContext; _networkUtils = networkUtils; } public void Update() { if (!_networkUtils.IsConnected || (Object)(object)StartOfRound.Instance == (Object)null) { _gameContext.GameState = GameStateEnum.MainMenu; } else if (StartOfRound.Instance.inShipPhase && _hasLanded) { _hasLanded = false; _gameContext.GameState = GameStateEnum.Orbit; } else if (StartOfRound.Instance.shipHasLanded && !_hasLanded) { _hasLanded = true; Debug.Log((object)("Landed on moon : " + RoundManager.Instance.currentLevel.sceneName)); if (RoundManager.Instance.currentLevel.sceneName == "CompanyBuilding") { _gameContext.GameState = GameStateEnum.CompanyHQ; } else { _gameContext.GameState = GameStateEnum.Level; } } } } public class KillableEnemiesOutput : MonoBehaviour { private const string OUTPUT_PATH = "/../BepInEx/config2/KillableEnemies.md"; private const string OUTPUT_PREFIX = "#KILLABLE ENEMIES LIST\r\nCopy the names from this list into the enemy assignment whilelist config entry to allow them to spawn.\r\nNote that some enemies would normally be spawnable on certain maps only, I'm not sure how well some\r\nenemies will handle being spawned on those maps but they should work I would have thought."; public void Update() { if (!((Object)(object)StartOfRound.Instance == (Object)null)) { OutputList(); Object.Destroy((Object)(object)this); } } private void OutputList() { List<string> list = new List<string>(); string text = "#KILLABLE ENEMIES LIST\r\nCopy the names from this list into the enemy assignment whilelist config entry to allow them to spawn.\r\nNote that some enemies would normally be spawnable on certain maps only, I'm not sure how well some\r\nenemies will handle being spawned on those maps but they should work I would have thought."; SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { if (!list.Contains(enemy.enemyType.enemyName) && enemy.enemyType.canDie) { list.Add(enemy.enemyType.enemyName); text = text + "\n" + enemy.enemyType.enemyName; } } } try { FileStream fileStream = File.OpenWrite(Application.dataPath + "/../BepInEx/config2/KillableEnemies.md"); using (StreamWriter streamWriter = new StreamWriter(fileStream)) { streamWriter.Write(text); } fileStream.Close(); } catch (Exception ex) { Debug.Log((object)ex); } } } public class UpdateChecker : MonoBehaviour { public const string EXPECTED_VERSION = "1.1.0"; public const int MAINMENU_BUILDINDEX = 2; public const string THUNDERSTORE_URL = "https://thunderstore.io/package/download/amnsoft/EmployeeAssignments/"; private UnityWebRequestAsyncOperation _webRequest; public bool IsLatestVersion { get; private set; } private void Awake() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (((Scene)(ref scene)).buildIndex == 2) { UnityWebRequest val = new UnityWebRequest("https://thunderstore.io/package/download/amnsoft/EmployeeAssignments/" + "1.1.0"); _webRequest = val.SendWebRequest(); ((AsyncOperation)_webRequest).completed += OnComplete; SceneManager.sceneLoaded -= OnSceneLoaded; } } private void OnComplete(AsyncOperation obj) { IsLatestVersion = _webRequest.webRequest.responseCode == 404; if (!IsLatestVersion) { MenuManager val = Object.FindObjectOfType<MenuManager>(); ((TMP_Text)val.menuNotificationText).SetText("Employee Assignments mod is out of date, new version is atleast 1.1.0. Please update the mod.", true); ((TMP_Text)val.menuNotificationButtonText).SetText("[ CLOSE ]", true); val.menuNotification.SetActive(true); } _webRequest = null; } } } namespace PersonalAssignments.AssignmentLogic { public class CollectScrapLogic : IAssignmentLogic { private readonly PAContext _context; public CollectScrapLogic(PAContext context) { _context = context; } public bool ServerSetupAssignment(ref Assignment assignment) { GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if (!_context.ExcludeTargetIds.Contains(((NetworkBehaviour)array[i]).NetworkObjectId) && !array[i].scrapPersistedThroughRounds && array[i].itemProperties.isScrap) { assignment.TargetIds[0] = ((NetworkBehaviour)array[i]).NetworkObjectId; assignment.TargetText = array[i].itemProperties.itemName.ToUpper(); _context.ExcludeTargetIds.Add(((NetworkBehaviour)array[i]).NetworkObjectId); return true; } } return false; } public bool HandleAllocationEvent(ref Assignment assignment, bool localPlayer) { if (!localPlayer) { return false; } GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if (((NetworkBehaviour)array[i]).NetworkObjectId == assignment.TargetIds[0]) { assignment.TargetText = array[i].itemProperties.itemName.ToUpper(); ScanNodeProperties componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogError((object)("Scan node is missing for item!: " + ((Object)((Component)array[i]).gameObject).name)); return false; } componentInChildren.headerText = "ASSIGNMENT TARGET"; componentInChildren.subText = "Value : ???"; break; } } return true; } public AssignmentState CheckCompletion(ref Assignment assignment) { foreach (GrabbableObject item in RoundManager.Instance.scrapCollectedThisRound) { if (item.isInShipRoom && ((NetworkBehaviour)item).NetworkObjectId == assignment.TargetIds[0]) { if (_context.AllPlayersComplete || ((NetworkBehaviour)item).OwnerClientId == assignment.PlayerId) { return AssignmentState.Complete; } return AssignmentState.Failed; } } return AssignmentState.InProgress; } public void CompleteAssignment(ref Assignment assignment, bool localPlayer) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.SpawnManager.SpawnedObjects.TryGetValue(assignment.TargetIds[0], out var value)) { GrabbableObject component = ((Component)value).gameObject.GetComponent<GrabbableObject>(); component.SetScrapValue(assignment.CashReward + component.scrapValue); ScanNodeProperties componentInChildren = ((Component)component).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.headerText = component.itemProperties.itemName; } if (NetworkManager.Singleton.IsHost) { _context.SyncedRewardValues.Add((((NetworkBehaviour)component).NetworkObject, component.scrapValue)); } } } } public class HuntAndKillLogic : IAssignmentLogic { private const float MAX_SPAWNDISTANCE = 20f; private const float MAX_PLAYERDISTANCE = 10f; private const string REWARD = "Gold bar"; private readonly PAContext _context; public HuntAndKillLogic(PAContext context) { _context = context; } public bool ServerSetupAssignment(ref Assignment assignment) { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } int num = Utils.WeightedRandom(_context.EnemyWeights); string text = _context.EnemyWhitelist[num]; assignment.CashReward = _context.EnemyRewards[num]; bool flag = false; for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++) { EnemyAI val = RoundManager.Instance.SpawnedEnemies[i]; if (!(val.enemyType.enemyName != text) && ((NetworkBehaviour)val).IsSpawned && !val.isEnemyDead && !_context.ExcludeTargetIds.Contains(((NetworkBehaviour)val).NetworkObjectId)) { assignment.TargetIds[0] = ((NetworkBehaviour)val).NetworkObjectId; assignment.TargetText = val.enemyType.enemyName.ToUpper(); _context.ExcludeTargetIds.Add(((NetworkBehaviour)val).NetworkObjectId); flag = true; ScanNodeProperties componentInChildren = ((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>(); componentInChildren.headerText = "ASSIGNMENT TARGET"; break; } } if (!flag) { SpawnableEnemyWithRarity val2 = null; num = 0; for (int j = 0; j < RoundManager.Instance.currentLevel.Enemies.Count; j++) { if (RoundManager.Instance.currentLevel.Enemies[j].enemyType.enemyName == text) { val2 = RoundManager.Instance.currentLevel.Enemies[j]; num = j; break; } } if (val2 == null) { return false; } Vector3 val3 = Vector3.zero; EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(); for (int k = 0; k < array.Length; k++) { if (!array[k].isEntranceToBuilding && array[k].entranceId == 0) { val3 = ((Component)array[k]).transform.position; } } List<(EnemyVent, float)> list = new List<(EnemyVent, float)>(); EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents; foreach (EnemyVent val4 in allEnemyVents) { list.Add((val4, Vector3.Distance(val4.floorNode.position, val3))); } list = list.OrderByDescending<(EnemyVent, float), float>(((EnemyVent vent, float distance) a) => a.distance).ToList(); bool flag2 = false; int num2 = 0; Vector3 val5 = Vector3.zero; NavMeshHit val6 = default(NavMeshHit); while (!flag2 && num2 < 5) { EnemyVent item = list[Random.Range(0, list.Count / 2)].Item1; flag2 = NavMesh.SamplePosition(item.floorNode.position, ref val6, 20f, -1); val5 = ((NavMeshHit)(ref val6)).position; num2++; } if (!flag2) { return false; } RoundManager.Instance.SpawnEnemyOnServer(val5, 0f, num); ulong[] targetIds = assignment.TargetIds; List<EnemyAI> spawnedEnemies = RoundManager.Instance.SpawnedEnemies; targetIds[0] = ((NetworkBehaviour)spawnedEnemies[spawnedEnemies.Count - 1]).NetworkObjectId; List<EnemyAI> spawnedEnemies2 = RoundManager.Instance.SpawnedEnemies; assignment.TargetText = spawnedEnemies2[spawnedEnemies2.Count - 1].enemyType.enemyName.ToUpper(); _context.ExcludeTargetIds.Add(assignment.TargetIds[0]); List<EnemyAI> spawnedEnemies3 = RoundManager.Instance.SpawnedEnemies; ScanNodeProperties componentInChildren2 = ((Component)spawnedEnemies3[spawnedEnemies3.Count - 1]).gameObject.GetComponentInChildren<ScanNodeProperties>(); componentInChildren2.headerText = "ASSIGNMENT TARGET"; } return true; } public bool HandleAllocationEvent(ref Assignment assignment, bool localPlayer) { foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (((NetworkBehaviour)spawnedEnemy).NetworkObjectId == assignment.TargetIds[0]) { assignment.TargetText = spawnedEnemy.enemyType.enemyName.ToUpper(); ScanNodeProperties componentInChildren = ((Component)spawnedEnemy).gameObject.GetComponentInChildren<ScanNodeProperties>(); componentInChildren.headerText = "ASSIGNMENT TARGET"; return true; } } return true; } public AssignmentState CheckCompletion(ref Assignment assignment) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (((NetworkBehaviour)spawnedEnemy).NetworkObjectId != assignment.TargetIds[0] || !spawnedEnemy.isEnemyDead) { continue; } float num = float.MaxValue; foreach (NetworkClient connectedClients in NetworkManager.Singleton.ConnectedClientsList) { float num2 = Vector3.Distance(((Component)connectedClients.PlayerObject).transform.position, ((Component)spawnedEnemy.agent).transform.position); if (num2 < num) { num = num2; } } if (num < 10f) { return AssignmentState.Complete; } return AssignmentState.Failed; } return AssignmentState.InProgress; } public void CompleteAssignment(ref Assignment assignment, bool localPlayer) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsHost) { return; } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (((NetworkBehaviour)spawnedEnemy).NetworkObjectId == assignment.TargetIds[0]) { GameObject val = (from a in StartOfRound.Instance.allItemsList.itemsList?.Where((Item a) => a.itemName == "Gold bar") select a.spawnPrefab).First(); GameObject val2 = Object.Instantiate<GameObject>(val, spawnedEnemy.serverPosition, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = val2.GetComponent<GrabbableObject>(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); component.fallTime = 0f; component.SetScrapValue(assignment.CashReward); NetworkObject component2 = val2.GetComponent<NetworkObject>(); component2.Spawn(false); _context.SyncedRewardValues.Add((component2, assignment.CashReward)); break; } } } } public interface IAssignmentLogic { bool ServerSetupAssignment(ref Assignment assignment); bool HandleAllocationEvent(ref Assignment assignment, bool localPlayer); AssignmentState CheckCompletion(ref Assignment assignment); void CompleteAssignment(ref Assignment assignment, bool localPlayer); } public enum AssignmentState { InProgress, Complete, Failed } public class RepairValveLogic : IAssignmentLogic { private readonly PAContext _context; public RepairValveLogic(PAContext context) { _context = context; } public bool ServerSetupAssignment(ref Assignment assignment) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) SteamValveHazard[] array = Object.FindObjectsByType<SteamValveHazard>((FindObjectsSortMode)0); if (array.Length == 0) { return false; } Vector3 val = RoundManager.FindMainEntrancePosition(false, false); float num = 0f; int num2 = 0; for (int i = 0; i < array.Length; i++) { float num3 = Vector3.Distance(val, ((Component)array[i]).transform.position); if (num3 > num && num3 > 80f) { num2 = i; num = num3; } } if (!_context.ExcludeTargetIds.Contains(((NetworkBehaviour)array[num2]).NetworkObjectId) && ((NetworkBehaviour)array[num2]).IsSpawned) { assignment.TargetIds[0] = ((NetworkBehaviour)array[num2]).NetworkObjectId; _context.ExcludeTargetIds.Add(((NetworkBehaviour)array[num2]).NetworkObjectId); array[num2].valveCrackTime = 0.001f; array[num2].valveBurstTime = 0.01f; array[num2].triggerScript.interactable = true; assignment.FixedTargetPosition = ((Component)array[num2]).gameObject.transform.position; return true; } return false; } public bool HandleAllocationEvent(ref Assignment assignment, bool localPlayer) { return true; } public AssignmentState CheckCompletion(ref Assignment assignment) { SteamValveHazard[] array = Object.FindObjectsOfType<SteamValveHazard>(); SteamValveHazard[] array2 = array; foreach (SteamValveHazard val in array2) { if (((NetworkBehaviour)val).NetworkObjectId == assignment.TargetIds[0] && !val.triggerScript.interactable) { if (_context.AllPlayersComplete || ((NetworkBehaviour)val.triggerScript).OwnerClientId == assignment.PlayerId) { return AssignmentState.Complete; } return AssignmentState.Failed; } } return AssignmentState.InProgress; } public void CompleteAssignment(ref Assignment assignment, bool localPlayer) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsHost) { return; } SteamValveHazard[] array = Object.FindObjectsOfType<SteamValveHazard>(); SteamValveHazard[] array2 = array; foreach (SteamValveHazard val in array2) { if (((NetworkBehaviour)val).NetworkObjectId == assignment.TargetIds[0]) { GameObject val2 = (from a in StartOfRound.Instance.allItemsList.itemsList?.Where((Item a) => a.itemName == "Gold bar") select a.spawnPrefab).First(); GameObject val3 = Object.Instantiate<GameObject>(val2, ((Component)val).gameObject.transform.position, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = val3.GetComponent<GrabbableObject>(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); component.fallTime = 0f; component.SetScrapValue(assignment.CashReward); NetworkObject component2 = val3.GetComponent<NetworkObject>(); component2.Spawn(false); _context.SyncedRewardValues.Add((component2, assignment.CashReward)); break; } } } } }
BepInEx/plugins/FasterItemDropship.dll
Decompiled 10 months agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FasterItemDropship")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("Mod made by flipf17")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FasterItemDropship")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a5a250fd-b706-48b9-9be9-da360fd939dc")] [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 FasterItemDropship { public static class ConfigSettings { public static ConfigEntry<int> dropshipDeliveryTime; public static ConfigEntry<int> dropshipMaxStayDuration; public static ConfigEntry<int> dropshipLeaveAfterSecondsOpenDoors; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); dropshipDeliveryTime = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "DeliveryTime", 10, "How long it takes (in seconds) for the item dropship to arrive."); dropshipMaxStayDuration = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "MaxLandDuration", 40, "The max duration (in seconds) the item dropship will stay."); dropshipLeaveAfterSecondsOpenDoors = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "LeaveAfterSecondsOpenDoors", 3, "How long (in seconds) the item dropship will stay for after opening its doors."); } } [BepInPlugin("FlipMods.FasterItemDropship", "FasterItemDropship", "1.2.0")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("FasterItemDropship"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"FasterItemDropship loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.FasterItemDropship"; public const string PLUGIN_NAME = "FasterItemDropship"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace FasterItemDropship.Patches { [HarmonyPatch] internal class FasterItemDropshipPatcher { private static Terminal terminalScript; private static StartOfRound playersManager; private static List<int> itemsToDeliver; private static List<int> orderedItemsFromTerminal; [HarmonyPatch(typeof(ItemDropship), "Start")] [HarmonyPrefix] public static void InitializeDropship(ItemDropship __instance) { playersManager = Object.FindObjectOfType<StartOfRound>(); terminalScript = Object.FindObjectOfType<Terminal>(); itemsToDeliver = (List<int>)Traverse.Create((object)__instance).Field("itemsToDeliver").GetValue(); } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPrefix] public static void InitializeTerminal(Terminal __instance) { orderedItemsFromTerminal = __instance.orderedItemsFromTerminal; } [HarmonyPatch(typeof(ItemDropship), "Update")] [HarmonyPrefix] public static void DropshipUpdate(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer && !__instance.deliveringOrder && terminalScript.orderedItemsFromTerminal.Count > 0 && !playersManager.shipHasLanded) { __instance.shipTimer += Time.deltaTime; } } [HarmonyPatch(typeof(ItemDropship), "Update")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4) { if ((float)list[i].operand == 20f) { list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value; } else if ((float)list[i].operand == 40f) { list[i].operand = (float)(ConfigSettings.dropshipMaxStayDuration.Value + ConfigSettings.dropshipDeliveryTime.Value); } else if ((float)list[i].operand == 30f) { list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value; break; } } } return list.AsEnumerable(); } [HarmonyPatch(typeof(ItemDropship), "OpenShipDoorsOnServer")] [HarmonyPostfix] public static void OnOpenShipDoors(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer) { __instance.shipTimer = Mathf.Max(__instance.shipTimer, (float)(ConfigSettings.dropshipMaxStayDuration.Value - ConfigSettings.dropshipLeaveAfterSecondsOpenDoors.Value)); } } [HarmonyPatch(typeof(ItemDropship), "ShipLandedAnimationEvent")] [HarmonyPrefix] public static void AddLateItemsServer(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer && __instance.shipLanded && !__instance.shipDoorsOpened) { while (orderedItemsFromTerminal.Count > 0 && itemsToDeliver.Count < 12) { itemsToDeliver.Add(orderedItemsFromTerminal[0]); orderedItemsFromTerminal.RemoveAt(0); } } } } }
BepInEx/plugins/firearmlicense.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("firearmlicense")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Allows you to purchase Nutcracker shotguns from the store")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("firearmlicense")] [assembly: AssemblyTitle("firearmlicense")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace firearmlicense { public static class PluginInfo { public const string PLUGIN_GUID = "firearmlicense"; public const string PLUGIN_NAME = "firearmlicense"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace enemyalert { [BepInPlugin("firearmlicense", "firearmlicense", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Log; private static ConfigEntry<int> gunPrice; private static ConfigEntry<bool> gunEnabled; private static ConfigEntry<int> shellPrice; private static ConfigEntry<bool> shellEnabled; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"firearmlicense v. 1.1.0"); Log.LogInfo((object)"Allows you to purchase Nutcracker shotguns from the store"); gunPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Shotgun", "StorePrice", 1000, "Store price for the Nutcracker shotgun"); gunEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun", "Enabled", true, "If true, the shotgun will be available in store"); shellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Shotgun", "ShellStorePrice", 200, "Store price for the shotgun shells"); shellEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Shotgun", "ShellEnabled", true, "If true, the shotgun shells will be available in store"); SceneManager.sceneLoaded += OnSceneLoaded; } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (gunEnabled.Value) { Item obj = Object.Instantiate<Item>(getItem("Shotgun")); ((Object)obj).name = "PurchasableShotgun"; obj.isScrap = false; obj.creditsWorth = gunPrice.Value; TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val).name = "ShotgunInfoNode"; val.displayText = "The Company takes no liability for casualties inflicted by this item. Remember the 5 firearm handling rules: [INFORMATION EXPUNGED]\n\n"; val.clearPreviousText = true; val.maxCharactersToType = 25; Items.RegisterShopItem(obj, (TerminalNode)null, (TerminalNode)null, val, gunPrice.Value); Log.LogInfo((object)$"shotgun added to the store with price {gunPrice.Value}"); } if (shellEnabled.Value) { Item obj2 = Object.Instantiate<Item>(getItem("GunAmmo")); ((Object)obj2).name = "PurchasableShells"; obj2.isScrap = false; obj2.creditsWorth = shellPrice.Value; TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val2).name = "ShellInfoNode"; val2.displayText = "Ammo required for the shotgun to remain a practical weapon.\n\n"; val2.clearPreviousText = true; val2.maxCharactersToType = 25; Items.RegisterShopItem(obj2, (TerminalNode)null, (TerminalNode)null, val2, shellPrice.Value); Log.LogInfo((object)$"shells added to the store with price {shellPrice.Value}"); } } private static Item getItem(string v) { Item[] array = Resources.FindObjectsOfTypeAll<Item>(); foreach (Item val in array) { if (((Object)val).name == v) { return val; } } return null; } } }
BepInEx/plugins/HealthMetrics.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HealthMetrics")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HealthMetrics")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("eba7b111-51e5-4353-807d-1268e6290901")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HealthMetrics { [BepInPlugin("Matsuura.HealthMetrics", "HealthMetrics", "1.0.0")] public class HealthMetricsBase : BaseUnityPlugin { private const string modGUID = "Matsuura.HealthMetrics"; private const string modName = "HealthMetrics"; private const string modVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("Matsuura.HealthMetrics"); private static HealthMetricsBase _instance; private static ManualLogSource _logSource; internal void Awake() { if ((Object)(object)_instance == (Object)null) { _instance = this; } if (_logSource == null) { _logSource = Logger.CreateLogSource("Matsuura.HealthMetrics"); } _harmony.PatchAll(); _logSource.LogInfo((object)"HealthMetrics Awake"); } internal static void Log(string message) { if (_logSource != null) { _logSource.LogInfo((object)message); } } internal static void LogD(string message) { if (_logSource != null) { _logSource.LogDebug((object)message); } } } } namespace HealthMetrics.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HealthHUDPatches { private static TextMeshProUGUI _healthText; private static readonly string DefaultValueHealthText = " ¤"; public static int _oldValuehealthValueForUpdater = 0; public static int _healthValueForUpdater = 100; private static readonly Color _healthyColor = Color32.op_Implicit(new Color32((byte)0, byte.MaxValue, (byte)0, byte.MaxValue)); private static readonly Color _criticalHealthColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue)); [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ref HUDManager __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("HealthHUDDisplay"); val.AddComponent<RectTransform>(); TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)obj).rectTransform; ((Transform)rectTransform).SetParent(((Component)__instance.PTTIcon).transform, false); rectTransform.anchoredPosition = new Vector2(8f, -57f); ((TMP_Text)obj).font = ((TMP_Text)__instance.controlTipLines[0]).font; ((TMP_Text)obj).fontSize = 16f; ((TMP_Text)obj).text = "100"; ((Graphic)obj).color = _healthyColor; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; ((Behaviour)obj).enabled = true; _healthText = obj; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_healthText != (Object)null && _healthValueForUpdater != _oldValuehealthValueForUpdater) { _oldValuehealthValueForUpdater = _healthValueForUpdater; if (_healthValueForUpdater > 0) { ((TMP_Text)_healthText).text = _healthValueForUpdater.ToString().PadLeft((_healthValueForUpdater < 10) ? 2 : 3, ' '); } else { ((TMP_Text)_healthText).text = DefaultValueHealthText; } double percentage = (double)_healthValueForUpdater / 100.0; ((Graphic)_healthText).color = ColorInterpolation(_criticalHealthColor, _healthyColor, percentage); } } public static int LinearInterpolation(int start, int end, double percentage) { return start + (int)Math.Round(percentage * (double)(end - start)); } public static Color ColorInterpolation(Color start, Color end, double percentage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) return new Color(hexToFloat(LinearInterpolation(floatToHex(start.r), floatToHex(end.r), percentage)), hexToFloat(LinearInterpolation(floatToHex(start.g), floatToHex(end.g), percentage)), hexToFloat(LinearInterpolation(floatToHex(start.b), floatToHex((int)end.b), percentage)), 1f); } public static float hexToFloat(int hex) { return (float)hex / 255f; } public static int floatToHex(float f) { return (int)f * 255; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerPatches { [HarmonyPrefix] [HarmonyPatch("LateUpdate")] private static void LateUpdate_Prefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) { HealthHUDPatches._healthValueForUpdater = ((__instance.health >= 0) ? __instance.health : 0); } } } }
BepInEx/plugins/HideModList.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; [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("HideModList")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Hides the LC api modlist info")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HideModList")] [assembly: AssemblyTitle("HideModList")] [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 HideModList { [HarmonyPatch(typeof(HUDManager), "DisplayTip")] public static class DisplayTipPatch { public static bool Prefix(HUDManager __instance, string headerText, string bodyText, bool isWarning = false, bool useSave = false, string prefsKey = "LC_Tip1") { if (headerText.StartsWith("Mod List")) { return false; } return true; } } [BepInPlugin("HideModList", "HideModList", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("plugin.HideModList"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HideModList is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "HideModList"; public const string PLUGIN_NAME = "HideModList"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/LateCompanyV1.0.9.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("LateCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+45a32594ae7b3615a3d1703738f777272caa8e30")] [assembly: AssemblyProduct("LateCompany")] [assembly: AssemblyTitle("LateCompany")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LateCompany { public static class PluginInfo { public const string GUID = "twig.latecompany"; public const string PrintName = "Late Company"; public const string Version = "1.0.9"; } [BepInPlugin("twig.latecompany", "Late Company", "1.0.9")] internal class Plugin : BaseUnityPlugin { private ConfigEntry<bool> configLateJoinOrbitOnly; public static bool AllowJoiningWhileLanded = false; public static bool LobbyJoinable = true; public void Awake() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown configLateJoinOrbitOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Allow joining while landed", false, "Allow players to join while the ship is landed. (Will probably break some things)"); AllowJoiningWhileLanded = configLateJoinOrbitOnly.Value; Harmony val = new Harmony("twig.latecompany"); val.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.Log((LogLevel)16, (object)"Late Company loaded!"); } public static void SetLobbyJoinable(bool joinable) { LobbyJoinable = joinable; GameNetworkManager.Instance.SetLobbyJoinable(joinable); QuickMenuManager val = Object.FindObjectOfType<QuickMenuManager>(); if (Object.op_Implicit((Object)(object)val)) { val.inviteFriendsTextAlpha.alpha = (joinable ? 1f : 0.2f); } } } } namespace LateCompany.Patches { [HarmonyPatch(typeof(GameNetworkManager), "LeaveLobbyAtGameStart")] [HarmonyWrapSafe] internal static class LeaveLobbyAtGameStart_Patch { [HarmonyPrefix] private static bool Prefix() { return false; } } [HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")] [HarmonyWrapSafe] internal static class ConnectionApproval_Patch { [HarmonyPostfix] private static void Postfix(ConnectionApprovalRequest request, ConnectionApprovalResponse response) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (request.ClientNetworkId != NetworkManager.Singleton.LocalClientId && response.Reason.Contains("Game has already started") && Plugin.LobbyJoinable) { response.Reason = ""; response.CreatePlayerObject = false; response.Approved = true; response.Pending = false; } } } [HarmonyPatch(typeof(QuickMenuManager), "DisableInviteFriendsButton")] internal static class DisableInviteFriendsButton_Patch { [HarmonyPrefix] private static bool Prefix() { return false; } } [HarmonyPatch(typeof(QuickMenuManager), "InviteFriendsButton")] internal static class InviteFriendsButton_Patch { [HarmonyPrefix] private static bool Prefix() { if (Plugin.LobbyJoinable) { GameNetworkManager.Instance.InviteFriendsUI(); } return false; } } internal class RpcEnum : NetworkBehaviour { public static int None => 0; public static int Client => 2; public static int Server => 1; } internal static class WeatherSync { public static bool DoOverride = false; public static LevelWeatherType CurrentWeather = (LevelWeatherType)(-1); } [HarmonyPatch(typeof(RoundManager), "__rpc_handler_1193916134")] [HarmonyWrapSafe] internal static class __rpc_handler_1193916134_Patch { public static FieldInfo RPCExecStage = typeof(NetworkBehaviour).GetField("__rpc_exec_stage", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPrefix] private static bool Prefix(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) NetworkManager networkManager = target.NetworkManager; if ((Object)(object)networkManager != (Object)null && networkManager.IsListening && !networkManager.IsHost) { try { int num = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num); int num2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num2); if (((FastBufferReader)(ref reader)).Position < ((FastBufferReader)(ref reader)).Length) { int num3 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref num3); num3 -= 255; if (num3 < 0) { throw new Exception("In case of emergency, break glass."); } WeatherSync.CurrentWeather = (LevelWeatherType)num3; WeatherSync.DoOverride = true; } RPCExecStage.SetValue(target, RpcEnum.Client); ((RoundManager)((target is RoundManager) ? target : null)).GenerateNewLevelClientRpc(num, num2); RPCExecStage.SetValue(target, RpcEnum.None); return false; } catch { WeatherSync.DoOverride = false; ((FastBufferReader)(ref reader)).Seek(0); return true; } } return true; } } [HarmonyPatch(typeof(RoundManager), "SetToCurrentLevelWeather")] internal static class SetToCurrentLevelWeather_Patch { [HarmonyPrefix] private static void Prefix() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (WeatherSync.DoOverride) { RoundManager.Instance.currentLevel.currentWeather = WeatherSync.CurrentWeather; WeatherSync.DoOverride = false; } } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyWrapSafe] internal static class OnPlayerConnectedClientRpc_Patch { public static MethodInfo BeginSendClientRpc = typeof(RoundManager).GetMethod("__beginSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic); public static MethodInfo EndSendClientRpc = typeof(RoundManager).GetMethod("__endSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPostfix] private static void Postfix(ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed) { //IL_0066: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected I4, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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) StartOfRound instance = StartOfRound.Instance; PlayerControllerB val = instance.allPlayerScripts[assignedPlayerObjectId]; if (instance.connectedPlayersAmount + 1 >= instance.allPlayerScripts.Length) { Plugin.SetLobbyJoinable(joinable: false); } val.DisablePlayerModel(instance.allPlayerObjects[assignedPlayerObjectId], true, true); if (((NetworkBehaviour)instance).IsServer && !instance.inShipPhase) { RoundManager instance2 = RoundManager.Instance; ClientRpcParams val2 = default(ClientRpcParams); val2.Send = new ClientRpcSendParams { TargetClientIds = new List<ulong> { clientId } }; ClientRpcParams val3 = val2; FastBufferWriter val4 = (FastBufferWriter)BeginSendClientRpc.Invoke(instance2, new object[3] { 1193916134u, val3, 0 }); BytePacker.WriteValueBitPacked(val4, StartOfRound.Instance.randomMapSeed); BytePacker.WriteValueBitPacked(val4, StartOfRound.Instance.currentLevelID); BytePacker.WriteValueBitPacked(val4, instance2.currentLevel.currentWeather + 255); EndSendClientRpc.Invoke(instance2, new object[4] { val4, 1193916134u, val3, 0 }); FastBufferWriter val5 = (FastBufferWriter)BeginSendClientRpc.Invoke(instance2, new object[3] { 2729232387u, val3, 0 }); EndSendClientRpc.Invoke(instance2, new object[4] { val5, 2729232387u, val3, 0 }); } instance.livingPlayers = instance.connectedPlayersAmount + 1; for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val6 = instance.allPlayerScripts[i]; if (val6.isPlayerControlled && val6.isPlayerDead) { instance.livingPlayers--; } } } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyWrapSafe] internal static class OnPlayerDC_Patch { [HarmonyPostfix] private static void Postfix() { if (StartOfRound.Instance.inShipPhase || (Plugin.AllowJoiningWhileLanded && StartOfRound.Instance.shipHasLanded)) { Plugin.SetLobbyJoinable(joinable: true); } } } [HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")] internal static class SetShipReadyToLand_Patch { [HarmonyPostfix] private static void Postfix() { if (StartOfRound.Instance.connectedPlayersAmount + 1 < StartOfRound.Instance.allPlayerScripts.Length) { Plugin.SetLobbyJoinable(joinable: true); } } } [HarmonyPatch(typeof(StartOfRound), "StartGame")] internal static class StartGame_Patch { [HarmonyPrefix] private static void Prefix() { Plugin.SetLobbyJoinable(joinable: false); } } [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] internal static class OnShipLandedMiscEvents_Patch { [HarmonyPostfix] private static void Postfix() { if (Plugin.AllowJoiningWhileLanded && StartOfRound.Instance.connectedPlayersAmount + 1 < StartOfRound.Instance.allPlayerScripts.Length) { Plugin.SetLobbyJoinable(joinable: true); } } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] internal static class ShipLeave_Patch { [HarmonyPostfix] private static void Postfix() { Plugin.SetLobbyJoinable(joinable: false); } } }
BepInEx/plugins/LaterNights.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using LaterNights.Patches; 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 = "")] [assembly: AssemblyCompany("LaterNights")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LaterNights")] [assembly: AssemblyTitle("LaterNights")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LaterNights { [BepInPlugin("atk.lethalcompany.laternights", "Later Nights", "1.0.0")] public class LaterNightsMod : BaseUnityPlugin { public const string pluginGuid = "atk.lethalcompany.laternights"; public const string pluginName = "Later Nights"; public const string pluginVersion = "1.0.0"; public static Harmony harmony; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("atk.lethalcompany.laternights"); harmony.PatchAll(typeof(LaterNights.Patches.Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Later Nights mod loaded"); } } } namespace LaterNights.Patches { [HarmonyPatch] internal class Patches { private static float realTotalTime; private static float offset; [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPostfix] public static void Start(ref TimeOfDay __instance) { realTotalTime = __instance.lengthOfHours * (float)__instance.numberOfHours; __instance.numberOfHours = 24; __instance.totalTime = __instance.lengthOfHours * (float)__instance.numberOfHours; offset = (float)(__instance.numberOfHours - 18) / (float)__instance.numberOfHours; } [HarmonyPatch(typeof(TimeOfDay), "MoveTimeOfDay")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> MoveTimeOfDay(IEnumerable<CodeInstruction> instructions) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && list[i + 1].opcode == OpCodes.Ldc_R4 && (float)list[i + 1].operand == 0f) { list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo)); list.Insert(i + 2, new CodeInstruction(OpCodes.Add, (object)null)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(HUDManager), "SetClock")] [HarmonyPrefix] public static bool SetClock(ref HUDManager __instance, ref string __result, ref string ___newLine, ref string ___amPM, float timeNormalized, float numberOfHours, bool createNewLine = true) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = (int)Mathf.Floor((float)(num / 60)); if (!createNewLine) { ___newLine = " "; } else { ___newLine = "\n"; } ___amPM = ___newLine + "AM"; if (num2 >= 24) { num2 %= 24; } if (num2 < 12) { ___amPM = ___newLine + "AM"; } else { ___amPM = ___newLine + "PM"; } if (num2 > 12) { num2 %= 12; } int num3 = num % 60; string text = $"{num2:00}:{num3:00}" + ___amPM; ((TMP_Text)__instance.clockNumber).text = text; __result = text; return false; } [HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnEnemiesOutside(IEnumerable<CodeInstruction> instructions) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Patches), "realTotalTime"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo2); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnDaytimeEnemiesOutside(IEnumerable<CodeInstruction> instructions) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(Patches), "realTotalTime"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo2); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnRandomDaytimeEnemy(IEnumerable<CodeInstruction> instructions) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AssignRandomEnemyToVent(IEnumerable<CodeInstruction> instructions) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AdvanceHourAndSpawnNewBatchOfEnemies(IEnumerable<CodeInstruction> instructions) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(TimeOfDay), "totalTime"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(TimeOfDay), "normalizedTimeOfDay"); FieldInfo fieldInfo3 = AccessTools.Field(typeof(Patches), "realTotalTime"); FieldInfo fieldInfo4 = AccessTools.Field(typeof(Patches), "offset"); List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo, false)) { list[i] = new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3); list.RemoveAt(i - 1); list.RemoveAt(i - 2); i -= -2; } else if (CodeInstructionExtensions.LoadsField(list[i], fieldInfo2, false)) { list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4)); } } return list.AsEnumerable(); } } }
BepInEx/plugins/LCbetterTeleport.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCbetterTeleport.Patches; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCbetterTeleport")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCbetterTeleport")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e90b554f-0e11-4f79-b4b2-bd66da220a4f")] [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 LCbetterTeleport { [BepInPlugin("Poseidon.LCbetterTeleport", "Better Teleport Mod", "1.0.0")] public class BetterTeleport : BaseUnityPlugin { private const string modGUID = "Poseidon.LCbetterTeleport"; private const string modName = "Better Teleport Mod"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Poseidon.LCbetterTeleport"); public static string[] fullPath = new string[5] { "BepInEx/CustomVideoPlaylist/television_video1.mp4", "BepInEx/CustomVideoPlaylist/television_video2.mp4", "BepInEx/CustomVideoPlaylist/television_video3.mp4", "BepInEx/CustomVideoPlaylist/television_video4.mp4", "BepInEx/CustomVideoPlaylist/television_video5.mp4" }; private static BetterTeleport Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Poseidon.LCbetterTeleport"); mls.LogInfo((object)"The Teleport Mod is Active"); harmony.PatchAll(typeof(BetterTeleport)); harmony.PatchAll(typeof(ShipTeleporterPatch)); } } } namespace LCbetterTeleport.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("DropAllHeldItems")] [HarmonyPrefix] private static bool keepItemsPatch() { return false; } } [HarmonyPatch(typeof(ShipTeleporter))] internal class ShipTeleporterPatch { private static AudioClip teleporterBeamUpSFX; private static AudioSource shipTeleporterAudio; private static AudioClip teleporterSpinSFX; private static AudioClip beamUpPlayerBodySFX; private static Transform teleporterPosition; [HarmonyPatch("Awake")] [HarmonyPrefix] private static void noCooldown(ref float ___cooldownAmount) { ___cooldownAmount = 0f; } [HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")] [HarmonyPrefix] private static bool noDropItemsInverse(ref int playerObj, ref Vector3 teleportPos) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead) { StartCoroutine(teleportBodyOut(playerObj, teleportPos)); return false; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; SetPlayerTeleporterId(val, -1); if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val); } val.isInElevator = false; val.isInHangarShipRoom = false; val.isInsideFactory = true; val.averageVelocity = 0f; val.velocityLastFrame = Vector3.zero; StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true); StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play(); shipTeleporterAudio.PlayOneShot(teleporterBeamUpSFX); StartOfRound.Instance.allPlayerScripts[playerObj].movementAudio.PlayOneShot(teleporterBeamUpSFX); if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Debug.Log((object)"Teleporter shaking camera"); HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } return false; } private static void StartCoroutine(string v) { } private static void SetPlayerTeleporterId(PlayerControllerB playerControllerB, int v) { } private static string teleportBodyOut(int playerObj, Vector3 teleportPos) { return "test"; } } [HarmonyPatch] internal class CustomTelevisionPlaylistPatch { public static Random videoRandomizer = new Random(); [HarmonyPatch(typeof(TVScript), "TVFinishedClip")] [HarmonyPrefix] public static bool TVFinishedClip() { return false; } [HarmonyPatch(typeof(TVScript), "Update")] [HarmonyPrefix] public static bool Update() { return false; } [HarmonyPatch(typeof(TVScript), "TurnTVOnOff")] [HarmonyPrefix] public static bool TurnTVOnOff(bool on, TVScript __instance) { __instance.tvOn = on; if (on) { __instance.video.clip = null; __instance.tvSFX.clip = null; __instance.video.url = $"file:///{BetterTeleport.fullPath[videoRandomizer.Next(0, BetterTeleport.fullPath.Length)]}"; __instance.video.source = (VideoSource)1; __instance.video.controlledAudioTrackCount = 1; __instance.video.audioOutputMode = (VideoAudioOutputMode)1; __instance.video.SetTargetAudioSource((ushort)0, __instance.tvSFX); __instance.video.Prepare(); __instance.video.Stop(); __instance.tvSFX.Stop(); SetTVScreenMaterial(__instance, b: true); __instance.video.Play(); __instance.tvSFX.Play(); __instance.tvSFX.PlayOneShot(__instance.switchTVOn); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOn, 1f); } else { SetTVScreenMaterial(__instance, b: false); __instance.tvSFX.Stop(); __instance.tvSFX.PlayOneShot(__instance.switchTVOff); __instance.video.Stop(); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOff, 1f); } return false; } public static void SetTVScreenMaterial(TVScript instance, bool b) { ((object)instance).GetType().GetMethod("SetTVScreenMaterial", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(instance, new object[1] { b }); } } }
BepInEx/plugins/LethalFashion.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using 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("LethalFashion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adding immediate outfits for the crew")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4")] [assembly: AssemblyProduct("LethalFashion")] [assembly: AssemblyTitle("LethalFashion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalFashion { [BepInPlugin("LethalFashion", "LethalFashion", "1.0.4")] public class Plugin : BaseUnityPlugin { public static ManualLogSource Log; private static Harmony harmonyInstance; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalFashion is loaded!"); InitializeHarmony(); } private void InitializeHarmony() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (harmonyInstance == null) { harmonyInstance = new Harmony("LethalFashion"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony instance created"); try { harmonyInstance.PatchAll(typeof(SuitFashion)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patch applied successfully. You are now FASHIONABLE."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Error applying patch: " + ex.Message)); } } } } public class SuitFashion { private static readonly MethodInfo unlockItem; private static bool isHost; static SuitFashion() { unlockItem = typeof(StartOfRound).GetMethod("SpawnUnlockable", BindingFlags.Instance | BindingFlags.NonPublic); if (unlockItem == null) { Plugin.Log.LogError((object)"SpawnUnlockable method not found in StartOfRound. Please check game/plugin version."); } } public static void SpawnUnlockableDelegate(StartOfRound instance, int ID) { if (unlockItem == null) { Plugin.Log.LogError((object)"Cannot invoke SpawnUnlockable - method reference is null. Please check game/plugin version."); } else if (!instance.SpawnedShipUnlockables.ContainsKey(ID)) { try { unlockItem.Invoke(instance, new object[1] { ID }); } catch (Exception ex) { Plugin.Log.LogError((object)("Error invoking SpawnUnlockable: " + ex.Message)); } } } public static void PositionSuitsOnRack(StartOfRound startOfRoundInstance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) UnlockableSuit[] array = Object.FindObjectsOfType<UnlockableSuit>(); for (int i = 0; i < array.Length; i++) { UnlockableSuit val = array[i]; AutoParentToShip component = ((Component)val).gameObject.GetComponent<AutoParentToShip>(); if ((Object)(object)component != (Object)null) { component.overrideOffset = true; component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + startOfRoundInstance.rightmostSuitPosition.forward * 0.18f * (float)i; component.rotationOffset = new Vector3(0f, 90f, 0f); } } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] public static void StartOfRoundSuitPatch(StartOfRound __instance) { if (!isHost) { return; } int[] array = new int[3] { 1, 2, 3 }; int[] array2 = array; foreach (int num in array2) { if (num >= 0 && num < __instance.unlockablesList.unlockables.Count) { UnlockableItem val = __instance.unlockablesList.unlockables[num]; if (val != null) { val.alreadyUnlocked = true; val.hasBeenUnlockedByPlayer = true; val.inStorage = false; SpawnUnlockableDelegate(__instance, num); } } } PositionSuitsOnRack(__instance); } [HarmonyPatch(typeof(StartOfRound), "ResetShip")] [HarmonyPostfix] public static void ResetShipSuitPatch(StartOfRound __instance) { if (isHost) { StartOfRoundSuitPatch(__instance); } } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] private static void SetIsHost() { isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalFashion"; public const string PLUGIN_NAME = "LethalFashion"; public const string PLUGIN_VERSION = "1.0.4"; } }
BepInEx/plugins/LockDoorsMod.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; 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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("LockDoorsMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LockDoorsMod")] [assembly: AssemblyTitle("LockDoorsMod")] [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 LockDoorsMod { [HarmonyPatch(typeof(HUDManager))] public class Broadcaster { public static Action<string, string> GetString = delegate { }; public static void BroadcastString(string data, string signature) { HUDManager.Instance.AddTextToChatOnServer("<size=0>ENZDATA/" + data + "/" + signature + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1); } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] [HarmonyPostfix] internal static void AddChatMessagePatch(string chatMessage, string nameOfUserWhoTyped = "") { string[] array = chatMessage.Split(new char[1] { '/' }); if (chatMessage.StartsWith("<size=0>ENZDATA") && !(GameNetworkManager.Instance.localPlayerController.playerClientId.ToString() == array[3])) { GetString(array[1], array[2]); } } } public static class LDMPluginInfo { public const string PLUGIN_GUID = "ENZDS.LockDoorsMod"; public const string PLUGIN_NAME = "Lock Doors Mod"; public const string PLUGIN_VERSION = "1.1.0"; } public static class LDMLogger { public static readonly ManualLogSource logger = Logger.CreateLogSource("LockDoorsMod"); } [JsonObject] internal class LockDoorData { [JsonProperty] public ulong networkObjectId { get; set; } [JsonProperty] public ulong clientId { get; set; } } [HarmonyPatch(typeof(DoorLock))] public class DoorLockPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void Awake() { Broadcaster.GetString = (Action<string, string>)Delegate.Combine(Broadcaster.GetString, new Action<string, string>(CloseDoorReceived)); } private static void CloseDoorReceived(string data, string signature) { LockDoorData lockDoorData = JsonConvert.DeserializeObject<LockDoorData>(data); LDMLogger.logger.LogInfo((object)("[BROADCAST_RECEIVE] Got message \n data: " + data + " \n signature: " + signature)); if (signature == "lock_door") { GameObject val = FindObjectById(Convert.ToUInt64(lockDoorData.networkObjectId)); DoorLock componentInChildren = val.GetComponentInChildren<DoorLock>(); LDMLogger.logger.LogInfo((object)$"[BROADCAST_RECEIVE] found object with id {lockDoorData.networkObjectId}: {val} \n {componentInChildren} \n doorLockNID: {((NetworkBehaviour)componentInChildren).NetworkObjectId}"); componentInChildren.LockDoor(30f); } } [HarmonyPatch("LockDoor")] [HarmonyPrefix] private static bool LockDoorPatch(ref DoorLock __instance, ref bool ___isDoorOpened, ref bool ___isLocked, ref AudioSource ___doorLockSFX, ref AudioClip ___unlockSFX) { if (___isDoorOpened | ___isLocked) { LDMLogger.logger.LogInfo((object)"The door is opened or locked. Can't lock it"); return false; } AudioSource val = ___doorLockSFX; val.PlayOneShot(___unlockSFX); return true; } public static void LockDoorPatchSyncWithServer(ulong networkObjectId) { LockDoorData lockDoorData = new LockDoorData { networkObjectId = networkObjectId, clientId = GameNetworkManager.Instance.localPlayerController.playerClientId }; LDMLogger.logger.LogInfo((object)"[BROADCAST] Locking the door"); Broadcaster.BroadcastString(JsonConvert.SerializeObject((object)lockDoorData, (Formatting)0), "lock_door"); } private static GameObject FindObjectById(ulong networkId) { return (networkId == 0L) ? null : ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[networkId]).gameObject; } } [HarmonyPatch(typeof(KeyItem))] internal class KeyItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] private static bool ItemActivatePatch(ref KeyItem __instance, bool used, bool buttonDown = true) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; bool isOwner = ((NetworkBehaviour)__instance).IsOwner; RaycastHit val = default(RaycastHit); if ((Object)(object)playerHeldBy == (Object)null || !isOwner || !Physics.Raycast(new Ray(((Component)playerHeldBy.gameplayCamera).transform.position, ((Component)playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816)) { return false; } DoorLock component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>(); if ((Object)(object)component == (Object)null || component.isPickingLock) { return false; } if ((bool)typeof(DoorLock).GetField("isDoorOpened", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(component)) { LDMLogger.logger.LogInfo((object)"The door is opened"); return false; } if (!component.isLocked) { component.LockDoor(30f); DoorLockPatch.LockDoorPatchSyncWithServer(((NetworkBehaviour)component).NetworkObjectId); } else { component.UnlockDoorSyncWithServer(); } ((GrabbableObject)__instance).playerHeldBy.DespawnHeldObject(); return false; } } [BepInPlugin("ENZDS.LockDoorsMod", "Lock Doors Mod", "1.1.0")] public class LockingKeyModBase : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ENZDS.LockDoorsMod"); private static LockingKeyModBase instance; private void Awake() { if (instance == null) { instance = this; } LDMLogger.logger.LogInfo((object)"Lock Doors 1.1.0 :)"); harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "LockDoorsMod"; public const string PLUGIN_NAME = "LockDoorsMod"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/MaskedEnemyRework.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using MaskedEnemyRework.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(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("MaskedEnemyRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] [assembly: AssemblyProduct("MaskedEnemyRework")] [assembly: AssemblyTitle("MaskedEnemyRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MaskedEnemyRework { [BepInPlugin("MaskedEnemyRework", "MaskedEnemyRework", "2.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("MaskedEnemyRework"); private static Plugin Instance; internal ManualLogSource logger; private ConfigEntry<bool> RemoveMasksConfig; private ConfigEntry<bool> RemoveZombieArmsConfig; private ConfigEntry<bool> UseSpawnRarityConfig; private ConfigEntry<int> SpawnRarityConfig; private ConfigEntry<bool> CanSpawnOutsideConfig; private ConfigEntry<int> MaxSpawnCountConfig; private ConfigEntry<bool> ZombieApocalypeModeConfig; private ConfigEntry<bool> UseVanillaSpawnsConfig; private ConfigEntry<int> ZombieApocalypeRandomChanceConfig; private ConfigEntry<float> InsideEnemySpawnCurveConfig; private ConfigEntry<float> MiddayInsideEnemySpawnCurveConfig; private ConfigEntry<float> StartOutsideEnemySpawnCurveConfig; private ConfigEntry<float> MidOutsideEnemySpawnCurveConfig; private ConfigEntry<float> EndOutsideEnemySpawnCurveConfig; public static bool RemoveMasks; public static bool RemoveZombieArms; public static bool UseSpawnRarity; public static int SpawnRarity; public static bool CanSpawnOutside; public static int MaxSpawnCount; public static bool ZombieApocalypseMode; public static bool UseVanillaSpawns; public static int RandomChanceZombieApocalypse; public static float InsideEnemySpawnCurve; public static float MiddayInsideEnemySpawnCurve; public static float StartOutsideEnemySpawnCurve; public static float MidOutsideEnemySpawnCurve; public static float EndOutsideEnemySpawnCurve; public static int PlayerCount; public static SpawnableEnemyWithRarity maskedPrefab; public static SpawnableEnemyWithRarity flowerPrefab; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } RemoveMasksConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Mask From Masked Enemy", true, "Whether or not the Masked Enemy has a mask on."); RemoveZombieArmsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Zombie Arms", true, "Remove the animation where the Masked raise arms like a zombie."); UseVanillaSpawnsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use Vanilla Spawns", false, "Ignores anything else in this mod. Only uses the above settings from this config. Will not spawn on all moons. will ignore EVERYTHING in the config below this point."); UseSpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Use Spawn Rarity", false, "Use custom spawn rate from config. If this is false, the masked spawns at the same rate as the Bracken. If true, will spawn at whatever rarity is given in Spawn Rarity config option"); SpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Spawn Rarity", 15, "The rarity for the Masked Enemy to spawn. The higher the number, the more likely to spawn. Can go to 1000000000, any higher will break. Use Spawn Rarity must be set to True"); CanSpawnOutsideConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Allow Masked To Spawn Outside", false, "Whether the Masked Enemy can spawn outside the building"); MaxSpawnCountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Max Number of Masked", 2, "Max Number of possible masked to spawn in one level"); ZombieApocalypeModeConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Zombie Apocalypse Mode", "Zombie Apocalype Mode", false, "Only spawns Masked! Make sure to crank up the Max Spawn Count in this config! Would also recommend bringing a gun (mod), a shovel works fine too though.... This mode does not play nice with other mods that affect spawn rates. Disable those before playing for best results"); ZombieApocalypeRandomChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Zombie Apocalypse Mode", "Random Zombie Apocalype Mode", -1, "[Must Be Whole Number] The percent chance from 1 to 100 that a day could contain a zombie apocalypse. Put at -1 to never have the chance arise and don't have Only Spawn Masked turned on"); InsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Inside Masked Spawn Curve", 0.1f, "Spawn curve for masked inside, start of the day. Crank this way up for immediate action. More info in the readme"); MiddayInsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Inside Masked Spawn Curve", 500f, "Spawn curve for masked inside, midday."); StartOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Masked Outside Spawn Curve", -30f, "Spawn curve for outside masked, start of the day."); MidOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Outside Masked Spawn Curve", -30f, "Spawn curve for outside masked, midday."); EndOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "EOD Outside Masked Spawn Curve", 10f, "Spawn curve for outside masked, end of day"); RemoveMasks = RemoveMasksConfig.Value; UseVanillaSpawns = UseVanillaSpawnsConfig.Value; RemoveZombieArms = RemoveZombieArmsConfig.Value; UseSpawnRarity = UseSpawnRarityConfig.Value; CanSpawnOutside = CanSpawnOutsideConfig.Value; MaxSpawnCount = MaxSpawnCountConfig.Value; SpawnRarity = SpawnRarityConfig.Value; ZombieApocalypseMode = ZombieApocalypeModeConfig.Value; InsideEnemySpawnCurve = InsideEnemySpawnCurveConfig.Value; MiddayInsideEnemySpawnCurve = MiddayInsideEnemySpawnCurveConfig.Value; StartOutsideEnemySpawnCurve = StartOutsideEnemySpawnCurveConfig.Value; MidOutsideEnemySpawnCurve = MaxSpawnCountConfig.Value; EndOutsideEnemySpawnCurve = EndOutsideEnemySpawnCurveConfig.Value; RandomChanceZombieApocalypse = ZombieApocalypeRandomChanceConfig.Value; logger = Logger.CreateLogSource("MaskedEnemyRework"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MaskedEnemyRework is loaded! Woohoo!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetMaskedPrefabForLaterUse)); harmony.PatchAll(typeof(MaskedVisualRework)); harmony.PatchAll(typeof(MaskedSpawnSettings)); harmony.PatchAll(typeof(RemoveZombieArms)); } } public static class PluginInfo { public const string PLUGIN_GUID = "MaskedEnemyRework"; public const string PLUGIN_NAME = "MaskedEnemyRework"; public const string PLUGIN_VERSION = "2.1.0"; } } namespace MaskedEnemyRework.Patches { [HarmonyPatch(typeof(Terminal))] internal class GetMaskedPrefabForLaterUse { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); SelectableLevel[] array = ___moonsCatalogueList; foreach (SelectableLevel val2 in array) { foreach (SpawnableEnemyWithRarity enemy in val2.Enemies) { if (enemy.enemyType.enemyName == "Masked") { val.LogInfo((object)"Found Masked!"); Plugin.maskedPrefab = enemy; } else if (enemy.enemyType.enemyName == "Flowerman") { Plugin.flowerPrefab = enemy; val.LogInfo((object)"Found Flowerman!"); } } } } } [HarmonyPatch(typeof(RoundManager))] internal class MaskedSpawnSettings { [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02ba: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Expected O, but got Unknown if (Plugin.UseVanillaSpawns) { return; } ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); val.LogInfo((object)"Starting Round Manager"); SpawnableEnemyWithRarity maskedPrefab = Plugin.maskedPrefab; SpawnableEnemyWithRarity val2 = Plugin.flowerPrefab; SelectableLevel obj = ___currentLevel; obj.maxEnemyPowerCount += maskedPrefab.enemyType.MaxCount; SelectableLevel obj2 = ___currentLevel; obj2.maxDaytimeEnemyPowerCount += maskedPrefab.enemyType.MaxCount; SelectableLevel obj3 = ___currentLevel; obj3.maxOutsideEnemyPowerCount += maskedPrefab.enemyType.MaxCount; List<SpawnableEnemyWithRarity> enemies = ___currentLevel.Enemies; for (int i = 0; i < ___currentLevel.Enemies.Count; i++) { SpawnableEnemyWithRarity val3 = ___currentLevel.Enemies[i]; if (val3.enemyType.enemyName == "Masked") { enemies.Remove(val3); } if (val3.enemyType.enemyName == "Flowerman") { val2 = val3; } } ___currentLevel.Enemies = enemies; maskedPrefab.enemyType.PowerLevel = 1; maskedPrefab.enemyType.probabilityCurve = val2.enemyType.probabilityCurve; if (Plugin.UseSpawnRarity) { maskedPrefab.rarity = Plugin.SpawnRarity; } else { maskedPrefab.rarity = val2.rarity; } maskedPrefab.enemyType.MaxCount = Plugin.MaxSpawnCount; maskedPrefab.enemyType.isOutsideEnemy = Plugin.CanSpawnOutside; int num = 0; num = ((StartOfRound.Instance.randomMapSeed.ToString().Length >= 3) ? int.Parse(StartOfRound.Instance.randomMapSeed.ToString().Substring(1, 2)) : 0); val.LogInfo((object)("Map seed " + num + " random chance " + Plugin.RandomChanceZombieApocalypse)); num = Mathf.Clamp(num, 0, 100); if (Plugin.ZombieApocalypseMode || (num <= Plugin.RandomChanceZombieApocalypse && Plugin.RandomChanceZombieApocalypse >= 0)) { val.LogInfo((object)"ZOMBIE APOCALYPSE"); ___currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, Plugin.InsideEnemySpawnCurve), new Keyframe(0.5f, Plugin.MiddayInsideEnemySpawnCurve) }); ___currentLevel.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 7f), new Keyframe(0.5f, 7f) }); ___currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, Plugin.StartOutsideEnemySpawnCurve), new Keyframe(20f, Plugin.MidOutsideEnemySpawnCurve), new Keyframe(21f, Plugin.EndOutsideEnemySpawnCurve) }); ___currentLevel.DaytimeEnemies.Clear(); ___currentLevel.OutsideEnemies.Clear(); maskedPrefab.rarity = 1000000000; foreach (SpawnableEnemyWithRarity enemy in ___currentLevel.Enemies) { enemy.rarity = 0; } if (Plugin.CanSpawnOutside) { maskedPrefab.enemyType.isOutsideEnemy = true; ___currentLevel.OutsideEnemies.Add(maskedPrefab); ___currentLevel.DaytimeEnemies.Add(maskedPrefab); } } else { val.LogInfo((object)"no zombies :("); } ___currentLevel.Enemies.Add(maskedPrefab); } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedVisualRework { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ReformVisuals(ref MaskedPlayerEnemy __instance) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = StartOfRound.Instance.ClientPlayerList.Count; if (num == 0) { num = Random.Range(0, 2); val.LogInfo((object)"Player count was zero"); } int num2 = StartOfRound.Instance.randomMapSeed % num; val.LogInfo((object)("player count" + num)); val.LogInfo((object)("player index" + num2)); num2 = Mathf.Clamp(num2, 0, num); PlayerControllerB val2 = allPlayerScripts[num2]; __instance.mimickingPlayer = val2; __instance.SetSuit(val2.currentSuitID); if (Plugin.RemoveMasks) { ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false); ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false); } } } internal class RemoveZombieArms { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetHandsOutClientRpc")] [HarmonyPrefix] private static void RemoveArms(ref bool setOut) { if (Plugin.RemoveZombieArms) { setOut = false; } } } }
BepInEx/plugins/MoreEmotes1.2.2.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using MoreEmotes.Patch; using Tools; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FuckYouMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FuckYouMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5ecc2bf2-af12-4e83-a6f1-cf2eacbf3060")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Tools { public class Reflection { public static object GetInstanceField(Type type, object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField(fieldName, bindingAttr); return field.GetValue(instance); } public static object CallMethod(object instance, string methodName, params object[] args) { MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { return method.Invoke(instance, args); } return null; } } } namespace MoreEmotes { [BepInPlugin("MoreEmotes", "MoreEmotes-Sligili", "1.2.2")] public class FuckYouModInitialization : BaseUnityPlugin { private Harmony _harmony; private ConfigEntry<string> config_KeyWheel; private ConfigEntry<bool> config_InventoryCheck; private ConfigEntry<string> config_KeyEmote3; private ConfigEntry<string> config_KeyEmote4; private ConfigEntry<string> config_KeyEmote5; private ConfigEntry<string> config_KeyEmote6; private ConfigEntry<string> config_KeyEmote7; private ConfigEntry<string> config_KeyEmote8; private void Awake() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreEmotes loaded"); EmotePatch.animationsBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animationsbundle")); EmotePatch.animatorBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MoreEmotes/animatorbundle")); EmotePatch.local = 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(); IncompatibilityAids(); _harmony = new Harmony("MoreEmotes"); _harmony.PatchAll(typeof(EmotePatch)); } private void IncompatibilityAids() { 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; } } } private void ConfigFile() { EmotePatch.keybinds = new string[9]; config_KeyWheel = ((BaseUnityPlugin)this).Config.Bind<string>("EMOTE WHEEL", "Key", "v", (ConfigDescription)null); EmotePatch.wheelKeybind = config_KeyWheel.Value; config_InventoryCheck = ((BaseUnityPlugin)this).Config.Bind<bool>("OTHERS", "InventoryCheck", true, "Prevents some emotes from performing while holding any item/scrap"); EmotePatch.InvCheck = config_InventoryCheck.Value; config_KeyEmote3 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Middle Finger", "3", (ConfigDescription)null); EmotePatch.keybinds[2] = config_KeyEmote3.Value.Replace(" ", ""); config_KeyEmote4 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "The Griddy", "6", (ConfigDescription)null); EmotePatch.keybinds[5] = config_KeyEmote4.Value.Replace(" ", ""); config_KeyEmote5 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Shy", "5", (ConfigDescription)null); EmotePatch.keybinds[4] = config_KeyEmote5.Value.Replace(" ", ""); config_KeyEmote6 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Clap", "4", (ConfigDescription)null); EmotePatch.keybinds[3] = config_KeyEmote6.Value.Replace(" ", ""); config_KeyEmote7 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Twerk", "7", (ConfigDescription)null); EmotePatch.keybinds[6] = config_KeyEmote7.Value.Replace(" ", ""); config_KeyEmote8 = ((BaseUnityPlugin)this).Config.Bind<string>("QUICK EMOTES", "Salute", "8", (ConfigDescription)null); EmotePatch.keybinds[7] = config_KeyEmote8.Value.Replace(" ", ""); } } public static class PluginInfo { public const string Guid = "MoreEmotes"; public const string Name = "MoreEmotes-Sligili"; public const string Ver = "1.2.2"; } } namespace MoreEmotes.Patch { internal class EmotePatch { public static AssetBundle animationsBundle; public static AssetBundle animatorBundle; public static string[] keybinds; public static string wheelKeybind; private static CallbackContext context; public static RuntimeAnimatorController local; public static RuntimeAnimatorController others; private static int currentEmoteID; private static float svMovSpeed; public static bool IncompatibleStuff; public static bool InvCheck; public static bool emoteWheelIsOpened; public static GameObject wheel; public static GameObject rebindmenu; public static GameObject btn; private static SelectionWheel selectionWheel; [HarmonyPatch(typeof(MenuManager), "Start")] [HarmonyPostfix] private static void MenuStart(MenuManager __instance) { GameObject val = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesPanel.prefab"); GameObject val2 = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesButton.prefab"); GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject; GameObject gameObject2 = ((Component)((Component)gameObject.transform.Find("MenuContainer")).transform.Find("SettingsPanel")).gameObject; if ((Object)(object)btn != (Object)null) { Object.Destroy((Object)(object)btn.gameObject); } btn = Object.Instantiate<GameObject>(val2, gameObject2.transform); btn.transform.SetSiblingIndex(7); if ((Object)(object)rebindmenu != (Object)null) { Object.Destroy((Object)(object)rebindmenu.gameObject); } rebindmenu = Object.Instantiate<GameObject>(val, gameObject2.transform); RebindBtn.defaultKeys = keybinds; BasicToggle.configValueInv = InvCheck; if ((Object)(object)gameObject2.GetComponent<SetupEverything>() == (Object)null) { gameObject2.AddComponent<SetupEverything>(); } SetupEverything.configValue = InvCheck; } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] private static void StartPostfix(PlayerControllerB __instance) { GameObject gameObject = ((Component)((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel")).transform.Find("metarig")).gameObject; CustomAudioAnimationEvent customAudioAnimationEvent = gameObject.AddComponent<CustomAudioAnimationEvent>(); svMovSpeed = __instance.movementSpeed; customAudioAnimationEvent.player = __instance; if (Object.FindObjectsOfType(typeof(SelectionWheel)).Length == 0) { GameObject val = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesMenu.prefab"); GameObject gameObject2 = ((Component)((Component)GameObject.Find("Systems").gameObject.transform.Find("UI")).gameObject.transform.Find("Canvas")).gameObject; GameObject val2 = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesPanel.prefab"); GameObject val3 = animationsBundle.LoadAsset<GameObject>("Assets/MoreEmotes/Resources/MoreEmotesButton.prefab"); GameObject gameObject3 = ((Component)((Component)gameObject2.transform.Find("QuickMenu")).transform.Find("SettingsPanel")).gameObject; if ((Object)(object)btn != (Object)null) { Object.Destroy((Object)(object)btn.gameObject); } btn = Object.Instantiate<GameObject>(val3, gameObject3.transform); btn.transform.SetSiblingIndex(7); if ((Object)(object)rebindmenu != (Object)null) { Object.Destroy((Object)(object)rebindmenu.gameObject); } rebindmenu = Object.Instantiate<GameObject>(val2, gameObject3.transform); RebindBtn.defaultKeys = keybinds; BasicToggle.configValueInv = InvCheck; if ((Object)(object)wheel != (Object)null) { Object.Destroy((Object)(object)wheel.gameObject); } wheel = Object.Instantiate<GameObject>(val, gameObject2.transform); selectionWheel = wheel.AddComponent<SelectionWheel>(); SelectionWheel.emotes_Keybinds = new string[keybinds.Length + 1]; SelectionWheel.emotes_Keybinds = keybinds; if ((Object)(object)gameObject3.GetComponent<SetupEverything>() == (Object)null) { gameObject3.AddComponent<SetupEverything>(); } SetupEverything.configValue = InvCheck; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { //IL_0231: 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) if (!__instance.isPlayerControlled || !((NetworkBehaviour)__instance).IsOwner) { __instance.playerBodyAnimator.runtimeAnimatorController = others; return; } if ((Object)(object)__instance.playerBodyAnimator != (Object)(object)local) { __instance.playerBodyAnimator.runtimeAnimatorController = local; } if (__instance.performingEmote) { currentEmoteID = __instance.playerBodyAnimator.GetInteger("emoteNumber"); } if (!IncompatibleStuff) { bool flag = (bool)Reflection.CallMethod(__instance, "CheckConditionsForEmote") && currentEmoteID == 6 && __instance.performingEmote; __instance.movementSpeed = (flag ? (svMovSpeed / 2f) : svMovSpeed); } if (!PlayerPrefs.HasKey("InvCheck")) { PlayerPrefs.SetInt("InvCheck", InvCheck ? 1 : 0); } else { InvCheck = PlayerPrefs.GetInt("InvCheck") == 1; } if (!PlayerPrefs.HasKey("Emote_Wheel")) { PlayerPrefs.SetString("Emote_Wheel", wheelKeybind); } if (InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[PlayerPrefs.GetString("Emote_Wheel")], 0f) && !emoteWheelIsOpened && !__instance.isPlayerDead && !__instance.inTerminalMenu && !__instance.quickMenuManager.isMenuOpen) { emoteWheelIsOpened = true; Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; wheel.SetActive(emoteWheelIsOpened); __instance.disableLookInput = true; } else if ((!InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[PlayerPrefs.GetString("Emote_Wheel")], 0f) && emoteWheelIsOpened) || __instance.quickMenuManager.isMenuOpen) { if (!__instance.quickMenuManager.isMenuOpen || __instance.isPlayerDead) { int selectedEmoteID = selectionWheel.selectedEmoteID; if (selectedEmoteID <= 3 || selectedEmoteID == 6 || !InvCheck) { __instance.PerformEmote(context, selectedEmoteID); } else if (!__instance.isHoldingObject) { __instance.PerformEmote(context, selectedEmoteID); } Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } if (__instance.isPlayerDead && !__instance.quickMenuManager.isMenuOpen) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } __instance.disableLookInput = false; emoteWheelIsOpened = false; wheel.SetActive(emoteWheelIsOpened); } if (!emoteWheelIsOpened && !__instance.quickMenuManager.isMenuOpen) { EmoteInput(keybinds[2], needsEmptyHands: false, 3, __instance); EmoteInput(keybinds[3], needsEmptyHands: true, 4, __instance); EmoteInput(keybinds[4], needsEmptyHands: true, 5, __instance); EmoteInput(keybinds[5], needsEmptyHands: false, 6, __instance); EmoteInput(keybinds[6], needsEmptyHands: true, 7, __instance); EmoteInput(keybinds[7], needsEmptyHands: true, 8, __instance); } } private static void EmoteInput(string keyBind, bool needsEmptyHands, int emoteID, PlayerControllerB player) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) bool flag = PlayerPrefs.GetInt("InvCheck") == 1; Emotes emotes = (Emotes)emoteID; string text = emotes.ToString(); if (PlayerPrefs.HasKey(text)) { keyBind = PlayerPrefs.GetString(text); } else { PlayerPrefs.SetString(text, keyBind); } if (!keyBind.Equals(string.Empty) && InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[keyBind], 0f) && (!player.isHoldingObject || !needsEmptyHands || !flag) && (!player.performingEmote || currentEmoteID != emoteID)) { Debug.Log((object)text); player.PerformEmote(context, emoteID); } } [HarmonyPatch(typeof(PlayerControllerB), "CheckConditionsForEmote")] [HarmonyPrefix] private static bool prefixCheckConditions(ref bool __result, PlayerControllerB __instance) { bool flag = (bool)Reflection.GetInstanceField(typeof(PlayerControllerB), __instance, "isJumping"); if (currentEmoteID == 6) { __result = !__instance.inSpecialInteractAnimation && !__instance.isPlayerDead && !flag && __instance.moveInputVector.x == 0f && !__instance.isSprinting && !__instance.isCrouching && !__instance.isClimbingLadder && !__instance.isGrabbingObjectAnimation && !__instance.inTerminalMenu && !__instance.isTypingChat; return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "PerformEmote")] [HarmonyPrefix] private static void PerformEmotePrefix(CallbackContext context, int emoteID, PlayerControllerB __instance) { if ((emoteID >= 3 || emoteWheelIsOpened || ((CallbackContext)(ref context)).performed) && ((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && (bool)Reflection.CallMethod(__instance, "CheckConditionsForEmote") && !(__instance.timeSinceStartingEmote < 0.5f)) { __instance.timeSinceStartingEmote = 0f; __instance.performingEmote = true; __instance.playerBodyAnimator.SetInteger("emoteNumber", emoteID); __instance.StartPerformingEmoteServerRpc(); } } } 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_0087: 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 || animator.GetInteger("emoteNumber") == 8) && ((Vector2)(ref player.moveInputVector)).sqrMagnitude == 0f) { player.PlayFootstepLocal(); player.PlayFootstepServer(); } } } public enum Emotes { Dance = 1, Point, Middle_Finger, Clap, Shy, The_Griddy, Twerk, Salute } public class SelectionWheel : MonoBehaviour { public RectTransform selectionBlock; 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; private int cuadrante = 0; public string selectedEmoteName; public float wheelMovementOffset = 3.3f; public static string[] emotes_Keybinds; private Vector2 center; private void OnEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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>(); emotes_Keybinds[0] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote1", false), 0, (DisplayStringOptions)0); emotes_Keybinds[1] = InputActionRebindingExtensions.GetBindingDisplayString(component.currentActionMap.FindAction("Emote2", false), 0, (DisplayStringOptions)0); Cursor.visible = true; selectionBlock = ((Component)((Component)this).gameObject.transform.Find("SelectedEmote")).gameObject.GetComponent<RectTransform>(); 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(); selectedEmoteID = currentBlock + Mathf.RoundToInt((float)(blocksNumber / 4)) + blocksNumber * pageNumber; displayEmoteInfo(); } private void wheelSelection() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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)) { bool flag = ((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() > center.x; bool flag2 = ((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() > center.y; cuadrante = ((!flag) ? (flag2 ? 2 : 3) : (flag2 ? 1 : 4)); float num = (((InputControl<float>)(object)((Pointer)Mouse.current).position.y).ReadValue() - center.y) / (((InputControl<float>)(object)((Pointer)Mouse.current).position.x).ReadValue() - center.x); float num2 = 180 * (cuadrante - ((cuadrante <= 2) ? 1 : 2)); angle = Mathf.Atan(num) * (180f / (float)Math.PI) + num2; if (angle == 90f) { angle = 270f; } else if (angle == 270f) { angle = 90f; } float num3 = 360 / blocksNumber; currentBlock = Mathf.RoundToInt((angle - num3 * 1.5f) / num3); ((Transform)selectionBlock).localRotation = Quaternion.Euler(((Component)this).transform.rotation.z, ((Component)this).transform.rotation.y, num3 * (float)currentBlock); } } 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; foreach (GameObject val in pages) { val.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 > emotes_Keybinds.Length) ? "" : emotes_Keybinds[selectedEmoteID - 1]); object obj; if (selectedEmoteID <= Enum.GetValues(typeof(Emotes)).Length) { Emotes emotes = (Emotes)selectedEmoteID; obj = emotes.ToString().Replace("_", " "); } else { obj = "EMPTY"; } string text2 = (string)obj; if (!PlayerPrefs.HasKey(text2.Replace(" ", "_"))) { PlayerPrefs.SetString(text2.Replace(" ", "_"), (selectedEmoteID > emotes_Keybinds.Length) ? "" : emotes_Keybinds[selectedEmoteID - 1]); } else { text = PlayerPrefs.GetString(text2.Replace(" ", "_")); } emoteInformation.text = text2 + "\n[" + text.ToUpper() + "]"; } } public class RebindBtn : MonoBehaviour { public string defaultKey; public static string[] defaultKeys; public string playerPrefs; public GameObject waitingForInput; public Text keyInfo; public Text description; private void Start() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown string text = ((Component)((Component)this).gameObject.transform.Find("Description")).GetComponent<Text>().text; try { int num = (int)(Emotes)Enum.Parse(typeof(Emotes), text.Replace(" ", "_")); defaultKey = defaultKeys[num - 1]; } catch { defaultKey = "V"; } playerPrefs = ((Component)((Component)this).gameObject.transform.Find("Description")).GetComponent<Text>().text.Replace(" ", "_"); ((Component)((Component)((Component)this).transform.parent).transform.Find("Delete")).gameObject.AddComponent<DeleteBtn>(); keyInfo = ((Component)((Component)this).transform.Find("InputText")).GetComponent<Text>(); waitingForInput = ((Component)((Component)this).transform.Find("wait")).gameObject; ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener(new UnityAction(GetKey)); if (!PlayerPrefs.HasKey(playerPrefs)) { PlayerPrefs.SetString(playerPrefs, defaultKey); } SetKeybind(PlayerPrefs.GetString(playerPrefs)); } public void SetKeybind(string key) { PlayerPrefs.SetString(playerPrefs, key); keyInfo.text = key; ((MonoBehaviour)this).StopAllCoroutines(); waitingForInput.SetActive(false); } public void GetKey() { waitingForInput.SetActive(true); ((MonoBehaviour)this).StartCoroutine(WaitForKey(delegate(string key) { SetKeybind(key); })); } private IEnumerator WaitForKey(Action<string> callback) { while (!((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame) { yield return (object)new WaitForEndOfFrame(); Observable.CallOnce<InputControl>(InputSystem.onAnyButtonPress, (Action<InputControl>)delegate(InputControl ctrl) { callback((ctrl.device == Keyboard.current) ? ctrl.name : defaultKey); }); } } } public class DeleteBtn : MonoBehaviour { private RebindBtn rebindBtn; private void Start() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown rebindBtn = ((Component)((Component)((Component)this).transform.parent).transform.Find("Button")).GetComponent<RebindBtn>(); Button component = ((Component)this).GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener(new UnityAction(deleteKey)); } public void deleteKey() { rebindBtn.SetKeybind(string.Empty); } } public class BasicToggle : MonoBehaviour { private Toggle tog; public static bool configValueInv; public string playerPrefs; private void Start() { tog = ((Component)this).GetComponent<Toggle>(); ((UnityEvent<bool>)(object)tog.onValueChanged).AddListener((UnityAction<bool>)SetNewValue); if (!PlayerPrefs.HasKey(playerPrefs)) { PlayerPrefs.SetInt(playerPrefs, configValueInv ? 1 : 0); } } public void SetNewValue(bool arg) { PlayerPrefs.SetInt(playerPrefs, tog.isOn ? 1 : 0); } } public class ButtonBasic : MonoBehaviour { public GameObject[] alternateActive = (GameObject[])(object)new GameObject[1]; private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((UnityEvent)((Component)this).GetComponent<Button>().onClick).AddListener(new UnityAction(onButtonTrigger)); if (((Object)((Component)this).gameObject).name.Equals("BackButton")) { alternateActive[0] = ((Component)((Component)this).transform.parent).gameObject; } if (((Object)((Component)this).gameObject).name.Equals("MoreEmotesButton(Clone)")) { alternateActive[0] = ((Component)((Component)((Component)this).transform.parent).gameObject.transform.Find("MoreEmotesPanel(Clone)")).gameObject; } } public void onButtonTrigger() { GameObject[] array = alternateActive; foreach (GameObject val in array) { val.SetActive((!val.activeInHierarchy) ? true : false); } } } public class SetupEverything : MonoBehaviour { private GameObject panel; public static bool configValue; private void Start() { panel = ((Component)((Component)this).transform.Find("MoreEmotesPanel(Clone)")).gameObject; ((Component)panel.transform.Find("Version")).GetComponent<Text>().text = "Sligili - 1.2.2"; if (!PlayerPrefs.HasKey("InvCheck")) { PlayerPrefs.SetInt("InvCheck", configValue ? 1 : 0); } SetupMenuButton(); BackButton(); KeybindButtons(); Others(); } private void SetupMenuButton() { GameObject gameObject = ((Component)((Component)this).transform.Find("MoreEmotesButton(Clone)")).gameObject; gameObject.AddComponent<ButtonBasic>(); } private void BackButton() { GameObject gameObject = ((Component)panel.transform.Find("BackButton")).gameObject; gameObject.AddComponent<ButtonBasic>(); } private void KeybindButtons() { GameObject gameObject = ((Component)panel.transform.Find("KeybindButtons")).gameObject; GameObject[] array = (GameObject[])(object)new GameObject[gameObject.transform.childCount]; for (int i = 0; i < gameObject.transform.childCount; i++) { array[i] = ((Component)gameObject.transform.GetChild(i)).gameObject; } GameObject[] array2 = array; foreach (GameObject val in array2) { ((Component)val.transform.Find("Button")).gameObject.AddComponent<RebindBtn>(); } } private void Others() { GameObject gameObject = ((Component)panel.transform.Find("Inv")).gameObject; gameObject.AddComponent<BasicToggle>(); BasicToggle basicToggle = gameObject.AddComponent<BasicToggle>(); basicToggle.playerPrefs = "InvCheck"; } } }
BepInEx/plugins/MoreItems.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using 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/NoPenalty.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using LC_API.ServerAPI; 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 = "")] [assembly: AssemblyCompany("NoPenalty")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Increase the max players in Lethal Company")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("NoPenalty")] [assembly: AssemblyTitle("NoPenalty")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] namespace NoPenalty { [BepInPlugin("NoPenalty", "NoPenalty", "1.0.1")] public class Plugin : BaseUnityPlugin { private Harmony harmonymain; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown harmonymain = new Harmony("NoPenalty"); harmonymain.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"NoPenalty has loaded!!!"); } private void OnDestroy() { ModdedServer.SetServerModdedOnly(); } } public static class PluginInfo { public const string PLUGIN_GUID = "NoPenalty"; public const string PLUGIN_NAME = "NoPenalty"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace PermUnlockables.Patches { [HarmonyPatch] internal class PenaltyPatches { [HarmonyPatch(typeof(HUDManager), "ApplyPenalty")] [HarmonyPrefix] public static bool ApplyPenalty() { return false; } [HarmonyPatch(typeof(HUDManager), "Awake")] [HarmonyPostfix] public static void ResizeLists2(ref HUDManager __instance) { ((Component)((TMP_Text)__instance.statsUIElements.penaltyTotal).transform.parent.parent).gameObject.SetActive(false); } } }
BepInEx/plugins/OctolarFirstMod.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using OctolarFirstMod.Patches; 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("OctolarFirstMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OctolarFirstMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a761e7d0-2e73-4d38-b7ad-3010bdcd4702")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace OctolarFirstMod { [BepInPlugin("Octolar.Healthstation", "Health Station mod", "1.0.0.1")] public class OctolarFirstMod : BaseUnityPlugin { private const string modGUID = "Octolar.Healthstation"; private const string modName = "Health Station mod"; private const string modVersion = "1.0.0.1"; private readonly Harmony harmony = new Harmony("Octolar.Healthstation"); private static OctolarFirstMod Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Octolar.Healthstation"); mls.LogInfo((object)"Octolar HealthStation mod is now active"); harmony.PatchAll(typeof(OctolarFirstMod)); harmony.PatchAll(typeof(ItemChargerPatch)); } } } namespace OctolarFirstMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPatch(typeof(ItemCharger))] internal class ItemChargerPatch { [HarmonyPatch("ChargeItem")] [HarmonyPostfix] private static void ChargerHealsPatch() { //IL_0014: 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) GameNetworkManager.Instance.localPlayerController.DamagePlayer(-100, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured) { GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false); } } } }
BepInEx/plugins/PushCompany.dll
Decompiled 10 months agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using PushCompany.Assets.Scripts; using PushCompany.Properties; 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("PushCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Push your fellow crewmates with the interaction key! (E by default)")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("PushCompany")] [assembly: AssemblyTitle("PushCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PushCompany { [BepInPlugin("PushCompany", "PushCompany", "1.2.0")] public class PushCompanyBase : BaseUnityPlugin { public static readonly Lazy<PushCompanyBase> Instance = new Lazy<PushCompanyBase>(() => new PushCompanyBase()); public static GameObject pushPrefab; public ManualLogSource mls; private readonly Harmony harmony = new Harmony("PushCompany"); public static ConfigEntry<float> config_PushCooldown; public static ConfigEntry<float> config_PushForce; public static ConfigEntry<float> config_PushRange; public static ConfigEntry<float> config_PushCost; private void Awake() { mls = Logger.CreateLogSource("PushCompany"); ConfigSetup(); LoadBundle(); harmony.PatchAll(typeof(PushCompanyBase)); harmony.PatchAll(typeof(PlayerControllerB_Patches)); harmony.PatchAll(typeof(NetworkHandler)); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls.LogInfo((object)"PushCompany has initialized!"); } private void ConfigSetup() { config_PushCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Push Cooldown", "Value", 0.025f, "How long until the player can push again"); config_PushForce = ((BaseUnityPlugin)this).Config.Bind<float>("Push Force", "Value", 12.5f, "How strong the player pushes."); config_PushRange = ((BaseUnityPlugin)this).Config.Bind<float>("Push Range", "Value", 3f, "The distance the player is able to push."); config_PushCost = ((BaseUnityPlugin)this).Config.Bind<float>("Push Cost", "Value", 0.08f, "The energy cost of each push."); } private void LoadBundle() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.pushcompany); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Push Bundle!"); } pushPrefab = val.LoadAsset<GameObject>("Assets/Push.prefab"); if ((Object)(object)pushPrefab == (Object)null) { throw new Exception("Failed to load Push Prefab!"); } pushPrefab.AddComponent<PushComponent>(); } } public static class PluginInfo { public const string PLUGIN_GUID = "PushCompany"; public const string PLUGIN_NAME = "PushCompany"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace PushCompany.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("PushCompany.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[] AssetBundles { get { object @object = ResourceManager.GetObject("AssetBundles", resourceCulture); return (byte[])@object; } } internal static byte[] AssetBundles_manifest { get { object @object = ResourceManager.GetObject("AssetBundles.manifest", resourceCulture); return (byte[])@object; } } internal static byte[] AssetBundles1 { get { object @object = ResourceManager.GetObject("AssetBundles1", resourceCulture); return (byte[])@object; } } internal static byte[] AssetBundles2 { get { object @object = ResourceManager.GetObject("AssetBundles2", resourceCulture); return (byte[])@object; } } internal static byte[] pushcompany { get { object @object = ResourceManager.GetObject("pushcompany", resourceCulture); return (byte[])@object; } } internal static byte[] pushcompany_push { get { object @object = ResourceManager.GetObject("pushcompany.push", resourceCulture); return (byte[])@object; } } internal static byte[] pushcompany_push_manifest { get { object @object = ResourceManager.GetObject("pushcompany.push.manifest", resourceCulture); return (byte[])@object; } } internal static byte[] pushcompany_push1 { get { object @object = ResourceManager.GetObject("pushcompany.push1", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace PushCompany.Assets.Scripts { [HarmonyPatch] public class NetworkHandler { private static GameObject pushObject; [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void Init() { NetworkManager.Singleton.AddNetworkPrefab(PushCompanyBase.pushPrefab); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkPrefab() { try { if (NetworkManager.Singleton.IsServer) { pushObject = Object.Instantiate<GameObject>(PushCompanyBase.pushPrefab); pushObject.GetComponent<NetworkObject>().Spawn(true); } } catch { PushCompanyBase.Instance.Value.mls.LogError((object)"Failed to instantiate network prefab!"); } } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerB_Patches { private static PushComponent pushComponent; [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "Update")] private static void Update(PlayerControllerB __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner) { return; } MovementActions movement = __instance.playerActions.Movement; if (((MovementActions)(ref movement)).Interact.WasPressedThisFrame()) { if ((Object)(object)pushComponent == (Object)null) { pushComponent = Object.FindObjectOfType<PushComponent>(); } if ((Object)(object)pushComponent != (Object)null) { pushComponent.PushServerRpc(((NetworkBehaviour)__instance).NetworkObjectId); } } } } public class PushComponent : NetworkBehaviour { private Dictionary<ulong, float> lastPushTimes = new Dictionary<ulong, float>(); private NetworkVariable<float> PushCooldown = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> PushRange = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> PushForce = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> PushCost = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer) { PushCooldown.Value = PushCompanyBase.config_PushCooldown.Value; PushRange.Value = PushCompanyBase.config_PushRange.Value; PushForce.Value = PushCompanyBase.config_PushForce.Value; PushCost.Value = PushCompanyBase.config_PushCost.Value; } } [ServerRpc(RequireOwnership = false)] public void PushServerRpc(ulong playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2433198804u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2433198804u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } if (lastPushTimes.TryGetValue(playerId, out var value)) { if (Time.time - value < PushCooldown.Value) { return; } } else { lastPushTimes.Add(playerId, 0f); } GameObject playerById = GetPlayerById(playerId); PlayerControllerB component = playerById.GetComponent<PlayerControllerB>(); Camera gameplayCamera = component.gameplayCamera; if (!CanPushPlayer(component)) { return; } int num = 1 << playerById.layer; Vector3 forward = ((Component)gameplayCamera).transform.forward; Vector3 normalized = ((Vector3)(ref forward)).normalized; RaycastHit[] array = Physics.RaycastAll(((Component)gameplayCamera).transform.position, normalized, PushRange.Value, num); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val3 = array2[i]; if ((Object)(object)((Component)((RaycastHit)(ref val3)).transform).gameObject != (Object)(object)playerById) { PlayerControllerB component2 = ((Component)((RaycastHit)(ref val3)).transform).GetComponent<PlayerControllerB>(); if (!component2.inSpecialInteractAnimation) { PushClientRpc(((NetworkBehaviour)component).NetworkObjectId, ((NetworkBehaviour)component2).NetworkObjectId, normalized * PushForce.Value * Time.fixedDeltaTime); lastPushTimes[playerId] = Time.time; } break; } } } [ClientRpc] private void PushClientRpc(ulong pusherId, ulong playerId, Vector3 push) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) 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(3498116674u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, pusherId); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref push); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3498116674u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject playerById = GetPlayerById(playerId); PlayerControllerB component = playerById.GetComponent<PlayerControllerB>(); ((MonoBehaviour)this).StartCoroutine(SmoothMove(component.thisController, push)); component.movementAudio.PlayOneShot(StartOfRound.Instance.playerJumpSFX); GameObject playerById2 = GetPlayerById(pusherId); PlayerControllerB component2 = playerById2.GetComponent<PlayerControllerB>(); component2.sprintMeter = Mathf.Clamp(component2.sprintMeter - PushCost.Value, 0f, 1f); } } } public IEnumerator SmoothMove(CharacterController controller, Vector3 push) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float force = PushForce.Value / 12.5f; float smoothTime = ((Vector3)(ref push)).magnitude / force; Vector3 targetPosition = ((Component)controller).transform.position + push; Vector3 val = targetPosition - ((Component)controller).transform.position; Vector3 direction = ((Vector3)(ref val)).normalized; float distance = Vector3.Distance(((Component)controller).transform.position, targetPosition); for (float currentTime = 0f; currentTime < smoothTime; currentTime += Time.fixedDeltaTime) { float currentDistance = distance * Mathf.Min(currentTime, smoothTime) / smoothTime; controller.Move(direction * currentDistance); yield return null; } } private bool CanPushPlayer(PlayerControllerB player) { return !player.quickMenuManager.isMenuOpen && !player.inSpecialInteractAnimation && !player.isTypingChat && !player.isExhausted; } private static GameObject GetPlayerById(ulong playerId) { if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(playerId, out var value)) { return ((Component)value).gameObject; } return null; } protected override void __initializeVariables() { if (PushCooldown == null) { throw new Exception("PushComponent.PushCooldown cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)PushCooldown).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)PushCooldown, "PushCooldown"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)PushCooldown); if (PushRange == null) { throw new Exception("PushComponent.PushRange cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)PushRange).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)PushRange, "PushRange"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)PushRange); if (PushForce == null) { throw new Exception("PushComponent.PushForce cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)PushForce).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)PushForce, "PushForce"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)PushForce); if (PushCost == null) { throw new Exception("PushComponent.PushCost cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)PushCost).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)PushCost, "PushCost"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)PushCost); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PushComponent() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2433198804u, new RpcReceiveHandler(__rpc_handler_2433198804)); NetworkManager.__rpc_func_table.Add(3498116674u, new RpcReceiveHandler(__rpc_handler_3498116674)); } private static void __rpc_handler_2433198804(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 playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PushComponent)(object)target).PushServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3498116674(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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong pusherId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref pusherId); ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); Vector3 push = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref push); target.__rpc_exec_stage = (__RpcExecStage)2; ((PushComponent)(object)target).PushClientRpc(pusherId, playerId, push); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PushComponent"; } } }
BepInEx/plugins/QuickRestart.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using 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/ShipClock.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ShipClock")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShipClock")] [assembly: AssemblyTitle("ShipClock")] [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 ShipClock { [BepInPlugin("atk.lethalcompany.shipclock", "Ship Clock", "0.9.0")] public class Main : BaseUnityPlugin { private const string PluginGuid = "atk.lethalcompany.shipclock"; private const string PluginName = "Ship Clock"; private const string PluginVersion = "0.9.0"; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("atk.lethalcompany.shipclock"); val.PatchAll(typeof(Patches)); } } [HarmonyPatch] internal class Patches { [HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")] [HarmonyPostfix] public static void SetInsideLightingDimness() { if ((Object)(object)GameNetworkManager.Instance != (Object)null && !GameNetworkManager.Instance.localPlayerController.isPlayerDead) { HUDManager.Instance.SetClockVisible(!GameNetworkManager.Instance.localPlayerController.isInsideFactory); } } } }
BepInEx/plugins/ShipLoot.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using 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/SolosBodycams.dll
Decompiled 10 months agousing System.Collections; 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 UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("SolosBodycams")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Solo's Bodycams")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SolosBodycams")] [assembly: AssemblyTitle("SolosBodycams")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SolosBodycams; [BepInPlugin("SolosBodycams", "Solo's Bodycams", "1.0")] public class Plugin : BaseUnityPlugin { private GameObject ShipExternalCamera = null; private int TransformIndexCopy; private bool ActivateCamera1 = false; private bool ActivateCamera2 = false; private bool SwitchedMonitors = false; private RenderTexture NewRT; private Vector3 CameraOriginalPosition; private Quaternion CameraOriginalRotation; private string Spine4Addition = ""; private static Plugin Instance; private static ConfigFile CameraPlacementFile { get; set; } internal static ConfigEntry<bool> BodycamOrHeadcam { get; set; } public void Awake() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; } else if ((Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } CameraPlacementFile = new ConfigFile(Paths.ConfigPath + "\\SoloMods\\CameraPlacement.cfg", true); BodycamOrHeadcam = CameraPlacementFile.Bind<bool>("CameraPlacement", "Bool", true, "True for HEADCAM, False for BODYCAM"); ((BaseUnityPlugin)this).Logger.LogInfo((object)BodycamOrHeadcam.Value); if (BodycamOrHeadcam.Value) { Spine4Addition = "/spine.004"; } else { Spine4Addition = ""; } Object.DontDestroyOnLoad((Object)((Component)this).gameObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SolosBodycams is loaded!"); SceneManager.sceneLoaded += OnSceneLoaded; } public void OnSceneLoaded(Scene scene, LoadSceneMode mode) { ActivateCamera2 = false; if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions")) { ActivateCamera1 = true; ((MonoBehaviour)this).StartCoroutine(LoadSceneEnter()); } else { ActivateCamera1 = false; SwitchedMonitors = false; } } private IEnumerator LoadSceneEnter() { yield return (object)new WaitForSeconds(5f); ActivateCamera2 = true; if (!((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") == (Object)null) && !SwitchedMonitors) { NewRT = new RenderTexture(160, 120, 32, (RenderTextureFormat)0); ((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)NewRT; if ((Object)(object)ShipExternalCamera == (Object)null) { ShipExternalCamera = Object.Instantiate<GameObject>(GameObject.Find("Environment/HangarShip/Cameras/ShipCamera")); ShipExternalCamera.transform.SetParent(GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").transform.parent); ShipExternalCamera.transform.SetLocalPositionAndRotation(GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").transform.localPosition, GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").transform.localRotation); ShipExternalCamera.AddComponent<Camera>(); CameraOriginalPosition = ShipExternalCamera.transform.localPosition; CameraOriginalRotation = ShipExternalCamera.transform.localRotation; Object.Destroy((Object)(object)((Component)ShipExternalCamera.transform.Find("VolumeMain (1)")).GetComponent<BoxCollider>()); Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<Animator>()); Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<MeshRenderer>()); } ShipExternalCamera.GetComponent<Camera>().targetTexture = NewRT; SwitchedMonitors = true; } } public void Update() { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (!ActivateCamera1 || !ActivateCamera2) { return; } TransformIndexCopy = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().targetTransformIndex; TransformAndName val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().radarTargets[TransformIndexCopy]; if (!val.isNonPlayer) { ShipExternalCamera.transform.SetPositionAndRotation(val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003" + Spine4Addition).position + new Vector3(0f, 0.1f, 0f), val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003" + Spine4Addition).rotation * Quaternion.Euler(0f, 0f, 0f)); DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>(); for (int i = 0; i < array.Length; i++) { if (array[i].playerScript.playerUsername == val.name) { ShipExternalCamera.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003" + Spine4Addition).position + new Vector3(0f, 0.1f, 0f), ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003" + Spine4Addition).rotation * Quaternion.Euler(0f, 0f, 0f)); } } } else { ShipExternalCamera.transform.SetPositionAndRotation(val.transform.position + new Vector3(0f, 1.6f, 0f), val.transform.rotation * Quaternion.Euler(0f, -90f, 0f)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "SolosBodycams"; public const string PLUGIN_NAME = "SolosBodycams"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/Suit Saver.dll
Decompiled 10 months agousing 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 GameNetcodeStuff; using HarmonyLib; 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("Suit Saver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Suit Saver")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cb7cfb30-b06e-4e41-9de7-03640e1662ea")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace SuitSaver { [BepInPlugin("Hexnet.lethalcompany.suitsaver", "Suit Saver", "1.1.2")] public class SuitSaver : BaseUnityPlugin { private const string modGUID = "Hexnet.lethalcompany.suitsaver"; private const string modName = "Suit Saver"; private const string modVersion = "1.1.2"; private readonly Harmony harmony = new Harmony("Hexnet.lethalcompany.suitsaver"); private void Awake() { harmony.PatchAll(); Debug.Log((object)"[SS]: Suit Saver loaded successfully!"); } } } namespace SuitSaver.Patches { [HarmonyPatch] internal class Patches { [HarmonyPatch(typeof(StartOfRound))] internal class StartPatch { [HarmonyPatch("ResetShip")] [HarmonyPostfix] private static void ResetShipPatch() { Debug.Log((object)"[SS]: Ship has been reset!"); Debug.Log((object)"[SS]: Reloading suit..."); LoadSuitFromFile(); } } [HarmonyPatch(typeof(UnlockableSuit))] internal class SuitPatch { [HarmonyPatch("SwitchSuitClientRpc")] [HarmonyPostfix] private static void SyncSuit(ref UnlockableSuit __instance, int playerID) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; int num = (int)localPlayerController.playerClientId; if (playerID != num) { UnlockableSuit.SwitchSuitForPlayer(StartOfRound.Instance.allPlayerScripts[playerID], __instance.syncedSuitID.Value, true); } } [HarmonyPatch("SwitchSuitToThis")] [HarmonyPostfix] private static void EquipSuitPatch() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; string unlockableName = StartOfRound.Instance.unlockablesList.unlockables[localPlayerController.currentSuitID].unlockableName; SaveToFile(unlockableName); Debug.Log((object)("[SS]: Successfully saved current suit. (" + unlockableName + ")")); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class JoinGamePatch { [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] private static void LoadSuitPatch(ref PlayerControllerB __instance) { ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.AddComponent<EquipAfterSyncPatch>(); } } internal class EquipAfterSyncPatch : MonoBehaviour { private void Start() { ((MonoBehaviour)this).StartCoroutine(LoadSuit()); } private IEnumerator LoadSuit() { Debug.Log((object)"[SS]: Waiting for suits to sync..."); yield return (object)new WaitForSeconds(1f); LoadSuitFromFile(); } } public static string SavePath = Application.persistentDataPath + "\\suitsaver.txt"; private static void SaveToFile(string suitName) { File.WriteAllText(SavePath, suitName); } private static string LoadFromFile() { if (File.Exists(SavePath)) { return File.ReadAllText(SavePath); } return "-1"; } private static UnlockableSuit GetSuitByName(string Name) { List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables; UnlockableSuit[] array = Resources.FindObjectsOfTypeAll<UnlockableSuit>(); foreach (UnlockableSuit val in array) { if (val.syncedSuitID.Value >= 0) { string unlockableName = unlockables[val.syncedSuitID.Value].unlockableName; if (unlockableName == Name) { return val; } } } return null; } private static void LoadSuitFromFile() { string text = LoadFromFile(); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!(text == "-1")) { UnlockableSuit suitByName = GetSuitByName(text); if ((Object)(object)suitByName != (Object)null) { UnlockableSuit.SwitchSuitForPlayer(localPlayerController, suitByName.syncedSuitID.Value, false); suitByName.SwitchSuitServerRpc((int)localPlayerController.playerClientId); Debug.Log((object)("[SS]: Successfully loaded saved suit. (" + text + ")")); } else { Debug.Log((object)("[SS]: Failed to load saved suit. Perhaps it's locked? (" + text + ")")); } } } } }
BepInEx/plugins/WeatherMultipliers.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("WeatherMultipliers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lethal Company mod adding scrap multipliers to moon weather")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("WeatherMultipliers")] [assembly: AssemblyTitle("WeatherMultipliers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WeatherMultipliers { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public Dictionary<LevelWeatherType, float> ValueMultipliers = new Dictionary<LevelWeatherType, float>(); private static readonly Dictionary<LevelWeatherType, float> defaultValueMultipliers = new Dictionary<LevelWeatherType, float> { { (LevelWeatherType)1, 1.05f }, { (LevelWeatherType)2, 1.2f }, { (LevelWeatherType)3, 1.15f }, { (LevelWeatherType)4, 1.25f }, { (LevelWeatherType)5, 1.5f } }; public Config(ConfigFile cfg) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) InitInstance(this); foreach (KeyValuePair<LevelWeatherType, float> defaultValueMultiplier in defaultValueMultipliers) { Dictionary<LevelWeatherType, float> valueMultipliers = ValueMultipliers; LevelWeatherType key = defaultValueMultiplier.Key; LevelWeatherType key2 = defaultValueMultiplier.Key; valueMultipliers[key] = cfg.Bind<float>("Multipliers", ((object)(LevelWeatherType)(ref key2)).ToString(), Mathf.Clamp(defaultValueMultiplier.Value, 1f, 1000f), $"Scrap value multiplier for {defaultValueMultiplier.Key} weather").Value; } } public static void RequestSync() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } Plugin.Logger.LogInfo((object)"Attempting to sync config with host"); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("WeatherMultipliers_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("WeatherMultipliers_OnReceiveConfigSync", clientId, val, (NetworkDelivery)4); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (SyncedInstance<Config>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("WeatherMultipliers_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("WeatherMultipliers_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } [BepInPlugin("WeatherMultipliers", "WeatherMultipliers", "1.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("WeatherMultipliers"); public static Config Config { get; internal set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { Config = new Config(((BaseUnityPlugin)this).Config); Logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); harmony.PatchAll(typeof(Config)); Logger.LogInfo((object)"Plugin WeatherMultipliers is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "WeatherMultipliers"; public const string PLUGIN_NAME = "WeatherMultipliers"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace WeatherMultipliers.patches { [HarmonyPatch(typeof(LungProp), "DisconnectFromMachinery")] public class ApparatusPatch { private static readonly ManualLogSource logger = Logger.CreateLogSource("WeatherMultipliers.ApparatusPatch"); private static void Prefix(LungProp __instance) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType currentWeather = __instance.roundManager.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[currentWeather]; ((GrabbableObject)__instance).scrapValue = (int)(num * (float)((GrabbableObject)__instance).scrapValue); logger.LogInfo((object)$"Adjusting LungProp (Apparatus) value for weather {currentWeather}: {((GrabbableObject)__instance).scrapValue}"); } } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] public class ScrapGeneration { private static readonly ManualLogSource logger = Logger.CreateLogSource("WeatherMultipliers.ScrapGeneration"); private static void Prefix(RoundManager __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[__instance.currentLevel.currentWeather]; __instance.scrapValueMultiplier *= num; logger.LogInfo((object)$"Set scrap value multiplier ({num}) for current weather \"{currentWeather}\""); } else { logger.LogInfo((object)$"No weather multiplier found for \"{currentWeather}\""); } } private static void Postfix(RoundManager __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) LevelWeatherType currentWeather = __instance.currentLevel.currentWeather; if (SyncedInstance<Config>.Instance.ValueMultipliers.ContainsKey(currentWeather)) { float num = SyncedInstance<Config>.Instance.ValueMultipliers[__instance.currentLevel.currentWeather]; __instance.scrapValueMultiplier /= num; logger.LogInfo((object)$"Scrap generated, resetting scrap value multiplier to its original value of {__instance.scrapValueMultiplier}"); } } } }