Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ModdedCompany3rd v1.3.2
BepInEx/plugins/plugins/AlwaysPickup.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; [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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AlwaysPickup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AlwaysPickup")] [assembly: AssemblyTitle("AlwaysPickup")] [assembly: AssemblyVersion("1.0.0.0")] namespace AlwaysPickup; [BepInPlugin("NutNutty.AlwaysPickup", "Always Pickup", "1.0.0")] public class AlwaysPickup : BaseUnityPlugin { public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("AlwaysPickup").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Always Pickup plugin loaded!"); } } [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObjectPatch { [HarmonyTranspiler] [HarmonyPatch("Start")] private static IEnumerable<CodeInstruction> TranspileGrabbableObject(IEnumerable<CodeInstruction> instructions) { //IL_0003: 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_0027: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, Array.Empty<CodeMatch>()).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(GrabbableObject), "itemProperties")), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(Item), "canBeGrabbedBeforeGameStart")) }).InstructionEnumeration(); } }
BepInEx/plugins/plugins/BetterClock.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; 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 TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BetterClock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterClock")] [assembly: AssemblyCopyright("Copyright © BlueAmulet 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("de27b4d1-820d-4505-a953-6001420281e4")] [assembly: AssemblyFileVersion("1.0.3")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.3.0")] namespace BetterClock { [BepInPlugin("BlueAmulet.BetterClock", "BetterClock", "1.0.3")] public class BetterClock : BaseUnityPlugin { internal const string Name = "BetterClock"; internal const string Author = "BlueAmulet"; internal const string ID = "BlueAmulet.BetterClock"; internal const string Version = "1.0.3"; public void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Settings.InitConfig(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("BlueAmulet.BetterClock"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches"); val.PatchAll(Assembly.GetExecutingAssembly()); int num = 0; foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name)); num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied")); } } internal static class Settings { internal static ConfigEntry<bool> compact; internal static ConfigEntry<bool> leadingZero; internal static ConfigEntry<bool> darkZero; internal static ConfigEntry<bool> fasterUpdate; internal static ConfigEntry<bool> raiseClock; internal static ConfigEntry<bool> hours24; internal static ConfigEntry<bool> properTime; internal static ConfigEntry<float> visibilityShip; internal static ConfigEntry<float> visibilityOutside; internal static ConfigEntry<float> visibilityInside; internal static ConfigEntry<float> visibilityOverride; internal static ConfigEntry<KeyboardShortcut> overrideKeybind; internal static ConfigEntry<bool> overrideToggle; public static void InitConfig(ConfigFile config) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) compact = config.Bind<bool>("Clock", "CompactClock", true, "Makes the clock more compact"); leadingZero = config.Bind<bool>("Clock", "LeadingZero", true, "Adds a leading zero to hours before 10"); darkZero = config.Bind<bool>("Clock", "DarkZero", true, "Leading zeros are dark"); fasterUpdate = config.Bind<bool>("Clock", "FasterUpdate", true, "Update the clock more often"); raiseClock = config.Bind<bool>("Clock", "RaiseClock", true, "Raise the clock near the top of the screen"); hours24 = config.Bind<bool>("Clock", "24Hours", false, "Use 24 hour time"); properTime = config.Bind<bool>("Clock", "ProperTime", true, "Fix time formatting caused by the game or other mods"); visibilityShip = config.Bind<float>("Clock", "VisibilityShip", 1f, "Visibility of clock inside ship"); visibilityOutside = config.Bind<float>("Clock", "VisibilityOutside", 1f, "Visibility of clock outside"); visibilityInside = config.Bind<float>("Clock", "VisibilityInside", 0.25f, "Visibility of clock inside factory"); visibilityOverride = config.Bind<float>("Clock", "VisibilityOverride", 1f, "Visibility when using override keybind"); overrideKeybind = config.Bind<KeyboardShortcut>("Clock", "OverrideKeybind", KeyboardShortcut.Empty, "Keybind to trigger visibility override"); overrideToggle = config.Bind<bool>("Clock", "OverrideToggle", false, "Switch the override keybind between toggle or hold"); } } } namespace BetterClock.Patches { [HarmonyPatch(typeof(HUDManager))] internal static class ClockPatch { private static int lastTime = -1; private static bool overrideDisplay = false; [HarmonyPostfix] [HarmonyPatch("Awake")] public static void PostfixAwake(ref HUDManager __instance) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_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_0076: 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_008f: Unknown result type (might be due to invalid IL or missing references) if (!Settings.compact.Value) { return; } Transform parent = ((TMP_Text)__instance.clockNumber).transform.parent; if (Settings.raiseClock.Value) { Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos; if (pluginInfos.ContainsKey("SolosRingCompass") || pluginInfos.ContainsKey("LineCompassPlugin")) { parent.localPosition += new Vector3(0f, 20f, 0f); } else { parent.localPosition += new Vector3(0f, 40f, 0f); } } RectTransform component = ((Component)parent).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, 50f); ((TMP_Text)__instance.clockNumber).enableWordWrapping = false; RectTransform component2 = ((Component)__instance.clockIcon).GetComponent<RectTransform>(); component2.sizeDelta *= 0.6f; if (!Settings.hours24.Value) { Transform transform = ((TMP_Text)__instance.clockNumber).transform; transform.localPosition += new Vector3(10f, -1f, 0f); Transform transform2 = ((Component)__instance.clockIcon).transform; transform2.localPosition += new Vector3(-25f, -2f, 0f); } } [HarmonyPrefix] [HarmonyPatch("SetClockVisible")] public static bool PrefixVisible(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) KeyboardShortcut value = Settings.overrideKeybind.Value; if (Settings.overrideToggle.Value) { if (((KeyboardShortcut)(ref value)).IsDown()) { overrideDisplay = !overrideDisplay; } } else { overrideDisplay = ((KeyboardShortcut)(ref value)).IsPressed(); } if (overrideDisplay) { __instance.Clock.targetAlpha = Settings.visibilityOverride.Value; return false; } GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = null; if ((Object)(object)instance != (Object)null) { val = instance.localPlayerController; } if ((Object)(object)val != (Object)null) { if (val.isInHangarShipRoom) { __instance.Clock.targetAlpha = Settings.visibilityShip.Value; } else if (val.isInsideFactory) { __instance.Clock.targetAlpha = Settings.visibilityInside.Value; } else { __instance.Clock.targetAlpha = Settings.visibilityOutside.Value; } return false; } return true; } [HarmonyPostfix] [HarmonyPatch("SetClock")] public static void PostfixSetClock(ref HUDManager __instance, ref float timeNormalized, ref float numberOfHours) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = num / 60 % 24; int num3 = num % 60; string text = ((!Settings.hours24.Value) ? ((TMP_Text)__instance.clockNumber).text : $"{num2}:{num3:00}"); if (Settings.properTime.Value) { if (text.Length >= 3 && text[0] == '0' && text[2] == ':') { text = text.Substring(1); } else if (text.StartsWith("24:")) { text = "0:" + text.Substring(3); } if (text.StartsWith("0:") && text.EndsWith("M")) { text = "12:" + text.Substring(2); } if (num2 < 12 && text.EndsWith("PM")) { text = text.Substring(0, text.Length - 2) + "AM"; } else if (num2 >= 12 && text.EndsWith("AM")) { text = text.Substring(0, text.Length - 2) + "PM"; } } if (Settings.compact.Value) { text = text.Replace('\n', ' ').Replace(" ", " "); } if (Settings.leadingZero.Value && (text.Length <= 4 || text.Length == 7)) { text = ((!Settings.darkZero.Value) ? ("0" + text) : ("<color=#602000>0</color>" + text)); } ((TMP_Text)__instance.clockNumber).text = text; } [HarmonyPostfix] [HarmonyPatch(typeof(TimeOfDay))] [HarmonyPatch("MoveTimeOfDay")] public static void PostfixMoveTimeOfDay(ref TimeOfDay __instance, ref float ___changeHUDTimeInterval) { if (Settings.fasterUpdate.Value) { int num = (int)(__instance.normalizedTimeOfDay * (60f * (float)__instance.numberOfHours)); if (num != lastTime) { lastTime = num; HUDManager.Instance.SetClock(__instance.normalizedTimeOfDay, (float)__instance.numberOfHours, true); ___changeHUDTimeInterval = 0f; } } } } }
BepInEx/plugins/plugins/BetterMonitor.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BetterMonitor.Models; using BetterMonitor.Patches.ManualCameraRendererPatch; using BetterMonitor.Patches.ScrapShapePatch; using BetterMonitor.Resources; using BetterMonitor.Utilities; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: AssemblyCompany("BetterMonitor")] [assembly: AssemblyDescription("Enhances the on-board monitor. Makes identifying objects and telling the way home easier.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterMonitor")] [assembly: AssemblyTitle("BetterMonitor")] [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 BetterMonitor { public class Config { public ConfigEntry<bool> VerboseLogging { get; private set; } public ConfigEntry<bool> DisplayScrapByValue { get; private set; } public ConfigEntry<bool> AlignMonitorToPlayer { get; private set; } public ConfigEntry<CompassLocationType> CompassLocation { get; private set; } public Config(ConfigFile config) { VerboseLogging = config.Bind<bool>("Logging", "Verbose logging", true, "Log all events to the console (Useful for identifying issues during customization)"); DisplayScrapByValue = config.Bind<bool>("Scraps", "Show value", true, "Scrap icon changes shape by their value (Customize the icons in the 'ScrapIcons' folder)"); AlignMonitorToPlayer = config.Bind<bool>("Monitor", "Align view to player", true, "Rotate the camera view so that the player is always facing up"); CompassLocation = config.Bind<CompassLocationType>("Monitor", "Compass location", CompassLocationType.AroundPlayerWithProximity, "Where the compass should be placed on the monitor"); } } [BepInPlugin("BetterMonitor", "BetterMonitor", "1.0.0")] public class Plugin : BaseUnityPlugin { public static Plugin Instance { get; private set; } public static Config Configuration { get; private set; } private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Instance = this; Configuration = new Config(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("com.fumiko.bettermonitor"); if (Configuration.DisplayScrapByValue.Value) { val.PatchAll(typeof(ScrapObjectPatch)); ScrapObjectPatch.Initialize(); } if (Configuration.CompassLocation.Value != 0) { val.PatchAll(typeof(MonitorPatch)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterMonitor is loaded!"); } public static void LogError(string s) { if (Configuration.VerboseLogging.Value) { ((BaseUnityPlugin)Instance).Logger.LogError((object)s); } } public static void LogInfo(string s) { if (Configuration.VerboseLogging.Value) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)s); } } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterMonitor"; public const string PLUGIN_NAME = "BetterMonitor"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace BetterMonitor.Utilities { public static class BytesExtensions { public static Sprite ToSprite(this byte[] bytes, int width = 256, int height = 256, float pixelsPerUnit = 100f, SpriteMeshType meshType = 1) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = bytes.ToTexture2D(width, height); return texture.ToSprite(pixelsPerUnit, meshType); } public static Texture2D ToTexture2D(this byte[] bytes, int width = 256, int height = 256) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(width, height); return ImageConversion.LoadImage(val, bytes) ? val : null; } } public static class Texture2DExtensions { public static Sprite ToSprite(this Texture2D texture, float pixelsPerUnit = 100f, SpriteMeshType meshType = 1) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), Vector2.one * 0.5f, pixelsPerUnit, 0u, meshType); } } } namespace BetterMonitor.Resources { public static class ModResources { private static readonly Assembly Assembly = typeof(ModResources).GetTypeInfo().Assembly; public static Stream Get(string path) { return Assembly.GetManifestResourceStream("BetterMonitor.Resources." + path); } } } namespace BetterMonitor.Patches.ScrapShapePatch { [HarmonyPatch(typeof(GrabbableObject))] public static class ScrapObjectPatch { private static readonly string ScrapIconsPath = Path.Combine(Paths.PluginPath, "ScrapIcons"); private static readonly int MainTexture = Shader.PropertyToID("_UnlitColorMap"); private static readonly SortedList<int, Texture> ScrapIcons = new SortedList<int, Texture>(); private static readonly Dictionary<string, Texture> NamedScrapReplacements = new Dictionary<string, Texture>(); public static void Initialize() { if (!Directory.Exists(ScrapIconsPath)) { InitializeDirectory(); } LoadScrapIcons(); } private static void LoadScrapIcons() { Plugin.LogInfo("Loading scrap icons from " + ScrapIconsPath); foreach (string item in Directory.EnumerateFiles(ScrapIconsPath)) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item); string extension = Path.GetExtension(item); if (!(extension.ToLowerInvariant() != ".png")) { Texture2D value = File.ReadAllBytes(item).ToTexture2D(); if (int.TryParse(fileNameWithoutExtension, out var result)) { ScrapIcons.Add(result, (Texture)(object)value); Plugin.LogInfo("Added icon for scrap value " + fileNameWithoutExtension); } else { NamedScrapReplacements.Add(fileNameWithoutExtension, (Texture)(object)value); Plugin.LogInfo("Added icon for scrap " + fileNameWithoutExtension); } } } if (ScrapIcons.Count > 0) { return; } using Stream stream = ModResources.Get("ScrapIcons.0.png"); byte[] array = new byte[stream.Length]; if (stream.Read(array, 0, array.Length) == 0) { ScrapIcons.Add(0, (Texture)(object)array.ToTexture2D()); } } private static void InitializeDirectory() { Directory.CreateDirectory(ScrapIconsPath); string[] array = new string[3] { "0.png", "59.png", "89.png" }; string[] array2 = array; foreach (string text in array2) { string path = Path.Combine(ScrapIconsPath, text); using FileStream destination = File.Create(path); ModResources.Get("ScrapIcons." + text).CopyTo(destination); } } [HarmonyPostfix] [HarmonyPatch("Start")] public static void StartPostfix(GrabbableObject __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown MeshRenderer val = default(MeshRenderer); if (__instance.itemProperties.isScrap && ((Component)__instance.radarIcon).TryGetComponent<MeshRenderer>(ref val)) { MaterialPropertyBlock val2 = new MaterialPropertyBlock(); ((Renderer)val).GetPropertyBlock(val2); val2.SetTexture(MainTexture, FindScrapIcon(__instance)); ((Renderer)val).SetPropertyBlock(val2); } } private static Texture FindScrapIcon(GrabbableObject item) { if (NamedScrapReplacements.TryGetValue(item.itemProperties.itemName, out var value)) { return value; } for (int i = 0; i < ScrapIcons.Count; i++) { int num = ScrapIcons.Keys[i]; if (num >= item.scrapValue) { return ScrapIcons.Values[Mathf.Max(0, i - 1)]; } } IList<Texture> values = ScrapIcons.Values; return values[values.Count - 1]; } } } namespace BetterMonitor.Patches.ManualCameraRendererPatch { [HarmonyPatch(typeof(ManualCameraRenderer))] public static class MonitorPatch { [HarmonyPostfix] [HarmonyPatch("Update")] public static void UpdatePostfix(ManualCameraRenderer __instance) { TransformAndName val = __instance.radarTargets[__instance.targetTransformIndex]; if (!((Object)(object)__instance.cam != (Object)(object)__instance.mapCamera) && !((Object)(object)val.transform == (Object)null)) { AlignCameraToPlayer(((Component)__instance.cam).transform, val.transform); UpdateCompass(__instance, val.transform); } } private static void UpdateCompass(ManualCameraRenderer __instance, Transform radarTarget) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00ec: Unknown result type (might be due to invalid IL or missing references) if (__instance.shipArrowUI.activeSelf) { Vector3 val = StartOfRound.Instance.elevatorTransform.position - radarTarget.position; val.y = 0f; if (Plugin.Configuration.AlignMonitorToPlayer.Value) { Quaternion rotation = radarTarget.rotation; val = Quaternion.AngleAxis(0f - rotation.y, Vector3.up) * val; } if (Plugin.Configuration.CompassLocation.Value == CompassLocationType.AroundPlayer) { __instance.shipArrowPointer.localPosition = ((Vector3)(ref val)).normalized * 50f; } else { float num = Mathf.Lerp(40f, 90f, ((Vector3)(ref val)).sqrMagnitude / 196f); __instance.shipArrowPointer.localPosition = ((Vector3)(ref val)).normalized * num; } __instance.shipArrowPointer.forward = val; } } private static void AlignCameraToPlayer(Transform camera, Transform player) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Configuration.AlignMonitorToPlayer.Value) { Quaternion rotation = player.rotation; camera.rotation = Quaternion.Euler(90f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f); } } } } namespace BetterMonitor.Models { public enum CompassLocationType { BottomRight, AroundPlayer, AroundPlayerWithProximity } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/plugins/BetterSprayPaint.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BetterSprayPaint.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("BetterSprayPaint")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.2.0")] [assembly: AssemblyInformationalVersion("2.0.2+dd23697e910f2b73bb0713b23c49cd0b4943baf7")] [assembly: AssemblyProduct("BetterSprayPaint")] [assembly: AssemblyTitle("BetterSprayPaint")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Color>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Color>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkObjectReference>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkObjectReference>(); } } 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 BetterSprayPaint { [HarmonyPatch] internal class Patches { private static MethodInfo physicsRaycast = typeof(Physics).GetMethod("Raycast", new Type[5] { typeof(Ray), typeof(RaycastHit).MakeByRefType(), typeof(float), typeof(int), typeof(QueryTriggerInteraction) }); private static MethodInfo raycastSkipPlayer = typeof(Patches).GetMethod("RaycastSkipPlayer"); [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "EndOfGame")] public static void EndOfGame() { foreach (GameObject sprayPaintDecal in SprayPaintItem.sprayPaintDecals) { if ((Object)(object)sprayPaintDecal != (Object)null && !sprayPaintDecal.activeInHierarchy) { Object.Destroy((Object)(object)sprayPaintDecal); } } } [HarmonyPrefix] [HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")] public static void LateUpdate(SprayPaintItem __instance, ref float ___sprayCanTank, ref float ___sprayCanShakeMeter, ref AudioSource ___sprayAudio, bool ___isSpraying) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) SprayPaintItemExt sprayPaintItemExt = __instance.Ext(); if (SessionData.InfiniteTank) { ___sprayCanTank = 1f; } __instance.maxSprayPaintDecals = Plugin.MaxSprayPaintDecals; __instance.sprayIntervalSpeed = 0.01f * sprayPaintItemExt.PaintSize; if (SessionData.ShakingNotNeeded) { ___sprayCanShakeMeter = 1f; } ___sprayAudio.volume = Plugin.Volume; if (sprayPaintItemExt.HeldByLocalPlayer && sprayPaintItemExt.ShakeMeter.Value != ___sprayCanShakeMeter) { sprayPaintItemExt.UpdateShakeMeterServerRpc(___sprayCanShakeMeter); } else { ___sprayCanShakeMeter = sprayPaintItemExt.ShakeMeter.Value; } NetworkObjectReference value; if (sprayPaintItemExt.HeldByLocalPlayer) { value = sprayPaintItemExt.PlayerHeldBy.Value; if (((NetworkObjectReference)(ref value)).NetworkObjectId != ((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).NetworkObjectId) { sprayPaintItemExt.SetPlayerHeldByServerRpc(new NetworkObjectReference(((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).NetworkObject)); goto IL_00de; } } value = sprayPaintItemExt.PlayerHeldBy.Value; NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref value)).TryGet(ref val, (NetworkManager)null)) { ((GrabbableObject)__instance).playerHeldBy = ((Component)val).GetComponent<PlayerControllerB>(); } goto IL_00de; IL_00de: if (sprayPaintItemExt.HeldByLocalPlayer) { ((GrabbableObject)__instance).playerHeldBy.Ext(); sprayPaintItemExt.IsErasing = Plugin.inputActions.SprayPaintEraseModifier.IsPressed() || Plugin.inputActions.SprayPaintErase.IsPressed(); } if (___isSpraying && (___sprayCanTank <= 0f || ___sprayCanShakeMeter <= 0f)) { sprayPaintItemExt.UpdateParticles(); __instance.StopSpraying(); PlayCanEmptyEffect(__instance, ___sprayCanTank <= 0f); } if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) || !Plugin.ShorterShakeAnimation) { return; } Animator playerBodyAnimator = ((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator; AnimatorClipInfo[] currentAnimatorClipInfo = playerBodyAnimator.GetCurrentAnimatorClipInfo(2); for (int i = 0; i < currentAnimatorClipInfo.Length; i++) { AnimatorClipInfo val2 = currentAnimatorClipInfo[i]; if (((Object)((AnimatorClipInfo)(ref val2)).clip).name == "ShakeItem") { AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(2); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.1f) { playerBodyAnimator.Play("HoldOneHandedItem"); } } } } public static void EraseSprayPaintAtPoint(SprayPaintItem __instance, Vector3 pos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject sprayPaintDecal in SprayPaintItem.sprayPaintDecals) { if ((Object)(object)sprayPaintDecal != (Object)null && Vector3.Distance(sprayPaintDecal.transform.position, pos) < Mathf.Max(0.15f, 0.5f * __instance.Ext().PaintSize)) { sprayPaintDecal.SetActive(false); } } } public static bool EraseSprayPaintLocal(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot, out RaycastHit sprayHit) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (RaycastSkipPlayer(new Ray(sprayPos, sprayRot), out sprayHit, SessionData.Range, __instance.Ext().sprayPaintMask, (QueryTriggerInteraction)2, __instance)) { EraseSprayPaintAtPoint(__instance, ((RaycastHit)(ref sprayHit)).point); return true; } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SprayPaintItem), "TrySpraying")] public static bool TrySpraying(SprayPaintItem __instance, ref bool __result, ref RaycastHit ___sprayHit, ref float ___sprayCanShakeMeter) { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) SprayPaintItemExt sprayPaintItemExt = __instance.Ext(); Vector3 position = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position; Vector3 forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward; sprayPaintItemExt.UpdateParticles(); if (SessionData.AllowErasing && sprayPaintItemExt.IsErasing) { if (EraseSprayPaintLocal(__instance, position, forward, out var sprayHit)) { __result = true; sprayPaintItemExt.EraseServerRpc(((RaycastHit)(ref sprayHit)).point); } return false; } if (AddSprayPaintLocal(__instance, position, forward)) { __result = true; sprayPaintItemExt.SprayServerRpc(position, forward); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SprayPaintItem), "ItemActivate")] public static void ItemActivate(SprayPaintItem __instance) { __instance.Ext().UpdateParticles(); } public static bool RaycastSkipPlayer(Ray ray, out RaycastHit sprayHit, float _distance, int layerMask, QueryTriggerInteraction _queryTriggerInteraction, SprayPaintItem __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; GameObject val = ((playerHeldBy != null) ? ((Component)playerHeldBy).gameObject : null); if ((Object)(object)val == (Object)null) { ManualLogSource log = Plugin.log; if (log != null) { log.LogWarning((object)"Player GameObject is null"); } } bool result = false; RaycastHit val2 = default(RaycastHit); float num = SessionData.Range + 1f; RaycastHit[] array = Physics.RaycastAll(ray, SessionData.Range, layerMask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (((Object)(object)val == (Object)null || !((RaycastHit)(ref val3)).transform.IsChildOf(val.transform)) && ((RaycastHit)(ref val3)).distance < num) { num = ((RaycastHit)(ref val3)).distance; val2 = val3; result = true; } } sprayHit = val2; return result; } [HarmonyTranspiler] [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] private static IEnumerable<CodeInstruction> transpiler_AddSprayPaintLocal(IEnumerable<CodeInstruction> instructions) { bool foundMinNextDecalDistance = false; bool foundRaycastCall = false; foreach (CodeInstruction instruction in instructions) { if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f) { foundMinNextDecalDistance = true; yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f); } else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast) { foundRaycastCall = true; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)raycastSkipPlayer); } else { yield return instruction; } } } public static float TankCapacity() { if (SessionData.InfiniteTank) { return 25f; } return SessionData.TankCapacity; } [HarmonyTranspiler] [HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")] private static IEnumerable<CodeInstruction> transpiler_LateUpdate(IEnumerable<CodeInstruction> instructions) { bool foundTankCapacityDivisor = false; foreach (CodeInstruction instruction in instructions) { if (!foundTankCapacityDivisor && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 25f) { foundTankCapacityDivisor = true; yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("TankCapacity")); } else { yield return instruction; } } } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(PlayerControllerB), "CanUseItem")] public static bool CanUseItem(object instance) { throw new NotImplementedException("stub"); } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] public static bool _AddSprayPaintLocal(object instance, Vector3 sprayPos, Vector3 sprayRot) { Transpiler(null); return false; static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { bool foundMinNextDecalDistance = false; bool foundRaycastCall = false; foreach (CodeInstruction instruction in instructions) { if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f) { foundMinNextDecalDistance = true; yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f); } else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast) { foundRaycastCall = true; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)raycastSkipPlayer); } else { yield return instruction; } } } } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(SprayPaintItem), "PlayCanEmptyEffect")] public static void PlayCanEmptyEffect(object instance, bool isEmpty) { throw new NotImplementedException("stub"); } public static bool AddSprayPaintLocal(SprayPaintItem instance, Vector3 sprayPos, Vector3 sprayRot) { //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_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_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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) bool num = _AddSprayPaintLocal(instance, sprayPos, sprayRot); if (num && SprayPaintItem.sprayPaintDecals.Count > SprayPaintItem.sprayPaintDecalsIndex) { GameObject val = SprayPaintItem.sprayPaintDecals[SprayPaintItem.sprayPaintDecalsIndex]; RaycastHit value = Traverse.Create((object)instance).Field<RaycastHit>("sprayHit").Value; val.transform.forward = -((RaycastHit)(ref value)).normal; if (((Component)((RaycastHit)(ref value)).collider).gameObject.layer == 11 || ((Component)((RaycastHit)(ref value)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref value)).collider).gameObject.layer == 0) { if (((Component)((RaycastHit)(ref value)).collider).transform.IsChildOf(StartOfRound.Instance.elevatorTransform) || (Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null) { val.transform.SetParent(StartOfRound.Instance.elevatorTransform, true); } else { val.transform.SetParent(RoundManager.Instance.mapPropsContainer.transform, true); } } DecalProjector component = val.GetComponent<DecalProjector>(); ((Behaviour)component).enabled = true; SprayPaintItemExt sprayPaintItemExt = instance.Ext(); component.drawDistance = Plugin.DrawDistance; component.material = sprayPaintItemExt.DecalMaterialForColor(sprayPaintItemExt.CurrentColor); component.scaleMode = (DecalScaleMode)1; val.transform.localScale = new Vector3(sprayPaintItemExt.PaintSize, sprayPaintItemExt.PaintSize, 1f); } return num; } public static float _shakeRestoreAmount() { return SessionData.ShakeEfficiency; } [HarmonyTranspiler] [HarmonyPatch(typeof(SprayPaintItem), "ItemInteractLeftRight")] private static IEnumerable<CodeInstruction> transpiler_ItemInteractLeftRight(IEnumerable<CodeInstruction> instructions) { bool foundShakeRestoreAmount = false; foreach (CodeInstruction instruction in instructions) { if (!foundShakeRestoreAmount && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.15f) { foundShakeRestoreAmount = true; yield return new CodeInstruction(OpCodes.Call, (object)typeof(Patches).GetMethod("_shakeRestoreAmount")); } else { yield return instruction; } } } } public class PlayerExt : NetworkBehaviour { internal NetworkVariable<float> paintSize; internal NetVar<float> PaintSize; private INetVar[] netVars = Array.Empty<INetVar>(); public PlayerControllerB instance => ((Component)this).GetComponent<PlayerControllerB>(); [ServerRpc(RequireOwnership = false)] private void SetPaintSizeServerRpc(float value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2568753563u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2568753563u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PaintSize.ServerSet(value); } } } private PlayerExt() { PaintSize = new NetVar<float>(out paintSize, SetPaintSizeServerRpc, () => instance.IsLocalPlayer(), 1f, null, null, null, (float value) => Mathf.Clamp(value, 0.1f, SessionData.MaxSize)); netVars = (from field in typeof(PlayerExt).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where typeof(INetVar).IsAssignableFrom(field.FieldType) select (INetVar)field.GetValue(this)).ToArray(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); } private void Update() { INetVar[] array = netVars; for (int i = 0; i < array.Length; i++) { array[i].Synchronize(); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); INetVar[] array = netVars; for (int i = 0; i < array.Length; i++) { array[i].Dispose(); } } protected override void __initializeVariables() { if (paintSize == null) { throw new Exception("PlayerExt.paintSize cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)paintSize).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)paintSize, "paintSize"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)paintSize); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PlayerExt() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2568753563u, new RpcReceiveHandler(__rpc_handler_2568753563)); } private static void __rpc_handler_2568753563(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float paintSizeServerRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref paintSizeServerRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PlayerExt)(object)target).SetPaintSizeServerRpc(paintSizeServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PlayerExt"; } } [BepInPlugin("taffyko.BetterSprayPaint", "BetterSprayPaint", "2.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private delegate bool ParseConfigValue<T>(string input, out T output); public const string modGUID = "taffyko.BetterSprayPaint"; public const string modName = "BetterSprayPaint"; public const string modVersion = "2.0.2"; internal static Harmony harmony; internal static ManualLogSource log; internal static List<Action> cleanupActions; internal static PluginInputActions inputActions; internal static GameObject? prefabContainer; public static bool AllowErasing { get; private set; } public static bool AllowColorChange { get; private set; } public static bool InfiniteTank { get; private set; } public static float TankCapacity { get; private set; } public static float ShakeEfficiency { get; private set; } public static bool ShakingNotNeeded { get; private set; } public static float Volume { get; private set; } public static float MaxSize { get; private set; } public static float Range { get; private set; } public static bool ShorterShakeAnimation { get; private set; } public static int MaxSprayPaintDecals { get; private set; } public static float DrawDistance { get; private set; } private static List<(Type custom, Type native)> BehaviourBindings { get; } static Plugin() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown harmony = new Harmony("taffyko.BetterSprayPaint"); cleanupActions = new List<Action>(); inputActions = new PluginInputActions(); prefabContainer = null; BehaviourBindings = new List<(Type, Type)>(); log = Logger.CreateLogSource("BetterSprayPaint"); } private void Awake() { log.LogInfo((object)"Loading taffyko.BetterSprayPaint"); ConfigInit(); harmony.PatchAll(Assembly.GetExecutingAssembly()); } private void OnDestroy() { } private void ConfigInit() { ((BaseUnityPlugin)this).Config.Bind<string>("README", "README", "", "All config values are text-based, as a workaround to make it possible for default values to change in future updates.\r\n\r\nSee https://github.com/taffyko/LCNiceChat/issues/3 for more information.\r\n\r\nIf you enter an invalid value, it will change back to \"default\" when the game starts."); ConfEntry("General", "AllowErasing", defaultValue: true, "When enabled, players can erase spray paint. (Note: With default controls, erasing is done by holding E and LMB at the same time)", bool.TryParse, hostControlled: true); ConfEntry("General", "AllowColorChange", defaultValue: true, "When enabled, players can control the color of their spray paint.", bool.TryParse, hostControlled: true); ConfEntry("General", "InfiniteTank", defaultValue: true, "When enabled, the spray can has infinite uses.", bool.TryParse, hostControlled: true); ConfEntry("General", "TankCapacity", 25f, "Amount of time (in seconds) that each can may spray for before running out (Has no effect when InfiniteTank is enabled.)", float.TryParse, hostControlled: true, 25f); ConfEntry("General", "ShakeEfficiency", 0.3f, "The percentage to restore on the \"shake meter\" each time the can is shaken.", float.TryParse, hostControlled: true, 0.15f); ConfEntry("General", "ShakingNotNeeded", defaultValue: false, "When enabled, the can never needs to be shaken.", bool.TryParse, hostControlled: true); ConfEntry("General", "MaxSize", 2f, "The maximum size of spray paint that players are allowed to create.", float.TryParse, hostControlled: true); ConfEntry("General", "Range", 6f, "The maximum distance that players can spray.", float.TryParse, hostControlled: true); ConfEntry("Client-side", "Volume", 0.1f, "Volume of spray paint sound effects.", float.TryParse, hostControlled: false, 1f); ConfEntry("Client-side", "ShorterShakeAnimation", defaultValue: true, "Whether to shorten the can-shaking animation.", bool.TryParse); ConfEntry("Client-side", "MaxSprayPaintDecals", 4000, "The maximum amount of spray paint decals that can exist at once. When the limit is reached, spray paint decals will start to disappear, starting with the oldest.", int.TryParse, hostControlled: false, 1000); ConfEntry("Client-side", "DrawDistance", 35f, "The maximum distance from which spray paint decals can be seen (Only applies to new spray paint drawn after the setting was changed, if changed mid-game)", float.TryParse, hostControlled: false, 20f); } private void ConfEntry<T>(string category, string name, T defaultValue, string description, ParseConfigValue<T> tryParse, bool hostControlled = false, T? vanillaValue = null) where T : struct { ParseConfigValue<T> tryParse2 = tryParse; PropertyInfo property = typeof(Plugin).GetProperty(name); bool flag = typeof(T) == typeof(float); string text = (flag ? $"{defaultValue:0.0#####}" : defaultValue.ToString()); string text2 = "[default: " + text + "]\n" + description; text2 += (hostControlled ? "\n(This setting is overridden by the lobby host)" : "\n(This setting's effect applies to you only)"); if (vanillaValue.HasValue) { string text3 = (flag ? $"{vanillaValue:0.0#####}" : vanillaValue.ToString()); text2 = text2 + "\n(The original value of this setting in the base-game is " + text3 + ")"; } ConfigEntry<string> config = ((BaseUnityPlugin)this).Config.Bind<string>(category, name, "default", text2); if (string.IsNullOrEmpty(config.Value)) { config.Value = "default"; } T output; bool flag2 = tryParse2(config.Value, out output) && config.Value != "default"; property.SetValue(null, flag2 ? output : defaultValue); if (!flag2) { config.Value = "default"; } EventHandler loadConfig = delegate { T output2; bool flag3 = tryParse2(config.Value, out output2) && config.Value != "default"; property.SetValue(null, flag3 ? output2 : defaultValue); }; config.SettingChanged += loadConfig; cleanupActions.Add(delegate { config.SettingChanged -= loadConfig; property.SetValue(null, defaultValue); }); } internal static void RegisterPrefab<T>(GameObject prefab) where T : MonoBehaviour { GameObject prefab2 = prefab; prefab2.AddComponent<T>(); ((Object)prefab2).hideFlags = (HideFlags)61; prefab2.transform.SetParent(prefabContainer.transform); prefab2.AddComponent<NetworkObject>(); NetworkManager.Singleton.AddNetworkPrefab(prefab2); cleanupActions.Add(delegate { MonoBehaviour[] array = (MonoBehaviour[])(object)Resources.FindObjectsOfTypeAll<T>(); array = array; foreach (MonoBehaviour obj in array) { NetworkManager.Singleton.RemoveNetworkPrefab(prefab2); Object.Destroy((Object)(object)((Component)obj).gameObject); } }); } internal static void RegisterScriptWithExistingPrefab<TCustomBehaviour, TNativeBehaviour>() where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) TNativeBehaviour[] array = Resources.FindObjectsOfTypeAll<TNativeBehaviour>(); foreach (TNativeBehaviour val in array) { Scene scene = ((Component)(object)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { NetworkPrefabs prefabs = NetworkManager.Singleton.NetworkConfig.Prefabs; NetworkObject networkObject = ((Component)(object)val).gameObject.GetComponent<NetworkObject>(); NetworkPrefab val2 = prefabs.m_Prefabs.Find((NetworkPrefab p) => p.SourcePrefabGlobalObjectIdHash == networkObject.GlobalObjectIdHash); foreach (NetworkPrefabsList networkPrefabsList in prefabs.NetworkPrefabsLists) { networkPrefabsList.Remove(val2); } NetworkManager.Singleton.RemoveNetworkPrefab(((Component)(object)val).gameObject); if (val2 != null) { _ = val2.SourcePrefabGlobalObjectIdHash; prefabs.NetworkPrefabOverrideLinks.Remove(val2.SourcePrefabGlobalObjectIdHash); } if (val2 != null) { _ = val2.TargetPrefabGlobalObjectIdHash; prefabs.OverrideToNetworkPrefab.Remove(val2.TargetPrefabGlobalObjectIdHash); } } ((NetworkBehaviour)(object)((Component)(object)val).gameObject.AddComponent<TCustomBehaviour>()).SyncWithNetworkObject(((Component)(object)val).gameObject.GetComponent<NetworkObject>()); scene = ((Component)(object)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { NetworkManager.Singleton.AddNetworkPrefab(((Component)(object)val).gameObject); } } cleanupActions.Add(delegate { TNativeBehaviour[] array2 = Resources.FindObjectsOfTypeAll<TNativeBehaviour>(); for (int j = 0; j < array2.Length; j++) { Object.Destroy((Object)(object)((Component)(object)array2[j]).gameObject.GetComponent<TCustomBehaviour>()); } }); BindToPreExistingObjectByBehaviourPatch<TCustomBehaviour, TNativeBehaviour>(); } private static void RegisterCustomScripts() { Plugin.RegisterPrefab<SessionData>(SessionData.prefab); NetworkManager.Singleton.OnServerStarted += SessionData.ServerSpawn; cleanupActions.Add(delegate { NetworkManager.Singleton.OnServerStarted -= SessionData.ServerSpawn; }); NetworkManager.Singleton.OnClientStopped += SessionData.Despawn; cleanupActions.Add(delegate { NetworkManager.Singleton.OnClientStopped -= SessionData.Despawn; }); Plugin.RegisterScriptWithExistingPrefab<SprayPaintItemExt, SprayPaintItem>(); Plugin.RegisterScriptWithExistingPrefab<PlayerExt, PlayerControllerB>(); } public static void BindToPreExistingObjectByBehaviourPatch<TCustomBehaviour, TNativeBehaviour>() where TCustomBehaviour : NetworkBehaviour where TNativeBehaviour : NetworkBehaviour { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown Type typeFromHandle = typeof(TCustomBehaviour); Type typeFromHandle2 = typeof(TNativeBehaviour); BehaviourBindings.Add((typeFromHandle, typeFromHandle2)); MethodBase methodBase = AccessTools.Method(typeFromHandle2, "Awake", (Type[])null, (Type[])null); if (methodBase != null) { HarmonyMethod val = new HarmonyMethod(typeof(Plugin), "BindBehaviourOnAwake", (Type[])null); harmony.Patch(methodBase, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } internal static void BindBehaviourOnAwake(NetworkBehaviour __instance, MethodBase __originalMethod) { MethodBase __originalMethod2 = __originalMethod; Type type = ((object)__instance).GetType(); Component val = default(Component); foreach (var item in BehaviourBindings.Where<(Type, Type)>(((Type custom, Type native) obj) => obj.native == __originalMethod2.DeclaringType || type == obj.native)) { if (!((Component)__instance).gameObject.TryGetComponent(item.Item1, ref val)) { Component obj2 = ((Component)__instance).gameObject.AddComponent(item.Item1); ((NetworkBehaviour)(object)((obj2 is NetworkBehaviour) ? obj2 : null)).SyncWithNetworkObject(((Component)__instance).gameObject.GetComponent<NetworkObject>()); } } } internal static void NetcodeInit() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if ((Object)(object)prefabContainer != (Object)null) { throw new Exception("Ran NetcodeInit() more than once"); } prefabContainer = new GameObject(); prefabContainer.SetActive(false); ((Object)prefabContainer).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)prefabContainer); RegisterCustomScripts(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } private static GameObject? FindBuiltinPrefabByScript<T>() where T : MonoBehaviour { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) GameObject result = null; T[] array = Resources.FindObjectsOfTypeAll<T>(); foreach (T val in array) { Scene scene = ((Component)(object)val).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { result = ((Component)(object)val).gameObject; break; } } return result; } private static void NetcodeUnload() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown foreach (Transform item in prefabContainer.transform) { Transform val = item; NetworkManager.Singleton.RemoveNetworkPrefab(((Component)val).gameObject); Object.Destroy((Object)(object)((Component)val).gameObject); } Object.Destroy((Object)(object)prefabContainer); } } public class PluginInputActions : LcInputActions { [InputAction("<Keyboard>/e", Name = "Spray Paint Erase Modifier", ActionId = "SprayPaintEraseModifier", GamepadPath = "<Gamepad>/dpad/up")] public InputAction? SprayPaintEraseModifier { get; set; } [InputAction("", Name = "Spray Paint Erase", ActionId = "SprayPaintErase")] public InputAction? SprayPaintErase { get; set; } [InputAction("<Keyboard>/t", Name = "Spray Paint Next Color", ActionId = "SprayPaintNextColor")] public InputAction? SprayPaintNextColor { get; set; } [InputAction("", Name = "Spray Paint Previous Color", ActionId = "SprayPaintPreviousColor")] public InputAction? SprayPaintPreviousColor { get; set; } [InputAction("", Name = "Spray Paint Color 1", ActionId = "SprayPaintColor1")] public InputAction? SprayPaintColor1 { get; set; } [InputAction("", Name = "Spray Paint Color 2", ActionId = "SprayPaintColor2")] public InputAction? SprayPaintColor2 { get; set; } [InputAction("", Name = "Spray Paint Color 3", ActionId = "SprayPaintColor3")] public InputAction? SprayPaintColor3 { get; set; } [InputAction("", Name = "Spray Paint Color 4", ActionId = "SprayPaintColor4")] public InputAction? SprayPaintColor4 { get; set; } [InputAction("<Keyboard>/equals", Name = "Spray Paint Increase Size", ActionId = "SprayPaintIncreaseSize")] public InputAction? SprayPaintIncreaseSize { get; set; } [InputAction("<Keyboard>/minus", Name = "Spray Paint Decrease Size", ActionId = "SprayPaintDecreaseSize")] public InputAction? SprayPaintDecreaseSize { get; set; } [InputAction("", Name = "Spray Paint Set Size 0.1", ActionId = "SprayPaintSize01")] public InputAction? SprayPaintSize01 { get; set; } [InputAction("", Name = "Spray Paint Set Size 1.0", ActionId = "SprayPaintSize1")] public InputAction? SprayPaintSize1 { get; set; } [InputAction("", Name = "Spray Paint Set Size 2.0", ActionId = "SprayPaintSize2")] public InputAction? SprayPaintSize2 { get; set; } } public class ActionSubscriptionBuilder { public List<Action> cleanupActions; public Func<bool> active; public ActionSubscriptionBuilder(List<Action> cleanupActions, Func<bool> active) { this.cleanupActions = cleanupActions; this.active = active; base..ctor(); } public void Subscribe(InputAction? action, EventHandler<CallbackContext> onStart, EventHandler<CallbackContext>? onStop = null) { EventHandler<CallbackContext> onStart2 = onStart; EventHandler<CallbackContext> onStop2 = onStop; Subscribe(action, delegate(object sender, CallbackContext e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) onStart2(sender, e); return null; }, (onStop2 == null) ? null : ((Action<object, CallbackContext, object>)delegate(object sender, CallbackContext e, object? ret) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) onStop2(sender, e); })); } public void Subscribe<T>(InputAction? action, Func<object, CallbackContext, T> onStart, Action<object, CallbackContext, T?>? onStop = null) { Func<object, CallbackContext, T> onStart2 = onStart; Action<object, CallbackContext, T?> onStop2 = onStop; InputAction action2 = action; if (action2 == null) { Plugin.log.LogWarning((object)"Subscribe called with null InputAction"); return; } EventInfo startedEvent = typeof(InputAction).GetEvent("started"); EventInfo canceledEvent = typeof(InputAction).GetEvent("canceled"); T ret = default(T); bool actionHeld = false; Action<CallbackContext> startHandler = delegate(CallbackContext e) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (active()) { actionHeld = true; ret = onStart2(this, e); } }; Action<CallbackContext> cancelHandler = delegate(CallbackContext e) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (actionHeld && onStop2 != null) { onStop2(this, e, ret); actionHeld = false; } }; startedEvent.AddEventHandler(action2, startHandler); cleanupActions.Add(delegate { startedEvent.RemoveEventHandler(action2, startHandler); }); canceledEvent.AddEventHandler(action2, cancelHandler); cleanupActions.Add(delegate { canceledEvent.RemoveEventHandler(action2, cancelHandler); }); } } internal interface INetVar : IDisposable { void Synchronize(); } internal class NetVar<T> : INetVar, IDisposable where T : IEquatable<T> { public readonly NetworkVariable<T> networkVariable; private bool deferPending = true; private T deferredValue; private T _localValue; private readonly bool isGlued; private readonly Action<T>? setGlued; private readonly Func<T>? getGlued; private readonly Func<T, T>? validate; private readonly Func<bool> inControl; private readonly Action<T> SetOnServer; private readonly OnValueChangedDelegate<T>? onChange; private T localValue { get { return _localValue; } set { if (isGlued) { setGlued(value); } _localValue = value; } } public T Value { get { Synchronize(); return localValue; } set { if (inControl()) { deferPending = false; if (validate != null) { value = validate(value); } if (!EqualityComparer<T>.Default.Equals(localValue, value)) { T prevValue = localValue; localValue = value; SetOnServer(value); OnChange(prevValue, value); } } } } public NetVar(out NetworkVariable<T> networkVariable, Action<T> SetOnServer, Func<bool> inControl, T initialValue = default(T), OnValueChangedDelegate<T>? onChange = null, Action<T>? setGlued = null, Func<T>? getGlued = null, Func<T, T>? validate = null) { isGlued = setGlued != null && getGlued != null; this.setGlued = setGlued; this.getGlued = getGlued; this.validate = validate; this.onChange = onChange; this.SetOnServer = SetOnServer; this.inControl = inControl; this.networkVariable = new NetworkVariable<T>(initialValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); networkVariable = this.networkVariable; _localValue = initialValue; localValue = initialValue; deferredValue = initialValue; NetworkVariable<T> obj = networkVariable; obj.OnValueChanged = (OnValueChangedDelegate<T>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)(OnValueChangedDelegate<T>)delegate(T prevValue, T currentValue) { if (!EqualityComparer<T>.Default.Equals(localValue, currentValue)) { Synchronize(); OnChange(prevValue, currentValue); } }); } public void ServerSet(T value) { if (validate != null) { value = validate(value); } networkVariable.Value = value; } public void SetDeferred(T value) { deferredValue = value; } private void OnChange(T prevValue, T currentValue) { if (onChange != null) { onChange.Invoke(prevValue, currentValue); } } public void UpdateDeferred() { if (inControl() && deferPending) { Value = deferredValue; } deferPending = false; } public void Synchronize() { if (!inControl()) { localValue = networkVariable.Value; deferPending = false; } else if (isGlued) { Value = getGlued(); } else { Value = localValue; } } public void Dispose() { ((NetworkVariableBase)networkVariable).Dispose(); } } [HarmonyPatch] internal class NetcodeInitPatch { private static bool loaded; [HarmonyPrefix] [HarmonyPatch(typeof(MenuManager), "Update")] public static void MenuUpdate(PreInitSceneScript __instance) { if (!loaded && (Object)(object)NetworkManager.Singleton != (Object)null) { if ((Object)(object)Plugin.prefabContainer == (Object)null) { Plugin.NetcodeInit(); } loaded = true; } } } public class SessionData : NetworkBehaviour { internal static GameObject prefab = new GameObject("SessionData"); internal static SessionData? instance = null; private NetworkVariable<bool> allowColorChange = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<bool> allowErasing = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<bool> infiniteTank = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> tankCapacity = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> shakeEfficiency = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<bool> shakingNotNeeded = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> range = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private NetworkVariable<float> maxSize = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static bool AllowColorChange => instance?.allowColorChange?.Value ?? Plugin.AllowColorChange; public static bool AllowErasing => instance?.allowErasing?.Value ?? Plugin.AllowErasing; public static bool InfiniteTank => instance?.infiniteTank?.Value ?? Plugin.InfiniteTank; public static float TankCapacity => instance?.tankCapacity?.Value ?? Plugin.TankCapacity; public static float ShakeEfficiency => instance?.shakeEfficiency?.Value ?? Plugin.ShakeEfficiency; public static bool ShakingNotNeeded => instance?.shakingNotNeeded?.Value ?? Plugin.ShakingNotNeeded; public static float Range => instance?.range?.Value ?? Plugin.Range; public static float MaxSize => instance?.maxSize?.Value ?? Plugin.MaxSize; public override void OnNetworkSpawn() { instance = ((Component)this).GetComponent<SessionData>(); } public override void OnDestroy() { instance = null; } internal static void ServerSpawn() { if (NetworkManager.Singleton.IsServer && (Object)(object)instance == (Object)null) { Object.Instantiate<GameObject>(prefab).GetComponent<NetworkObject>().Spawn(false); } } internal static void Despawn(bool _) { SessionData? sessionData = instance; Object.Destroy((Object)(object)((sessionData != null) ? ((Component)sessionData).gameObject : null)); } public void Update() { if (((NetworkBehaviour)this).IsServer) { allowErasing.Value = Plugin.AllowErasing; allowColorChange.Value = Plugin.AllowColorChange; infiniteTank.Value = Plugin.InfiniteTank; tankCapacity.Value = Plugin.TankCapacity; shakeEfficiency.Value = Plugin.ShakeEfficiency; shakingNotNeeded.Value = Plugin.ShakingNotNeeded; range.Value = Plugin.Range; maxSize.Value = Plugin.MaxSize; } } protected override void __initializeVariables() { if (allowColorChange == null) { throw new Exception("SessionData.allowColorChange cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)allowColorChange).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)allowColorChange, "allowColorChange"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)allowColorChange); if (allowErasing == null) { throw new Exception("SessionData.allowErasing cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)allowErasing).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)allowErasing, "allowErasing"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)allowErasing); if (infiniteTank == null) { throw new Exception("SessionData.infiniteTank cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)infiniteTank).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)infiniteTank, "infiniteTank"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)infiniteTank); if (tankCapacity == null) { throw new Exception("SessionData.tankCapacity cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)tankCapacity).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)tankCapacity, "tankCapacity"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)tankCapacity); if (shakeEfficiency == null) { throw new Exception("SessionData.shakeEfficiency cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)shakeEfficiency).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shakeEfficiency, "shakeEfficiency"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)shakeEfficiency); if (shakingNotNeeded == null) { throw new Exception("SessionData.shakingNotNeeded cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)shakingNotNeeded).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)shakingNotNeeded, "shakingNotNeeded"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)shakingNotNeeded); if (range == null) { throw new Exception("SessionData.range cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)range).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)range, "range"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)range); if (maxSize == null) { throw new Exception("SessionData.maxSize cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)maxSize).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)maxSize, "maxSize"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)maxSize); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "SessionData"; } } public class SprayPaintItemExt : NetworkBehaviour { private NetworkVariable<bool> _isErasing = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool _localIsErasing; public NetworkVariable<float> ShakeMeter = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<Color> _currentColor = new NetworkVariable<Color>(default(Color), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Color _localCurrentColor; public NetworkVariable<NetworkObjectReference> PlayerHeldBy = new NetworkVariable<NetworkObjectReference>(default(NetworkObjectReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public int sprayPaintMask; public Material? baseParticleMaterial; public Material? sprayEraseParticleMaterial; public Material? baseDecalMaterial; public ParticleSystem? sprayCanColorChangeParticle; private List<Action> cleanupActions = new List<Action>(); public static Dictionary<Color, WeakReference<Material>> AllDecalMaterials = new Dictionary<Color, WeakReference<Material>>(); public static Dictionary<Color, WeakReference<Material>> AllParticleMaterials = new Dictionary<Color, WeakReference<Material>>(); public List<Color> ColorPalette = new List<Color>(); private SprayPaintItem instance => ((Component)this).GetComponent<SprayPaintItem>(); public bool HeldByLocalPlayer => ((GrabbableObject)instance).playerHeldBy.IsLocalPlayer(); public bool InActiveSlot { get { if ((Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null) { return (Object)(object)((GrabbableObject)instance).playerHeldBy.ItemSlots[((GrabbableObject)instance).playerHeldBy.currentItemSlot] == (Object)(object)instance; } return false; } } private static SessionData sessionData => SessionData.instance; public bool IsErasing { get { if (!HeldByLocalPlayer) { return _isErasing.Value; } return _localIsErasing; } set { if (_localIsErasing != value) { _localIsErasing = value; ToggleErasingServerRpc(value); } } } public float PaintSize { get { return ((GrabbableObject)instance).playerHeldBy?.Ext()?.PaintSize.Value ?? 1f; } set { ((GrabbableObject)instance).playerHeldBy.Ext().PaintSize.Value = value; } } public Color CurrentColor { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!HeldByLocalPlayer) { return _currentColor.Value; } return _localCurrentColor; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (_localCurrentColor != value) { _localCurrentColor = value; SetCurrentColorServerRpc(value); } } } [ServerRpc(RequireOwnership = false)] public void ToggleErasingServerRpc(bool active) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(781929866u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 781929866u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _isErasing.Value = active; } } } public void OnChangeErasing(bool previous, bool current) { if (!HeldByLocalPlayer) { UpdateParticles(); } } [ServerRpc(RequireOwnership = false)] public void SetCurrentColorServerRpc(Color color) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(523598528u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref color); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 523598528u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { _currentColor.Value = color; } } } [ServerRpc(RequireOwnership = false)] public void SetPlayerHeldByServerRpc(NetworkObjectReference playerRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1536704001u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1536704001u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); PlayerControllerB val4 = default(PlayerControllerB); if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<PlayerControllerB>(ref val4)) { PlayerHeldBy.Value = playerRef; } } } public int posmod(int n, int d) { return (n % d + d) % d; } public Material DecalMaterialForColor(Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (AllDecalMaterials.TryGetValue(color, out WeakReference<Material> value) && value.TryGetTarget(out var target) && (Object)(object)target != (Object)null && target.color == color) { return target; } target = new Material(baseDecalMaterial) { color = color }; AllDecalMaterials[color] = new WeakReference<Material>(target); return target; } public Material ParticleMaterialForColor(Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (AllParticleMaterials.TryGetValue(color, out WeakReference<Material> value) && value.TryGetTarget(out var target)) { return target; } target = new Material(baseParticleMaterial) { color = color }; AllParticleMaterials[color] = new WeakReference<Material>(target); return target; } public override void OnNetworkSpawn() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00d0: 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_0134: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); sprayPaintMask = Traverse.Create((object)instance).Field("sprayPaintMask").GetValue<int>(); int value = Traverse.Create((object)instance).Field<int>("sprayCanMatsIndex").Value; baseParticleMaterial = instance.particleMats[value]; baseDecalMaterial = instance.sprayCanMats[value]; if (((NetworkBehaviour)this).IsServer) { Random random = new Random(); Material val = instance.sprayCanMats[random.Next(instance.sprayCanMats.Length)]; CurrentColor = val.color; } sprayEraseParticleMaterial = new Material(baseParticleMaterial); sprayEraseParticleMaterial.color = new Color(0.5f, 0.5f, 0.5f, 1f); ColorPalette = instance.sprayCanMats.Select((Material mat) => mat.color).ToList(); Material[] sprayCanMats = instance.sprayCanMats; foreach (Material val2 in sprayCanMats) { AllDecalMaterials[val2.color] = new WeakReference<Material>(val2); } sprayCanMats = instance.particleMats; foreach (Material val3 in sprayCanMats) { AllParticleMaterials[val3.color] = new WeakReference<Material>(val3); } GameObject val4 = Object.Instantiate<GameObject>(((Component)instance.sprayCanNeedsShakingParticle).gameObject); ((Object)val4).name = "ColorChangeParticle"; sprayCanColorChangeParticle = val4.GetComponent<ParticleSystem>(); ((Component)sprayCanColorChangeParticle).transform.SetParent(((Component)instance).transform, false); MainModule main = sprayCanColorChangeParticle.main; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).startSpeedMultiplier = 2f; ((MainModule)(ref main)).startLifetimeMultiplier = 0.1f; EmissionModule emission = sprayCanColorChangeParticle.emission; ((EmissionModule)(ref emission)).rateOverTimeMultiplier = 100f; ShapeModule shape = sprayCanColorChangeParticle.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ActionSubscriptionBuilder actionSubscriptionBuilder = new ActionSubscriptionBuilder(cleanupActions, () => HeldByLocalPlayer && InActiveSlot && Patches.CanUseItem(((GrabbableObject)instance).playerHeldBy)); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintEraseModifier, delegate { if (SessionData.AllowErasing) { IsErasing = true; } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintErase, delegate { if (SessionData.AllowErasing) { IsErasing = true; } ((GrabbableObject)instance).UseItemOnClient(true); }, delegate { ((GrabbableObject)instance).UseItemOnClient(false); }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintNextColor, delegate { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int num2 = ColorPalette.FindIndex((Color color) => color == CurrentColor); num2 = posmod(++num2, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[num2])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintPreviousColor, delegate { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int num = ColorPalette.FindIndex((Color color) => color == CurrentColor); num = posmod(--num, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[num])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor1, delegate { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int index4 = posmod(0, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[index4])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor2, delegate { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int index3 = posmod(1, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[index3])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor3, delegate { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int index2 = posmod(2, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[index2])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintColor4, delegate { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (SessionData.AllowColorChange) { int index = posmod(3, ColorPalette.Count); ((MonoBehaviour)this).StartCoroutine(ChangeColorCoroutine(ColorPalette[index])); } }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintIncreaseSize, (object _, CallbackContext _) => ((MonoBehaviour)this).StartCoroutine(ChangeSizeCoroutine()), delegate(object _, CallbackContext _, Coroutine? coroutine) { ((MonoBehaviour)this).StopCoroutine(coroutine); }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintDecreaseSize, (object _, CallbackContext _) => ((MonoBehaviour)this).StartCoroutine(ChangeSizeCoroutine()), delegate(object _, CallbackContext _, Coroutine? coroutine) { ((MonoBehaviour)this).StopCoroutine(coroutine); }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize01, delegate { PaintSize = 0.1f; }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize1, delegate { PaintSize = 1f; }); actionSubscriptionBuilder.Subscribe(Plugin.inputActions.SprayPaintSize2, delegate { PaintSize = 2f; }); NetworkVariable<bool> isErasing = _isErasing; isErasing.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isErasing.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnChangeErasing)); } private IEnumerator ChangeColorCoroutine(Color color) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) CurrentColor = color; UpdateParticles(); if (Traverse.Create((object)instance).Field("sprayCanTank").GetValue<float>() > 0f) { sprayCanColorChangeParticle.Play(); yield return (object)new WaitForSeconds(0.1f); sprayCanColorChangeParticle.Stop(); } } private IEnumerator ChangeSizeCoroutine() { bool increase = Plugin.inputActions.SprayPaintIncreaseSize.IsPressed(); bool decrease = Plugin.inputActions.SprayPaintDecreaseSize.IsPressed(); PaintSize += (increase ? 0.1f : (-0.1f)); yield return (object)new WaitForSeconds(0.1f); while (HeldByLocalPlayer && (increase || decrease)) { increase = Plugin.inputActions.SprayPaintIncreaseSize.IsPressed(); decrease = Plugin.inputActions.SprayPaintDecreaseSize.IsPressed(); PaintSize += (increase ? 0.1f : (-0.1f)); yield return (object)new WaitForSeconds(0.025f); } } public void UpdateParticles() { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) ShapeModule shape = instance.sprayParticle.shape; MainModule main = instance.sprayParticle.main; float num = Mathf.Min(1.5f, PaintSize); ((MainModule)(ref main)).startSizeMultiplier = 0.5f * num; ((ShapeModule)(ref shape)).scale = new Vector3(num, num, num); Material material = ParticleMaterialForColor(CurrentColor); ((Renderer)((Component)sprayCanColorChangeParticle).GetComponent<ParticleSystemRenderer>()).material = material; if (SessionData.AllowErasing && IsErasing) { Material material2 = sprayEraseParticleMaterial; ((Renderer)((Component)instance.sprayCanNeedsShakingParticle).GetComponent<ParticleSystemRenderer>()).material = material2; ((Renderer)((Component)instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = material2; ((ShapeModule)(ref shape)).angle = 5f; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(50f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.1f); } else { ((Renderer)((Component)instance.sprayCanNeedsShakingParticle).GetComponent<ParticleSystemRenderer>()).material = material; ((Renderer)((Component)instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = material; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(100f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.05f); ((ShapeModule)(ref shape)).angle = 0f; } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); NetworkVariable<bool> isErasing = _isErasing; isErasing.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isErasing.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnChangeErasing)); foreach (Action cleanupAction in cleanupActions) { cleanupAction(); } } public void Update() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (HeldByLocalPlayer && InActiveSlot) { UpdateTooltips(); } if (!HeldByLocalPlayer && _localCurrentColor != _currentColor.Value) { _localCurrentColor = _currentColor.Value; } if (!HeldByLocalPlayer && (Object)(object)((GrabbableObject)instance).playerHeldBy != (Object)null) { UpdateParticles(); } } public void UpdateTooltips() { if (HUDManager.Instance.controlTipLines.Length >= 4) { ((TMP_Text)HUDManager.Instance.controlTipLines[3]).text = $"Size : {PaintSize:0.0}"; } } [ServerRpc(RequireOwnership = false)] public void UpdateShakeMeterServerRpc(float shakeMeter) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2374845675u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref shakeMeter, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2374845675u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ShakeMeter.Value = shakeMeter; } } } [ServerRpc(RequireOwnership = false)] public void EraseServerRpc(Vector3 sprayPos, ServerRpcParams rpc = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(58454459u, rpc, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayPos); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 58454459u, rpc, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && SessionData.AllowErasing) { EraseClientRpc(sprayPos); } } } [ClientRpc] public void EraseClientRpc(Vector3 sprayPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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(3250670214u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref sprayPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3250670214u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && SessionData.AllowErasing && !HeldByLocalPlayer) { Patches.EraseSprayPaintAtPoint(instance, sprayPos); } } } [ServerRpc(RequireOwnership = false)] public void SprayServerRpc(Vector3 sprayPos, Vector3 sprayRot, ServerRpcParams rpc = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3380313119u, rpc, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayRot); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3380313119u, rpc, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SprayClientRpc(sprayPos, sprayRot); } } } [ClientRpc] public void SprayClientRpc(Vector3 sprayPos, Vector3 sprayRot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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(1505460458u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref sprayPos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref sprayRot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1505460458u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !HeldByLocalPlayer) { Patches.AddSprayPaintLocal(instance, sprayPos, sprayRot); } } } protected override void __initializeVariables() { if (_isErasing == null) { throw new Exception("SprayPaintItemExt._isErasing cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_isErasing).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isErasing, "_isErasing"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_isErasing); if (ShakeMeter == null) { throw new Exception("SprayPaintItemExt.ShakeMeter cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ShakeMeter).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ShakeMeter, "ShakeMeter"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ShakeMeter); if (_currentColor == null) { throw new Exception("SprayPaintItemExt._currentColor cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_currentColor).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_currentColor, "_currentColor"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_currentColor); if (PlayerHeldBy == null) { throw new Exception("SprayPaintItemExt.PlayerHeldBy cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)PlayerHeldBy).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)PlayerHeldBy, "PlayerHeldBy"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)PlayerHeldBy); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SprayPaintItemExt() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(781929866u, new RpcReceiveHandler(__rpc_handler_781929866)); NetworkManager.__rpc_func_table.Add(523598528u, new RpcReceiveHandler(__rpc_handler_523598528)); NetworkManager.__rpc_func_table.Add(1536704001u, new RpcReceiveHandler(__rpc_handler_1536704001)); NetworkManager.__rpc_func_table.Add(2374845675u, new RpcReceiveHandler(__rpc_handler_2374845675)); NetworkManager.__rpc_func_table.Add(58454459u, new RpcReceiveHandler(__rpc_handler_58454459)); NetworkManager.__rpc_func_table.Add(3250670214u, new RpcReceiveHandler(__rpc_handler_3250670214)); NetworkManager.__rpc_func_table.Add(3380313119u, new RpcReceiveHandler(__rpc_handler_3380313119)); NetworkManager.__rpc_func_table.Add(1505460458u, new RpcReceiveHandler(__rpc_handler_1505460458)); } private static void __rpc_handler_781929866(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).ToggleErasingServerRpc(active); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_523598528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color currentColorServerRpc = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref currentColorServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).SetCurrentColorServerRpc(currentColorServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1536704001(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference playerHeldByServerRpc = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerHeldByServerRpc, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).SetPlayerHeldByServerRpc(playerHeldByServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2374845675(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float shakeMeter = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref shakeMeter, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).UpdateShakeMeterServerRpc(shakeMeter); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_58454459(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 sprayPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayPos); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).EraseServerRpc(sprayPos, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3250670214(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 sprayPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayPos); target.__rpc_exec_stage = (__RpcExecStage)2; ((SprayPaintItemExt)(object)target).EraseClientRpc(sprayPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3380313119(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 sprayPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayPos); Vector3 sprayRot = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayRot); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((SprayPaintItemExt)(object)target).SprayServerRpc(sprayPos, sprayRot, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1505460458(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 sprayPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayPos); Vector3 sprayRot = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayRot); target.__rpc_exec_stage = (__RpcExecStage)2; ((SprayPaintItemExt)(object)target).SprayClientRpc(sprayPos, sprayRot); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SprayPaintItemExt"; } } public static class Utils { public static string GetPath(this Transform current) { if ((Object)(object)current.parent == (Object)null) { return "/" + ((Object)current).name; } return current.parent.GetPath() + "/" + ((Object)current).name; } public static bool IsLocalPlayer(this PlayerControllerB? player) { if ((Object)(object)player != (Object)null) { return (Object)(object)player == (Object)(object)StartOfRound.Instance?.localPlayerController; } return false; } public static SprayPaintItemExt Ext(this SprayPaintItem instance) { return ((Component)instance).GetComponent<SprayPaintItemExt>(); } public static PlayerExt? Ext(this PlayerControllerB? instance) { PlayerExt result = default(PlayerExt); if ((Object)(object)instance != (Object)null && ((Component)instance).TryGetComponent<PlayerExt>(ref result)) { return result; } return null; } public static void SyncWithNetworkObject(this NetworkBehaviour networkBehaviour, NetworkObject? networkObject) { networkObject = networkObject ?? networkBehaviour.NetworkObject; if (!networkObject.ChildNetworkBehaviours.Contains(networkBehaviour)) { networkObject.ChildNetworkBehaviours.Add(networkBehaviour); } networkBehaviour.UpdateNetworkProperties(); } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterSprayPaint"; public const string PLUGIN_NAME = "BetterSprayPaint"; public const string PLUGIN_VERSION = "2.0.2"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace BetterSprayPaint.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/plugins/BuyableShotgunShells.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgunShells")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+04f63d17d79539fa78b9ec2ebfd4ae2fb22ef878")] [assembly: AssemblyProduct("BuyableShotgunShells")] [assembly: AssemblyTitle("BuyableShotgunShells")] [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 BuyableShotgunShells { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgunShells", "Buyable Shotgun Shells", "1.1.0")] public class BuyableShotgunShells : BaseUnityPlugin { private const string modGUID = "MegaPiggy.BuyableShotgunShells"; private const string modName = "Buyable Shotgun Shells"; private const string modVersion = "1.1.0"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgunShells"); private static BuyableShotgunShells Instance; private static ConfigEntry<int> ShellPriceConfig; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public static List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public static Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("GunAmmo"))); public static Item ShotgunShellClone { get; private set; } public static GameObject ShotgunShellObjectClone { get; private set; } public static int ShellPrice => ShellPriceConfig.Value; private void Awake() { if ((Object)(object)Instance == (Object)null) { Object.DontDestroyOnLoad((Object)(object)this); Instance = this; } harmony.PatchAll(); ShellPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunShellPrice", 20, "Credits needed to buy shotgun shells"); SceneManager.sceneLoaded += OnSceneLoaded; ShotgunShellClone = MakeNonScrap(ShellPrice); AddToShop(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun Shells is loaded with version 1.1.0!"); } private static Item MakeNonScrap(int price) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).name = "Error"; val.itemName = "Error"; val.itemId = 6624; val.isScrap = false; val.creditsWorth = price; val.canBeGrabbedBeforeGameStart = true; val.automaticallySetUsingPower = false; val.batteryUsage = 300f; val.canBeInspected = false; val.isDefensiveWeapon = true; val.saveItemVariable = true; val.syncGrabFunction = false; val.twoHandedAnimation = true; val.verticalOffset = 0.25f; GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("Cube"); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); val3.transform.SetParent(val2.transform, false); ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterial.shader = Shader.Find("HDRP/Lit"); val2.AddComponent<BoxCollider>().size = Vector3.one * 2f; val2.AddComponent<AudioSource>(); PhysicsProp val4 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).itemProperties = val; ((GrabbableObject)val4).grabbable = true; val.spawnPrefab = val2; val2.tag = "PhysicsProp"; val2.layer = LayerMask.NameToLayer("Props"); val3.layer = LayerMask.NameToLayer("Props"); try { GameObject val5 = Object.Instantiate<GameObject>(Items.scanNodePrefab, val2.transform); ((Object)val5).name = "ScanNode"; val5.transform.localPosition = new Vector3(0f, 0f, 0f); Transform transform = val5.transform; transform.localScale *= 2f; ScanNodeProperties component = val5.GetComponent<ScanNodeProperties>(); component.nodeType = 1; component.headerText = "Error"; component.subText = "A mod is incompatible with Buyable Shotgun Shells"; } catch (Exception ex) { LoggerInstance.LogError((object)ex.ToString()); } val2.transform.localScale = Vector3.one / 2f; return val; } private static GameObject CloneNonScrap(Item original, Item clone, int price) { GameObject val = NetworkPrefabs.CloneNetworkPrefab(original.spawnPrefab, (string)null); Object.DontDestroyOnLoad((Object)(object)val); CopyFields(original, clone); val.GetComponent<GrabbableObject>().itemProperties = clone; clone.spawnPrefab = val; ((Object)clone).name = "Buyable" + ((Object)original).name; clone.creditsWorth = price; return val; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private static TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!((Object)(object)ShotgunShell == (Object)null) && !((Object)(object)ShotgunShellObjectClone != (Object)null)) { ShotgunShellObjectClone = CloneNonScrap(ShotgunShell, ShotgunShellClone, ShellPrice); ShotgunShellClone.itemName = "Shells"; } } private static void AddToShop() { Item shotgunShellClone = ShotgunShellClone; int shellPrice = ShellPrice; Items.RegisterShopItem(shotgunShellClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("ShotgunShell", "Ammo for the Nutcracker's Shotgun."), shellPrice); LoggerInstance.LogInfo((object)$"Shotgun Shell added to Shop for {ShellPrice} credits"); } } }
BepInEx/plugins/plugins/CoilHeadStare.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TDP.CoilHeadStare.Patch; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CoilHeadStare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadStare")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace TDP.CoilHeadStare { [BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.0.9")] public class ModBase : BaseUnityPlugin { private const string modGUID = "TDP.CoilHeadStare"; private const string modName = "CoilHeadStare"; private const string modVersion = "1.0.9"; private Harmony harmony; internal static ModBase instance; internal ManualLogSource mls; public static ConfigEntry<float> config_timeUntilStare; public static ConfigEntry<float> config_maxStareDistance; public static ConfigEntry<float> config_turnHeadSpeed; public static ConfigEntry<bool> config_shovelReact; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } else { Object.Destroy((Object)(object)this); } ConfigFile(); harmony = new Harmony("TDP.CoilHeadStare"); harmony.PatchAll(typeof(CoilHeadPatch)); mls = Logger.CreateLogSource("TDP.CoilHeadStare"); mls.LogInfo((object)"CoilHeadStare 1.0.9 loaded."); } private void ConfigFile() { config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)"); config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)"); config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player"); config_shovelReact = ((BaseUnityPlugin)this).Config.Bind<bool>("CoilHeadStare", "Head Bounce on Shovel Hit", true, "Should the coilhead spring wobble when hit with a shovel (or with anything else)"); Stare.timeUntilStare = config_timeUntilStare.Value; Stare.maxStareDistance = config_maxStareDistance.Value; Stare.turnHeadSpeed = config_turnHeadSpeed.Value; CoilHeadPatch.shovelReact = config_shovelReact.Value; } } } namespace TDP.CoilHeadStare.Patch { internal class CoilHeadPatch { public static bool shovelReact; [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] [HarmonyPriority(200)] private static void StartPostFix(EnemyAI __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (__instance is SpringManAI) { Debug.Log((object)"CoilHead found. Adding stare script."); Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>(); stare.Initialize((SpringManAI)__instance); } } [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPrefix] public static void HitEnemyPreFix(EnemyAI __instance) { if (__instance is SpringManAI) { if ((Object)(object)__instance == (Object)null) { ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head instance is missing."); } else if ((Object)(object)__instance.creatureAnimator == (Object)null) { ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head animator is missing."); } else if (__instance.creatureAnimator.parameters.All((AnimatorControllerParameter x) => x.name == "springBoing")) { ModBase.instance.mls.LogError((object)"On player hit Coil Head: Coil Head animatorcontroller is missing the parameter \"springBoing\"."); } else if (shovelReact) { __instance.creatureAnimator.SetTrigger("springBoing"); } } } } public class Stare : MonoBehaviour { private SpringManAI coilHeadInstance; public static float timeUntilStare; public static float maxStareDistance; public static float turnHeadSpeed; private Transform head; private float timeSinceMoving; private bool isTurningHead; private PlayerControllerB stareTarget; public void Initialize(SpringManAI instance) { Debug.Log((object)"Initializing Stare on Coil Head."); coilHeadInstance = instance; if ((Object)(object)coilHeadInstance == (Object)null) { ModBase.instance.mls.LogError((object)"Coil Head instance missing. Harmony Patch failed?"); } List<Transform> list = FindChildren(((Component)coilHeadInstance).transform, "springBone.002"); if (list == null) { ModBase.instance.mls.LogError((object)"Search for head parent returned null. This should not be possible, something went wrong."); } else if (list.Count > 0) { if (list.Last().childCount > 0) { head = list.Last().GetChild(list.Last().childCount - 1); } else { ModBase.instance.mls.LogError((object)"Found head parent (springBone.002), but it has no child transforms."); } } else { ModBase.instance.mls.LogError((object)"Could not find head parent bone. Possibly missing or renamed? Head must be parented to \"springBone.002\"."); } if ((Object)(object)head == (Object)null) { ModBase.instance.mls.LogError((object)"Could not find head transform. Destroying script. (Coil Head should be unaffected by this)"); Object.Destroy((Object)(object)this); } else { ModBase.instance.mls.LogInfo((object)("Found head transform: " + ((Object)head).name)); } } private List<Transform> FindChildren(Transform parent, string name) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown List<Transform> list = new List<Transform>(); foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { list.Add(val); } else { list.AddRange(FindChildren(val, name)); } } return list; } private void Start() { if ((Object)(object)head != (Object)null) { ModBase.instance.mls.LogInfo((object)"Stare initialization successful. \nNote: If a reskin is being used and the head does not turn it is most likely incompatible."); } else { ModBase.instance.mls.LogInfo((object)"Stare initialization unsuccessful. An error has probably occurred."); } } private void Update() { //IL_0092: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coilHeadInstance == (Object)null) { return; } if ((Object)(object)head == (Object)null) { ModBase.instance.mls.LogError((object)"Head transform missing. Destroying script."); Object.Destroy((Object)(object)this); return; } if (!isTurningHead) { stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false); } if (!((Object)(object)stareTarget == (Object)null)) { Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position; float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position); if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f) { timeSinceMoving = 0f; } else { timeSinceMoving += Time.deltaTime; } if (timeSinceMoving > timeUntilStare) { isTurningHead = true; } else { isTurningHead = false; } if (isTurningHead) { head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f); } } } } }
BepInEx/plugins/plugins/CrouchToStand.dll
Decompiled 2 years agousing System.Collections; using System.Diagnostics; 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("CrouchToStand")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CrouchToStand")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("666C668E-9A5E-40B0-BA2F-6CD63B92BDAD")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace CrouchToStand; [BepInPlugin("Mhz.CrouchToStand", "CrouchToStand", "1.0.0")] public class StandUp : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] private class JumpPerformedPatch { private static void Prefix(PlayerControllerB __instance) { ((MonoBehaviour)__instance).StartCoroutine(PerformDelayedAction(__instance)); } } private static Harmony _harmony; private 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("Mhz.CrouchToStand"); _harmony.PatchAll(); } private static IEnumerator PerformDelayedAction(PlayerControllerB instance) { yield return null; if (instance.isCrouching) { instance.Crouch(false); } } }
BepInEx/plugins/plugins/CustomTranslatorCharLimit.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("CustomTranslatorCharLimit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+43206f0475d7dae18e393eaa115cfd192399712f")] [assembly: AssemblyProduct("CustomTranslatorCharLimit")] [assembly: AssemblyTitle("CustomTranslatorCharLimit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CustomTranslatorCharLimit { [BepInPlugin("CustomTranslatorCharLimit", "CustomTranslatorCharLimit", "1.0.2")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("CustomTranslatorCharLimit"); private static Plugin Instance; public static ManualLogSource Logger; public static ConfigEntry<int> MaxCharLength; public static ConfigEntry<float> MinSecondsToWait; public static ConfigEntry<float> MaxSecondsToWait; public static ConfigEntry<float> SecondsToWait; public static ConfigEntry<bool> UseRNG; public static ConfigEntry<bool> AllowSpecialCharacters; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin CustomTranslatorCharLimit is loaded!"); MaxCharLength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxCharLength", 10, "Maximum number of characters to be able to transmit with the Signal Translator"); MinSecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinSecondsToWait", 0.7f, "Minimum number of seconds to potentially wait before sending another message"); MaxSecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxSecondsToWait", 2.7f, "Maximum number of seconds to potentially wait before sending another character"); SecondsToWait = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SecondsToWait", 0.7f, "Number of seconds to constantly wait before sending another character (RNG must be false for this)"); UseRNG = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UseRNG", true, "Use RNG to determine how long to wait before sending another character"); AllowSpecialCharacters = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowSpecialCharacters", true, "Allow special characters (e.g. !@#$%^&*():) to be used in the terminal"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } } public static class PluginInfo { public const string PLUGIN_GUID = "CustomTranslatorCharLimit"; public const string PLUGIN_NAME = "CustomTranslatorCharLimit"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace CustomTranslatorCharLimit.Patches { [HarmonyPatch] internal class PatchHUDManger { [HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorServerRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Patch(IEnumerable<CodeInstruction> codes) { return codes.Select(delegate(CodeInstruction code) { if (code.opcode == OpCodes.Ldc_I4_S && (sbyte)code.operand == 12) { code.opcode = OpCodes.Ldc_I4; code.operand = Plugin.MaxCharLength.Value + 2; } return code; }); } [HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PatchUseSignalTranslatorClientRpc(IEnumerable<CodeInstruction> codes) { return codes.Select(delegate(CodeInstruction code) { if (code.opcode == OpCodes.Ldc_I4_S && (sbyte)code.operand == 10) { code.opcode = OpCodes.Ldc_I4; code.operand = Plugin.MaxCharLength.Value; } return code; }); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> TranspileMoveNext(IEnumerable<CodeInstruction> codes) { List<CodeInstruction> list = codes.ToList(); if (Plugin.MinSecondsToWait.Value != 0.7f && Plugin.UseRNG.Value) { int num = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4 && (float)code.operand == 0.7f); if (num == -1) { Plugin.Logger.LogError((object)"HUDManager::DisplaySignalTranslatorMessage: Could not find index of ldc.r4 0.7!"); return list.AsEnumerable(); } list[num].operand = Plugin.MinSecondsToWait.Value; } if (Plugin.MaxSecondsToWait.Value != 2.7f && Plugin.UseRNG.Value) { int num2 = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_M1) + 1; while (true) { num2 = list.FindIndex(num2 + 1, (CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_M1) + 1; if (num2 != -1 && list[num2].opcode == OpCodes.Ldc_I4_4) { break; } if (num2 == -1) { Plugin.Logger.LogError((object)"HUDManager::DisplaySignalTranslatorMessage: Could not find index of ldc.i4.m1!"); return list.AsEnumerable(); } } float num3 = (Plugin.MaxSecondsToWait.Value - Plugin.MinSecondsToWait.Value) * 2f; float num4 = 0f - num3 / 2f; if (num3 < 0f - num4) { num3 = 0f - num4; } list[num2 - 1].opcode = OpCodes.Ldc_I4; list[num2 - 1].operand = Mathf.RoundToInt(num4); list[num2].opcode = OpCodes.Ldc_I4; list[num2].operand = Mathf.RoundToInt(num3); } if (!Plugin.UseRNG.Value && Plugin.SecondsToWait.Value != 0.7f) { int num5 = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4 && (float)code.operand == 0.7f); if (num5 == -1) { return list.AsEnumerable(); } list[num5].operand = Plugin.SecondsToWait.Value; list[num5 + 1].opcode = OpCodes.Ldc_R4; list[num5 + 1].operand = 0f; } return list.AsEnumerable(); } } [HarmonyPatch] internal class PatchTerminal { [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> PatchParsePlayerSentence(IEnumerable<CodeInstruction> codes) { List<CodeInstruction> list = codes.ToList(); int index = list.FindIndex((CodeInstruction code) => code.opcode == OpCodes.Call && code.operand.ToString().Contains("Min")) - 1; list[index].opcode = OpCodes.Ldc_I4; list[index].operand = ((Plugin.MaxCharLength.Value == 0) ? 10 : Plugin.MaxCharLength.Value); return list.AsEnumerable(); } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] public static void PatchStart(Terminal __instance) { foreach (TerminalNode specialNode in __instance.terminalNodes.specialNodes) { if ((((Object)specialNode).name == "Start" || ((Object)specialNode).name == "HelpCommands" || ((Object)specialNode).name == "ParserError1" || ((Object)specialNode).name == "SendSignalTranslator") && specialNode.maxCharactersToType <= 35) { specialNode.maxCharactersToType = 9999; } } } [HarmonyPatch(typeof(Terminal), "RemovePunctuation")] [HarmonyPrefix] public static bool PatchRemovePunctuation(ref string __result, string s) { if (Plugin.AllowSpecialCharacters.Value) { __result = s; return false; } return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/plugins/EladsHUD.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using CustomHUD; using GameNetcodeStuff; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; 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("EladsHUD")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Custom HUD for lethal company :]")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("EladsHUD")] [assembly: AssemblyTitle("EladsHUD")] [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; } } } public enum PocketFlashlightOptions { Disabled, Vanilla, Separate } public enum StaminaTextOptions { Disabled, PercentageOnly, Full } internal class CustomHUD_Mono : MonoBehaviour { public static CustomHUD_Mono instance; [Header("Health")] public CanvasGroup healthGroup; public Image healthBar; public TextMeshProUGUI healthText; [Header("Stamina")] public CanvasGroup staminaGroup; public Image staminaBar; public Image staminaBarChangeFG; public TextMeshProUGUI staminaText; public TextMeshProUGUI carryText; [Header("Battery")] public CanvasGroup batteryGroup; public Image batteryBar; public TextMeshProUGUI batteryText; [Header("Flashlight")] public CanvasGroup flashlightGroup; public Image flashlightBar; public TextMeshProUGUI flashlightText; private Color staminaColor; private Color staminaWarnColor = new Color(255f, 0f, 0f); private float colorLerp; private int lastHealth = 100; private float lastHealthChange = 0f; private void Awake() { if ((Object)(object)instance != (Object)null) { throw new Exception("2 instances of CustomHUD_Mono!"); } instance = this; } private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) staminaColor = ((Graphic)staminaBar).color; } public void UpdateFromPlayer(PlayerControllerB player) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) lastHealthChange += Time.deltaTime; if (lastHealth != player.health) { lastHealth = player.health; lastHealthChange = 0f; } int health = player.health; float sprintMeter = player.sprintMeter; float sprintTime = player.sprintTime; if ((double)sprintMeter < 0.3) { colorLerp = Mathf.Clamp01(colorLerp + Time.deltaTime * 8f); } else { colorLerp = Mathf.Clamp01(colorLerp - Time.deltaTime * 8f); } ((Graphic)staminaBar).color = Color.Lerp(staminaColor, staminaWarnColor, colorLerp); int num = Mathf.FloorToInt(sprintMeter * 100f); float num2 = CalculateStaminaOverTime(player); float num3 = num2 * 100f; if (Plugin.detailedStamina.Value != 0) { ((TMP_Text)staminaText).text = $"{num}<size=75%><voffset=1>%</voffset></size>"; } else { ((TMP_Text)staminaText).text = ""; } float num4 = Mathf.Sign(num2); float num5 = num4; if (num5 != -1f) { if (num5 != 0f) { if (num5 != 1f) { } staminaBar.fillAmount = sprintMeter; staminaBarChangeFG.fillAmount = 0f; if (Plugin.detailedStamina.Value == StaminaTextOptions.Full) { TextMeshProUGUI obj = staminaText; ((TMP_Text)obj).text = ((TMP_Text)obj).text + " | +" + num3.ToString("0.0") + "<size=75%>/sec</size>"; } } else { staminaBar.fillAmount = sprintMeter; staminaBarChangeFG.fillAmount = 0f; if (Plugin.detailedStamina.Value == StaminaTextOptions.Full) { TextMeshProUGUI obj2 = staminaText; ((TMP_Text)obj2).text = ((TMP_Text)obj2).text + " | +0.0<size=75%>/sec</size>"; } } } else { staminaBar.fillAmount = sprintMeter - Mathf.Abs(num2); ((Graphic)staminaBarChangeFG).color = Color.Lerp(Color.white, staminaWarnColor, colorLerp); staminaBarChangeFG.fillAmount = Mathf.Min(sprintMeter, Mathf.Abs(num2)); ((Transform)((Graphic)staminaBarChangeFG).rectTransform).localPosition = new Vector3(270f * Mathf.Max(0f, sprintMeter - Mathf.Abs(num2)), 0f); if (Plugin.detailedStamina.Value == StaminaTextOptions.Full) { TextMeshProUGUI obj3 = staminaText; ((TMP_Text)obj3).text = ((TMP_Text)obj3).text + " | " + num3.ToString("0.0") + "<size=75%>/sec</size>"; } } float num6 = Mathf.RoundToInt(Mathf.Clamp(player.carryWeight - 1f, 0f, 100f) * 105f); if (Plugin.shouldDoKGConversion) { num6 *= 0.453592f; ((TMP_Text)carryText).text = $"{num6}<size=60%>kg</size>"; } else { ((TMP_Text)carryText).text = $"{num6}<size=60%>lb</size>"; } healthBar.fillAmount = (float)health / 100f; ((TMP_Text)healthText).text = health.ToString(); float value = Plugin.healthbarHideDelay.Value; healthGroup.alpha = (Plugin.autoHideHealthbar.Value ? Mathf.InverseLerp(value + 1f, value, lastHealthChange) : 1f); ((Component)flashlightGroup).gameObject.SetActive(UpdateFlashlight(player)); ((Component)batteryGroup).gameObject.SetActive(UpdateBattery(player)); } private bool UpdateFlashlight(PlayerControllerB player) { if (Plugin.pocketedFlashlightDisplayMode.Value != PocketFlashlightOptions.Separate) { return false; } if (!((Behaviour)player.helmetLight).enabled) { return false; } GrabbableObject pocketedFlashlight = player.pocketedFlashlight; if ((Object)(object)pocketedFlashlight == (Object)null) { return false; } if (!pocketedFlashlight.itemProperties.requiresBattery) { return false; } flashlightBar.fillAmount = pocketedFlashlight.insertedBattery.charge; int num = Mathf.CeilToInt(pocketedFlashlight.insertedBattery.charge * pocketedFlashlight.itemProperties.batteryUsage); ((TMP_Text)flashlightText).text = $"{Mathf.CeilToInt(pocketedFlashlight.insertedBattery.charge * 100f)}%"; if (Plugin.displayTimeLeft.Value) { return true; } TextMeshProUGUI obj = flashlightText; ((TMP_Text)obj).text = ((TMP_Text)obj).text + string.Format(" <size=60%>{0}:{1}", num / 60, (num % 60).ToString("D2")); return true; } private bool UpdateBattery(PlayerControllerB player) { GrabbableObject val = player.currentlyHeldObjectServer; if ((Object)(object)val == (Object)null && Plugin.pocketedFlashlightDisplayMode.Value == PocketFlashlightOptions.Vanilla) { val = player.pocketedFlashlight; } if ((Object)(object)val == (Object)null) { return false; } if (!val.itemProperties.requiresBattery) { return false; } batteryBar.fillAmount = val.insertedBattery.charge; int num = (int)(val.insertedBattery.charge / val.itemProperties.batteryUsage); int num2 = Mathf.CeilToInt(val.insertedBattery.charge * val.itemProperties.batteryUsage); ((TMP_Text)batteryText).text = $"{Mathf.CeilToInt(val.insertedBattery.charge * 100f)}%"; if (!Plugin.displayTimeLeft.Value) { return true; } if (val.itemProperties.itemIsTrigger) { TextMeshProUGUI obj = batteryText; ((TMP_Text)obj).text = ((TMP_Text)obj).text + $" ({num} uses remaining)"; } else { TextMeshProUGUI obj2 = batteryText; ((TMP_Text)obj2).text = ((TMP_Text)obj2).text + string.Format(" ({0}:{1} remaining)", num2 / 60, (num2 % 60).ToString("D2")); } return true; } private float CalculateStaminaOverTime(PlayerControllerB player) { if (player.sprintMeter == 1f) { return 0f; } bool privateField = player.GetPrivateField<bool>("isWalking"); float sprintTime = player.sprintTime; float num = 1f; if ((double)player.drunkness > 0.019999999552965164) { num *= Mathf.Abs(StartOfRound.Instance.drunknessSpeedEffect.Evaluate(player.drunkness) - 1.25f); } return player.isSprinting ? (-1f / sprintTime * player.carryWeight * num) : ((player.isMovementHindered > 0 && privateField) ? (-1f / sprintTime * num * 0.5f) : ((!privateField) ? (1f / (sprintTime + 4f) * num) : (1f / (sprintTime + 9f) * num))); } } namespace EladsHUD { public static class PluginInfo { public const string PLUGIN_GUID = "EladsHUD"; public const string PLUGIN_NAME = "EladsHUD"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace CustomHUD { [BepInPlugin("me.eladnlg.customhud", "Elads HUD", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Plugin instance; public AssetBundle assets; public GameObject HUD; public static bool shouldDoKGConversion; internal static ConfigEntry<PocketFlashlightOptions> pocketedFlashlightDisplayMode; internal static ConfigEntry<StaminaTextOptions> detailedStamina; internal static ConfigEntry<bool> displayTimeLeft; internal static ConfigEntry<float> hudScale; internal static ConfigEntry<bool> autoHideHealthbar; internal static ConfigEntry<float> healthbarHideDelay; private void Awake() { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown if ((Object)(object)instance != (Object)null) { throw new Exception("what the cuck??? more than 1 plugin instance."); } instance = this; hudScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HUDScale", 1f, "The size of the HUD."); autoHideHealthbar = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideHealthbarAutomatically", true, "Should the healthbar be hidden after not taking damage for a while."); healthbarHideDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HealthbarHideDelay", 4f, "The amount of time before the healthbar starts fading away."); pocketedFlashlightDisplayMode = ((BaseUnityPlugin)this).Config.Bind<PocketFlashlightOptions>("General", "FlashlightBattery", PocketFlashlightOptions.Separate, "How the flashlight battery is displayed whilst unequipped.\r\nDisabled - Flashlight battery will not be displayed.\r\nVanilla - Flashlight battery will be displayed when you don't have a battery-using item equipped.\r\nSeparate - Flashlight battery will be displayed using a dedicated panel. (recommended)"); detailedStamina = ((BaseUnityPlugin)this).Config.Bind<StaminaTextOptions>("General", "DetailedStamina", StaminaTextOptions.PercentageOnly, "What the stamina text should display.\r\nDisabled - The stamina text will be hidden.\r\nPercentageOnly - Only the percentage will be displayed. (recommended)\r\nFull - Both percentage and rate of gain/loss will be displayed."); displayTimeLeft = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisplayTimeLeft", true, "Should the uses/time left for a battery-using item be displayed."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Elad's HUD is loaded!"); assets = AssetUtils.LoadAssetBundleFromResources("customhud", typeof(PlayerPatches).Assembly); HUD = assets.LoadAsset<GameObject>("PlayerInfo"); Harmony val = new Harmony("me.eladnlg.customhud"); val.PatchAll(Assembly.GetExecutingAssembly()); } private void Start() { ((BaseUnityPlugin)this).Logger.LogInfo((object)(Chainloader.PluginInfos.Count + " plugins loaded")); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin GUID: " + pluginInfo.Value.Metadata.GUID)); } shouldDoKGConversion = Chainloader.PluginInfos.Any((KeyValuePair<string, PluginInfo> pair) => pair.Value.Metadata.GUID == "com.zduniusz.lethalcompany.lbtokg"); } } [HarmonyPatch(typeof(HUDManager))] public class HUDPatches { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(HUDManager __instance) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) HUDElement[] privateField = __instance.GetPrivateField<HUDElement[]>("HUDElements"); privateField[2].canvasGroup.alpha = 0f; GameObject val = Object.Instantiate<GameObject>(Plugin.instance.HUD, ((Component)privateField[2].canvasGroup).transform.parent); val.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f) * Plugin.hudScale.Value; privateField[2].canvasGroup = val.GetComponent<CanvasGroup>(); } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerPatches { [HarmonyPrefix] [HarmonyPatch("LateUpdate")] private static void LateUpdate_Prefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject) && !((Object)(object)CustomHUD_Mono.instance == (Object)null)) { CustomHUD_Mono.instance.UpdateFromPlayer(__instance); } } } internal static class ReflectionUtils { public static T GetPrivateField<T>(this object obj, string field) { return (T)obj.GetType().GetField(field, BindingFlags.Instance | BindingFlags.NonPublic).GetValue(obj); } } } namespace Jotunn.Utils { public static class AssetUtils { public const char AssetBundlePathSeparator = '$'; public static Texture2D LoadTexture(string texturePath, bool relativePath = true) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown string text = texturePath; if (relativePath) { text = Path.Combine(Paths.PluginPath, texturePath); } if (!File.Exists(text)) { return null; } if (!text.EndsWith(".png") && !text.EndsWith(".jpg")) { throw new Exception("LoadTexture can only load png or jpg textures"); } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2); val.LoadRawTextureData(array); return val; } public static Sprite LoadSpriteFromFile(string spritePath) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadTexture(spritePath); if ((Object)(object)val != (Object)null) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), default(Vector2), 100f); } return null; } public static AssetBundle LoadAssetBundle(string bundlePath) { string text = Path.Combine(Paths.PluginPath, bundlePath); if (!File.Exists(text)) { return null; } return AssetBundle.LoadFromFile(text); } public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly) { if (resourceAssembly == null) { throw new ArgumentNullException("Parameter resourceAssembly can not be null."); } string text = null; try { text = resourceAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName)); } catch (Exception) { } if (text == null) { Debug.LogError((object)("AssetBundle " + bundleName + " not found in assembly manifest")); return null; } AssetBundle result; using (Stream stream = resourceAssembly.GetManifestResourceStream(text)) { result = AssetBundle.LoadFromStream(stream); } return result; } public static string LoadText(string path) { string text = Path.Combine(Paths.PluginPath, path); if (!File.Exists(text)) { Debug.LogError((object)("Error, failed to load contents from non-existant path: $" + text)); return null; } return File.ReadAllText(text); } public static Sprite LoadSprite(string assetPath) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(Paths.PluginPath, assetPath); if (!File.Exists(text)) { return null; } if (text.Contains('$'.ToString())) { string[] array = text.Split('$'); string text2 = array[0]; string text3 = array[1]; AssetBundle val = AssetBundle.LoadFromFile(text2); Sprite result = val.LoadAsset<Sprite>(text3); val.Unload(false); return result; } Texture2D val2 = LoadTexture(text, relativePath: false); if (!Object.op_Implicit((Object)(object)val2)) { return null; } return Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero); } } }
BepInEx/plugins/plugins/fixes/DoorFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using DunGen; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DoorFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes the hitbox of doors so items can be picked up through open doors more easily.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DoorFix")] [assembly: AssemblyTitle("DoorFix")] [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 DoorFix { [BepInPlugin("DoorFix", "DoorFix", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(DungeonUtil))] [HarmonyPatch("AddAndSetupDoorComponent")] public class DungeonUtilPatch { private static void Postfix(Dungeon dungeon, GameObject doorPrefab, Doorway doorway) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (!((Object)doorPrefab).name.StartsWith("SteelDoorMapSpawn")) { return; } foreach (Transform item in doorPrefab.GetComponent<SpawnSyncedObject>().spawnPrefab.transform) { Transform val = item; if (!((Object)val).name.StartsWith("SteelDoor")) { continue; } foreach (Transform item2 in ((Component)val).transform) { Transform val2 = item2; if (!((Object)val2).name.StartsWith("DoorMesh")) { continue; } LOGGER.LogInfo((object)((object)val2).ToString()); foreach (Transform item3 in ((Component)val2).transform) { Transform val3 = item3; if (((Component)val3).tag != "InteractTrigger") { continue; } LOGGER.LogInfo((object)((object)val3).ToString()); BoxCollider[] components = ((Component)val3).gameObject.GetComponents<BoxCollider>(); foreach (BoxCollider val4 in components) { if (((Collider)val4).isTrigger) { LOGGER.LogDebug((object)"Patching door size"); val4.size = new Vector3(0.64f, 1f, 1f); } } } } } } } private static readonly ManualLogSource LOGGER = Logger.CreateLogSource("DoorFix"); private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("DoorFix").PatchAll(); LOGGER.LogInfo((object)"Plugin DoorFix is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "DoorFix"; public const string PLUGIN_NAME = "DoorFix"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/plugins/fixes/FlashlightFix.dll
Decompiled 2 years 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 BepInEx.Configuration; using BepInEx.Logging; using FlashlightFix.Patches; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [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("FlashlightFix")] [assembly: AssemblyConfiguration("Deploy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+efa456a7c428807fedab719b19801754ee2a99c3")] [assembly: AssemblyProduct("FlashlightFix")] [assembly: AssemblyTitle("FlashlightFix")] [assembly: AssemblyVersion("1.0.0.0")] namespace FlashlightFix { internal static class Metadata { public const string GUID = "ShaosilGaming.FlashlightFix"; public const string PLUGIN_NAME = "FlashlightFix"; public const string VERSION = "1.1.2"; } [BepInPlugin("ShaosilGaming.FlashlightFix", "FlashlightFix", "1.1.2")] public class Plugin : BaseUnityPlugin { private const string OptionalFixesSection = "Optional Fixes"; public static ManualLogSource MLS { get; private set; } public static ConfigEntry<bool> OnlyOneLight { get; private set; } public static ConfigEntry<bool> TreatLaserPointersAsFlashlights { get; private set; } public static ConfigEntry<string> ToggleShortcut { get; private set; } private void Awake() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) MLS = ((BaseUnityPlugin)this).Logger; string[] array = (from Key c in Enum.GetValues(typeof(Key)) where (int)c < 106 select ((object)(Key)(ref c)).ToString()).ToArray(); OnlyOneLight = ((BaseUnityPlugin)this).Config.Bind<bool>("Optional Fixes", "OnlyOneLight", true, "When turning on any flashlight, will turn off any others in your inventory that are still active."); TreatLaserPointersAsFlashlights = ((BaseUnityPlugin)this).Config.Bind<bool>("Optional Fixes", "TreatLaserPointersAsFlashlights", false, "If set to true, laser pointers will be like flashlights and automatically toggle off and on when switching to them, etc."); ConfigFile config = ((BaseUnityPlugin)this).Config; Key val = (Key)0; ToggleShortcut = config.Bind<string>("Optional Fixes", "ToggleShortcut", ((object)(Key)(ref val)).ToString(), new ConfigDescription("A shortcut key to allow toggling a flashlight at any time.", (AcceptableValueBase)(object)new AcceptableValueList<string>(array), Array.Empty<object>())); PlayerControllerBPatch.ToggleShortcutKey = Enum.Parse<Key>(ToggleShortcut.Value); MLS.LogInfo((object)"Configuration Initialized."); Harmony.CreateAndPatchAll(typeof(PlayerControllerBPatch), (string)null); MLS.LogInfo((object)"PlayerControllerB patched."); Harmony.CreateAndPatchAll(typeof(FlashlightItemPatch), (string)null); MLS.LogInfo((object)"FlashlightItem patched."); MLS.LogInfo((object)"FlashlightFix v1.1.2 fully loaded."); } } } namespace FlashlightFix.Patches { internal static class FlashlightItemPatch { public const int LaserPointerTypeID = 2; [HarmonyPatch(typeof(FlashlightItem), "Start")] [HarmonyPostfix] private static void Start(FlashlightItem __instance) { if (__instance.changeMaterial) { Material[] sharedMaterials = ((Renderer)__instance.flashlightMesh).sharedMaterials; sharedMaterials[1] = (((GrabbableObject)__instance).isBeingUsed ? __instance.bulbLight : __instance.bulbDark); ((Renderer)__instance.flashlightMesh).sharedMaterials = sharedMaterials; } } [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> PatchEquipFlashlight(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Callvirt && (list[i].operand as MethodInfo)?.Name == "ChangeHelmetLight") { list.RemoveRange(i - 5, 11); } else if (list[i].opcode == OpCodes.Call && (list[i].operand as MethodInfo)?.Name == "SwitchFlashlight") { list.RemoveRange(i - 5, 6); } } Plugin.MLS.LogDebug((object)"Patched FlashlightItem.EquipItem"); return list.AsEnumerable(); } [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] [HarmonyPostfix] private static void EquipItem(FlashlightItem __instance) { if (((GrabbableObject)__instance).isBeingUsed) { __instance.SwitchFlashlight(true); } } [HarmonyPatch(typeof(FlashlightItem), "DiscardItem")] [HarmonyPostfix] private static void DiscardItem(FlashlightItem __instance, PlayerControllerB ___previousPlayerHeldBy) { if (!Plugin.OnlyOneLight.Value) { return; } IEnumerable<FlashlightItem> source = from f in ___previousPlayerHeldBy.ItemSlots.OfType<FlashlightItem>() where (Object)(object)f != (Object)(object)__instance select f; FlashlightItem val = (from f in source where ((GrabbableObject)f).isBeingUsed orderby f.CheckForLaser() select f).FirstOrDefault(); if ((Object)(object)val != (Object)null) { Plugin.MLS.LogDebug((object)"Turning active helmet light back on after a flashlight was discarded"); ((GrabbableObject)val).playerHeldBy.ChangeHelmetLight(val.flashlightTypeID, true); } else if (((GrabbableObject)__instance).isBeingUsed && ((NetworkBehaviour)___previousPlayerHeldBy).IsOwner) { FlashlightItem val2 = source.FirstOrDefault((Func<FlashlightItem, bool>)((FlashlightItem f) => !f.CheckForLaser() && !((GrabbableObject)f).insertedBattery.empty)); if ((Object)(object)val2 != (Object)null) { Plugin.MLS.LogDebug((object)"Turning another flashlight on after an active one was discarded"); ((GrabbableObject)val2).UseItemOnClient(true); } } } [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] [HarmonyPrefix] private static bool SwitchFlashlight(FlashlightItem __instance, bool on) { ((GrabbableObject)__instance).isBeingUsed = on; ((Behaviour)__instance.flashlightBulb).enabled = on && !((GrabbableObject)__instance).isPocketed; ((Behaviour)__instance.flashlightBulbGlow).enabled = on && !((GrabbableObject)__instance).isPocketed; if (__instance.changeMaterial) { ((Renderer)__instance.flashlightMesh).materials[1] = (on ? __instance.bulbLight : __instance.bulbDark); } if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) { if (on && ((NetworkBehaviour)__instance).IsOwner && Plugin.OnlyOneLight.Value && !__instance.CheckForLaser()) { for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { GrabbableObject obj = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i]; FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if (val != null && (Object)(object)val != (Object)(object)__instance && ((GrabbableObject)val).isBeingUsed && !val.CheckForLaser()) { Plugin.MLS.LogDebug((object)$"Flashlight in pocket slot {i} TURNING OFF after turning on a held flashlight"); ((GrabbableObject)val).UseItemOnClient(true); } } } PlayerControllerBPatch.UpdateHelmetLight(((GrabbableObject)__instance).playerHeldBy); } return false; } public static bool CheckForLaser(this FlashlightItem flashlight) { return flashlight.flashlightTypeID == 2 && !Plugin.TreatLaserPointersAsFlashlights.Value; } } internal static class PlayerControllerBPatch { public static Key ToggleShortcutKey; [HarmonyPatch(typeof(PlayerControllerB), "ItemTertiaryUse_performed")] [HarmonyPrefix] private static bool ItemTertiaryUse_performed(PlayerControllerB __instance) { return !(__instance.currentlyHeldObjectServer is FlashlightItem); } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] private static void SwitchToItemSlot(PlayerControllerB __instance, int slot) { GrabbableObject obj = __instance.ItemSlots[slot]; FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if (val == null) { return; } if (((NetworkBehaviour)__instance).IsOwner && !((GrabbableObject)val).isBeingUsed && ((Behaviour)__instance.helmetLight).enabled && !val.CheckForLaser() && Plugin.OnlyOneLight.Value) { for (int i = 0; i < __instance.ItemSlots.Length; i++) { if (i != slot) { GrabbableObject obj2 = __instance.ItemSlots[i]; FlashlightItem val2 = (FlashlightItem)(object)((obj2 is FlashlightItem) ? obj2 : null); if (val2 != null && val2.usingPlayerHelmetLight && !val2.CheckForLaser() && !((GrabbableObject)val).insertedBattery.empty && !val.CheckForLaser()) { Plugin.MLS.LogDebug((object)$"Flashlight in slot {slot} turning ON after switching to it"); ((GrabbableObject)val).UseItemOnClient(true); break; } } } } UpdateHelmetLight(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void Update(PlayerControllerB __instance) { //IL_001b: 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) if (((NetworkBehaviour)__instance).IsOwner && (int)ToggleShortcutKey != 0 && !__instance.inTerminalMenu && !__instance.isTypingChat && __instance.isPlayerControlled && ((ButtonControl)Keyboard.current[ToggleShortcutKey]).wasPressedThisFrame) { FlashlightItem val = (from f in __instance.ItemSlots.OfType<FlashlightItem>() where !((GrabbableObject)f).insertedBattery.empty orderby f.CheckForLaser(), (Object)(object)__instance.currentlyHeldObjectServer == (Object)(object)f descending, ((GrabbableObject)f).isBeingUsed descending, f.flashlightTypeID select f).FirstOrDefault(); if ((Object)(object)val != (Object)null) { ((GrabbableObject)val).UseItemOnClient(true); } } } public static void UpdateHelmetLight(PlayerControllerB player) { FlashlightItem val = (from f in player.ItemSlots.OfType<FlashlightItem>() where ((GrabbableObject)f).isBeingUsed orderby f.CheckForLaser(), ((GrabbableObject)f).isPocketed descending select f).FirstOrDefault(); if ((Object)(object)val != (Object)null && (Object)(object)player.helmetLight != (Object)(object)player.allHelmetLights[val.flashlightTypeID]) { Plugin.MLS.LogDebug((object)string.Format("Updating helmet light to type {0} ({1}).", val.flashlightTypeID, ((GrabbableObject)val).isPocketed ? "ON" : "OFF")); player.ChangeHelmetLight(val.flashlightTypeID, ((GrabbableObject)val).isPocketed); } bool flag = (Object)(object)val != (Object)null && ((GrabbableObject)val).isBeingUsed && ((GrabbableObject)val).isPocketed; if ((Object)(object)player.helmetLight != (Object)null && ((Behaviour)player.helmetLight).enabled != flag) { Plugin.MLS.LogDebug((object)("Toggling helmet light " + (flag ? "on" : "off") + ".")); ((Behaviour)player.helmetLight).enabled = flag; if (flag && (Object)(object)player.pocketedFlashlight != (Object)(object)val) { Plugin.MLS.LogDebug((object)"Updating pocketed flashlight"); player.pocketedFlashlight = (GrabbableObject)(object)val; } } } } }
BepInEx/plugins/plugins/fixes/IntroTweaks.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using IntroTweaks.Data; using IntroTweaks.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("IntroTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Seamless skipping of Lethal Company intro/menu screens.")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+1cc26656336b53e5f702b9a100c6aad010cb99cd")] [assembly: AssemblyProduct("IntroTweaks")] [assembly: AssemblyTitle("IntroTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace IntroTweaks { [BepInPlugin("IntroTweaks", "IntroTweaks", "1.5.0")] public class Plugin : BaseUnityPlugin { internal static string SelectedMode; private const string GUID = "IntroTweaks"; private const string NAME = "IntroTweaks"; private const string VERSION = "1.5.0"; private Harmony patcher; private static bool menuLoaded; internal static ManualLogSource Logger { get; private set; } public static Config Config { get; private set; } public static bool ModInstalled(string name) { name = name.ToLower(); return Chainloader.PluginInfos.Values.Any((PluginInfo p) => p.Metadata.GUID.ToLower().Contains(name) || p.Metadata.Name.ToLower() == name); } private void Awake() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); if (!PluginEnabled(logDisabled: true)) { return; } SceneManager.sceneLoaded += SceneLoaded; if (Config.SKIP_SPLASH_SCREENS.Value) { Task.Run((Action)SkipSplashScreen); } Config.InitBindings(); SelectedMode = Config.AUTO_SELECT_MODE.Value.ToLower(); try { patcher = new Harmony("IntroTweaks"); patcher.PatchAll(); Logger.LogInfo((object)"Plugin loaded."); } catch (Exception ex) { Logger.LogError((object)ex); } } public bool PluginEnabled(bool logDisabled = false) { bool value = Config.PLUGIN_ENABLED.Value; if (!value && logDisabled) { Logger.LogInfo((object)"IntroTweaks disabled globally."); } return value; } private void SkipSplashScreen() { Logger.LogDebug((object)"Skipping splash screens. Ew."); while (!menuLoaded) { SplashScreen.Stop((StopBehavior)0); } } private void SceneLoaded(Scene scene, LoadSceneMode _) { switch (((Scene)(ref scene)).name) { case "InitScene": case "InitSceneLaunchOptions": case "MainMenu": menuLoaded = true; break; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "IntroTweaks"; public const string PLUGIN_NAME = "IntroTweaks"; public const string PLUGIN_VERSION = "1.5.0"; } } namespace IntroTweaks.Utils { internal class DisplayUtil { public static List<DisplayInfo> Displays { get; private set; } = new List<DisplayInfo>(); internal static void Move(int displayIndex) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) Screen.GetDisplayLayout(Displays); int num = Displays.IndexOf(Screen.mainWindowDisplayInfo); if (displayIndex != num) { MoveWindowAsync(displayIndex); } } private static async void MoveWindowAsync(int index) { await MoveWindowTask(index); } private static async Task MoveWindowTask(int index) { if (index >= Displays.Count) { await Task.CompletedTask; Plugin.Logger.LogDebug((object)"Display index out of bounds for current layout!"); return; } DisplayInfo val = Displays[index]; Vector2Int zero = Vector2Int.zero; if ((int)Screen.fullScreenMode != 3) { ((Vector2Int)(ref zero)).x = ((Vector2Int)(ref zero)).x + val.width / 2; ((Vector2Int)(ref zero)).y = ((Vector2Int)(ref zero)).y + val.height / 2; } AsyncOperation operation = Screen.MoveMainWindowTo(ref val, zero); while (operation.progress < 1f) { await Task.Yield(); } Plugin.Logger.LogDebug((object)("Game moved to display: " + Displays[index].name)); } } internal static class Extensions { internal static GameObject FindInParent(this GameObject obj, string name) { Transform parent = obj.transform.parent; try { return ((Component)parent.Find(name)).gameObject; } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error finding '{name}' in: {((Object)parent).name}\n{arg}"); return null; } } internal static bool IsAbove(this Transform cur, Transform target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return cur.localPosition.y > target.localPosition.y; } internal static void ResetAnchoredPos(this RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) rect.anchoredPosition = Vector2.zero; rect.anchoredPosition3D = Vector3.zero; } internal static void ResetPivot(this RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rect.pivot = Vector2.zero; } internal static void ResetSizeDelta(this RectTransform rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rect.sizeDelta = Vector2.zero; } internal static void EditOffsets(this RectTransform rect, Vector2 max, Vector2 min) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) rect.offsetMax = max; rect.offsetMin = min; } internal static void EditAnchors(this RectTransform rect, Vector2 max, Vector2 min) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) rect.anchorMax = max; rect.anchorMin = min; } internal static void AnchorToBottomRight(this RectTransform rect) { //IL_0011: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) rect.ResetAnchoredPos(); rect.EditAnchors(new Vector2(1f, 0f), new Vector2(1f, 0f)); ((Transform)rect).localPosition = new Vector3(432f, -222f, 0f); ((Transform)rect).localRotation = Quaternion.identity; } internal static void AnchorToBottom(this RectTransform rect) { //IL_0017: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) rect.ResetSizeDelta(); rect.ResetAnchoredPos(); rect.EditAnchors(new Vector2(0.5f, 0f), new Vector2(0.5f, 0f)); rect.EditOffsets(new Vector2(0f, 0f), new Vector2(0f, 0f)); rect.RefreshPosition(); } internal static void RefreshPosition(this RectTransform rect) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.Config.VERSION_TEXT_OFFSET.Value; ((Transform)rect).localPosition = new Vector3(0f, -205f + value, 0f); ((Transform)rect).localRotation = Quaternion.identity; } internal static void SetLocalX(this RectTransform rect, float newX) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Transform)rect).localPosition = new Vector3(newX, ((Transform)rect).localPosition.y, ((Transform)rect).localPosition.z); } internal static void FixScale(this Transform transform) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) transform.localScale = new Vector3(1.02f, 1.06f, 1.02f); } internal static float ClampedValue(this ConfigEntry<float> entry, float min, float max) { return Mathf.Clamp(entry.Value, min, max); } } } namespace IntroTweaks.Patches { [HarmonyPatch(typeof(InitializeGame))] internal class InitializeGamePatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void DisableBootAnimation(InitializeGame __instance) { int value = Plugin.Config.GAME_STARTUP_DISPLAY.Value; if (value >= 0) { DisplayUtil.Move(value); } if (Plugin.Config.SKIP_BOOT_ANIMATION.Value) { __instance.runBootUpScreen = false; __instance.bootUpAudio = null; __instance.bootUpAnimation = null; } } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { internal static GameObject VersionNum = null; internal static Transform MenuContainer = null; internal static Transform MenuPanel = null; public static Color32 DARK_ORANGE = new Color32((byte)175, (byte)115, (byte)0, byte.MaxValue); private static MenuManager Instance; public static int realVer { get; internal set; } public static int gameVer { get; private set; } public static TextMeshProUGUI versionText { get; private set; } public static RectTransform versionTextRect { get; private set; } private static Config Cfg => Plugin.Config; [HarmonyPostfix] [HarmonyPatch("Start")] private static void Init(MenuManager __instance) { Instance = __instance; ((MonoBehaviour)Instance).StartCoroutine(PatchMenuDelayed()); } private static IEnumerator PatchMenuDelayed() { yield return (object)new WaitUntil((Func<bool>)(() => !GameNetworkManager.Instance.firstTimeInMenu)); GameObject obj = GameObject.Find("MenuContainer"); MenuContainer = ((obj != null) ? obj.transform : null); Transform menuContainer = MenuContainer; MenuPanel = ((menuContainer != null) ? menuContainer.Find("MainButtons") : null); Transform menuContainer2 = MenuContainer; object versionNum; if (menuContainer2 == null) { versionNum = null; } else { Transform obj2 = menuContainer2.Find("VersionNum"); versionNum = ((obj2 != null) ? ((Component)obj2).gameObject : null); } VersionNum = (GameObject)versionNum; PatchMenu(); } private static void PatchMenu() { Cfg.ALWAYS_SHORT_VERSION.SettingChanged += delegate { SetVersion(); }; Cfg.VERSION_TEXT_SIZE.SettingChanged += delegate { ((TMP_Text)versionText).fontSize = Cfg.VERSION_TEXT_SIZE.ClampedValue(10f, 40f); }; Cfg.VERSION_TEXT_OFFSET.SettingChanged += delegate { versionTextRect.RefreshPosition(); }; try { if (Cfg.FIX_MENU_PANELS.Value) { FixPanelAlignment(MenuPanel); FixPanelAlignment(MenuContainer.Find("LobbyHostSettings")); FixPanelAlignment(MenuContainer.Find("LobbyList")); FixPanelAlignment(MenuContainer.Find("LoadingScreen")); Plugin.Logger.LogDebug((object)"Fixed menu panel alignment."); } IEnumerable<GameObject> buttons = from b in ((Component)MenuPanel).GetComponentsInChildren<Button>(true) select ((Component)b).gameObject; if (Cfg.ALIGN_MENU_BUTTONS.Value) { AlignButtons(buttons); } if (Cfg.REMOVE_CREDITS_BUTTON.Value) { RemoveCreditsButton(buttons); } bool changeRenderMode = Cfg.FIX_MENU_CANVAS.Value; bool flag = Plugin.ModInstalled("AdvancedCompany"); bool flag2 = Plugin.ModInstalled("MoreCompany"); if (flag || flag2) { changeRenderMode = false; } if (Cfg.FIX_MORE_COMPANY.Value && flag2 && !flag) { string text = (FixMoreCompany() ? ". Edits have been made to its UI elements." : " but its UI elements do not exist!"); Plugin.Logger.LogDebug((object)("MoreCompany found" + text)); } TweakCanvasSettings(Instance.menuButtons, changeRenderMode); } catch (Exception arg) { Plugin.Logger.LogError((object)$"An error occurred patching the menu. SAJ.\n{arg}"); } if (Cfg.REMOVE_NEWS_PANEL.Value) { GameObject newsPanel = Instance.NewsPanel; if (newsPanel != null) { newsPanel.SetActive(false); } } if (Cfg.REMOVE_LAN_WARNING.Value) { GameObject lanWarningContainer = Instance.lanWarningContainer; if (lanWarningContainer != null) { lanWarningContainer.SetActive(false); } } if (Cfg.REMOVE_LAUNCHED_IN_LAN.Value) { TextMeshProUGUI launchedInLanModeText = Instance.launchedInLanModeText; GameObject val = ((launchedInLanModeText != null) ? ((Component)launchedInLanModeText).gameObject : null); if (Object.op_Implicit((Object)(object)val)) { val.SetActive(false); } } if (Cfg.AUTO_SELECT_HOST.Value) { Instance.ClickHostButton(); } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch(MenuManager __instance) { bool activeSelf = __instance.menuButtons.activeSelf; if ((Object)(object)versionText == (Object)null) { TryReplaceVersionText(); return; } ((TMP_Text)versionText).text = Cfg.VERSION_TEXT.Value.Replace("$VERSION", $"{gameVer}"); GameObject gameObject = ((Component)versionText).gameObject; if (!gameObject.activeSelf && activeSelf) { gameObject.SetActive(true); } } [HarmonyPrefix] [HarmonyPatch("ClickHostButton")] private static void DisableMenuOnHost() { Transform menuPanel = MenuPanel; if (menuPanel != null) { ((Component)menuPanel).gameObject.SetActive(false); } } private static bool FixMoreCompany() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("GlobalScale"); if (!Object.op_Implicit((Object)(object)val)) { return false; } GameObject gameObject = ((Component)val.transform.Find("CosmeticsScreen")).gameObject; val.GetComponentInParent<Canvas>().pixelPerfect = true; Transform transform = ((Component)gameObject.transform.Find("SpinAreaButton")).transform; transform.localScale = new Vector3(0.48f, 0.55f, 0.46f); transform.position = new Vector3(421.65f, 245.7f, 200f); RectTransform component = gameObject.FindInParent("ActivateButton").GetComponent<RectTransform>(); RectTransform component2 = ((Component)gameObject.transform.Find("ExitButton")).GetComponent<RectTransform>(); component.AnchorToBottomRight(); component2.AnchorToBottomRight(); ((Transform)component2).SetAsLastSibling(); ((Component)gameObject.transform.Find("CosmeticsHolderBorder")).transform.localScale = new Vector3(2.4f, 2.1f, 1f); Transform transform2 = ((Component)Instance.menuButtons.transform.Find("HeaderImage")).transform; transform2.localScale = new Vector3(4.9f, 4.9f, 4.9f); transform2.localPosition = new Vector3(transform2.localPosition.x, transform2.localPosition.y + 35f, 0f); return (Object)(object)val != (Object)null; } private static void RemoveCreditsButton(IEnumerable<GameObject> buttons) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) buttons.First((GameObject b) => ((Object)b).name == "QuitButton"); GameObject creditsButton = buttons.First((GameObject b) => ((Object)b).name == "Credits"); creditsButton.SetActive(false); RectTransform creditsRect = creditsButton.GetComponent<RectTransform>(); Rect rect = creditsRect.rect; float creditsHeight = ((Rect)(ref rect)).height * 1.3f; CollectionExtensions.Do<GameObject>(buttons, (Action<GameObject>)delegate(GameObject obj) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)obj) && !((Object)(object)obj == (Object)(object)creditsButton)) { Transform transform = obj.transform; Vector3 localPosition = transform.localPosition; if (obj.transform.IsAbove((Transform)(object)creditsRect)) { transform.localPosition = new Vector3(localPosition.x, localPosition.y - creditsHeight, localPosition.z); } } }); Plugin.Logger.LogDebug((object)"Removed credits button."); } private static void AlignButtons(IEnumerable<GameObject> buttons) { //IL_002d: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) RectTransform component = buttons.First((GameObject b) => ((Object)b).name == "HostButton").GetComponent<RectTransform>(); component.SetLocalX(((Transform)component).localPosition.x + 15f); foreach (GameObject button in buttons) { if (!Object.op_Implicit((Object)(object)button)) { Plugin.Logger.LogDebug((object)("Could not align button " + ((Object)button).name)); continue; } RectTransform component2 = button.GetComponent<RectTransform>(); component2.sizeDelta = component.sizeDelta; ((Transform)component2).localPosition = new Vector3(((Transform)component).localPosition.x, ((Transform)component2).localPosition.y, ((Transform)component).localPosition.z); TextMeshProUGUI componentInChildren = button.GetComponentInChildren<TextMeshProUGUI>(true); ((TMP_Text)componentInChildren).transform.FixScale(); TweakTextSettings(componentInChildren); ((TMP_Text)componentInChildren).fontSize = 15f; ((TMP_Text)componentInChildren).wordSpacing = ((TMP_Text)componentInChildren).wordSpacing - 25f; RectTransform component3 = ((Component)componentInChildren).gameObject.GetComponent<RectTransform>(); component3.ResetAnchoredPos(); component3.EditOffsets(Vector2.zero, new Vector2(5f, 0f)); } Plugin.Logger.LogDebug((object)"Aligned menu buttons."); } internal static void TryReplaceVersionText() { if (Cfg.CUSTOM_VERSION_TEXT.Value && !((Object)(object)VersionNum == (Object)null) && !((Object)(object)MenuPanel == (Object)null)) { GameObject obj = Object.Instantiate<GameObject>(VersionNum, MenuPanel); ((Object)obj).name = "VersionNumberText"; versionText = InitTextMesh(obj.GetComponent<TextMeshProUGUI>()); versionTextRect = ((Component)versionText).gameObject.GetComponent<RectTransform>(); versionTextRect.AnchorToBottom(); VersionNum.SetActive(false); } } private static void SetVersion() { bool value = Cfg.ALWAYS_SHORT_VERSION.Value; int num = Math.Abs(GameNetworkManager.Instance.gameVersionNum); gameVer = (value ? realVer : ((num != realVer) ? num : realVer)); } private static TextMeshProUGUI InitTextMesh(TextMeshProUGUI tmp) { SetVersion(); ((TMP_Text)tmp).text = Cfg.VERSION_TEXT.Value; ((TMP_Text)tmp).fontSize = Cfg.VERSION_TEXT_SIZE.ClampedValue(10f, 40f); ((TMP_Text)tmp).alignment = (TextAlignmentOptions)514; TweakTextSettings(tmp); return tmp; } private static void TweakTextSettings(TextMeshProUGUI tmp, bool overflow = true, bool wordWrap = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (overflow) { ((TMP_Text)tmp).overflowMode = (TextOverflowModes)0; } ((TMP_Text)tmp).enableWordWrapping = wordWrap; ((TMP_Text)tmp).faceColor = DARK_ORANGE; } private static void TweakCanvasSettings(GameObject panel, bool changeRenderMode) { Canvas componentInParent = panel.GetComponentInParent<Canvas>(); componentInParent.pixelPerfect = true; if (changeRenderMode) { componentInParent.renderMode = (RenderMode)0; } } private static void FixPanelAlignment(Transform panel) { //IL_0021: 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) RectTransform component = ((Component)panel).gameObject.GetComponent<RectTransform>(); component.ResetSizeDelta(); component.ResetAnchoredPos(); component.EditOffsets(new Vector2(-20f, -25f), new Vector2(20f, 25f)); panel.FixScale(); } } [HarmonyPatch(typeof(GameNetworkManager))] internal class NetworkManagerPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] private static void SetRealVersion(GameNetworkManager __instance) { MenuManagerPatch.realVer = __instance.gameVersionNum; } } [HarmonyPatch(typeof(PreInitSceneScript))] internal class PreInitScenePatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void FinishedFirstLaunch() { IngamePlayerSettings instance = IngamePlayerSettings.Instance; if (instance != null) { instance.SetPlayerFinishedLaunchOptions(); } } [HarmonyPostfix] [HarmonyPatch("SkipToFinalSetting")] internal static void SkipToSelectedMode(PreInitSceneScript __instance, ref bool ___choseLaunchOption) { string selectedMode = Plugin.SelectedMode; if (!(selectedMode != "online") || !(selectedMode != "lan")) { CollectionExtensions.Do<GameObject>((IEnumerable<GameObject>)__instance.LaunchSettingsPanels, (Action<GameObject>)delegate(GameObject panel) { panel.SetActive(false); }); __instance.currentLaunchSettingPanel = 0; ((TMP_Text)__instance.headerText).text = ""; ((Component)__instance.blackTransition).gameObject.SetActive(false); __instance.continueButton.gameObject.SetActive(false); ___choseLaunchOption = true; __instance.mainAudio.PlayOneShot(__instance.selectSFX); SceneManager.LoadSceneAsync((Plugin.SelectedMode == "online") ? "InitScene" : "InitSceneLANMode", (LoadSceneMode)1); } } } [HarmonyPatch(typeof(StartMatchLever))] internal class StartMatchLeverPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void StartMatch(StartMatchLever __instance) { if (Plugin.Config.AUTO_START_GAME.Value && !__instance.leverHasBeenPulled) { ((MonoBehaviour)__instance).StartCoroutine(PullLeverAnim(__instance)); } } private static IEnumerator PullLeverAnim(StartMatchLever instance) { yield return (object)new WaitForSeconds(Plugin.Config.AUTO_START_GAME_DELAY.Value); if (!instance.leverHasBeenPulled) { instance.leverAnimatorObject.SetBool("pullLever", true); instance.leverHasBeenPulled = true; instance.triggerScript.interactable = false; instance.PullLever(); } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("firstDayAnimation")] private static IEnumerator DisableFirstDaySFX(IEnumerator result, StartOfRound __instance) { while (result.MoveNext()) { yield return result.Current; } if (Plugin.Config.DISABLE_FIRST_DAY_SFX.Value) { StopSpeaker(__instance.speakerAudioSource); } } private static void StopSpeaker(AudioSource source) { if (source.isPlaying) { source.Stop(); } } } } namespace IntroTweaks.Data { public class Config { private readonly ConfigFile configFile; public ConfigEntry<bool> PLUGIN_ENABLED { get; private set; } public ConfigEntry<bool> SKIP_SPLASH_SCREENS { get; private set; } public ConfigEntry<bool> SKIP_BOOT_ANIMATION { get; private set; } public ConfigEntry<string> AUTO_SELECT_MODE { get; private set; } public ConfigEntry<bool> AUTO_SELECT_HOST { get; private set; } public ConfigEntry<bool> ALIGN_MENU_BUTTONS { get; private set; } public ConfigEntry<bool> FIX_MENU_CANVAS { get; private set; } public ConfigEntry<bool> FIX_MENU_PANELS { get; private set; } public ConfigEntry<bool> FIX_MORE_COMPANY { get; internal set; } public ConfigEntry<bool> REMOVE_LAN_WARNING { get; private set; } public ConfigEntry<bool> REMOVE_LAUNCHED_IN_LAN { get; private set; } public ConfigEntry<bool> REMOVE_NEWS_PANEL { get; private set; } public ConfigEntry<bool> REMOVE_CREDITS_BUTTON { get; private set; } public ConfigEntry<bool> CUSTOM_VERSION_TEXT { get; private set; } public ConfigEntry<string> VERSION_TEXT { get; private set; } public ConfigEntry<float> VERSION_TEXT_SIZE { get; private set; } public ConfigEntry<float> VERSION_TEXT_OFFSET { get; private set; } public ConfigEntry<bool> ALWAYS_SHORT_VERSION { get; private set; } public ConfigEntry<bool> AUTO_START_GAME { get; private set; } public ConfigEntry<float> AUTO_START_GAME_DELAY { get; private set; } public ConfigEntry<bool> DISABLE_FIRST_DAY_SFX { get; private set; } public ConfigEntry<int> GAME_STARTUP_DISPLAY { get; private set; } public Config(ConfigFile cfg) { configFile = cfg; PLUGIN_ENABLED = NewEntry("bEnabled", defaultVal: true, "Enable or disable the plugin globally."); SKIP_SPLASH_SCREENS = NewEntry(Category.INTRO_TWEAKS, "bSkipSplashScreens", defaultVal: true, "Skips those pesky Unity and Zeekers startup logos!"); } private ConfigEntry<T> NewEntry<T>(string key, T defaultVal, string desc) { return NewEntry(Category.GENERAL, key, defaultVal, desc); } private ConfigEntry<T> NewEntry<T>(Category category, string key, T defaultVal, string desc) { return configFile.Bind<T>(category.Value, key, defaultVal, desc); } public void InitBindings() { SKIP_BOOT_ANIMATION = NewEntry(Category.INTRO_TWEAKS, "bSkipBootAnimation", defaultVal: true, "If the loading animation (booting OS) should be skipped."); AUTO_SELECT_MODE = NewEntry(Category.INTRO_TWEAKS, "sAutoSelectMode", "OFF", "Which mode to automatically enter into after the splash screen.\nValid options: ONLINE, LAN, OFF"); AUTO_SELECT_HOST = NewEntry(Category.INTRO_TWEAKS, "bAutoSelectHost", defaultVal: false, "Whether the 'Host' button is automatically selected when the Online/LAN menu loads."); ALIGN_MENU_BUTTONS = NewEntry(Category.MENU_TWEAKS, "bAlignMenuButtons", defaultVal: true, "If the main menu buttons should align with each other."); FIX_MENU_CANVAS = NewEntry(Category.MENU_TWEAKS, "bFixMenuCanvas", defaultVal: false, "Whether the main menu canvas should have its settings corrected.\nMay cause overlapping issues, only enable it if you don't use other mods that edit the menu."); FIX_MENU_PANELS = NewEntry(Category.MENU_TWEAKS, "bFixMenuPanels", defaultVal: false, "The main menu panels (host, servers, loading screen) all have anchoring, offset and sizing issues.\nThis option helps solve them and improve the look of the menu.\n\nMAY BREAK SOME MODS."); FIX_MORE_COMPANY = NewEntry(Category.MENU_TWEAKS, "bFixMoreCompany", defaultVal: true, "Whether to apply fixes to MoreCompany UI elements.\nFixes include: button placement, header positioning & scaling of cosmetics border.\n\nPRONE TO INCOMPATIBILITIES! TURN THIS OFF IF YOU ENCOUNTER BREAKING BUGS."); REMOVE_LAN_WARNING = NewEntry(Category.MENU_TWEAKS, "bRemoveLanWarning", defaultVal: true, "Hides the warning popup when hosting a LAN session."); REMOVE_LAUNCHED_IN_LAN = NewEntry(Category.MENU_TWEAKS, "bRemoveLaunchedInLanText", defaultVal: true, "Hides the 'Launched in LAN mode' text below the Quit button."); REMOVE_NEWS_PANEL = NewEntry(Category.MENU_TWEAKS, "bRemoveNewsPanel", defaultVal: false, "Hides the panel that displays news such as game updates."); REMOVE_CREDITS_BUTTON = NewEntry(Category.MENU_TWEAKS, "bRemoveCreditsButton", defaultVal: true, "Hides the 'Credits' button on the main menu. The other buttons are automatically adjusted."); CUSTOM_VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "bCustomVersionText", defaultVal: true, "Whether to replace the game's version text with a custom alternative."); VERSION_TEXT = NewEntry(Category.VERSION_TEXT, "sVersionText", "v$VERSION\n[MODDED]", "Replace the game's version text with this custom text in the main menu.\nTo insert the version number, use the $VERSION syntax. E.g. Ver69 would be Ver$VERSION"); VERSION_TEXT_SIZE = NewEntry(Category.VERSION_TEXT, "fVersionTextSize", 20f, "The font size of the version text. Min = 10, Max = 40."); VERSION_TEXT_OFFSET = NewEntry(Category.VERSION_TEXT, "fVersionTextOffset", 0f, "Use this option to adjust the Y position of the version text if it's out of place.\nFor example, when using 3 lines of text, a small positive value would move it back up."); ALWAYS_SHORT_VERSION = NewEntry(Category.VERSION_TEXT, "bAlwaysShortVersion", defaultVal: true, "If the custom version text should always show the short 'real' version.\nThis will ignore mods like LC_API and MoreCompany that change the game version."); AUTO_START_GAME = NewEntry(Category.MISC, "bAutoStartGame", defaultVal: false, "If enabled, the lever will be pulled automatically to begin the landing sequence."); AUTO_START_GAME_DELAY = NewEntry(Category.MISC, "fAutoStartGameDelay", 1.5f, "The delay before the lever is automatically pulled when bAutoStartGame is true.\nMinimum: 1 | Maximum: 30"); DISABLE_FIRST_DAY_SFX = NewEntry(Category.MISC, "bDisableFirstDaySFX", defaultVal: false, "Toggles the first day ship speaker SFX."); GAME_STARTUP_DISPLAY = NewEntry(Category.MISC, "iGameStartupDisplay", 0, "The index of the monitor to display the game on when starting.\nYou can find these indexes in your Windows display settings.\nDefaults to 0 (main monitor)."); } } public struct Category { public static Category GENERAL => new Category("0 >> General << 0"); public static Category INTRO_TWEAKS => new Category("1 >> Intro << 1"); public static Category MENU_TWEAKS => new Category("2 >> Main Menu << 2"); public static Category VERSION_TEXT => new Category("3 >> Custom Version Text << 3"); public static Category MISC => new Category("4 >> Miscellaneous << 4"); public string Value { get; private set; } public Category(string value) { Value = value; } } }
BepInEx/plugins/plugins/fixes/LC_Optim.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("LC_Optim")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Source moment")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LC_Optim")] [assembly: AssemblyTitle("LC_Optim")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LC_Optim; [BepInPlugin("mnc.fixcentipedelag", "FixCentipedeLag", "2023.12.7")] public class Plugin : BaseUnityPlugin { private Harmony thisHarmony; private static Dictionary<int, ulong> instanceMap = new Dictionary<int, ulong>(); private static ulong deadtimer = 100uL; private static ManualLogSource Log; private static ConfigEntry<bool> configShowDebug; private static void Debug(object data, LogLevel logLevel = 16) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (configShowDebug.Value) { Log.Log(logLevel, data); } } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown configShowDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable debug printing", true, "Enabling this will show debug info in console, e.g. when a new centipede gets tracked or removed."); thisHarmony = new Harmony("mnc.fixcentipedelag"); thisHarmony.Patch((MethodBase)typeof(CentipedeAI).GetMethod("DoAIInterval"), new HarmonyMethod(typeof(Plugin), "RemoveLagCentipede", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug("Registered the patch method", (LogLevel)4); Log = ((BaseUnityPlugin)this).Logger; } public static void RemoveLagCentipede(CentipedeAI __instance) { if (((EnemyAI)__instance).TargetClosestPlayer(1.5f, false, 70f)) { return; } int instanceID = ((Object)__instance).GetInstanceID(); ulong num = (ulong)Time.frameCount; if (!instanceMap.ContainsKey(instanceID)) { instanceMap.Add(instanceID, num); Debug($"Tracked {instanceID}", (LogLevel)16); return; } ulong num2 = instanceMap[instanceID]; if (num - num2 <= deadtimer) { ((EnemyAI)__instance).KillEnemy(true); instanceMap.Remove(instanceID); Debug($"Removed centipede at {instanceID}", (LogLevel)16); } else { instanceMap[instanceID] = num; } } public void OnDestroy() { thisHarmony.UnpatchSelf(); } } internal class PluginMetadata { public const string PLUGIN_GUID = "mnc.fixcentipedelag"; public const string PLUGIN_NAME = "FixCentipedeLag"; public const string PLUGIN_VERSION = "2023.12.7"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "LC_Optim"; public const string PLUGIN_NAME = "LC_Optim"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/plugins/fixes/Linkoid.Dissonance.LagFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Dissonance; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Linkoid.Dissonance.LagFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Linkoid.Dissonance.LagFix")] [assembly: AssemblyCopyright("Copyright © linkoid 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("07f63a54-331c-49fa-870c-ee582bb74fd3")] [assembly: AssemblyFileVersion("1.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.8746.28325")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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 Linkoid.Dissonance.LagFix { [BepInPlugin("Linkoid.Dissonance.LagFix", "Dissonance Lag Fix", "1.0")] public sealed class DissonanceLagFixPlugin : BaseUnityPlugin { private void Awake() { Logs.SetLogLevel((LogCategory)1, (LogLevel)4); } } public static class PluginInfo { internal const string GUID = "Linkoid.Dissonance.LagFix"; internal const string NAME = "Dissonance Lag Fix"; internal const string VERSION = "1.0"; public static readonly string Guid = "Linkoid.Dissonance.LagFix"; public static readonly string Name = "Dissonance Lag Fix"; public static readonly string Version = "1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/plugins/fixes/NameFix.dll
Decompiled 2 years agousing System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NameFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NameFix")] [assembly: AssemblyCopyright("Copyright © BlueAmulet 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9a85f7c4-c974-4bff-b83a-5cbcde42b246")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.1.0")] namespace NameFix { [BepInPlugin("BlueAmulet.NameFix", "NameFix", "1.0.1")] public class NameFix : BaseUnityPlugin { internal const string Name = "NameFix"; internal const string Author = "BlueAmulet"; internal const string ID = "BlueAmulet.NameFix"; internal const string Version = "1.0.1"; public void Awake() { //IL_0005: 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) Harmony val = new Harmony("BlueAmulet.NameFix"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches"); val.PatchAll(Assembly.GetExecutingAssembly()); int num = 0; foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name)); num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied")); } public static string NoPunctuation(string input) { return new string(input.Where((char c) => char.IsLetterOrDigit(c) || c == '_').ToArray()); } } } namespace NameFix.Patches { [HarmonyPatch] internal static class NameSanitizePatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "NoPunctuation")] public static bool Prefix1(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "NoPunctuation")] public static bool Prefix2(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "NoPunctuation")] public static bool Prefix3(ref string __result, string input) { __result = NameFix.NoPunctuation(input); return false; } } }
BepInEx/plugins/plugins/fixes/RankFix.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RankFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RankFix")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ed4b0141-4dda-408b-935b-2970c6691c98")] [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 RankFix; [BepInPlugin("LCMOD.RankFix", "RankFix", "1.0.1")] public class RankFixBase : BaseUnityPlugin { [HarmonyPatch(typeof(HUDManager))] private class HUDManagerPatches { [HarmonyPatch("SetSavedValues")] [HarmonyPostfix] private static void HUDSetSavedValues(HUDManager __instance) { if (NetworkManager.Singleton.IsHost) { GameNetworkManager.Instance.localPlayerController.playerLevelNumber = __instance.localPlayerLevel; } } } public const string MODGUID = "LCMOD.RankFix"; public const string MODNAME = "RankFix"; public const string MODVERSION = "1.0.1"; private readonly Harmony harmony = new Harmony("LCMOD.RankFix"); public static RankFixBase Instance; public static ManualLogSource logger; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod LCMOD.RankFix is loaded!"); harmony.PatchAll(typeof(HUDManagerPatches)); } }
BepInEx/plugins/plugins/fixes/SignalTranslatorAligner.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; 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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("SignalTranslatorAligner")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("SignalTranslatorAligner")] [assembly: AssemblyTitle("SignalTranslatorAligner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] namespace SignalTranslatorAligner; [HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")] internal class DisplaySignalTranslatorMessage { private static void Prefix(ref bool __runOriginal, ref IEnumerator __result, Animator ___signalTranslatorAnimator, AudioSource ___UIAudio, TextMeshProUGUI ___signalTranslatorText, string signalMessage, int seed, SignalTranslator signalTranslator) { __runOriginal = false; Plugin.Instance.LogInfo("DisplaySignalTranslatorMessage hooked"); __result = ReplacedRoutine(); IEnumerator ReplacedRoutine() { Random signalMessageRandom = new Random(seed + StartOfRound.Instance.randomMapSeed); ___signalTranslatorAnimator.SetBool("transmitting", true); signalTranslator.localAudio.Play(); ___UIAudio.PlayOneShot(signalTranslator.startTransmissionSFX, 1f); string trimedMessage = signalMessage.Trim(); ((TMP_Text)___signalTranslatorText).text = "<#00000000>" + trimedMessage + "</color>"; yield return (object)new WaitForSeconds(1.21f); for (int i = 0; i <= trimedMessage.Length; i++) { if ((Object)(object)signalTranslator == (Object)null) { break; } if (!((Component)signalTranslator).gameObject.activeSelf) { break; } ___UIAudio.PlayOneShot(signalTranslator.typeTextClips[Random.Range(0, signalTranslator.typeTextClips.Length)]); string text = trimedMessage.Substring(0, i) + "<#00000000>" + trimedMessage.Substring(i, trimedMessage.Length - i) + "</color>"; ((TMP_Text)___signalTranslatorText).text = text; float num = Mathf.Min((float)signalMessageRandom.Next(-1, 4) * 0.5f, 0f); yield return (object)new WaitForSeconds(0.7f + num); } if ((Object)(object)signalTranslator != (Object)null) { ___UIAudio.PlayOneShot(signalTranslator.finishTypingSFX); signalTranslator.localAudio.Stop(); } yield return (object)new WaitForSeconds(0.5f); ___signalTranslatorAnimator.SetBool("transmitting", false); } } } [HarmonyPatch(typeof(HUDManager), "Awake")] internal class AwakePatch { private static void Postfix(TextMeshProUGUI ___signalTranslatorText) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((TMP_Text)___signalTranslatorText).transform.GetParent(); RectTransform val = (RectTransform)parent.GetChild(1); RectTransform val2 = (RectTransform)parent.GetChild(2); val.anchorMin = new Vector2(0f, 0.5f); val.anchorMax = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(0f, val.sizeDelta.y); TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).margin = new Vector4(0f, 0f, val.anchoredPosition.x * 2f, 0f); ((TMP_Text)component).alignment = (TextAlignmentOptions)514; val2.anchorMin = new Vector2(0f, 0.5f); val2.anchorMax = new Vector2(1f, 0.5f); val2.sizeDelta = new Vector2(0f, val2.sizeDelta.y); TextMeshProUGUI component2 = ((Component)val2).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).margin = new Vector4(0f, 0f, val2.anchoredPosition.x * 2f, 0f); ((TMP_Text)component2).alignment = (TextAlignmentOptions)514; ((TMP_Text)___signalTranslatorText).alignment = (TextAlignmentOptions)514; ((TMP_Text)___signalTranslatorText).rectTransform.anchorMin = new Vector2(0f, 0.5f); ((TMP_Text)___signalTranslatorText).rectTransform.anchorMax = new Vector2(1f, 0.5f); ((TMP_Text)___signalTranslatorText).rectTransform.anchoredPosition = new Vector2(0f, ((TMP_Text)___signalTranslatorText).rectTransform.anchoredPosition.y); ((TMP_Text)___signalTranslatorText).rectTransform.sizeDelta = new Vector2(0f, ((TMP_Text)___signalTranslatorText).rectTransform.sizeDelta.y); } } internal class PluginInfo { public const string GUID = "lekakid.lcsignaltranslatoraligner"; public const string Name = "SignalTranslatorAligner"; public const string Version = "1.0.0"; } [BepInPlugin("lekakid.lcsignaltranslatoraligner", "SignalTranslatorAligner", "1.0.0")] internal class Plugin : BaseUnityPlugin { public static Plugin Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } public void LogInfo(string msg) { ((BaseUnityPlugin)this).Logger.LogInfo((object)msg); } public void LogWarning(string msg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)msg); } public void LogError(string msg) { ((BaseUnityPlugin)this).Logger.LogError((object)msg); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "SignalTranslatorAligner"; public const string PLUGIN_NAME = "SignalTranslatorAligner"; public const string PLUGIN_VERSION = "1.1.0"; }
BepInEx/plugins/plugins/fixes/SlimeTamingFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; [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("Fixes a bug that made Hygroderes unable to be tamed with Boomboxes.")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+38f01b21fff41249851eaa3d5a7686cfd554bb79")] [assembly: AssemblyProduct("SlimeTamingFix")] [assembly: AssemblyTitle("SlimeTamingFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SlimeTamingFix { public static class PluginInfo { public const string PLUGIN_ID = "SlimeTamingFix"; public const string PLUGIN_NAME = "SlimeTamingFix"; public const string PLUGIN_VERSION = "1.0.2"; public const string PLUGIN_GUID = "com.elitemastereric.slimetamingfix"; } [BepInPlugin("com.elitemastereric.slimetamingfix", "SlimeTamingFix", "1.0.2")] public class Plugin : BaseUnityPlugin { public ManualLogSource PluginLogger; public static Plugin Instance { get; private set; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Instance = this; PluginLogger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("com.elitemastereric.slimetamingfix"); val.PatchAll(); PluginLogger.LogInfo((object)"Plugin SlimeTamingFix (com.elitemastereric.slimetamingfix) is loaded!"); } } } namespace SlimeTamingFix.Patch { [HarmonyPatch(typeof(BlobAI))] [HarmonyPatch("OnCollideWithPlayer")] internal class BlobAIOnCollideWithPlayerPatch { public static bool Prefix(BlobAI __instance) { float value = Traverse.Create((object)__instance).Field("tamedTimer").GetValue<float>(); float value2 = Traverse.Create((object)__instance).Field("angeredTimer").GetValue<float>(); if (value > 0f && value2 <= 0f) { return false; } return true; } } }
BepInEx/plugins/plugins/fixes/SprintLadderFix.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using SprintLadderFix.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SprintLadderFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SprintLadderFix")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cd8cad2b-a700-4306-b8a2-1eb833c9d281")] [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 SprintToggleFix { [BepInPlugin("MoonJuice.SprintLadderFix", "SprintLadderFix", "1.0.0")] public class SprintLadderFix : BaseUnityPlugin { private const string modGUID = "MoonJuice.SprintLadderFix"; private const string modName = "SprintLadderFix"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("MoonJuice.SprintLadderFix"); private static SprintLadderFix Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("MoonJuice.SprintLadderFix"); mls.LogInfo((object)"SprintLadderFix loaded"); harmony.PatchAll(typeof(SprintLadderFix)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } } namespace SprintLadderFix.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void sprintLadderFix(ref bool ___isClimbingLadder, ref bool ___isSprinting) { if (___isClimbingLadder) { ___isSprinting = false; } } } }
BepInEx/plugins/plugins/HideModList.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using 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/plugins/HoldScanButton.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using HoldScanButton.Patches; using Microsoft.CodeAnalysis; using UnityEngine; 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("HoldScanButton")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A mod which allows you to hold the scan button instead of needing to spam it.")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+92607af20e0f471d869a59ef64bf096440b07cf2")] [assembly: AssemblyProduct("HoldScanButton")] [assembly: AssemblyTitle("HoldScanButton")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HoldScanButton { [BepInPlugin("HoldScanButton", "HoldScanButton", "1.1.1")] public class HoldScanButtonPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("HoldScanButton"); public static HoldScanButtonPlugin Instance; internal ManualLogSource logger; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("HoldScanButton"); logger.LogInfo((object)"Plugin HoldScanButton has loaded!"); harmony.PatchAll(typeof(HoldScanButtonPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "HoldScanButton"; public const string PLUGIN_NAME = "HoldScanButton"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace HoldScanButton.Patches { internal class HoldScanButtonPatch { private static CallbackContext pingContext; [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] private static void UpdatePatch(HUDManager __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false).IsPressed()) { __instance.PingScan_performed(pingContext); } } [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] [HarmonyPrefix] private static void OnScan(HUDManager __instance, CallbackContext context) { //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) pingContext = context; } } }
BepInEx/plugins/plugins/ItemDropCycler.dll
Decompiled 2 years agousing 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 ItemDropCycler.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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ItemDropCycler")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItemDropCycler")] [assembly: AssemblyTitle("ItemDropCycler")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ItemDropCycler { [BepInPlugin("LCMOD.ItemDropCycler", "ItemDropCycler", "1.1.0")] public class ItemDropCyclerBase : BaseUnityPlugin { public const string MODGUID = "LCMOD.ItemDropCycler"; public const string MODNAME = "ItemDropCycler"; public const string MODVERSION = "1.1.0"; private readonly Harmony harmony = new Harmony("LCMOD.ItemDropCycler"); public static ItemDropCyclerBase Instance; public static ManualLogSource logger; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod LCMOD.ItemDropCycler is loaded!"); harmony.PatchAll(typeof(ItemDropCyclerBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } } namespace ItemDropCycler.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("DiscardHeldObject")] [HarmonyPostfix] private static void CycleSlotsOnDrop() { ItemDropCyclerBase.logger.LogInfo((object)"Item Dropped"); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; MethodInfo method = typeof(PlayerControllerB).GetMethod("NextItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method3 = typeof(PlayerControllerB).GetMethod("SwitchItemSlotsServerRpc", BindingFlags.Instance | BindingFlags.NonPublic); object[] parameters = new object[1] { true }; object obj = method.Invoke(localPlayerController, parameters); object[] parameters2 = new object[2] { obj, null }; ItemDropCyclerBase.logger.LogInfo((object)$"Got slot at {obj} \tOld: {localPlayerController.currentItemSlot}"); method2.Invoke(localPlayerController, parameters2); method3.Invoke(localPlayerController, parameters); ItemDropCyclerBase.logger.LogInfo((object)$"Set slot at {obj}"); } } }
BepInEx/plugins/plugins/JetpackWarning.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Hamunii")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A Lethal Company Mod that adds a visual and audio indicator for when your jetpack is about to explode.")] [assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyInformationalVersion("2.2.0")] [assembly: AssemblyProduct("JetpackWarning")] [assembly: AssemblyTitle("JetpackWarning")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.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 JetpackWarning { public static class Assets { public static string mainAssetBundleName = "jetpackAssets"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(',')[0]; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName)) { MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } [BepInPlugin("JetpackWarning", "JetpackWarning", "2.2.0")] public class JetpackWarningPlugin : BaseUnityPlugin { public static Harmony _harmony; public static AudioClip jetpackCriticalBeep; public static GameObject meterContainer; public static GameObject meter; public static GameObject frame; public static GameObject warning; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JetpackWarning is loaded!"); Assets.PopulateAssets(); _harmony = new Harmony("JetpackWarning"); _harmony.PatchAll(typeof(Patches)); SceneManager.sceneLoaded += OnSceneRelayLoaded; jetpackCriticalBeep = Assets.MainAssetBundle.LoadAsset<AudioClip>("JetpackCriticalBeep"); } private void OnSceneRelayLoaded(Scene scene, LoadSceneMode loadMode) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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) if (((Scene)(ref scene)).name == "SampleSceneRelay") { GameObject val = GameObject.Find("IngamePlayerHUD"); meterContainer = new GameObject("jetpackMeterContainer"); meterContainer.AddComponent<CanvasGroup>(); RectTransform obj = meterContainer.AddComponent<RectTransform>(); ((Transform)obj).parent = val.transform; ((Transform)obj).localScale = Vector3.one; obj.anchoredPosition = Vector2.zero; ((Transform)obj).localPosition = Vector2.op_Implicit(new Vector2(50f, 0f)); obj.sizeDelta = Vector2.one; meter = AddImageToHUD("jetpackMeter", scene); frame = AddImageToHUD("jetpackMeterFrame", scene); warning = AddImageToHUD("jetpackMeterWarning", scene); GameObject[] array = (GameObject[])(object)new GameObject[3] { meter, frame, warning }; foreach (GameObject obj2 in array) { obj2.transform.parent = meterContainer.transform; obj2.transform.localPosition = Vector2.op_Implicit(Vector2.zero); } meter.GetComponent<Image>().type = (Type)3; meter.GetComponent<Image>().fillMethod = (FillMethod)1; Transform transform = warning.transform; transform.localPosition += new Vector3(30f, 0f); } } private GameObject AddImageToHUD(string imageName, Scene scene) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown Sprite val = Assets.MainAssetBundle.LoadAsset<Sprite>(imageName); GameObject val2 = new GameObject(imageName); SceneManager.MoveGameObjectToScene(val2, scene); GameObject val3 = GameObject.Find("IngamePlayerHUD"); RectTransform obj = val2.AddComponent<RectTransform>(); ((Transform)obj).parent = val3.transform; ((Transform)obj).localScale = Vector2.op_Implicit(Vector2.one); obj.anchoredPosition = Vector2.zero; ((Transform)obj).localPosition = Vector2.op_Implicit(Vector2.zero); Rect rect = val.rect; float num = ((Rect)(ref rect)).width / 2f; rect = val.rect; obj.sizeDelta = new Vector2(num, ((Rect)(ref rect)).height / 2f); val2.AddComponent<Image>().sprite = val; val2.AddComponent<CanvasRenderer>(); return val2; } } internal class Patches { private static bool playJetpackCritical = false; private static bool playingJetpackCritical = false; private static float criticalFill = 0.75f; [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] private static void PlayerControllerB_LateUpdate_Postfix(ref PlayerControllerB __instance) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_008a: 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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject) || !__instance.isPlayerControlled || __instance.isPlayerDead) { return; } if (__instance.isHoldingObject && __instance.currentlyHeldObjectServer is JetpackItem) { JetpackItem val = (JetpackItem)__instance.currentlyHeldObjectServer; JetpackWarningPlugin.meterContainer.SetActive(true); Vector3 val2 = (Vector3)typeof(JetpackItem).GetField("forces", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val); float num = (float)typeof(JetpackItem).GetField("jetpackPower", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val); float num2 = ((!(num < 80f)) ? (0.5f - Mathf.Clamp(num / 20f - 4f, 0f, 1f) / 2f) : (Mathf.Clamp(num / 25f - 2.2f, 0f, 1f) / 2f)); if (((Vector3)(ref val2)).magnitude > 47f) { num2 = Mathf.Clamp(((Vector3)(ref val2)).magnitude / 3f - 15.6666f, 0f, 1f); } float num3 = ((((Vector3)(ref val2)).magnitude >= 0f) ? (((Vector3)(ref val2)).magnitude / 50f) : 0f); float num4 = Mathf.Lerp((((Vector3)(ref val2)).magnitude / 2f + num / 2.25f >= 0f) ? ((((Vector3)(ref val2)).magnitude / 2f + num / 2.25f) / 50f) : 0f, num3, num2); JetpackWarningPlugin.meter.GetComponent<Image>().fillAmount = num4; JetpackWarningPlugin.warning.SetActive(num4 > criticalFill); playJetpackCritical = num4 > criticalFill; Color color = Color.Lerp(new Color(1f, 0.82f, 0.405f, 1f), new Color(0.769f, 0.243f, 0.243f, 1f), num4); ((Graphic)JetpackWarningPlugin.meter.GetComponent<Image>()).color = color; ((Graphic)JetpackWarningPlugin.frame.GetComponent<Image>()).color = color; ((Graphic)JetpackWarningPlugin.warning.GetComponent<Image>()).color = color; if (playJetpackCritical) { if (!playingJetpackCritical) { playingJetpackCritical = true; val.jetpackBeepsAudio.clip = JetpackWarningPlugin.jetpackCriticalBeep; val.jetpackBeepsAudio.Play(); } } else { playingJetpackCritical = false; } } else { JetpackWarningPlugin.meterContainer.SetActive(false); } } [HarmonyPatch(typeof(JetpackItem), "SetJetpackAudios")] [HarmonyPrefix] private static bool JetpackItem_SetJetpackAudios_Prefix(ref bool ___jetpackActivated, ref AudioSource ___jetpackBeepsAudio) { return !playingJetpackCritical; } [HarmonyPatch(typeof(JetpackItem), "JetpackEffect")] [HarmonyPostfix] private static void JetpackItem_JetpackEffect_Postfix(ref bool __0, JetpackItem __instance) { if (__0 && playJetpackCritical) { playingJetpackCritical = true; __instance.jetpackBeepsAudio.clip = JetpackWarningPlugin.jetpackCriticalBeep; __instance.jetpackBeepsAudio.Play(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "JetpackWarning"; public const string PLUGIN_NAME = "JetpackWarning"; public const string PLUGIN_VERSION = "2.2.0"; } }
BepInEx/plugins/plugins/LCAmmoCheck.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LCAmmoCheck")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Mod that allows you to check ammo in shotgun")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+09faa498f4a0e28be67bf9ce9655783d408c92ee")] [assembly: AssemblyProduct("LCAmmoCheck")] [assembly: AssemblyTitle("LCAmmoCheck")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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 System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace LCAmmoCheck { [BepInPlugin("me.axd1x8a.lcammocheck", "LCAmmoCheck", "1.1.1")] public class LCAmmoCheckPlugin : BaseUnityPlugin { private static Harmony? harmony; public static LCAmmoCheckPlugin? Instance { get; private set; } public static AnimationClip? ShotgunInspectClip { get; private set; } public static AudioClip? ShotgunInspectSFX { get; private set; } private static void LoadAssetBundle() { AssetBundle obj = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("LCAmmoCheck.lcammocheck")); ShotgunInspectClip = obj.LoadAsset<AnimationClip>("Assets/AnimationClip/ShotgunInspect.anim"); ShotgunInspectSFX = obj.LoadAsset<AudioClip>("Assets/AudioClip/ShotgunInspect.ogg"); AudioClip? shotgunInspectSFX = ShotgunInspectSFX; if (shotgunInspectSFX != null) { shotgunInspectSFX.LoadAudioData(); } obj.Unload(false); } public void Awake() { Instance = this; LoadAssetBundle(); harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.axd1x8a.lcammocheck"); ((BaseUnityPlugin)this).Logger.Log((LogLevel)8, (object)"LCAmmoCheck loaded!"); } public static void OnDestroy() { Harmony? obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Instance = null; harmony = null; Debug.Log((object)"LCAmmoCheck unloaded!"); } } internal static class GeneratedPluginInfo { public const string Identifier = "me.axd1x8a.lcammocheck"; public const string Name = "LCAmmoCheck"; public const string Version = "1.1.1"; } } namespace LCAmmoCheck.Patches { [HarmonyPatch(typeof(ShotgunItem))] internal sealed class ShotgunItemPatch { private static readonly Dictionary<int, AnimationClip> originalClips = new Dictionary<int, AnimationClip>(); private static AnimatorOverrideController OverrideController(Animator animator) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController; AnimatorOverrideController val = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null); if (val != null) { return val; } return (AnimatorOverrideController)(object)(animator.runtimeAnimatorController = (RuntimeAnimatorController)new AnimatorOverrideController(animator.runtimeAnimatorController)); } private static IEnumerator CheckAmmoAnimation(ShotgunItem s) { AnimatorOverrideController overrideController = OverrideController(((GrabbableObject)s).playerHeldBy.playerBodyAnimator); int playerAnimatorId = ((Object)((GrabbableObject)s).playerHeldBy.playerBodyAnimator).GetInstanceID(); originalClips[playerAnimatorId] = overrideController["ShotgunReloadOneShell"]; overrideController["ShotgunReloadOneShell"] = LCAmmoCheckPlugin.ShotgunInspectClip; s.isReloading = true; ((Renderer)s.shotgunShellLeft).enabled = s.shellsLoaded > 0; ((Renderer)s.shotgunShellRight).enabled = s.shellsLoaded > 1; ((GrabbableObject)s).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", true); yield return (object)new WaitForSeconds(0.3f); s.gunAudio.PlayOneShot(LCAmmoCheckPlugin.ShotgunInspectSFX); s.gunAnimator.SetBool("Reloading", true); yield return (object)new WaitForSeconds(0.95f); yield return (object)new WaitForSeconds(0.95f); yield return (object)new WaitForSeconds(0.15f); s.gunAnimator.SetBool("Reloading", false); yield return (object)new WaitForSeconds(0.25f); ((GrabbableObject)s).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false); yield return (object)new WaitForSeconds(0.25f); originalClips.Remove(playerAnimatorId, out AnimationClip value); overrideController["ShotgunReloadOneShell"] = value; s.isReloading = false; } private static void CleanUp(Animator animator) { RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController; AnimatorOverrideController val = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null); if (val != null && originalClips.Remove(((Object)animator).GetInstanceID(), out AnimationClip value)) { val["ShotgunReloadOneShell"] = value; } } [HarmonyPrefix] [HarmonyPatch("StopUsingGun")] public static bool StopUsingGunPrefix(ShotgunItem __instance) { CleanUp((((GrabbableObject)__instance).playerHeldBy ?? __instance.previousPlayerHeldBy).playerBodyAnimator); return true; } [HarmonyPrefix] [HarmonyPatch("StartReloadGun")] public static bool StartReloadGunPrefix(ShotgunItem __instance) { if (!__instance.ReloadedGun() || __instance.shellsLoaded >= 2) { if (__instance.gunCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(__instance.gunCoroutine); } __instance.gunCoroutine = ((MonoBehaviour)__instance).StartCoroutine(CheckAmmoAnimation(__instance)); return false; } return true; } [HarmonyPrefix] [HarmonyPatch("ItemInteractLeftRight")] public static bool ItemInteractLeftRightPrefix(ShotgunItem __instance, bool right) { if (!right) { return true; } if ((Object)(object)((RaycastHit)(ref ((GrabbableObject)__instance).playerHeldBy.hit)).collider != (Object)null && ((Component)((RaycastHit)(ref ((GrabbableObject)__instance).playerHeldBy.hit)).collider).tag == "InteractTrigger") { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("Start")] public static bool StartPrefix(ShotgunItem __instance) { ((GrabbableObject)__instance).itemProperties.toolTips[1] = "Reload / Check ammo : [E]"; return true; } [HarmonyTranspiler] [HarmonyPatch(typeof(ShotgunItem), "StartReloadGun")] public static IEnumerable<CodeInstruction> StartReloadGunTranspiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call && ((MethodInfo)list[i].operand).Name == "ReloadedGun") { list[i - 1].opcode = OpCodes.Nop; list[i].opcode = OpCodes.Ldc_I4_1; list[i].operand = null; break; } } return list.AsEnumerable(); } [HarmonyTranspiler] [HarmonyPatch(typeof(ShotgunItem), "ItemInteractLeftRight")] public static IEnumerable<CodeInstruction> ItemInteractLeftRightTranspiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && list[i].operand.ToString().Contains("shellsLoaded")) { list[i + 1].opcode = OpCodes.Ldc_I4_3; break; } } return list.AsEnumerable(); } } }
BepInEx/plugins/plugins/LethalLoudnessMeter.dll
Decompiled 2 years 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 LethalLoudnessMeter.Patches; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LoudnessMeter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LoudnessMeter")] [assembly: AssemblyCopyright("Copyright © extraes 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("368a271e-98d6-48f8-981e-60df5875ea73")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyVersion("1.0.2.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 LethalLoudnessMeter { internal static class BuildInfo { public const string GUID = "xyz.extraes.lethalLoudness"; public const string NAME = "LoudnessMeter"; public const string SHORT_NAME = "LoudMeter"; public const string VERSION = "1.0.2"; public const string AUTHOR = "extraes"; } internal static class LMUtils { public static MethodInfo AsInfo<T>(T dele) where T : Delegate { return dele.Method; } public static HarmonyMethod ToHarmony<T>(T dele) where T : Delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return new HarmonyMethod(AsInfo(dele)); } } [BepInPlugin("xyz.extraes.lethalLoudness", "LoudMeter", "1.0.2")] public sealed class LoudnessMeterPlugin : BaseUnityPlugin { private Image volumeImg; private Collider playersCollider; private float accumulatedVolume; public static LoudnessMeterPlugin Instance { get; private set; } public static ManualLogSource Log { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) LoudnessMeterPlugin instance = Instance; return (ManualLogSource)(((object)((instance != null) ? ((BaseUnityPlugin)instance).Logger : null)) ?? ((object)new ManualLogSource("LoudMeter"))); } } public bool NeedsSnatchedImage => (Object)(object)volumeImg == (Object)null; internal static Harmony Harmony { get; private set; } static LoudnessMeterPlugin() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Log.LogMessage((object)"Initializing Lethal Loudness Meter..."); Stopwatch stopwatch = Stopwatch.StartNew(); Harmony = new Harmony("xyz.extraes.lethalLoudness"); Harmony.PatchAll(); FootstepPatches.Init(); ItemPatches.Init(); Log.LogInfo((object)("Initialized LethalLoudness in " + stopwatch.ElapsedMilliseconds + "ms")); } private void Awake() { Instance = this; Object.DontDestroyOnLoad((Object)(object)this); PlayAudibleNoisePatch.noisePlayed = (Action<Vector3, float, float>)Delegate.Combine(PlayAudibleNoisePatch.noisePlayed, new Action<Vector3, float, float>(NoisePlayed)); } private void NoisePlayed(Vector3 pos, float range, float vol) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } if ((Object)(object)playersCollider == (Object)null) { playersCollider = ((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<Collider>(); } if (playersCollider.enabled) { Vector3 val = playersCollider.ClosestPoint(pos); if (!(Vector3.Distance(pos, val) > 0.8f)) { accumulatedVolume += vol; } } } private void Update() { if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } if ((Object)(object)volumeImg == (Object)null && accumulatedVolume != 0f) { Log.LogError((object)"Volume image wasn't found! Wha?"); return; } if (volumeImg.fillAmount < accumulatedVolume) { volumeImg.fillAmount = Mathf.Clamp(accumulatedVolume, 0.05f, 1f); } else { float fillAmount = volumeImg.fillAmount; float num = Mathf.Clamp(accumulatedVolume, 0.01f, 1f); float num2 = Mathf.Clamp(Time.deltaTime * 3f, 0f, 1f); volumeImg.fillAmount = Mathf.Lerp(fillAmount, num, num2); } accumulatedVolume = 0f; } private void OnDestroy() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) Log.LogError((object)"Creating new GameObject to host LoudnessMeter..."); new GameObject("LMP").AddComponent<LoudnessMeterPlugin>(); } public void SetVolumeImage(Image img) { if ((Object)(object)volumeImg != (Object)null) { Log.LogWarning((object)"Volume img isn't null but you're replacing it? Whar?"); } volumeImg = img; } } } namespace LethalLoudnessMeter.Patches { internal static class FootstepPatches { public static void Init() { MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "PlayFootstepServer", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.DeclaredMethod(typeof(PlayerControllerB), "PlayFootstepLocal", (Type[])null, (Type[])null); HarmonyMethod val = LMUtils.ToHarmony<Action<PlayerControllerB>>(FootstepServer); HarmonyMethod val2 = LMUtils.ToHarmony<Action<PlayerControllerB>>(FootstepLocal); LoudnessMeterPlugin.Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); LoudnessMeterPlugin.Harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void FootstepServer(PlayerControllerB __instance) { } private static void FootstepLocal(PlayerControllerB __instance) { } } internal static class ItemPatches { public static void Init() { } } [HarmonyPatch(typeof(DisplayPlayerMicVolume), "Awake")] internal static class MicVolumeSnatcher { public static void Postfix(DisplayPlayerMicVolume __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0069: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(((Component)__instance.volumeMeterImage).gameObject); Image component = obj.GetComponent<Image>(); RectTransform val = (RectTransform)obj.transform; CanvasRenderer canvasRenderer = ((Graphic)component).canvasRenderer; GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner"); ((Transform)val).SetParent(val2.transform, true); val.anchoredPosition3D = new Vector3(-10f, 40f, 0f); ((Transform)val).localScale = new Vector3(15f, 15f, 15f); canvasRenderer.SetAlpha(4f); component.fillAmount = 1f; LoudnessMeterPlugin.Log.LogMessage((object)"Snatched mic volume!"); LoudnessMeterPlugin.Instance.SetVolumeImage(component); } } [HarmonyPatch(typeof(RoundManager), "PlayAudibleNoise")] internal static class PlayAudibleNoisePatch { public static Action<Vector3, float, float> noisePlayed; public static void Postfix(Vector3 noisePosition, float noiseRange, float noiseLoudness) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) noisePlayed?.Invoke(noisePosition, noiseRange, noiseLoudness); } } [HarmonyPatch(typeof(HUDManager), "Awake")] internal static class SettingsPanelActivator { public static void Postfix() { Transform obj = GameObject.Find("Systems/UI/Canvas").transform.Find("QuickMenu"); Transform val = obj.Find("SettingsPanel"); ((Component)obj).gameObject.SetActive(true); ((Component)val).gameObject.SetActive(true); ((Component)val).gameObject.SetActive(false); ((Component)obj).gameObject.SetActive(false); LoudnessMeterPlugin.Log.LogMessage((object)"Toggled QuickMenu -> SettingsPanel successfully"); } } }
BepInEx/plugins/plugins/MoreSuits.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("MoreSuits")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that adds more suit options to Lethal Company")] [assembly: AssemblyFileVersion("1.4.3.0")] [assembly: AssemblyInformationalVersion("1.4.3")] [assembly: AssemblyProduct("MoreSuits")] [assembly: AssemblyTitle("MoreSuits")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.3.0")] [module: UnverifiableCode] namespace MoreSuits; [BepInPlugin("x753.More_Suits", "More Suits", "1.4.3")] public class MoreSuitsMod : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(ref StartOfRound __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown try { if (SuitsAdded) { return; } int count = __instance.unlockablesList.unlockables.Count; UnlockableItem val = new UnlockableItem(); int num = 0; for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++) { UnlockableItem val2 = __instance.unlockablesList.unlockables[i]; if (!((Object)(object)val2.suitMaterial != (Object)null) || !val2.alreadyUnlocked) { continue; } val = val2; List<string> list = Directory.GetDirectories(Paths.PluginPath, "moresuits", SearchOption.AllDirectories).ToList(); List<string> list2 = new List<string>(); List<string> list3 = new List<string>(); List<string> list4 = DisabledSuits.ToLower().Replace(".png", "").Split(',') .ToList(); List<string> list5 = new List<string>(); if (!LoadAllSuits) { foreach (string item2 in list) { if (File.Exists(Path.Combine(item2, "!less-suits.txt"))) { string[] collection = new string[9] { "glow", "kirby", "knuckles", "luigi", "mario", "minion", "skeleton", "slayer", "smile" }; list5.AddRange(collection); break; } } } foreach (string item3 in list) { if (item3 != "") { string[] files = Directory.GetFiles(item3, "*.png"); string[] files2 = Directory.GetFiles(item3, "*.matbundle"); list2.AddRange(files); list3.AddRange(files2); } } list3.Sort(); list2.Sort(); try { foreach (string item4 in list3) { Object[] array = AssetBundle.LoadFromFile(item4).LoadAllAssets(); foreach (Object val3 in array) { if (val3 is Material) { Material item = (Material)val3; customMaterials.Add(item); } } } } catch (Exception ex) { Debug.Log((object)("Something went wrong with More Suits! Could not load materials from asset bundle(s). Error: " + ex)); } foreach (string item5 in list2) { if (list4.Contains(Path.GetFileNameWithoutExtension(item5).ToLower())) { continue; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (list5.Contains(Path.GetFileNameWithoutExtension(item5).ToLower()) && item5.Contains(directoryName)) { continue; } UnlockableItem val4; Material val5; if (Path.GetFileNameWithoutExtension(item5).ToLower() == "default") { val4 = val; val5 = val4.suitMaterial; } else { val4 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val)); val5 = Object.Instantiate<Material>(val4.suitMaterial); } byte[] array2 = File.ReadAllBytes(item5); Texture2D val6 = new Texture2D(2, 2); ImageConversion.LoadImage(val6, array2); val6.Apply(true, true); val5.mainTexture = (Texture)(object)val6; val4.unlockableName = Path.GetFileNameWithoutExtension(item5); try { string path = Path.Combine(Path.GetDirectoryName(item5), "advanced", val4.unlockableName + ".json"); if (File.Exists(path)) { string[] array3 = File.ReadAllLines(path); for (int j = 0; j < array3.Length; j++) { string[] array4 = array3[j].Trim().Split(':'); if (array4.Length != 2) { continue; } string text = array4[0].Trim('"', ' ', ','); string text2 = array4[1].Trim('"', ' ', ','); if (text2.Contains(".png")) { byte[] array5 = File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(item5), "advanced", text2)); Texture2D val7 = new Texture2D(2, 2); ImageConversion.LoadImage(val7, array5); val7.Apply(true, true); val5.SetTexture(text, (Texture)(object)val7); continue; } if (text == "PRICE" && int.TryParse(text2, out var result)) { try { if (!UnlockAll) { val4 = AddToRotatingShop(val4, result, __instance.unlockablesList.unlockables.Count); } } catch (Exception ex2) { Debug.Log((object)("Something went wrong with More Suits! Could not add a suit to the rotating shop. Error: " + ex2)); } continue; } switch (text2) { case "KEYWORD": val5.EnableKeyword(text); continue; case "DISABLEKEYWORD": val5.DisableKeyword(text); continue; case "SHADERPASS": val5.SetShaderPassEnabled(text, true); continue; case "DISABLESHADERPASS": val5.SetShaderPassEnabled(text, false); continue; } float result2; Vector4 vector; if (text == "SHADER") { Shader shader = Shader.Find(text2); val5.shader = shader; } else if (text == "MATERIAL") { foreach (Material customMaterial in customMaterials) { if (((Object)customMaterial).name == text2) { val5 = Object.Instantiate<Material>(customMaterial); val5.mainTexture = (Texture)(object)val6; break; } } } else if (float.TryParse(text2, out result2)) { val5.SetFloat(text, result2); } else if (TryParseVector4(text2, out vector)) { val5.SetVector(text, vector); } } } } catch (Exception ex3) { Debug.Log((object)("Something went wrong with More Suits! Error: " + ex3)); } val4.suitMaterial = val5; if (val4.unlockableName.ToLower() != "default") { if (num == MaxSuits) { Debug.Log((object)"Attempted to add a suit, but you've already reached the max number of suits! Modify the config if you want more."); continue; } __instance.unlockablesList.unlockables.Add(val4); num++; } } SuitsAdded = true; break; } UnlockableItem val8 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val)); val8.alreadyUnlocked = false; val8.hasBeenMoved = false; val8.placedPosition = Vector3.zero; val8.placedRotation = Vector3.zero; val8.unlockableType = 753; while (__instance.unlockablesList.unlockables.Count < count + MaxSuits) { __instance.unlockablesList.unlockables.Add(val8); } } catch (Exception ex4) { Debug.Log((object)("Something went wrong with More Suits! Error: " + ex4)); } } [HarmonyPatch("PositionSuitsOnRack")] [HarmonyPrefix] private static bool PositionSuitsOnRackPatch(ref StartOfRound __instance) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) List<UnlockableSuit> source = Object.FindObjectsOfType<UnlockableSuit>().ToList(); source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList(); int num = 0; foreach (UnlockableSuit item in source) { AutoParentToShip component = ((Component)item).gameObject.GetComponent<AutoParentToShip>(); component.overrideOffset = true; float num2 = 0.18f; if (MakeSuitsFitOnRack && source.Count > 13) { num2 /= (float)Math.Min(source.Count, 20) / 12f; } component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + __instance.rightmostSuitPosition.forward * num2 * (float)num; component.rotationOffset = new Vector3(0f, 90f, 0f); num++; } return false; } } private const string modGUID = "x753.More_Suits"; private const string modName = "More Suits"; private const string modVersion = "1.4.3"; private readonly Harmony harmony = new Harmony("x753.More_Suits"); private static MoreSuitsMod Instance; public static bool SuitsAdded = false; public static string DisabledSuits; public static bool LoadAllSuits; public static bool MakeSuitsFitOnRack; public static bool UnlockAll; public static int MaxSuits; public static List<Material> customMaterials = new List<Material>(); private static TerminalNode cancelPurchase; private static TerminalKeyword buyKeyword; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } DisabledSuits = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Disabled Suit List", "UglySuit751.png,UglySuit752.png,UglySuit753.png", "Comma-separated list of suits that shouldn't be loaded").Value; LoadAllSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Ignore !less-suits.txt", false, "If true, ignores the !less-suits.txt file and will attempt to load every suit, except those in the disabled list. This should be true if you're not worried about having too many suits.").Value; MakeSuitsFitOnRack = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Make Suits Fit on Rack", true, "If true, squishes the suits together so more can fit on the rack.").Value; UnlockAll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Unlock All Suits", false, "If true, unlocks all custom suits that would normally be sold in the shop.").Value; MaxSuits = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Suits", 100, "The maximum number of suits to load. If you have more, some will be ignored.").Value; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin More Suits is loaded!"); } private static UnlockableItem AddToRotatingShop(UnlockableItem newSuit, int price, int unlockableID) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); for (int i = 0; i < val.terminalNodes.allKeywords.Length; i++) { if (((Object)val.terminalNodes.allKeywords[i]).name == "Buy") { buyKeyword = val.terminalNodes.allKeywords[i]; break; } } newSuit.alreadyUnlocked = false; newSuit.hasBeenMoved = false; newSuit.placedPosition = Vector3.zero; newSuit.placedRotation = Vector3.zero; newSuit.shopSelectionNode = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)newSuit.shopSelectionNode).name = newSuit.unlockableName + "SuitBuy1"; newSuit.shopSelectionNode.creatureName = newSuit.unlockableName + " suit"; newSuit.shopSelectionNode.displayText = "You have requested to order " + newSuit.unlockableName + " suits.\nTotal cost of item: [totalCost].\n\nPlease CONFIRM or DENY.\n\n"; newSuit.shopSelectionNode.clearPreviousText = true; newSuit.shopSelectionNode.shipUnlockableID = unlockableID; newSuit.shopSelectionNode.itemCost = price; newSuit.shopSelectionNode.overrideOptions = true; CompatibleNoun val2 = new CompatibleNoun(); val2.noun = ScriptableObject.CreateInstance<TerminalKeyword>(); val2.noun.word = "confirm"; val2.noun.isVerb = true; val2.result = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val2.result).name = newSuit.unlockableName + "SuitBuyConfirm"; val2.result.creatureName = ""; val2.result.displayText = "Ordered " + newSuit.unlockableName + " suits! Your new balance is [playerCredits].\n\n"; val2.result.clearPreviousText = true; val2.result.shipUnlockableID = unlockableID; val2.result.buyUnlockable = true; val2.result.itemCost = price; val2.result.terminalEvent = ""; CompatibleNoun val3 = new CompatibleNoun(); val3.noun = ScriptableObject.CreateInstance<TerminalKeyword>(); val3.noun.word = "deny"; val3.noun.isVerb = true; if ((Object)(object)cancelPurchase == (Object)null) { cancelPurchase = ScriptableObject.CreateInstance<TerminalNode>(); } val3.result = cancelPurchase; ((Object)val3.result).name = "MoreSuitsCancelPurchase"; val3.result.displayText = "Cancelled order.\n"; newSuit.shopSelectionNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { val2, val3 }; TerminalKeyword val4 = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)val4).name = newSuit.unlockableName + "Suit"; val4.word = newSuit.unlockableName.ToLower() + " suit"; val4.defaultVerb = buyKeyword; CompatibleNoun val5 = new CompatibleNoun(); val5.noun = val4; val5.result = newSuit.shopSelectionNode; List<CompatibleNoun> list = buyKeyword.compatibleNouns.ToList(); list.Add(val5); buyKeyword.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val4); list2.Add(val2.noun); list2.Add(val3.noun); val.terminalNodes.allKeywords = list2.ToArray(); return newSuit; } public static bool TryParseVector4(string input, out Vector4 vector) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) vector = Vector4.zero; string[] array = input.Split(','); if (array.Length == 4 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3) && float.TryParse(array[3], out var result4)) { vector = new Vector4(result, result2, result3, result4); return true; } return false; } }
BepInEx/plugins/plugins/NoSellLimit.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("NoSellLimit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Remove the limit of items that can be placed on the deposit desk")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("NoSellLimit")] [assembly: AssemblyTitle("NoSellLimit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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 NoSellLimit { [BepInPlugin("viviko.NoSellLimit", "NoSellLimit", "1.0.1")] public class NoSellLimit : BaseUnityPlugin { [HarmonyPatch(typeof(DepositItemsDesk))] [HarmonyPatch("PlaceItemOnCounter")] public static class PlaceItemOnCounterPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[7] { new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldarg_0), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsField(i, AccessTools.Field(typeof(DepositItemsDesk), "deskObjectsContainer"), false)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldlen), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I4), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldc_I4_S), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bge), (string)null) }; CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.Start(); val.MatchForward(false, array); val.SetOpcodeAndAdvance(OpCodes.Nop); val.RemoveInstructions(array.Length - 1); return val.Instructions(); } } private const string modGUID = "viviko.NoSellLimit"; private const string modName = "NoSellLimit"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("viviko.NoSellLimit"); private static NoSellLimit Instance; public static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("NoSellLimit"); harmony.PatchAll(); mls.LogInfo((object)"Plugin NoSellLimit is loaded!"); } } internal static class GeneratedPluginInfo { public const string Identifier = "viviko.NoSellLimit"; public const string Name = "NoSellLimit"; public const string Version = "1.0.1"; } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }
BepInEx/plugins/plugins/PushToMute.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using PushToMute.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PushToMute")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PushToMute")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("faaa231e-a5f3-481d-a1d9-f1f5799855fc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace PushToMute { [BepInPlugin("Baba.PushToMute", "PushToMute", "1.0.0")] public class PTMModBase : BaseUnityPlugin { private const string modGUID = "Baba.PushToMute"; private const string modName = "PushToMute"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Baba.PushToMute"); private static PTMModBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Baba.PushToMute"); harmony.PatchAll(typeof(PTMModBase)); harmony.PatchAll(typeof(UpdatePatch)); harmony.PatchAll(typeof(InGamePlayerSettingsPatch)); mls.LogInfo((object)"Push To Mute successfully loaded!"); } } } namespace PushToMute.Patches { [HarmonyPatch(typeof(StartOfRound), "Update")] internal class UpdatePatch { private static void Postfix(StartOfRound __instance) { if ((Object)(object)__instance.voiceChatModule != (Object)null && !IngamePlayerSettings.Instance.settings.pushToTalk) { __instance.voiceChatModule.IsMuted = IngamePlayerSettings.Instance.playerInput.actions.FindAction("VoiceButton", false).IsPressed(); } } } [HarmonyPatch(typeof(IngamePlayerSettings))] internal class InGamePlayerSettingsPatch { [HarmonyPatch("SetMicPushToTalk")] [HarmonyPostfix] private static void SetMicPushToTalkPatch(IngamePlayerSettings __instance) { if (!__instance.unsavedSettings.pushToTalk) { __instance.SetSettingsOptionsText((SettingsOptionType)3, "MODE: Push to mute"); } } [HarmonyPatch("UpdateMicPushToTalkButton")] [HarmonyPostfix] private static void UpdateMicPushToTalkButtonPatch(IngamePlayerSettings __instance) { if (!__instance.settings.pushToTalk) { __instance.SetSettingsOptionsText((SettingsOptionType)3, "MODE: Push to mute"); } } } }
BepInEx/plugins/plugins/RushOfAdrenaline.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RushOfAdrenaline")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")] [assembly: AssemblyProduct("RushOfAdrenaline")] [assembly: AssemblyTitle("RushOfAdrenaline")] [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 RushOfAdrenaline { [BepInPlugin("Uprank.RushOfAdrenaline", "Rush of Adrenaline", "1.0.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Uprank.RushOfAdrenaline"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Uprank.RushOfAdrenaline is loaded!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } public class PluginInfo { public const string PLUGIN_GUID = "Uprank.RushOfAdrenaline"; public const string PLUGIN_NAME = "Rush of Adrenaline"; public const string PLUGIN_VERSION = "1.0.0.0"; } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void AdjustSpeedBasedOnPanic(ref StartOfRound ___playersManager, ref float ___targetFOV, ref float ___sprintMultiplier) { if (___playersManager.fearLevel >= 0.4f) { ___sprintMultiplier = Mathf.Lerp(___sprintMultiplier, 1f + ___playersManager.fearLevel / 2f, Time.deltaTime * 0.25f); } } } }
BepInEx/plugins/plugins/SellTracker.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("SellTracker")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SellTracker")] [assembly: AssemblyTitle("SellTracker")] [assembly: AssemblyVersion("1.0.0.0")] namespace SellTracker; [BepInPlugin("NutNutty.SellTracker", "Sell Tracker", "1.2.1")] public class SellTracker : BaseUnityPlugin { public ConfigEntry<string> SellTrackerColorConfig; public ConfigEntry<string> SellPercentageColorConfig; public static Color SellTrackerColor; public static Color SellPercentageColor; public void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) SellTrackerColorConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "SellTrackerColor", "#FF0000", "The hex color of the sell tracker text (use a site like https://htmlcolorcodes.com to generate a hex code)"); SellPercentageColorConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "SellPercentageColor", "#FF0000", "The hex color of the sell percentage text (use a site like https://htmlcolorcodes.com to generate a hex code)"); ColorUtility.TryParseHtmlString(SellTrackerColorConfig.Value, ref SellTrackerColor); ColorUtility.TryParseHtmlString(SellPercentageColorConfig.Value, ref SellPercentageColor); new Harmony("SellTracker").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sell Tracker plugin loaded!"); } } public class Patches { [HarmonyPatch(typeof(DisplayCompanyBuyingRate))] public class DisplayCompanyBuyingRatePatch { [HarmonyPrefix] [HarmonyPatch("Update")] public static bool OverwriteText(ref DisplayCompanyBuyingRate __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) int num = TimeOfDay.Instance.quotaFulfilled + calculatedValue; ((TMP_Text)__instance.displayText).text = $"PROFIT QUOTA: {num}/{TimeOfDay.Instance.profitQuota}"; ((TMP_Text)__instance.displayText).color = SellTracker.SellTrackerColor; ((TMP_Text)__instance.displayText).fontSize = 28f; return false; } } [HarmonyPatch(typeof(DepositItemsDesk))] public class DepositItemsDeskPatch { [HarmonyPostfix] [HarmonyPatch("AddObjectToDeskClientRpc")] public static void FetchValue(ref DepositItemsDesk __instance) { if (!NetworkManager.Singleton.IsServer && NetworkManager.Singleton.IsClient) { object value = Traverse.Create((object)__instance).Field("lastObjectAddedToDesk").GetValue(); NetworkObject val = (NetworkObject)((value is NetworkObject) ? value : null); __instance.itemsOnCounter.Add(((Component)val).GetComponentInChildren<GrabbableObject>()); } int num = 0; for (int i = 0; i < __instance.itemsOnCounter.Count; i++) { if (__instance.itemsOnCounter[i].itemProperties.isScrap) { num += __instance.itemsOnCounter[i].scrapValue; } } calculatedValue = (int)((float)num * StartOfRound.Instance.companyBuyingRate); } [HarmonyPostfix] [HarmonyPatch("SellItemsClientRpc")] public static void ClearValue(ref DepositItemsDesk __instance) { if (!NetworkManager.Singleton.IsServer && NetworkManager.Singleton.IsClient) { __instance.itemsOnCounter.Clear(); } calculatedValue = 0; } [HarmonyPostfix] [HarmonyPatch("Start")] public static void CreateScreen() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Scene sceneByName = SceneManager.GetSceneByName("CompanyBuilding"); if (((Scene)(ref sceneByName)).IsValid()) { GameObject val = Object.Instantiate<GameObject>(GameObject.Find("/Cube")); GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("/Canvas")); SceneManager.MoveGameObjectToScene(val, sceneByName); SceneManager.MoveGameObjectToScene(val2, sceneByName); Transform transform = val.transform; transform.position += new Vector3(0f, 0f, -3f); Transform transform2 = val2.transform; transform2.position += new Vector3(0f, 0f, -3f); Object.Destroy((Object)(object)val2.GetComponentInChildren<DisplayCompanyBuyingRate>()); TextMeshProUGUI componentInChildren = val2.GetComponentInChildren<TextMeshProUGUI>(); ((TMP_Text)componentInChildren).text = $"{Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}%"; ((TMP_Text)componentInChildren).color = SellTracker.SellPercentageColor; ((TMP_Text)componentInChildren).fontSize = 64.37f; } } } public static int calculatedValue; }
BepInEx/plugins/plugins/SellYourStuff.dll
Decompiled 2 years agousing System.Collections.Generic; 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 SellYourStuff.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("SellYourStuff")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SellYourStuff")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("be25d89d-f866-45bd-808b-723b2d0aa1f8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace SellYourStuff { [BepInPlugin("Axeron.SellYourStuff", "SellYourStuff", "1.0.1.0")] public class SellYourStuffModBase : BaseUnityPlugin { private const string modGUID = "Axeron.SellYourStuff"; private const string modName = "SellYourStuff"; private const string modVersion = "1.0.1.0"; private readonly Harmony harmony = new Harmony("Axeron.SellYourStuff"); internal ManualLogSource mls; private static SellYourStuffModBase Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Axeron.SellYourStuff"); mls.LogInfo((object)"SellYourStuff plugin loaded. Version 1.0.1.0"); harmony.PatchAll(typeof(SellYourStuffModBase)); harmony.PatchAll(typeof(ItemPatch)); harmony.PatchAll(typeof(SellPatch)); } } } namespace SellYourStuff.Patches { internal class PatchableItemsList { protected static readonly List<string> PatchableItems = new List<string> { "Flashlight", "Extension ladder", "Lockpicker", "Jetpack", "Pro-flashlight", "TZP-Inhalant", "Stun grenade", "Boombox", "Spray paint", "Shovel", "Walkie-talkie", "Zap gun", "Radar-booster" }; } [HarmonyPatch(typeof(DepositItemsDesk))] internal class SellPatch : PatchableItemsList { [HarmonyPatch("PlaceItemOnCounter")] private static void Prefix(DepositItemsDesk __instance, [HarmonyArgument(0)] PlayerControllerB playerWhoTriggered) { if ((Object)(object)playerWhoTriggered != (Object)null) { GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && (Object)(object)currentlyHeldObjectServer.itemProperties != (Object)null && PatchableItemsList.PatchableItems.Contains(currentlyHeldObjectServer.itemProperties.itemName)) { currentlyHeldObjectServer.itemProperties.isScrap = true; } } } } [HarmonyPatch(typeof(GrabbableObject))] internal class ItemPatch : PatchableItemsList { private const int NodeType = 2; private const int MinRange = 3; private const int MaxRange = 12; private const int creatureScanId = -1; private const bool requiresLineOfSight = false; [HarmonyPatch("Start")] private static void Postfix(GrabbableObject __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.itemProperties != (Object)null && PatchableItemsList.PatchableItems.Contains(__instance.itemProperties.itemName)) { TryAddScanNode(__instance); __instance.itemProperties.isScrap = true; TrySetScrapValue(__instance); __instance.itemProperties.isScrap = false; } } private static void TrySetScrapValue(GrabbableObject __instance) { try { Terminal val = Object.FindObjectOfType<Terminal>(); for (int i = 0; i < Object.FindObjectOfType<Terminal>().buyableItemsList.Length; i++) { if (val.buyableItemsList[i].itemName == __instance.itemProperties.itemName) { int num = val.itemSalesPercentages[i]; __instance.SetScrapValue(__instance.itemProperties.creditsWorth * num / 200); } } } catch { Debug.LogError((object)"Item not found in the current terminal store or other error occured"); } } private static void TryAddScanNode(GrabbableObject __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { object headerText = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>().headerText; } catch { GameObject gameObject = ((Component)Object.FindObjectOfType<ScanNodeProperties>()).gameObject; if ((Object)(object)gameObject != (Object)null) { GameObject val = Object.Instantiate<GameObject>(gameObject, ((Component)__instance).transform.position, Quaternion.Euler(Vector3.zero), ((Component)__instance).transform); ScanNodeProperties component = val.GetComponent<ScanNodeProperties>(); if ((Object)(object)component != (Object)null) { component.headerText = __instance.itemProperties.itemName; component.nodeType = 2; component.minRange = 3; component.maxRange = 12; component.requiresLineOfSight = false; component.creatureScanID = -1; } } else { Debug.LogError((object)"Couldn't create scanNode for object"); } } } } }
BepInEx/plugins/plugins/ShipDecorations.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ShipDecorations.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("ShipDecorations")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShipDecorations")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("752b4a5e-d779-490a-a540-e85dd73f2bd2")] [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 ShipDecorations { public static class ConfigSettings { public static ConfigEntry<bool> makeShipDecorationsFree; public static void BindConfigSettings() { } public static string GetDisplayName(string key) { key = key.Replace("<Keyboard>/", ""); key = key.Replace("<Mouse>/", ""); string text = key; text = text.Replace("leftAlt", "Alt"); text = text.Replace("rightAlt", "Alt"); text = text.Replace("leftCtrl", "Ctrl"); text = text.Replace("rightCtrl", "Ctrl"); text = text.Replace("leftShift", "Shift"); text = text.Replace("rightShift", "Shift"); text = text.Replace("leftButton", "LMB"); text = text.Replace("rightButton", "RMB"); return text.Replace("middleButton", "MMB"); } } [BepInPlugin("Sant.ShipDecorationsUnlock", "Unlock Ship Decorations", "1.0.0.0")] public class ShipDecorationsUnlockedModBase : BaseUnityPlugin { private const string modGUID = "Sant.ShipDecorationsUnlock"; private const string modName = "Unlock Ship Decorations"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Sant.ShipDecorationsUnlock"); public static ShipDecorationsUnlockedModBase instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("Sant.ShipDecorationsUnlock"); mls.LogInfo((object)"The Ship Decorations Unlock mod has awaken"); harmony.PatchAll(typeof(ShipDecorationsUnlockedModBase)); harmony.PatchAll(typeof(ShipDecorationsUnlockedPatch)); } public static void Log(string message) { Log(message); } } } namespace ShipDecorations.Patches { [HarmonyPatch(typeof(Terminal))] internal class ShipDecorationsUnlockedPatch { [HarmonyPatch("RotateShipDecorSelection")] [HarmonyPostfix] private static void unlockAllShipDecorations(ref List<TerminalNode> ___ShipDecorSelection) { ___ShipDecorSelection.Clear(); List<TerminalNode> list = new List<TerminalNode>(); for (int i = 0; i < StartOfRound.Instance.unlockablesList.unlockables.Count; i++) { if ((Object)(object)StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode != (Object)null && !StartOfRound.Instance.unlockablesList.unlockables[i].alwaysInStock) { list.Add(StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode); } } for (int j = 0; j < list.Count; j++) { TerminalNode item = list[j]; ___ShipDecorSelection.Add(item); } } } }
BepInEx/plugins/plugins/ShootableMouthDogs.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.AI; [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("AgentRev")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0eac58e2c712170b22b29352fe20cbcc1cec04b3")] [assembly: AssemblyProduct("ShootableMouthDogs")] [assembly: AssemblyTitle("ShootableMouthDogs")] [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 ShootableMouthDogs { [BepInPlugin("ShootableMouthDogs", "ShootableMouthDogs", "1.0.0")] public class Plugin : BaseUnityPlugin { public void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ShootableMouthDogs v1.0.0 loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } [HarmonyPatch(typeof(Physics))] public static class PhysicsPatch { [HarmonyPatch("SphereCastNonAlloc")] [HarmonyPatch(new Type[] { typeof(Ray), typeof(float), typeof(RaycastHit[]), typeof(float), typeof(int), typeof(QueryTriggerInteraction) })] private static void Postfix(RaycastHit[] results, int layerMask, ref int __result) { //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) if ((layerMask & 0x80000) == 0) { return; } int num = 0; for (int i = 0; i < __result; i++) { Transform transform = ((RaycastHit)(ref results[i])).transform; if ((Object)(object)((transform != null) ? ((Component)transform).GetComponent<NavMeshAgent>() : null) == (Object)null) { if (i > num) { results[num] = results[i]; } num++; } } __result = num; } } public static class PluginInfo { public const string PLUGIN_GUID = "ShootableMouthDogs"; public const string PLUGIN_NAME = "ShootableMouthDogs"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/plugins/Suit Saver.dll
Decompiled 2 years 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/plugins/TwoHandedStorage.dll
Decompiled 2 years agousing 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("TwoHandedStorage")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("TwoHandedStorage")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TwoHandedStorage")] [assembly: AssemblyTitle("TwoHandedStorage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TwoHandedStorage { [BepInPlugin("viviko.TwoHandedStorage", "TwoHandedStorage", "1.0.0")] public class TwoHandedStorage : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPostfix] [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] private static void SetHoverTipAndCurrentInteractTriggerPatch(ref InteractTrigger ___hoveringOverTrigger) { if (Object.op_Implicit((Object)(object)___hoveringOverTrigger)) { ___hoveringOverTrigger.twoHandedItemAllowed = true; } } } private const string modGUID = "viviko.TwoHandedStorage"; private const string modName = "TwoHandedStorage"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("viviko.TwoHandedStorage"); private static TwoHandedStorage Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("viviko.TwoHandedStorage"); harmony.PatchAll(); mls.LogInfo((object)"Plugin TwoHandedStorage is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "TwoHandedStorage"; public const string PLUGIN_NAME = "TwoHandedStorage"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/plugins/VanillaContentExpansion/VanillaContentExpansion.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Unity.Netcode; using UnityEngine; using VanillaContentExpansion; using VanillaContentPlus; [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("VanillaContentExpansion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VanillaContentExpansion")] [assembly: AssemblyTitle("VanillaContentExpansion")] [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 VanillaContentPlus { [BepInPlugin("bigmcnugget.vanillaContentExpansion", "Vanilla Content Expansion", "0.1.7")] public class Plugin : BaseUnityPlugin { private const string GUID = "bigmcnugget.vanillaContentExpansion"; private const string NAME = "Vanilla Content Expansion"; private const string VERSION = "0.1.7"; public static Plugin instance; public ConfigEntry<bool> AllowDebugLogs; public static AssetBundle scrapAssetBundle; public static string scrapListJson; public static AssetBundle monsterAssetBundle; public static ConfigFile mainConfig { get; internal set; } public static ConfigFile scrapConfig { get; internal set; } public static ConfigFile monsterConfig { get; internal set; } private void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown instance = this; mainConfig = new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath, "bigmcnugget.vanillaContentExpansion-main.cfg" }), true); AllowDebugLogs = mainConfig.Bind<bool>("Main", "Allow Debug Logs", true, "Allow printing logs to the console, really only needed for debug"); PrepareForPatching(); scrapAssetBundle = LoadAssetBundle("Scrap", Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "customscrap")); scrapListJson = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ScrapList.json"); scrapConfig = new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath, "bigmcnugget.vanillaContentExpansion-scrap.cfg" }), false); CustomScrap.Init(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "bigmcnugget.vanillaContentExpansion"); } private static void PrepareForPatching() { 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); } } } } private static AssetBundle LoadAssetBundle(string debugName, string path) { AssetBundle result = AssetBundle.LoadFromFile(path); instance.LogInfo("Loaded " + debugName + " Asset bundle from " + path); return result; } public void LogInfo(string message) { if (AllowDebugLogs.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } public void LogWarning(string message) { ((BaseUnityPlugin)this).Logger.LogWarning((object)message); } } } namespace VanillaContentPlus.CustomBehaviour { public class FlipPhone : GrabbableObject { public AudioSource src; public AudioClip[] ringtones; public bool isPlaying; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner && isPlaying) { } } [ServerRpc(RequireOwnership = false)] public void PlayServerRpc() { int i = Random.Range(0, ringtones.Length); PlayClientRpc(i); } [ClientRpc] public void PlayClientRpc(int i) { ((MonoBehaviour)this).StartCoroutine(PlayOneShotIEnum(i)); } public IEnumerator PlayOneShotIEnum(int i) { isPlaying = true; AudioClip clip = ringtones[i]; Debug.Log((object)("Phone item: Playing clip " + ((Object)clip).name)); src.PlayOneShot(clip); yield return (object)new WaitForSeconds(clip.length + 0.2f); isPlaying = false; } } } namespace VanillaContentExpansion { public class ChatterboxAI : EnemyAI { } public class CustomEnemy { public class CustomEnemyData { public string name; public string enemyPath; public int rarity; public LevelTypes levelFlags; public SpawnType spawnType; public string infoKeyword; public string infoNode; public bool enabled = true; private CustomEnemyConfig config; public CustomEnemyData(string name, string enemyPath, int rarity, LevelTypes levelFlags, SpawnType spawnType, string infoKeyword, string infoNode) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) this.name = name; this.enemyPath = enemyPath; this.rarity = rarity; this.levelFlags = levelFlags; this.spawnType = spawnType; this.infoKeyword = infoKeyword; this.infoNode = infoNode; config = new CustomEnemyConfig(name, rarity); enabled = config.ENABLED.Value; this.rarity = config.RARITY.Value; allMonsters.Add(this); } } public static List<CustomEnemyData> allMonsters = new List<CustomEnemyData>(); public static CustomEnemyData chatterbox = new CustomEnemyData("chatterbox", "Assets/content/enemies/chatterbox/data/chatterbox_enemy_type.asset", 1000, (LevelTypes)(-1), (SpawnType)0, null, ""); public static void Init() { foreach (CustomEnemyData allMonster in allMonsters) { RegisterCustomMonster(allMonster); } } private static void RegisterCustomMonster(CustomEnemyData monster) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Plugin.instance.LogInfo("Attempting To register Custom Monster: " + monster.name + " at " + monster.enemyPath); if (!monster.enabled) { Plugin.instance.LogInfo("Register Skipped" + monster.name + " Disabled in config"); return; } EnemyType val = Plugin.monsterAssetBundle.LoadAsset<EnemyType>(monster.enemyPath); if ((Object)(object)val == (Object)null) { Plugin.instance.LogWarning("!!!!!!!!!!!!!CANNOT FIND!!!!!!!!!!!!!!" + monster.name); return; } NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, monster.rarity, monster.levelFlags, monster.spawnType, (TerminalNode)null, (TerminalKeyword)null); Plugin.instance.LogInfo("Registered Custom Monster: " + monster.name); Plugin.instance.LogInfo("\n"); } } public class CustomEnemyConfig { public string name; public int rarity; public ConfigEntry<bool> ENABLED; public ConfigEntry<int> RARITY; public CustomEnemyConfig(string _name, int _defaultRarity) { name = _name; rarity = _defaultRarity; ENABLED = Plugin.monsterConfig.Bind<bool>(name, name + " Enabled", true, (ConfigDescription)null); RARITY = Plugin.monsterConfig.Bind<int>(name, name + " Rarity", rarity, ""); Plugin.instance.LogInfo(name + " Config Loaded: [ENABLED] " + ENABLED.Value + " | [RARITY] " + RARITY.Value); } } public class CustomScrap { public class CustomScrapItem { public string scrapName; public string path; public Dictionary<LevelTypes, int> moonWeights; public bool enabled; public int minValue; public int maxValue; public float itemWeight; private CustomScrapConfig config; public CustomScrapItem(string name, string path, int[] weights, int minValue, int maxValue, float weight) { scrapName = name; this.path = path; moonWeights = new Dictionary<LevelTypes, int> { { (LevelTypes)4, weights[0] }, { (LevelTypes)8, weights[1] }, { (LevelTypes)16, weights[2] }, { (LevelTypes)32, weights[3] }, { (LevelTypes)64, weights[4] }, { (LevelTypes)128, weights[5] }, { (LevelTypes)256, weights[6] }, { (LevelTypes)512, weights[7] }, { (LevelTypes)1024, weights[0] } }; this.minValue = minValue; this.maxValue = maxValue; itemWeight = weight; config = new CustomScrapConfig(scrapName, this); enabled = config.ENABLED.Value; this.minValue = config.valueMin.Value; this.maxValue = config.valueMax.Value; itemWeight = config.itemWeight.Value; } } public class CustomScrapConfig { public string name; public ConfigEntry<bool> ENABLED; public ConfigEntry<int> valueMin; public ConfigEntry<int> valueMax; public ConfigEntry<float> itemWeight; public CustomScrapConfig(string _name, CustomScrapItem item) { name = _name; ENABLED = Plugin.scrapConfig.Bind<bool>("SCRAP " + name, name + " Enabled", true, (ConfigDescription)null); valueMin = Plugin.scrapConfig.Bind<int>("SCRAP " + name, name + " Minimum Value", item.minValue, (ConfigDescription)null); valueMax = Plugin.scrapConfig.Bind<int>("SCRAP " + name, name + " Maximum Value", item.maxValue, (ConfigDescription)null); itemWeight = Plugin.scrapConfig.Bind<float>("SCRAP " + name, name + " Item Weight", item.itemWeight, (ConfigDescription)null); Plugin.instance.LogInfo(name + " Config Loaded: [ENABLED] " + ENABLED.Value); } } public class JsonRoot { [JsonProperty("SCRAP")] public JsonData[] scraplist { get; set; } } public class JsonData { [JsonProperty("name")] public string name; [JsonProperty("path")] public string path; [JsonProperty("weights")] public int[] weights; [JsonProperty("minValue")] public int minValue; [JsonProperty("maxValue")] public int maxValue; [JsonProperty("itemWeight")] public float itemWeight; } public static List<CustomScrapItem> allScrapItems = new List<CustomScrapItem>(); public static void Init() { ParseJsonList(); } private static void RegisterCustomScrapItem(CustomScrapItem scrap) { if (!scrap.enabled) { Plugin.instance.LogInfo("Register Skipped" + scrap.scrapName + " Disabled in config"); return; } Item val = Plugin.scrapAssetBundle.LoadAsset<Item>(scrap.path); if ((Object)(object)val == (Object)null) { Plugin.instance.LogWarning("!!!!!!!!!!!!!CANNOT FIND!!!!!!!!!!!!!!" + scrap.scrapName); return; } val.minValue = (int)((double)scrap.minValue * 2.5); val.maxValue = (int)((double)scrap.maxValue * 2.5); val.weight = scrap.itemWeight; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, scrap.moonWeights, (Dictionary<string, int>)null); Plugin.instance.LogInfo("Succesfully Registered Scrap: " + scrap.scrapName); } private static void ParseJsonList() { StreamReader streamReader = new StreamReader(Plugin.scrapListJson); string text = streamReader.ReadToEnd(); JsonRoot jsonRoot = JsonConvert.DeserializeObject<JsonRoot>(text); int num = jsonRoot.scraplist.Length; for (int i = 0; i < num; i++) { JsonData jsonData = jsonRoot.scraplist[i]; CustomScrapItem scrap = new CustomScrapItem(jsonData.name, jsonData.path, jsonData.weights, jsonData.minValue, jsonData.maxValue, jsonData.itemWeight); RegisterCustomScrapItem(scrap); } } } } namespace VanillaContentExpansion.CustomBehaviour { public class AlarmClock { public Transform hHand; public Transform mHand; public Transform sHand; public AudioSource src; public AudioClip tick; public AudioClip alarm; } public class Lighter : GrabbableObject { private bool enabled; public AudioSource src; public AudioClip enabledSfx; public AudioClip disabledSfx; public Light pointLight; private float defaultlightRange = 5f; private Vector2 lightRangeRandom = new Vector2(4f, 8f); private float currentLightRange; private float defaultlightIntensity = 500f; private Vector2 lightIntensityRandom = new Vector2(125f, 150f); private float currentLightIntensity; private Vector2 flickerTimerRandom = new Vector2(0.01f, 0.15f); private float flickerTimer = 0.1f; public float fuel = 100f; private float fuelLeft; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)pointLight).enabled = false; } } public void Toggle() { enabled = !enabled; if (enabled) { Debug.Log((object)"Lighter enabled"); src.PlayOneShot(enabledSfx); ((Behaviour)pointLight).enabled = true; } else { Debug.Log((object)"Lighter disabled"); src.PlayOneShot(disabledSfx); ((Behaviour)pointLight).enabled = false; pointLight.intensity = defaultlightIntensity; pointLight.range = defaultlightRange; } } public void Tick() { flickerTimer -= Time.deltaTime; if (flickerTimer <= 0f) { currentLightIntensity = Random.Range(lightIntensityRandom.x, lightIntensityRandom.y); currentLightRange = Random.Range(lightRangeRandom.x, lightRangeRandom.y); pointLight.intensity = currentLightIntensity; pointLight.range = currentLightRange; flickerTimer = Random.Range(flickerTimerRandom.x, flickerTimerRandom.y); } } public override void Update() { ((GrabbableObject)this).Update(); Tick(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if (enabled) { Toggle(); } } } public class Missile : GrabbableObject { } public class PolaroidCamera : GrabbableObject { private bool canUse; public Light light; private float flashTimer; public AudioSource src; public AudioClip flashSFX; public AudioClip primedSFX; public override void Start() { ((GrabbableObject)this).Start(); ((Behaviour)light).enabled = false; canUse = true; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((NetworkBehaviour)this).IsOwner) { } } public IEnumerator Flash() { canUse = false; src.PlayOneShot(flashSFX); ((Behaviour)light).enabled = true; light.intensity = 10f; Light obj = light; obj.intensity += Time.deltaTime * 50000f; yield return (object)new WaitForSeconds(0.3f); ((Behaviour)light).enabled = false; light.intensity = 0f; yield return (object)new WaitForSeconds(3f); src.PlayOneShot(primedSFX); canUse = true; } } public class TrafficLight : GrabbableObject { private bool enabled = false; private bool switching; public Light[] lights; public AudioSource src; public AudioClip changeClickClip; private Vector2 timerRandom = new Vector2(5f, 20f); private float currentTimer = 0f; public override void Start() { ((GrabbableObject)this).Start(); Light[] array = lights; foreach (Light val in array) { ((Behaviour)val).enabled = false; } } public override void Update() { ((GrabbableObject)this).Update(); if (!enabled) { return; } currentTimer -= Time.deltaTime; if (currentTimer <= 0f && !switching) { Light[] array = lights; foreach (Light val in array) { ((Behaviour)val).enabled = false; } ((MonoBehaviour)this).StartCoroutine(ToggleLights()); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); enabled = false; Light[] array = lights; foreach (Light val in array) { ((Behaviour)val).enabled = false; } } public override void EquipItem() { enabled = true; } private IEnumerator ToggleLights() { switching = true; yield return (object)new WaitForSeconds(0.75f); src.PlayOneShot(changeClickClip); int i = Random.Range(0, lights.Length); ((Behaviour)lights[i]).enabled = true; currentTimer = Random.Range(timerRandom.x, timerRandom.y); switching = false; } } }
BepInEx/plugins/plugins/VoiceHUD.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; using VoiceHUD.Configuration; [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("VoiceHUD")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Displays push-to-talk icon on voice activation")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+f1e0a0cfa0a629002418c9e0aa3a753676e33192")] [assembly: AssemblyProduct("VoiceHUD")] [assembly: AssemblyTitle("VoiceHUD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VoiceHUD { [BepInPlugin("5Bit.VoiceHUD", "VoiceHUD", "1.0.4")] public class VoiceHUD : BaseUnityPlugin { private const string modGUID = "5Bit.VoiceHUD"; private const string modName = "VoiceHUD"; private const string modVersion = "1.0.4"; private readonly Harmony harmony = new Harmony("5Bit.VoiceHUD"); private static VoiceHUD Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("5Bit.VoiceHUD"); Config.Init(); harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "VoiceHUD"; public const string PLUGIN_NAME = "VoiceHUD"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace VoiceHUD.Patches { [HarmonyPatch(typeof(HUDManager))] internal class VoiceHUDPatch { private static Color Start = new Color(0f, 255f, 0f, 255f); private static Color Center = new Color(165f, 255f, 0f, 255f); private static Color End = new Color(255f, 0f, 0f, 255f); [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (!IngamePlayerSettings.Instance.settings.micEnabled || IngamePlayerSettings.Instance.settings.pushToTalk || (Object)(object)StartOfRound.Instance.voiceChatModule == (Object)null) { return; } VoicePlayerState val = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName); if (val.IsSpeaking) { float num = Mathf.Clamp(val.Amplitude * 35f, 0f, 1f); if (Config.ColorsEnabled) { ((Graphic)HUDManager.Instance.PTTIcon).color = GetColorByVolume(num * 100f); } ((Behaviour)HUDManager.Instance.PTTIcon).enabled = num > 0.01f; } } public static Color GetColorByVolume(float volume) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (volume < 20f) { return Start; } if (volume > 70f) { return End; } return Center; } } } namespace VoiceHUD.Configuration { internal static class Config { private const string CONFIG_FILE_NAME = "VoiceHUD.cfg"; private static ConfigFile config; private static ConfigEntry<bool> colorsEnabled; public static bool ColorsEnabled => colorsEnabled.Value; public static void Init() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "VoiceHUD.cfg"); config = new ConfigFile(text, true); colorsEnabled = config.Bind<bool>("Config", "Colors enabled", false, "Change icon color based on volume."); } } }