Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PPPMCP v1.1.7
BepInEx/plugins/AccurateStaminaDisplay.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.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; 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("AccurateStaminaDisplay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes the stamina meter display on the HUD, so it more accurately represents your current stamina percentage.")] [assembly: AssemblyFileVersion("2.1.1.0")] [assembly: AssemblyInformationalVersion("2.1.1")] [assembly: AssemblyProduct("AccurateStaminaDisplay")] [assembly: AssemblyTitle("AccurateStaminaDisplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.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 AccurateStaminaDisplay { internal static class NewStaminaMeter { private const float STAMINA_EMPTY = 0.1f; private const float STAMINA_EXHAUSTED = 0.3f; private const float METER_EMPTY = 0.29767f; private const float METER_FULL = 0.911f; private static readonly Color NORM_COLOR = new Color(1f, 0.4626f, 0f); private static readonly Color EX_COLOR = new Color(0.9f, 0.1f, 0f); private static PlayerControllerB player; private static float minStamina; private static bool exhausted; private static Image meterOverlay; private static readonly float OVERLAY_MAX = Mathf.Lerp(0.29767f, 0.911f, Mathf.InverseLerp(0.1f, 1f, 0.3f)); private static Gradient tzpGrad; private static readonly Color LIME = new Color(0.4f, 1f, 0f); private const float TZP_LIGHT_MIN = 0.1f; private const float TZP_LIGHT_MAX = 0.2f; private const float TZP_HEAVY_MIN = 0.65f; private const float TZP_HEAVY_MAX = 0.77f; private static CanvasRenderer meterAlpha; private static CanvasRenderer overlayAlpha; private static readonly FieldInfo playerMovementHinderedPrev = typeof(PlayerControllerB).GetField("movementHinderedPrev", BindingFlags.Instance | BindingFlags.NonPublic); private static bool wasClimbing; internal static void UpdateMeter() { //IL_01a1: 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_0163: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { Init(); return; } minStamina = ((Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.Empty) ? 0.3f : 0.1f); float num = Mathf.InverseLerp(minStamina, 1f, player.sprintMeter); player.sprintMeterUI.fillAmount = Mathf.Lerp(0.29767f, 0.911f, num); if (player.isClimbingLadder) { wasClimbing = true; } else if (player.thisController.isGrounded) { wasClimbing = false; } bool flag = (int)playerMovementHinderedPrev.GetValue(player) > 0 && !wasClimbing && !player.jetpackControls; bool flag2 = Plugin.configInhalantInfo.Value && player.drunkness > 0f && tzpGrad != null; bool flag3 = Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.ChangeColor || (Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.AlwaysShow && (flag || flag2)); if (exhausted) { if (!flag3 || player.isSprinting || (player.sprintMeter >= 0.3f && !flag)) { exhausted = false; } } else if (flag3 && (player.isExhausted || flag)) { exhausted = true; ((Graphic)player.sprintMeterUI).color = EX_COLOR; } else if (flag2) { ((Graphic)player.sprintMeterUI).color = tzpGrad.Evaluate(player.drunkness); } else { ((Graphic)player.sprintMeterUI).color = NORM_COLOR; } if (!((Object)(object)meterOverlay != (Object)null)) { return; } if (Plugin.configExhaustionIndicator.Value == ExhaustionIndicator.AlwaysShow && !exhausted && !player.criticallyInjured && !flag2) { meterOverlay.fillAmount = Mathf.Min(player.sprintMeterUI.fillAmount, OVERLAY_MAX); if ((Object)(object)overlayAlpha != (Object)null) { overlayAlpha.SetAlpha(meterAlpha.GetAlpha()); } ((Component)meterOverlay).gameObject.SetActive(true); } else { ((Component)meterOverlay).gameObject.SetActive(false); } } private static void Init() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) player = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)meterOverlay == (Object)null && (Object)(object)player != (Object)null) { meterOverlay = ((Component)Object.Instantiate<Transform>(((Component)player.sprintMeterUI).transform, ((Component)player.sprintMeterUI).transform.parent)).GetComponent<Image>(); ((Graphic)meterOverlay).color = EX_COLOR; } if (tzpGrad == null) { tzpGrad = new Gradient(); tzpGrad.SetKeys((GradientColorKey[])(object)new GradientColorKey[6] { new GradientColorKey(NORM_COLOR, 0f), new GradientColorKey(Color.yellow, 0.1f), new GradientColorKey(Color.yellow, 0.2f), new GradientColorKey(LIME, 0.65f), new GradientColorKey(LIME, 0.77f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }); } if (Chainloader.PluginInfos.ContainsKey("ShyHUD") && (Object)(object)player != (Object)null && (Object)(object)meterOverlay != (Object)null) { meterAlpha = ((Component)player.sprintMeterUI).GetComponent<CanvasRenderer>(); overlayAlpha = ((Component)meterOverlay).GetComponent<CanvasRenderer>(); } } } internal enum ExhaustionIndicator { Empty, ChangeColor, AlwaysShow, DontShow } [BepInPlugin("butterystancakes.lethalcompany.accuratestaminadisplay", "Accurate Stamina Display", "2.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string PLUGIN_GUID = "butterystancakes.lethalcompany.accuratestaminadisplay"; private const string PLUGIN_NAME = "Accurate Stamina Display"; private const string PLUGIN_VERSION = "2.1.1"; internal static ConfigEntry<bool> configInhalantInfo; internal static ConfigEntry<ExhaustionIndicator> configExhaustionIndicator; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) LoadConfig(); new Harmony("butterystancakes.lethalcompany.accuratestaminadisplay").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Accurate Stamina Display v2.1.1 loaded"); } private void LoadConfig() { configInhalantInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "InhalantInfo", false, "Adjusts the color of the stamina meter to reflect the amount of TZP inhaled. (Light = yellow, heavy = green, \"overdose\" = white)"); configExhaustionIndicator = ((BaseUnityPlugin)this).Config.Bind<ExhaustionIndicator>("Misc", "ExhaustionIndicator", ExhaustionIndicator.AlwaysShow, "How the stamina meter displays exhaustion. You become exhausted when stamina hits 0% or if you release the sprint key while stamina is 20% or lower.\n\"Empty\" will make the stamina bar display as empty for the last 20% of stamina, just like the original game. \"ChangeColor\" will turn the bar red when you are currently exhausted. \"AlwaysShow\" will always display the last 20% of the bar as red. \"DontShow\" will not display any special indicator for exhaustion."); if (configExhaustionIndicator.Value != ExhaustionIndicator.AlwaysShow) { return; } bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "AlwaysShowRedPortion", true, "Legacy setting, use \"ExhaustionIndicator\" instead").Value; bool value2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Extra", "ExhaustedRed", true, "Legacy setting, use \"ExhaustionIndicator\" instead").Value; if (((BaseUnityPlugin)this).Config.Bind<bool>("Miscellaneous", "EmptyEarly", false, "Legacy setting, use \"ExhaustionIndicator\" instead").Value) { configExhaustionIndicator.Value = ExhaustionIndicator.Empty; } else if (value2) { if (value) { configExhaustionIndicator.Value = ExhaustionIndicator.AlwaysShow; } else { configExhaustionIndicator.Value = ExhaustionIndicator.ChangeColor; } } else { configExhaustionIndicator.Value = ExhaustionIndicator.DontShow; } ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Extra", "AlwaysShowRedPortion"].Definition); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Extra", "ExhaustedRed"].Definition); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Miscellaneous", "EmptyEarly"].Definition); ((BaseUnityPlugin)this).Config.Save(); } } public static class PluginInfo { public const string PLUGIN_GUID = "AccurateStaminaDisplay"; public const string PLUGIN_NAME = "AccurateStaminaDisplay"; public const string PLUGIN_VERSION = "2.1.1"; } } namespace AccurateStaminaDisplay.Patches { [HarmonyPatch] internal class AccurateStaminaDisplayPatches { [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] public static void PlayerPostLateUpdate() { NewStaminaMeter.UpdateMeter(); } } }
BepInEx/plugins/AddMoneyMod.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TerminalApi; using TerminalApi.Classes; 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("AddMoneyMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AddMoneyMod")] [assembly: AssemblyTitle("AddMoneyMod")] [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 AddMoneyMod { [BepInPlugin("Apoly.AddMoneyMod", "Add Money Mod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class AddMoneyModBase : BaseUnityPlugin { private const string mod_GUID = "Apoly.AddMoneyMod"; private const string mod_NAME = "Add Money Mod"; private const string mod_VERSION = "1.0.0"; private readonly Harmony harmony = new Harmony("Apoly.AddMoneyMod"); private static AddMoneyModBase Instance; internal ManualLogSource mls; public static string description = "Adds the specified amount of credits"; private void Awake() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Apoly.AddMoneyMod"); harmony.PatchAll(); mls.LogInfo((object)"Plugin Apoly.AddMoneyMod is loaded!"); CommandInfo val = new CommandInfo(); val.Category = "none"; val.Description = description; val.DisplayTextSupplier = delegate { string terminalInput5 = TerminalApi.GetTerminalInput(); mls.LogInfo((object)(terminalInput5 ?? "")); int num5 = 250; Terminal val10 = Object.FindObjectOfType<Terminal>(); val10.groupCredits += num5; return "Added 250 credits\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; }; TerminalApi.AddCommand("addmoney250", val, (string)null, true); CommandInfo val2 = new CommandInfo(); val2.Category = "none"; val2.Description = description; val2.DisplayTextSupplier = delegate { string terminalInput4 = TerminalApi.GetTerminalInput(); mls.LogInfo((object)(terminalInput4 ?? "")); int num4 = 500; Terminal val9 = Object.FindObjectOfType<Terminal>(); val9.groupCredits += num4; return "Added 500 credits\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; }; TerminalApi.AddCommand("addmoney500", val2, (string)null, true); CommandInfo val3 = new CommandInfo(); val3.Category = "none"; val3.Description = description; val3.DisplayTextSupplier = delegate { string terminalInput3 = TerminalApi.GetTerminalInput(); mls.LogInfo((object)(terminalInput3 ?? "")); int num3 = 750; Terminal val8 = Object.FindObjectOfType<Terminal>(); val8.groupCredits += num3; return "Added 750 credits\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; }; TerminalApi.AddCommand("addmoney750", val3, (string)null, true); CommandInfo val4 = new CommandInfo(); val4.Category = "none"; val4.Description = description; val4.DisplayTextSupplier = delegate { string terminalInput2 = TerminalApi.GetTerminalInput(); mls.LogInfo((object)(terminalInput2 ?? "")); int num2 = 1000; Terminal val7 = Object.FindObjectOfType<Terminal>(); val7.groupCredits += num2; return "Added 1000 credits\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; }; TerminalApi.AddCommand("addmoney1000", val4, (string)null, true); CommandInfo val5 = new CommandInfo(); val5.Category = "none"; val5.Description = description; val5.DisplayTextSupplier = delegate { string terminalInput = TerminalApi.GetTerminalInput(); mls.LogInfo((object)(terminalInput ?? "")); int num = 5000; Terminal val6 = Object.FindObjectOfType<Terminal>(); val6.groupCredits += num; return "Added 5000 credits\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; }; TerminalApi.AddCommand("addmoney5000", val5, (string)null, true); } } public static class PluginInfo { public const string PLUGIN_GUID = "AddMoneyMod"; public const string PLUGIN_NAME = "AddMoneyMod"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/An0n_Patches.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using An0n_Patches.Patches; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("An0n_Patches")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("An0n_Patches")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("415f18a2-c213-4036-b3f0-7673c0a38c58")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyVersion("1.0.0.0")] namespace An0n_Patches { [BepInPlugin("com.an0n.patch", "An0n Patch", "1.0.4")] public class An0n_Patch_Plugin : BaseUnityPlugin { private const string pluginGUID = "com.an0n.patch"; private const string pluginName = "An0n Patch"; private const string pluginVersion = "1.0.4"; public static ManualLogSource mls = Logger.CreateLogSource("com.an0n.patch"); private Harmony harmony = new Harmony("com.an0n.patch"); public static ConfigEntry<float> instantSprint; public static ConfigEntry<float> slipperiness; public static ConfigEntry<bool> instantJump; public static ConfigEntry<bool> showHPSP; private Harmony patcher; private void Awake() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown instantJump = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "instantJump", true, "Enable/disable instant jump. Removes the delay with jumping when enabled."); instantSprint = ((BaseUnityPlugin)this).Config.Bind<float>("General", "instantSprint", 2.25f, "How fast to accelerate to sprint value of 2.25. 2.25 is the max, so it's instant acceleration."); slipperiness = ((BaseUnityPlugin)this).Config.Bind<float>("General", "slipperiness", 10f, "The amount of slipperiness when running and changing direction. 10-15f is a good value for little to no slippery feeling."); showHPSP = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "showHealthStamina", true, "Show your health and sprint/stamina % on the HUD."); mls.LogInfo((object)"[An0nPatch] Plugin Loaded"); patcher = new Harmony("com.an0n.patch"); patcher.PatchAll(typeof(PlayerControllerPatch)); patcher.PatchAll(typeof(HUDManagerPatch)); } } } namespace An0n_Patches.Patches { [HarmonyPatch] internal class HUDManagerPatch : MonoBehaviour { public static TextMeshProUGUI HPSP_HUDText; public static bool instantiating = true; [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void CreateHPSP_HUD() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (instantiating) { GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI"); GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner"); GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); ((Object)val3).name = "HPSP"; GameObject gameObject = ((Component)val3.transform.GetChild(0)).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); component.anchoredPosition = new Vector2(-45f, 10f); HPSP_HUDText = gameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)HPSP_HUDText).faceColor = Color32.op_Implicit(new Color(255f, 0f, 0f, 255f)); ((TMP_Text)HPSP_HUDText).fontSize = 12f; ((TMP_Text)HPSP_HUDText).margin = new Vector4(0f, -36f, 100f, 0f); ((TMP_Text)HPSP_HUDText).alignment = (TextAlignmentOptions)260; ((TMP_Text)HPSP_HUDText).text = $"{100}\n\n\n{100}%"; instantiating = false; } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void unInstantiate() { instantiating = true; } [HarmonyPatch(typeof(HUDManager), "Update")] [HarmonyPostfix] public static void Update() { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !instantiating) { float num = Mathf.RoundToInt((float)GameNetworkManager.Instance.localPlayerController.health); float num2 = Mathf.RoundToInt((GameNetworkManager.Instance.localPlayerController.sprintMeter * 100f - 10f) / 90f * 100f); if (num2 < 0f) { num2 = 0f; } if (An0n_Patch_Plugin.showHPSP.Value) { ((TMP_Text)HPSP_HUDText).text = $"{num}\n\n\n\n{num2}%"; } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerPatch { private static PlayerControllerB __mainPlayer; public static bool tempcrouch = false; private static bool stillInitializing = true; [HarmonyTranspiler] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static IEnumerable<CodeInstruction> RemoveJumpDelay(IEnumerable<CodeInstruction> instructions) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); if (!An0n_Patch_Plugin.instantJump.Value) { return list; } int num = 0; for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (!(val.opcode != OpCodes.Newobj)) { ConstructorInfo constructorInfo = val.operand as ConstructorInfo; if (((constructorInfo != null) ? constructorInfo.DeclaringType : null) == typeof(WaitForSeconds)) { Debug.Log((object)"[An0nPatch] patched Instant-Jump"); list[i] = new CodeInstruction(OpCodes.Ldnull, (object)null); Debug.Log((object)(num + "-REM:" + ((object)list[i]).ToString())); Debug.Log((object)(num - 1 + "REM:" + ((object)list[i - 1]).ToString())); list.RemoveAt(i - 1); i--; } } num++; } return list; } [HarmonyTranspiler] [HarmonyPatch(typeof(PlayerControllerB), "Update")] public static IEnumerable<CodeInstruction> fixFloatyTurnAndRun(IEnumerable<CodeInstruction> instructions) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count - 3; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Ldc_R4 && (float)val.operand == 5f && CodeInstructionExtensions.LoadsField(list[i + 2], typeof(PlayerControllerB).GetField("carryWeight"), false) && list[i + 3].opcode == OpCodes.Ldc_R4 && (float)list[i + 3].operand == 1.5f) { Debug.Log((object)"[An0nPatch] patched slipperiness"); list[i] = new CodeInstruction(OpCodes.Ldc_R4, (object)An0n_Patch_Plugin.slipperiness.Value); } } for (int j = 1; j < list.Count - 2; j++) { CodeInstruction val2 = list[j]; if (val2.opcode == OpCodes.Ldc_R4 && (float)val2.operand == 2.25f && list[j - 1].opcode == OpCodes.Ldfld && ((object)list[j - 1]).ToString() == "ldfld float GameNetcodeStuff.PlayerControllerB::sprintMultiplier" && list[j + 2].opcode == OpCodes.Ldc_R4 && (float)list[j + 2].operand == 1f) { Debug.Log((object)"[An0nPatch] patched instant sprint"); list[j + 2] = new CodeInstruction(OpCodes.Ldc_R4, (object)An0n_Patch_Plugin.instantSprint.Value); } } return list; } public static bool canJump(RaycastHit ___hit) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; return !Physics.Raycast(((Component)localPlayerController.gameplayCamera).transform.position, Vector3.up, ref ___hit, 0.72f, localPlayerController.playersManager.collidersAndRoomMask, (QueryTriggerInteraction)1); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void ReadInput(PlayerControllerB __instance, RaycastHit ___hit) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) try { if (!stillInitializing) { if (__mainPlayer == null) { __mainPlayer = StartOfRound.Instance.localPlayerController; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject)) && !__instance.isTestingPlayer && !__mainPlayer.inTerminalMenu && !__mainPlayer.isTypingChat && !__mainPlayer.isPlayerDead && !__mainPlayer.quickMenuManager.isMenuOpen && !IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", true).IsPressed() && !Physics.Raycast(((Component)localPlayerController.gameplayCamera).transform.position, Vector3.up, ref ___hit, 0.72f, localPlayerController.playersManager.collidersAndRoomMask, (QueryTriggerInteraction)1)) { localPlayerController.isCrouching = false; localPlayerController.playerBodyAnimator.SetBool("crouching", false); } } } catch { } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPrefix] public static void Jump_performedA(PlayerControllerB __instance, RaycastHit ___hit) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (__instance.isCrouching && canJump(___hit)) { __instance.isCrouching = false; tempcrouch = true; } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPostfix] public static void Jump_performedB(PlayerControllerB __instance) { if (tempcrouch) { __instance.isCrouching = true; tempcrouch = false; } } [HarmonyPatch(typeof(PlayerControllerB), "Crouch_performed")] [HarmonyPrefix] public static void Crouch_performed() { } [HarmonyPatch(typeof(PlayerControllerB), "PlayerHitGroundEffects")] [HarmonyPostfix] public static void PlayerHitGroundEffects() { if (GameNetworkManager.Instance.localPlayerController.isCrouching) { GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetTrigger("startCrouching"); GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetBool("crouching", true); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] public static void Uninitialize() { stillInitializing = true; } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void Initialize() { stillInitializing = false; } } }
BepInEx/plugins/Batteries.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.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Unity.Netcode; 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: AssemblyTitle("Batteries")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Batteries")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d3aee990-a08c-4376-93d1-e137bd434d45")] [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 Batteries { public class BatteryManager : MonoBehaviour { public static BatteryManager Instance { get; private set; } public InputAction ReloadBatteryAction { get; private set; } private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) Instance = this; ReloadBatteryAction = new InputAction("ReloadBattery", (InputActionType)0, (string)null, (string)null, (string)null, (string)null); if (string.IsNullOrEmpty(ConfigManager.useBatteryKeybinds.Value)) { ConfigManager.useBatteryKeybinds.Value = "<Keyboard>/c,<Gamepad>/dpad/up,<XRController>{RightHand}/gripButton"; } string[] array = ConfigManager.useBatteryKeybinds.Value.Split(new char[1] { ',' }); foreach (string text in array) { InputActionSetupExtensions.AddBinding(ReloadBatteryAction, text, (string)null, (string)null, (string)null); } ReloadBatteryAction.Enable(); ReloadBatteryAction.performed += ReloadBatteryActionPerformed; } private void OnDestroy() { ReloadBatteryAction.performed -= ReloadBatteryActionPerformed; ReloadBatteryAction.Disable(); } private static void ReloadBatteryActionPerformed(CallbackContext context) { if (!((CallbackContext)(ref context)).performed) { return; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((Object)(object)localPlayerController.currentlyHeldObjectServer == (Object)null || localPlayerController.inSpecialInteractAnimation || !localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery || !(localPlayerController.currentlyHeldObjectServer.insertedBattery.charge < 1f)) { return; } for (int i = 0; i < localPlayerController.ItemSlots.Length; i++) { if ((Object)(object)localPlayerController.ItemSlots[i] != (Object)null && (localPlayerController.ItemSlots[i].itemProperties.itemId == 5601 || localPlayerController.ItemSlots[i].itemProperties.itemId == 5602)) { ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<AudioSource>().PlayOneShot(BatteriesMod.useBattery); localPlayerController.DestroyItemInSlotAndSync(i); if (ConfigManager.batteryChargeAmount.Value < 0f || ConfigManager.batteryChargeAmount.Value > 1f) { Battery insertedBattery = localPlayerController.currentlyHeldObjectServer.insertedBattery; insertedBattery.charge += (float)((ConfigEntryBase)ConfigManager.batteryChargeAmount).DefaultValue; } else { Battery insertedBattery2 = localPlayerController.currentlyHeldObjectServer.insertedBattery; insertedBattery2.charge += ConfigManager.batteryChargeAmount.Value; } if (localPlayerController.currentlyHeldObjectServer.insertedBattery.charge > 1f) { localPlayerController.currentlyHeldObjectServer.insertedBattery.charge = 1f; } if (localPlayerController.currentlyHeldObjectServer.insertedBattery.empty) { localPlayerController.currentlyHeldObjectServer.insertedBattery.empty = false; } break; } } } } internal class ConfigManager { public const string DEFAULT_KEYBINDS = "<Keyboard>/c,<Gamepad>/dpad/up,<XRController>{RightHand}/gripButton"; public static ConfigEntry<bool> toolTipEnabled; public static ConfigEntry<bool> disableChargingCoil; public static ConfigEntry<string> useBatteryKeybinds; public static ConfigEntry<float> batteryChargeAmount; public static ConfigEntry<int> batteryMaxSpawns; public static ConfigEntry<int> batteryRarity; public static ConfigEntry<int> batteryScrapValue; public static ConfigEntry<int> batteryShopValue; public static void Init() { toolTipEnabled = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<bool>("General Settings", "toolTipEnabled", true, "Allows the mod to add/remove a tool tip to battery powered items when necessary."); disableChargingCoil = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<bool>("General Settings", "disableChargingCoil", false, "Disables the charging coil. Mainly for people who wish to have batteries as the only charge source."); useBatteryKeybinds = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<string>("General Settings", "useBatteryKeybinds", "<Keyboard>/c,<Gamepad>/dpad/up,<XRController>{RightHand}/gripButton", "The value for the keybinds to use a battery, split by comma. Values for keybinds can be found here: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.Key.html."); batteryChargeAmount = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<float>("Battery Settings", "batteryChargeAmount", 0.25f, "The amount that batteries charge battery powered items. Can be set to a minimum of 0 (0% charge) and a maximum of 1 (100% charge)."); batteryMaxSpawns = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<int>("Battery Settings", "batteryMaxSpawns", 10, "The maximum number of batteries that can spawn per moon. Can be set to any number greater than 0."); batteryRarity = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<int>("Battery Settings", "batteryRarity", 70, "How rare it is for a battery to spawn. Can be set to a minimum of 0 (cannot spawn) and a maximum of 100 (common)."); batteryScrapValue = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<int>("Battery Settings", "batteryScrapValue", 5, "The scrap value of batteries."); batteryShopValue = ((BaseUnityPlugin)BatteriesMod.instance).Config.Bind<int>("Battery Settings", "batteryShopValue", 0, "How much batteries cost in the shop. When set to 0 or less batteries will not appear in the shop."); } } [BepInPlugin("eXish.Batteries", "Batteries", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BatteriesMod : BaseUnityPlugin { private const string mGUID = "eXish.Batteries"; private const string mName = "Batteries"; private const string mVersion = "1.1.0"; private readonly Harmony harmony = new Harmony("eXish.Batteries"); internal static BatteriesMod instance; internal static AssetBundle bundle; internal static AudioClip useBattery; internal static Item batteryItem; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } ConfigManager.Init(); if (string.IsNullOrEmpty(ConfigManager.useBatteryKeybinds.Value)) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("The value \"" + ConfigManager.useBatteryKeybinds.Value + "\" is not valid for setting \"useBatteryKeybinds\"! The default will be used instead.")); } if (ConfigManager.batteryChargeAmount.Value < 0f || ConfigManager.batteryChargeAmount.Value > 1f) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"The value \"{ConfigManager.batteryChargeAmount.Value}\" is not valid for setting \"batteryChargeAmount\"! The default will be used instead."); } if (ConfigManager.batteryRarity.Value < 0 || ConfigManager.batteryRarity.Value > 100) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"The value \"{ConfigManager.batteryRarity.Value}\" is not valid for setting \"batteryRarity\"! The default will be used instead."); } if (ConfigManager.batteryMaxSpawns.Value <= 0) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"The value \"{ConfigManager.batteryMaxSpawns.Value}\" is not valid for setting \"batteryMaxSpawns\"! The default will be used instead."); } if (ConfigManager.batteryScrapValue.Value < 0) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"The value \"{ConfigManager.batteryScrapValue.Value}\" is not valid for setting \"batteryScrapValue\"! The default will be used instead."); } string text = ((BaseUnityPlugin)instance).Info.Location.TrimEnd("Batteries.dll".ToCharArray()); bundle = AssetBundle.LoadFromFile(text + "batteries"); if ((Object)(object)bundle != (Object)null) { useBattery = bundle.LoadAsset<AudioClip>("Assets/Batteries/UseBattery.wav"); batteryItem = bundle.LoadAsset<Item>("Assets/Batteries/Battery.asset"); if (ConfigManager.batteryRarity.Value != 0) { Utilities.FixMixerGroups(batteryItem.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(batteryItem.spawnPrefab); Items.RegisterItem(batteryItem); } if (ConfigManager.batteryShopValue.Value > 0) { Item val = bundle.LoadAsset<Item>("Assets/Batteries/StoreBattery.asset"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>(); val2.clearPreviousText = true; val2.displayText = "Are you tired of having to travel all the way back to your ship to charge equipment? Well fear not! Durable's new battery line will solve all your charging needs! Get the power you deserve right when you need it!\n\nDurable is not responsible for any injury or death caused by our product. All items purchased are non-refundable.\n\n"; Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, ConfigManager.batteryShopValue.Value); } } else { ((BaseUnityPlugin)instance).Logger.LogError((object)"Unable to locate the asset file! Batteries will not spawn or appear in the shop."); } harmony.PatchAll(); ((BaseUnityPlugin)instance).Logger.LogInfo((object)"Batteries-1.1.0 loaded!"); } } } namespace Batteries.Patches { [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ObjUpdatePatch(ref GrabbableObject __instance) { if (__instance.itemProperties.itemId == 5601) { if (ConfigManager.batteryScrapValue.Value < 0) { __instance.SetScrapValue((int)((ConfigEntryBase)ConfigManager.batteryScrapValue).DefaultValue); } else { __instance.SetScrapValue(ConfigManager.batteryScrapValue.Value); } } } } [HarmonyPatch(typeof(ItemCharger))] internal class ItemChargerPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ChargerUpdatePatch(ref ItemCharger __instance) { if (((Component)__instance).gameObject.activeSelf && ConfigManager.disableChargingCoil.Value) { ((Component)__instance).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static bool wasUsingController; [HarmonyPatch("Update")] [HarmonyPostfix] private static void PlayerUpdatePatch(ref PlayerControllerB __instance) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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) if (!((NetworkBehaviour)__instance).IsOwner || (Object)(object)__instance.currentlyHeldObjectServer == (Object)null || __instance.inSpecialInteractAnimation || !ConfigManager.toolTipEnabled.Value || !__instance.currentlyHeldObjectServer.itemProperties.requiresBattery) { return; } if (__instance.currentlyHeldObjectServer.insertedBattery.charge < 1f && (!BatteryTooltipShown() || wasUsingController != StartOfRound.Instance.localPlayerUsingController) && BatteryInInventory()) { InputBinding val = ((IEnumerable<InputBinding>)(object)BatteryManager.Instance.ReloadBatteryAction.bindings).FirstOrDefault((Func<InputBinding, bool>)((InputBinding x) => ((InputBinding)(ref x)).path.ToLowerInvariant().Contains(StartOfRound.Instance.localPlayerUsingController ? "<gamepad>" : "<keyboard>"))); string text = ((val == default(InputBinding)) ? "?" : ((InputBinding)(ref val)).ToDisplayString((DisplayStringOptions)0, (InputControl)null)); string[] toolTips = __instance.currentlyHeldObjectServer.itemProperties.toolTips; string[] array = new string[toolTips.Length + 1]; for (int i = 0; i < array.Length; i++) { if (i != array.Length - 1) { array[i] = toolTips[i]; } else { array[i] = "Use Battery : [" + text + "]"; } } __instance.currentlyHeldObjectServer.itemProperties.toolTips = array; HUDManager.Instance.ClearControlTips(); __instance.currentlyHeldObjectServer.SetControlTipsForItem(); wasUsingController = StartOfRound.Instance.localPlayerUsingController; } if (BatteryTooltipShown() && (__instance.currentlyHeldObjectServer.insertedBattery.charge >= 1f || !BatteryInInventory())) { __instance.currentlyHeldObjectServer.itemProperties.toolTips = __instance.currentlyHeldObjectServer.itemProperties.toolTips.Where((string x) => !x.StartsWith("Use Battery : [")).ToArray(); HUDManager.Instance.ClearControlTips(); __instance.currentlyHeldObjectServer.SetControlTipsForItem(); } } private static bool BatteryInInventory() { return StartOfRound.Instance.localPlayerController.ItemSlots.Any((GrabbableObject x) => Object.op_Implicit((Object)(object)x) && (x.itemProperties.itemId == 5601 || x.itemProperties.itemId == 5602)); } private static bool BatteryTooltipShown() { return StartOfRound.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.toolTips.Any((string tooltip) => tooltip.StartsWith("Use Battery : [")); } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPostfix] private static void SpawnScrapPatch(ref RoundManager __instance) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) int num = ConfigManager.batteryRarity.Value; if (num < 0 || num > 100) { num = (int)((ConfigEntryBase)ConfigManager.batteryRarity).DefaultValue; } if (num == 0) { return; } int num2 = ConfigManager.batteryMaxSpawns.Value; if (num2 <= 0) { num2 = (int)((ConfigEntryBase)ConfigManager.batteryMaxSpawns).DefaultValue; } for (int i = 0; i < num2; i++) { int num3 = __instance.AnomalyRandom.Next(1, 151); if (num3 <= num) { int num4 = __instance.AnomalyRandom.Next(0, __instance.insideAINodes.Length); Vector3 randomNavMeshPositionInBoxPredictable = __instance.GetRandomNavMeshPositionInBoxPredictable(__instance.insideAINodes[num4].transform.position, 8f, __instance.navHit, __instance.AnomalyRandom, -1); Object.Instantiate<GameObject>(BatteriesMod.batteryItem.spawnPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity, __instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false); } } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OnStartOfRoundStart(StartOfRound __instance) { ((Component)__instance).gameObject.AddComponent<BatteryManager>(); } } }
BepInEx/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/BetterLightning.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BetterLightning")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterLightning")] [assembly: AssemblyTitle("BetterLightning")] [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 BetterLightning { [BepInPlugin("Archmage.BetterLightning", "BetterLightning", "1.0.3")] public class BetterLightningMod : BaseUnityPlugin { private const string modGUID = "Archmage.BetterLightning"; private const string modName = "BetterLightning"; private const string modVersion = "1.0.3"; public static BetterLightningMod Instance; private readonly Harmony harmony = new Harmony("Archmage.BetterLightning"); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Archmage.BetterLightning is loaded!"); harmony.PatchAll(); } } } namespace BetterLightning.Patches { internal static class Util { public static bool StartParticleEffect(ref StormyWeather _instance, ref GameObject warningObject, ref Vector3 currentRandomStrikePos, ref float randomThunderTime, ref ParticleSystem particles) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)warningObject == (Object)null) { warningObject = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)warningObject).name = "LightningSpot"; } warningObject.transform.localPosition = currentRandomStrikePos; GameObject obj = warningObject; if (obj != null) { obj.SetActive(true); } float num = MathF.Abs(TimeOfDay.Instance.globalTime - randomThunderTime); ShapeModule shape = particles.shape; GameObject obj2 = warningObject; ((ShapeModule)(ref shape)).meshRenderer = ((obj2 != null) ? obj2.GetComponent<MeshRenderer>() : null); ((Component)particles).transform.localPosition = currentRandomStrikePos; Transform transform = ((Component)particles).transform; transform.localPosition += new Vector3(0f, 0.01f, 0f); float length = _instance.staticElectricityAudio.length; if (num <= length) { StartAudioAndParticles(length - num, ref particles, ref _instance); return true; } return false; } public static void StartAudioAndParticles(float offset, ref ParticleSystem particles, ref StormyWeather _instance) { particles.time = offset + 2f; particles.Play(); particles.time = offset + 2f; ((Component)particles).gameObject.GetComponent<AudioSource>().clip = _instance.staticElectricityAudio; ((Component)particles).gameObject.GetComponent<AudioSource>().loop = false; ((Component)particles).gameObject.GetComponent<AudioSource>().time = offset + 2f; ((Component)particles).gameObject.GetComponent<AudioSource>().Play(); } } [HarmonyPatch(typeof(StormyWeather))] internal class StormyWeatherPatch { public static Vector3 lastRandomStrikePos = Vector3.zero; public static Vector3 currentRandomStrikePos = Vector3.zero; public static float randomThunderTime = 0f; public static bool generatedWarning = false; public static GameObject warningObject = null; public static float AudioTimer = -1f; public static ParticleSystem RandomLightningParticle = null; public static GameObject ParticleObject = null; private static bool StartedWarning = false; [HarmonyPatch("OnEnable")] [HarmonyPostfix] private static void OnEnable(ref StormyWeather __instance) { generatedWarning = false; if ((Object)(object)warningObject != (Object)null) { Object.Destroy((Object)(object)warningObject); } if ((Object)(object)ParticleObject == (Object)null) { ParticleObject = Object.Instantiate<GameObject>(((Component)__instance.staticElectricityParticle).gameObject); ((Object)ParticleObject).name = "RandomLightningParticles"; RandomLightningParticle = ParticleObject.GetComponent<ParticleSystem>(); } randomThunderTime = 0f; } [HarmonyPatch("OnDisable")] [HarmonyPostfix] private static void OnDisable() { if ((Object)(object)warningObject != (Object)null) { Object.Destroy((Object)(object)warningObject); } if ((Object)(object)ParticleObject != (Object)null) { Object.Destroy((Object)(object)ParticleObject); RandomLightningParticle = null; } } [HarmonyPatch("LightningStrikeRandom")] [HarmonyPrefix] private static bool patch_Pre_LightningStrikeRandom(ref StormyWeather __instance, ref float ___timeAtLastStrike, ref GameObject[] ___outsideNodes, ref NavMeshHit ___navHit) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) FieldInfo fieldInfo = AccessTools.Field(typeof(StormyWeather), "seed"); Random random = (Random)fieldInfo.GetValue(__instance); Vector3 randomNavMeshPositionInBoxPredictable; if (random.Next(0, 100) < 60 && (randomThunderTime - ___timeAtLastStrike) * TimeOfDay.Instance.currentWeatherVariable < 3f) { randomNavMeshPositionInBoxPredictable = currentRandomStrikePos; } else { int num = random.Next(0, ___outsideNodes.Length); if (___outsideNodes == null || (Object)(object)___outsideNodes[num] == (Object)null) { ___outsideNodes = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode") orderby x.transform.position.x + x.transform.position.z select x).ToArray(); } randomNavMeshPositionInBoxPredictable = ___outsideNodes[num].transform.position; randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(randomNavMeshPositionInBoxPredictable, 15f, ___navHit, random, -1); } currentRandomStrikePos = randomNavMeshPositionInBoxPredictable; generatedWarning = true; return false; } [HarmonyPatch("DetermineNextStrikeInterval")] [HarmonyPrefix] private static void patch_Pre_DetermineNextStrikeInterval(ref float ___randomThunderTime) { ___randomThunderTime = randomThunderTime; } [HarmonyPatch("DetermineNextStrikeInterval")] [HarmonyPostfix] private static void patch_Post_DetermineNextStrikeInterval(ref float ___randomThunderTime) { randomThunderTime = ___randomThunderTime; ___randomThunderTime = TimeOfDay.Instance.globalTime + 1f; } [HarmonyPatch("Update")] [HarmonyPrefix] private static void patch_Pre_Update(ref StormyWeather __instance, ref float ___randomThunderTime) { //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!((Component)__instance).gameObject.activeInHierarchy) { return; } ___randomThunderTime = TimeOfDay.Instance.globalTime + 1f; if (!generatedWarning) { AccessTools.Method(typeof(StormyWeather), "DetermineNextStrikeInterval", (Type[])null, (Type[])null).Invoke(__instance, null); AccessTools.Method(typeof(StormyWeather), "LightningStrikeRandom", (Type[])null, (Type[])null).Invoke(__instance, null); StartedWarning = Util.StartParticleEffect(ref __instance, ref warningObject, ref currentRandomStrikePos, ref randomThunderTime, ref RandomLightningParticle); AudioTimer = __instance.staticElectricityAudio.length; } if (!StartedWarning) { float num = MathF.Abs(TimeOfDay.Instance.globalTime - randomThunderTime); if (num <= AudioTimer) { Util.StartAudioAndParticles(AudioTimer - num, ref RandomLightningParticle, ref __instance); StartedWarning = true; } } if (TimeOfDay.Instance.globalTime > randomThunderTime) { __instance.LightningStrike(currentRandomStrikePos, false); generatedWarning = false; RandomLightningParticle.Stop(); ((Component)RandomLightningParticle).gameObject.GetComponent<AudioSource>().Stop(); GameObject obj = warningObject; if (obj != null) { obj.SetActive(false); } } } } }
BepInEx/plugins/ChangeName.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.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ChangeName")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Change in-game name")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9ad07e918fa6011a98cef2e1281a0a7577b70a07")] [assembly: AssemblyProduct("ChangeName")] [assembly: AssemblyTitle("ChangeName")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChangeName { [BepInPlugin("me.wallen.changename", "Change Player Names", "1.0.0")] public class ChangeNamePlugin : BaseUnityPlugin { private const string GUID = "me.wallen.changename"; private const string NAME = "Change Player Names"; private const string VERSION = "1.0.0"; private static ChangeNamePlugin Instance; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Instance = this; LogInfo("Loading..."); Harmony val = new Harmony("me.wallen.changename"); val.PatchAll(); Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(NameDatabase.NDNetGetString)); LogInfo("Loading Complete!"); } internal static void LogDebug(string message) { Instance.Log(message, (LogLevel)32); } internal static void LogInfo(string message) { Instance.Log(message, (LogLevel)16); } internal static void LogWarning(string message) { Instance.Log(message, (LogLevel)4); } internal static void LogError(string message) { Instance.Log(message, (LogLevel)2); } internal static void LogError(Exception ex) { Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2); } private void Log(string message, LogLevel logLevel) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.Log(logLevel, (object)message); } } internal static class NameDatabase { internal static bool shouldUpdateNames = false; internal static bool shouldSendNames = false; public const string SIG_BEGIN_UPDATE_NAMES = "CHANGE_NAME_BEGIN_UPDATE_NAMES"; public const string SIG_UPDATE_NAME = "CHANGE_NAME_UPDATE_NAME"; public const string SIG_END_UPDATE_NAMES = "CHANGE_NAME_END_UPDATE_NAMES"; public const string SIG_PLAYER_JOIN = "CHANGE_NAME_PLAYER_JOIN"; public const string SIG_NEW_LEVEL = "CHANGE_NAME_NEW_LEVEL"; private const string SIG_NEW_ROUND = "CHANGE_NAME_NEW_ROUND"; private static Dictionary<ulong, string> names = new Dictionary<ulong, string>(); internal static string GetName(ulong id) { if (!names.ContainsKey(id)) { ChangeNamePlugin.LogWarning("[NameDatabase.GetName] Failed to get name"); return ""; } return names[id]; } internal static void SetName(ulong id, string name) { if (!names.ContainsKey(id)) { names.Add(id, name); } else { names[id] = name; } } internal static bool HasName(string name) { return names.ContainsValue(name); } internal static bool HasId(ulong id) { return names.ContainsKey(id); } internal static ulong GetUsableIdFromPlayer(PlayerControllerB player) { if (!GameNetworkManager.Instance.disableSteam) { return player.playerSteamId; } return player.playerClientId; } internal static void UpdateName(string oldName, string newName) { if (!names.ContainsValue(oldName)) { ChangeNamePlugin.LogWarning("[NameDatabase.UpdateName] Tried to update name " + oldName + " but it does not exist"); ChangeNamePlugin.LogWarning(names.ToString()); } else { ulong key = names.FirstOrDefault((KeyValuePair<ulong, string> x) => x.Value == oldName).Key; names[key] = newName; } shouldUpdateNames = true; } internal static int NumberOfNames() { return names.Count; } internal static void NDNetGetString(string data, string signature) { switch (signature) { case "CHANGE_NAME_PLAYER_JOIN": case "CHANGE_NAME_NEW_ROUND": if (((NetworkBehaviour)StartOfRound.Instance).IsHost) { shouldSendNames = true; } break; case "CHANGE_NAME_BEGIN_UPDATE_NAMES": ChangeNamePlugin.LogInfo("[NameDatabase] Beginning name update process."); break; case "CHANGE_NAME_UPDATE_NAME": { KeyValuePair<ulong, string>? keyValuePair = DecodeName(data); if (keyValuePair.HasValue) { KeyValuePair<ulong, string> value = keyValuePair.Value; ChangeNamePlugin.LogInfo("[NameDatabase] New name received: " + value.Key + " : " + value.Value); names[value.Key] = value.Value; } break; } case "CHANGE_NAME_END_UPDATE_NAMES": ChangeNamePlugin.LogInfo("[NameDatabase] End of name update process."); shouldUpdateNames = true; break; } } internal static void NDNetSendNames() { Networking.Broadcast(string.Empty, "CHANGE_NAME_BEGIN_UPDATE_NAMES"); foreach (KeyValuePair<ulong, string> name in names) { string text = EncodeName(name); Networking.Broadcast(text, "CHANGE_NAME_UPDATE_NAME"); } Networking.Broadcast(string.Empty, "CHANGE_NAME_END_UPDATE_NAMES"); } private static string EncodeName(KeyValuePair<ulong, string> namePair) { return $"{namePair.Key}:{namePair.Value}"; } private static KeyValuePair<ulong, string>? DecodeName(string encoded) { string[] array = encoded.Split(':'); if (array.Length == 2 && ulong.TryParse(array[0], out var result)) { return new KeyValuePair<ulong, string>(result, array[1]); } return null; } private static string EncodeNames(Dictionary<ulong, string> names) { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<ulong, string> name in names) { stringBuilder.Append($"{name.Key}:{name.Value};"); } return stringBuilder.ToString(); } private static Dictionary<ulong, string> DecodeNames(string encoded) { string[] array = encoded.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); Dictionary<ulong, string> dictionary = new Dictionary<ulong, string>(); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); dictionary[ulong.Parse(array3[0])] = array3[1]; } return dictionary; } private static string DictionaryToString(Dictionary<ulong, string> dictionary) { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<ulong, string> item in dictionary) { stringBuilder.AppendLine($"Key: {item.Key}, Value: {item.Value}"); } return stringBuilder.ToString(); } } } namespace ChangeName.Patches { [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] internal class HUDManager_AddChatMessage { private static string lastChatMessage = ""; private static void Postfix(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped) { if (lastChatMessage == chatMessage) { return; } lastChatMessage = chatMessage; ChangeNamePlugin.LogDebug(chatMessage); if (chatMessage.Contains("!name")) { string text = chatMessage.Substring(chatMessage.IndexOf("!name") + "!name".Length).Trim(); if (NameDatabase.HasName(text)) { __instance.AddTextToChatOnServer("Duplicate names are not allowed!", -1); } else if (((NetworkBehaviour)__instance.playersManager).IsHost) { NameDatabase.UpdateName(nameOfUserWhoTyped, text); NameDatabase.shouldSendNames = true; NameDatabase.shouldUpdateNames = true; } } } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] internal class PlayerControllerB_ConnectClientToPlayerObject { private static void Postfix(PlayerControllerB __instance) { ChangeNamePlugin.LogDebug("Steam Disabled: " + GameNetworkManager.Instance.disableSteam); ChangeNamePlugin.LogDebug("Is Host: " + ((NetworkBehaviour)__instance).IsHost); ChangeNamePlugin.LogDebug("Player steam ID: " + __instance.playerSteamId); ChangeNamePlugin.LogDebug("Player client ID: " + __instance.playerClientId); ChangeNamePlugin.LogDebug("Actual client ID: " + __instance.actualClientId); ChangeNamePlugin.LogDebug("Player Username: " + __instance.playerUsername); Networking.Broadcast("", "CHANGE_NAME_PLAYER_JOIN"); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal class PlayerControllerB_Update { private static float lastUpdateTime; private static void Postfix(PlayerControllerB __instance) { if (!(lastUpdateTime + 2f < Time.time)) { return; } if (((NetworkBehaviour)__instance).IsHost) { PlayerControllerB[] allPlayerScripts = __instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!NameDatabase.HasId(NameDatabase.GetUsableIdFromPlayer(val))) { NameDatabase.SetName(NameDatabase.GetUsableIdFromPlayer(val), val.playerUsername); } } if (NameDatabase.shouldSendNames) { NameDatabase.NDNetSendNames(); NameDatabase.shouldSendNames = false; } } if (NameDatabase.shouldUpdateNames) { PlayerControllerB[] allPlayerScripts2 = __instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts2) { string name = NameDatabase.GetName(NameDatabase.GetUsableIdFromPlayer(val2)); foreach (TransformAndName radarTarget in StartOfRound.Instance.mapScreen.radarTargets) { Transform transform = radarTarget.transform; if (radarTarget.name == val2.playerUsername) { StartOfRound.Instance.mapScreen.ChangeNameOfTargetTransform(transform, name); } } val2.playerUsername = name; ((TMP_Text)val2.usernameBillboardText).text = name; } NameDatabase.shouldUpdateNames = false; } lastUpdateTime = Time.time; } } [HarmonyPatch(typeof(StartOfRound), "ArriveAtLevel")] internal class StartOfRound_ArriveAtLevel { private static void Postfix(StartOfRound __instance) { } } }
BepInEx/plugins/com.spycibot.cozyimprovements.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 HarmonyLib; using Microsoft.CodeAnalysis; using SpyciBot.LC.CozyImprovements.Improvements; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.spycibot.cozyimprovements")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("\r\n Enhance the experience inside the ship to create a more immersive, cozy, and accessible environment. v47 compatible.\r\n ")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+39da0e927e7ba9e69220c8a7b7ef50abc7f605fb")] [assembly: AssemblyProduct("Cozy Improvements")] [assembly: AssemblyTitle("com.spycibot.cozyimprovements")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SpyciBot.LC.CozyImprovements { public class Config { public ConfigEntry<bool> configStorageLights; public ConfigEntry<bool> configLightSwitchGlow; public ConfigEntry<bool> configTerminalGlow; public ConfigEntry<bool> configTerminalMonitorAlwaysOn; public ConfigEntry<bool> configChargeStationGlow; public ConfigEntry<bool> configBigDoorButtons; public ConfigEntry<bool> configEasyLaunchLever; public ConfigEntry<bool> configBigTeleporterButtons; public ConfigEntry<bool> configBigMonitorButtons; public Config(ConfigFile cfg) { configStorageLights = cfg.Bind<bool>("General", "StorageLightsEnabled", true, "Enables the Storage Lights System"); configLightSwitchGlow = cfg.Bind<bool>("General", "LightSwitchGlowEnabled", true, "Makes the LightSwitch glow in the dark"); configTerminalGlow = cfg.Bind<bool>("General", "TerminalGlowEnabled", true, "Makes the Terminal glow active all the time"); configTerminalMonitorAlwaysOn = cfg.Bind<bool>("General", "TerminalMonitorAlwaysOn", true, "Makes the Terminal screen active all the time; Will show the screen you left it on"); configChargeStationGlow = cfg.Bind<bool>("General", "ChargeStationGlowEnabled", true, "Makes the Charging Station glow with a yellow light"); configBigDoorButtons = cfg.Bind<bool>("General.Accessibility", "BigDoorButtonsEnabled", false, "Enlarges the door buttons so they're easier to press"); configEasyLaunchLever = cfg.Bind<bool>("General.Accessibility", "EasyLaunchLeverEnabled", true, "Enlarges the hitbox for the Launch Lever to cover more of the table so it's easier to pull"); configBigTeleporterButtons = cfg.Bind<bool>("General.Accessibility", "BigTeleporterButtonsEnabled", false, "Enlarges the teleporter buttons so they're easier to press"); configBigMonitorButtons = cfg.Bind<bool>("General.Accessibility", "BigMonitorButtonsEnabled", false, "Enlarges the Monitor buttons so they're easier to press"); } } [BepInPlugin("com.spycibot.cozyimprovements", "Cozy Improvements", "1.2.2")] [HarmonyPatch] public class CozyImprovements : BaseUnityPlugin { private static GameObject gameObject; private static Terminal TermInst; public static Config CozyConfig { get; internal set; } private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Cozy Improvements - com.spycibot.cozyimprovements - 1.2.2 is loaded!"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); CozyConfig = new Config(((BaseUnityPlugin)this).Config); } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void Postfix_Terminal_Start(Terminal __instance) { TermInst = __instance; if (CozyConfig.configTerminalMonitorAlwaysOn.Value) { TermInst.LoadNewNode(TermInst.terminalNodes.specialNodes[1]); } if (CozyConfig.configTerminalGlow.Value) { ((Behaviour)TermInst.terminalLight).enabled = true; } } [HarmonyPatch(typeof(Terminal), "waitUntilFrameEndToSetActive")] [HarmonyPrefix] private static void Prefix_Terminal_WaitUntilFrameEndToSetActive(Terminal __instance, ref bool active) { TermInst = __instance; if (CozyConfig.configTerminalMonitorAlwaysOn.Value) { active = true; } } [HarmonyPatch(typeof(Terminal), "SetTerminalInUseClientRpc")] [HarmonyPostfix] private static void Postfix_Terminal_SetTerminalInUseClientRpc(Terminal __instance, bool inUse) { TermInst = __instance; if (CozyConfig.configTerminalGlow.Value) { ((Behaviour)TermInst.terminalLight).enabled = true; } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void PostfixOnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed) { if (clientId == NetworkManager.Singleton.LocalClientId) { DoAllTheThings(); } } [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] [HarmonyPostfix] private static void PostfixLoadUnlockables(StartOfRound __instance) { DoAllTheThings(); } private static void DoAllTheThings() { try { manageInteractables(); } catch (Exception arg) { Debug.LogError((object)$"Caught Exception in manageInteractables(): {arg}"); } try { manageStorageCupboard(); } catch (Exception arg2) { Debug.LogError((object)$"Caught Exception in manageStorageCupboard(): {arg2}"); } } private static void manageInteractables() { //IL_0056: 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_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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) _ = GameNetworkManager.Instance.localPlayerController; GameObject[] array = GameObject.FindGameObjectsWithTag("InteractTrigger"); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == "LightSwitch" && CozyConfig.configLightSwitchGlow.Value) { makeEmissive(array[i], new Color32((byte)182, (byte)240, (byte)150, (byte)102)); makeEmissive(((Component)array[i].transform.GetChild(0)).gameObject, new Color32((byte)241, (byte)80, (byte)80, (byte)10), 0.15f); } if (((Object)array[i]).name == "Trigger" && ((Object)((Component)array[i].transform.parent).gameObject).name == "ChargeStationTrigger" && CozyConfig.configChargeStationGlow.Value) { GameObject val = ((Component)array[i].transform.parent.parent).gameObject; GameObject val2 = new GameObject("ChargeStationLight"); Light obj = val2.AddComponent<Light>(); obj.type = (LightType)2; obj.color = Color32.op_Implicit(new Color32((byte)240, (byte)240, (byte)140, byte.MaxValue)); obj.intensity = 0.05f; obj.range = 0.3f; obj.shadows = (LightShadows)2; val2.layer = LayerMask.NameToLayer("Room"); val2.transform.localPosition = new Vector3(0.5f, 0f, 0f); val2.transform.SetParent(val.transform, false); } if (((Object)array[i]).name == "Cube (2)" && ((Object)((Component)array[i].transform.parent).gameObject).name.StartsWith("CameraMonitor") && CozyConfig.configBigMonitorButtons.Value) { Accessibility.adjustMonitorButtons(array[i].gameObject); } } } private static void makeEmissive(GameObject gameObject, Color32 glowColor, float brightness = 0.02f) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); Material material = ((Renderer)component).material; material.SetColor("_EmissiveColor", Color32.op_Implicit(glowColor) * brightness); ((Renderer)component).material = material; } private static void manageStorageCupboard() { PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); for (int i = 0; i < array.Length; i++) { UnlockableItem obj = StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID]; _ = obj.unlockableType; if (obj.unlockableName == "Cupboard") { gameObject = ((Component)array[i].parentObject).gameObject; break; } } if (!((Object)(object)gameObject == (Object)null) && CozyConfig.configStorageLights.Value) { spawnStorageLights(gameObject); } } private static void spawnStorageLights(GameObject storageCloset) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) float num = -1.1175f; List<float> obj = new List<float> { 2.804f, 2.163f, 1.48f, 0.999f }; float num2 = 0.55f; float num3 = obj[0]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); num3 = obj[1]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); num3 = obj[2]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3), 2f); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3), 2f); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3), 2f); num3 = obj[3]; AttachLightToStorageCloset(storageCloset, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(storageCloset, new Vector3(num + num2, 0.4f, num3)); } private static void AttachLightToStorageCloset(GameObject storageCloset, Vector3 lightPositionOffset, float intensity = 3f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("StorageClosetLight"); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer obj = val.AddComponent<MeshRenderer>(); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0); val2.mesh = val3.GetComponent<MeshFilter>().mesh; Material val4 = new Material(Shader.Find("HDRP/Lit")); Color val5 = Color32.op_Implicit(new Color32((byte)249, (byte)240, (byte)202, byte.MaxValue)); val4.SetColor("_BaseColor", val5); float num = 1f; val4.SetColor("_EmissiveColor", val5 * num); ((Renderer)obj).material = val4; Object.DestroyImmediate((Object)(object)val3); Light obj2 = val.AddComponent<Light>(); obj2.type = (LightType)0; obj2.color = val5; obj2.intensity = intensity; obj2.range = 1.05f; obj2.spotAngle = 125f; obj2.shadows = (LightShadows)2; val.layer = LayerMask.NameToLayer("Room"); val.transform.localScale = new Vector3(0.125f, 0.125f, 0.04f); val.transform.localPosition = lightPositionOffset; val.transform.rotation = Quaternion.Euler(170f, 0f, 0f); val.transform.SetParent(storageCloset.transform, false); } private static string padString(string baseStr, char padChar, int width) { int totalWidth = (width - (baseStr.Length + 8)) / 2 + (baseStr.Length + 8); return (" " + baseStr + " ").PadLeft(totalWidth, padChar).PadRight(width, padChar); } private static void obviousDebug(string baseStr) { Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)padString(baseStr ?? "", '~', 65)); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Debug.Log((object)"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.spycibot.cozyimprovements"; public const string PLUGIN_NAME = "Cozy Improvements"; public const string PLUGIN_VERSION = "1.2.2"; } } namespace SpyciBot.LC.CozyImprovements.Improvements { [HarmonyPatch] public static class Accessibility { private static HangarShipDoor hangarShipDoor; [HarmonyPatch(typeof(StartMatchLever), "Start")] [HarmonyPostfix] private static void Postfix_StartMatchLever_Start(StartMatchLever __instance) { //IL_0027: 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_006b: Unknown result type (might be due to invalid IL or missing references) if (CozyImprovements.CozyConfig.configEasyLaunchLever.Value) { ((Component)__instance).transform.localScale = new Vector3(1.139f, 0.339f, 1.539f); ((Component)__instance).transform.localPosition = new Vector3(8.7938f, 1.479f, -7.0767f); ((Component)__instance).transform.GetChild(0).position = new Vector3(8.8353f, 0.2931f, -14.5767f); } } [HarmonyPatch(typeof(HangarShipDoor), "Start")] [HarmonyPostfix] private static void Postfix_HangarShipDoor_Start(HangarShipDoor __instance) { //IL_0043: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) if (!CozyImprovements.CozyConfig.configBigDoorButtons.Value) { return; } hangarShipDoor = __instance; GameObject gameObject = ((Component)__instance.hydraulicsDisplay.transform.parent).gameObject; gameObject.transform.localScale = new Vector3(-2f, -2f, -2f); gameObject.transform.localPosition = new Vector3(-5.2085f, 1.8882f, -8.823f); GameObject gameObject2 = ((Component)gameObject.transform.Find("StartButton")).gameObject; GameObject gameObject3 = ((Component)gameObject.transform.Find("StopButton")).gameObject; gameObject3.transform.localScale = new Vector3(-1.1986f, -0.1986f, -1.1986f); gameObject2.transform.localScale = gameObject3.transform.localScale; gameObject2.transform.GetChild(0).localPosition = gameObject3.transform.GetChild(0).localPosition; gameObject2.transform.GetChild(0).localScale = gameObject3.transform.GetChild(0).localScale; Material[] materials = ((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials; for (int i = 0; i < materials.Length; i++) { if (((Object)materials[i]).name == "GreenButton (Instance)") { materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)39, (byte)51, (byte)39, byte.MaxValue))); } if (((Object)materials[i]).name == "ButtonWhite (Instance)") { materials[i].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue))); } } ((Renderer)gameObject2.GetComponent<MeshRenderer>()).materials = materials; Material[] materials2 = ((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials; for (int j = 0; j < materials2.Length; j++) { if (((Object)materials2[j]).name == "RedButton (Instance)") { materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)64, (byte)24, (byte)24, byte.MaxValue))); } if (((Object)materials2[j]).name == "ButtonWhite (Instance)") { materials2[j].SetColor("_EmissiveColor", Color32.op_Implicit(new Color32((byte)179, (byte)179, (byte)179, byte.MaxValue))); } } ((Renderer)gameObject3.GetComponent<MeshRenderer>()).materials = materials2; Transform child = gameObject.transform.Find("StartButton").GetChild(0); Transform child2 = gameObject.transform.Find("StopButton").GetChild(0); ((Renderer)((Component)child).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32((byte)39, byte.MaxValue, (byte)39, byte.MaxValue)); ((Renderer)((Component)child2).GetComponent<MeshRenderer>()).material.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)24, (byte)24, byte.MaxValue)); Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(-3.7205f, 2.0504f, -16.3018f); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f); Vector3 localScale2 = default(Vector3); ((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f); child.position = position; child.localScale = localScale; child2.position = position; child2.localScale = localScale2; } [HarmonyPatch(typeof(StartOfRound), "SetShipDoorsClosed")] [HarmonyPostfix] private static void Postfix_StartOfRound_SetShipDoorsClosed(StartOfRound __instance, bool closed) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) if (CozyImprovements.CozyConfig.configBigDoorButtons.Value) { GameObject gameObject = ((Component)hangarShipDoor.hydraulicsDisplay.transform.parent).gameObject; Transform child = gameObject.transform.Find("StartButton").GetChild(0); Transform child2 = gameObject.transform.Find("StopButton").GetChild(0); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(0.7393f, 0.4526f, 0.6202f); Vector3 localScale2 = default(Vector3); ((Vector3)(ref localScale2))..ctor(0.003493f, 0.000526f, 0.002202f); child.localScale = localScale; child2.localScale = localScale; if (closed) { child.localScale = localScale; child2.localScale = localScale2; } else { child2.localScale = localScale; child.localScale = localScale2; } } } [HarmonyPatch(typeof(ShipTeleporter), "Awake")] [HarmonyPostfix] private static void Postfix_ShipTeleporter_Awake(ShipTeleporter __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (CozyImprovements.CozyConfig.configBigTeleporterButtons.Value) { ((Component)((Component)__instance.buttonTrigger).gameObject.transform.parent).gameObject.transform.localScale = Vector3.one * 3f; } } public static void adjustMonitorButtons(GameObject ButtonCube) { //IL_0038: 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) if (CozyImprovements.CozyConfig.configBigMonitorButtons.Value) { GameObject gameObject = ((Component)ButtonCube.transform.parent).gameObject; gameObject.transform.localScale = new Vector3(1.852f, 1.8475f, 1.852f); if (((Object)gameObject).name == "CameraMonitorSwitchButton") { gameObject.transform.localPosition = new Vector3(-0.28f, -1.807f, -0.29f); } } } } }
BepInEx/plugins/DeezNuts.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.Logging; using DeezNuts.Patch; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DeezNuts")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DeezNuts")] [assembly: AssemblyTitle("DeezNuts")] [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 DeezNuts { [BepInPlugin("com.fakemarsh.DeezNuts", "DeezNuts", "1.0.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private Harmony harmony = new Harmony("DeezNuts"); public static ManualLogSource logger; public static GameObject deez_nuts_button; public static Item deez_nuts_item; private void Awake() { logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Plugin DeezNuts is loaded!"); LoadButton(); harmony.PatchAll(typeof(DeezPatches)); harmony.PatchAll(typeof(NetworkPatches)); } private void LoadButton() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "deeznuts"); AssetBundle val = AssetBundle.LoadFromFile(text); GameObject val2 = val.LoadAsset<GameObject>("Assets/DeezNuts/DeezNuts.prefab"); deez_nuts_button = val2; deez_nuts_item = val.LoadAsset<Item>("Assets/DeezNuts/DeezNuts.asset"); logger.LogInfo((object)("custom scrap item loaded into network: " + deez_nuts_item.itemName)); } } public static class PluginInfo { public const string PLUGIN_GUID = "DeezNuts"; public const string PLUGIN_NAME = "DeezNuts"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DeezNuts.Patch { [HarmonyPatch(typeof(StartOfRound))] internal class DeezPatches { [HarmonyPrefix] [HarmonyPatch("Awake")] public static void DeezNutsButtonPatch(StartOfRound __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Plugin.logger.LogInfo((object)"inside button patch"); SelectableLevel[] levels = __instance.levels; SelectableLevel[] array = levels; foreach (SelectableLevel val in array) { SpawnableItemWithRarity val2 = new SpawnableItemWithRarity(); val2.spawnableItem = Plugin.deez_nuts_item; val2.rarity = 35; Plugin.logger.LogInfo((object)("Adding deez nuts button into moon " + ((Object)val).name)); val.spawnableScrap.Add(val2); Plugin.logger.LogInfo((object)"\n\n"); } if (!__instance.allItemsList.itemsList.Contains(Plugin.deez_nuts_item)) { __instance.allItemsList.itemsList.Add(Plugin.deez_nuts_item); } } } internal class NetworkPatches { private static GameObject networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init(GameNetworkManager __instance) { Plugin.logger.LogInfo((object)"inside deez nuts network patcher"); if (!((Object)(object)networkPrefab != (Object)null)) { Plugin.logger.LogInfo((object)"we are adding the deez nuts button to the network!"); networkPrefab = Plugin.deez_nuts_button; ((Component)__instance).GetComponent<NetworkManager>().PrefabHandler.AddNetworkPrefab(networkPrefab); } } } }
BepInEx/plugins/DiscountAlert.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 System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using DiscountAlert; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("DiscountAlert")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0.0")] [assembly: AssemblyProduct("DiscountAlert")] [assembly: AssemblyTitle("DiscountAlert")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(StartMatchLever))] public class StartMatchLever_Patches { private static string priceUpColor = Plugin.Instance.PRICE_UP_COLOR; private static string priceDownColor = Plugin.Instance.PRICE_DOWN_COLOR; private static string noDiscountColor = Plugin.Instance.NO_DISCOUNT_COLOR; private static string noDiscountText = Plugin.Instance.noDiscountText.Value; private static string titleColor = Plugin.Instance.TITLE_COLOR; private static string titleText = Plugin.Instance.titleText.Value; private static int delayAfterLeverIsPulled = Plugin.Instance.delayAfterLeverIsPulled.Value; private static bool colorsEnabled = Plugin.Instance.colorsEnabled.Value; private static bool alertEnabledWhenNoDiscounts = Plugin.Instance.alertEnabledWhenNoDiscounts.Value; public static bool playerAlerted = false; public static int counter = 0; [HarmonyPatch("PlayLeverPullEffectsClientRpc")] [HarmonyPostfix] public static void PlayLeverPullEffectsClientRpcPatch() { playerAlerted = false; counter++; if (StartOfRound.Instance.inShipPhase && !playerAlerted && counter == 1) { playerAlerted = true; ((MonoBehaviour)HUDManager.Instance).StartCoroutine(DisplayAlert()); } else if (counter > 1) { counter = 0; } } private static IEnumerator DisplayAlert() { yield return (object)new WaitForSeconds((float)delayAfterLeverIsPulled); Debug.Log((object)"Displaying alert"); StringBuilder discount_list = new StringBuilder(); for (int i = 0; i < HUDManager.Instance.terminalScript.buyableItemsList.Length; i++) { if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] != 100) { if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] < 0) { discount_list.Append("\n" + ((priceUpColor != null) ? ("<color=" + priceUpColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (1f - (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f)} " + string.Format("({0}% UP!){1}", Math.Abs(HUDManager.Instance.terminalScript.itemSalesPercentages[i]), (priceUpColor != null) ? "</color>" : "")); } else if (HUDManager.Instance.terminalScript.itemSalesPercentages[i] > 0) { discount_list.Append("\n" + ((priceDownColor != null) ? ("<color=" + priceDownColor + ">* ") : "* ") + HUDManager.Instance.terminalScript.buyableItemsList[i].itemName + $" ${(float)HUDManager.Instance.terminalScript.buyableItemsList[i].creditsWorth * (float)HUDManager.Instance.terminalScript.itemSalesPercentages[i] / 100f} " + string.Format("({0}% OFF!){1}", 100 - HUDManager.Instance.terminalScript.itemSalesPercentages[i], (priceDownColor != null) ? "</color>" : "")); } } } if ((!(discount_list.ToString() == "") && discount_list != null) || alertEnabledWhenNoDiscounts) { if ((discount_list.ToString() == "" || discount_list == null) && alertEnabledWhenNoDiscounts) { discount_list.Append(((noDiscountColor != null) ? ("<color=" + noDiscountColor + "> ") : " ") + noDiscountText + ((noDiscountColor != null) ? "</color>" : "")); } HUDManager.Instance.DisplayTip(((titleColor != null) ? ("<color=" + titleColor + "> ") : " ") + titleText + ((titleColor != null) ? "</color>" : ""), discount_list.ToString(), false, false, "LC_Tip1"); } } } namespace DiscountAlert { [BepInPlugin("discount.alert", "DiscountAlert", "2.3.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "discount.alert"; private const string modName = "DiscountAlert"; private const string modVersion = "2.3.0.0"; public ConfigEntry<string> priceUpColor; public ConfigEntry<string> priceDownColor; public ConfigEntry<string> noDiscountColor; public ConfigEntry<string> noDiscountText; public ConfigEntry<string> titleColor; public ConfigEntry<string> titleText; public ConfigEntry<int> delayAfterLeverIsPulled; public ConfigEntry<bool> colorsEnabled; public ConfigEntry<bool> alertEnabledWhenNoDiscounts; public string PRICE_UP_COLOR; public string PRICE_DOWN_COLOR; public string NO_DISCOUNT_COLOR; public string TITLE_COLOR; private readonly Harmony harmony = new Harmony("discount.alert"); public static Plugin? Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } priceUpColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceUpColor", "#990000", "Text color when the price goes up (currently only possible with other mods)"); priceDownColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "PriceDownColor", "#008000", "Text color when the price goes down"); delayAfterLeverIsPulled = ((BaseUnityPlugin)this).Config.Bind<int>("Alert", "DelayAfterLeverIsPulled", 4, "Number of seconds to wait after the \"Land ship\" or \"Start Game\" lever is pulled before showing the alert."); colorsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "ColorsEnabled", true, "Enable or disable text colors"); noDiscountColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "NoDiscountColor", "", "Text color when there are no discounts"); titleColor = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "TitleColor", "", "Text color for the alert's title"); titleText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "TitleText", "Today's discounts", "Alert title text"); noDiscountText = ((BaseUnityPlugin)this).Config.Bind<string>("Alert", "NoDiscountText", "None :( \n Check back tomorrow!", "Alert text when there are no discounts"); alertEnabledWhenNoDiscounts = ((BaseUnityPlugin)this).Config.Bind<bool>("Alert", "AlertEnabledWhenNoDiscounts", true, "Show alert when there are no discounts"); if (!IsValidHexCode(priceUpColor.Value)) { PRICE_UP_COLOR = null; } else { PRICE_UP_COLOR = priceUpColor.Value; } if (!IsValidHexCode(priceDownColor.Value)) { PRICE_DOWN_COLOR = null; } else { PRICE_DOWN_COLOR = priceDownColor.Value; } if (!IsValidHexCode(noDiscountColor.Value)) { NO_DISCOUNT_COLOR = null; } else { NO_DISCOUNT_COLOR = noDiscountColor.Value; } if (!IsValidHexCode(titleColor.Value)) { TITLE_COLOR = null; } else { TITLE_COLOR = titleColor.Value; } if (!colorsEnabled.Value) { PRICE_UP_COLOR = null; PRICE_DOWN_COLOR = null; NO_DISCOUNT_COLOR = null; TITLE_COLOR = null; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin discount.alert is loaded!"); harmony.PatchAll(); } public static bool IsValidHexCode(string hexCode) { string pattern = "^#?([0-9A-Fa-f]{3}){1,2}$"; return Regex.IsMatch(hexCode, pattern); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/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/FriendlyFirelessCompany.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 GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FriendlyFirelessCompany")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("You could have alternatively not hit your allies, but here we are.")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("FriendlyFirelessCompany")] [assembly: AssemblyTitle("FriendlyFirelessCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FriendlyFirelessCompany { [BepInPlugin("rogerfk.FriendlyFirelessCompany", "Friendly Fireless Company", "1.0.0")] public class Plugin : BaseUnityPlugin { public static string guid = "rogerfk.FriendlyFirelessCompany"; public static string pluginName = "Friendly Fireless Company"; public static string version = "1.0.0"; public Harmony _harmony; public ConfigEntry<float> damageScaleConfig; private bool heardItAlready; public static Plugin instance = null; public HashSet<PlayerControllerB> ignorePlayers = new HashSet<PlayerControllerB>(); private void Awake() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + guid + " is loading...")); if ((Object)(object)instance != (Object)null) { if (!heardItAlready) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Unsure what is going on, seemingly " + guid + " got reloaded somehow? Someone called 'Awake()' again?" + Environment.NewLine + "--> Since RogerFK is a smartass, he's unpatching all Harmony patches, just in case. Last time his smart ass heard of unpatching, it didn't really work all that well." + Environment.NewLine + "--> But since his smartest ass of all believes Andreas Pardeike or whoever contributed to Harmony is smarter than him, he believesthey probably fixed it already, right? It's been two years." + Environment.NewLine + "--> If something breaks, tell his smart ass on Discord this shit is broken and to not unpatch previous patches. Probably doesn't even make a difference now that I'm thinking, tbh. t. RogerFK")); } heardItAlready = true; instance._harmony.UnpatchSelf(); } instance = this; _harmony = new Harmony(pluginName); Type type = AccessTools.TypeByName("LC_API.CheatDatabase"); ((BaseUnityPlugin)this).Logger.LogInfo((object)type.FullName); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Methodis: " + string.Join(", ", (IEnumerable<MethodInfo>)type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic)))); _harmony.Patch((MethodBase)type.GetMethod("OtherPlayerCheatDetector", BindingFlags.Static | BindingFlags.Public), (HarmonyMethod)null, new HarmonyMethod(typeof(SyncFFCValues), "SyncWithLCAPIPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.PatchAll(); instance = this; damageScaleConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "DamageScale", 0f, "Multiplies the damage by this value. 0 means no damage, 0.5 half damage, 1 full damage, 2 double damage, etc."); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + guid + " (" + pluginName + " v" + version + ") loaded!")); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Configs: Damage Scale: {damageScaleConfig.Value}"); Networking.GetFloat = (Action<float, string>)Delegate.Combine(Networking.GetFloat, new Action<float, string>(SyncFFCValues.SyncedDelegate)); } public void LogInfo(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } [HarmonyPatch(typeof(NetworkManager), "Shutdown")] public class SyncFFCValues { public static bool useServerFF = true; public static float serverFFValue = 1f; public static void SyncWithLCAPIPostfix() { if (useServerFF) { Plugin.instance.LogInfo("Using own config for FF from now on"); } useServerFF = false; Networking.Broadcast(Plugin.instance.damageScaleConfig.Value, "FFC_DamageScale_FromHost"); } public static void Postfix() { Plugin.instance.LogInfo("Left the server, resetting server's friendly fire for compatibility."); useServerFF = true; serverFFValue = 1f; } internal static void SyncedDelegate(float value, string signature) { if (signature == "FFC_DamageScale_FromHost") { useServerFF = true; serverFFValue = value; Plugin.instance.LogInfo($"Using received config for FF from now on: {serverFFValue}"); } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerFromOtherClientServerRpc")] internal class DamageOtherPlayerPatch { private static void Prefix(PlayerControllerB __instance, ref int damageAmount, Vector3 hitDirection, int playerWhoHit) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Plugin.instance.LogInfo($"[DamageOtherPlayer] Instance: {__instance} | damageAmount: {damageAmount} | hitDirection: {hitDirection} | playerWhoHit: {playerWhoHit}"); if (Plugin.instance.ignorePlayers.Contains(__instance)) { Plugin.instance.LogInfo($"[FriendlyFirelessCompany] Applying normal FF damage to {__instance}"); } else { damageAmount = Mathf.RoundToInt((float)damageAmount * Plugin.instance.damageScaleConfig.Value); } } } [HarmonyPatch(typeof(ShotgunItem), "ShootGunServerRpc")] internal class ShotgunServerPatch { private static void Prefix(ShotgunItem __instance, ref Vector3 shotgunPosition) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) { Plugin.instance.LogInfo("[ShootGunServerRpc] Held by a player"); DamagePlayerPatch.timeToNotDamage = Time.time + 1f; DamagePlayerServerPatch.timeToNotDamage = Time.time + 1f; DamagePlayerPatch.timeToNotDamage = Time.time + 1f; } else { Plugin.instance.LogInfo("[ShootGunServerRpc] Not held by a player, damaging"); } } } [HarmonyPatch(typeof(ShotgunItem), "ShootGunClientRpc")] internal class ShotgunClientPatch { private static void Prefix(ShotgunItem __instance, ref Vector3 shotgunPosition) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) { Plugin.instance.LogInfo("[ShootGunClientRpc] Held by a player"); DamagePlayerPatch.timeToNotDamage = Time.time + 1f; DamagePlayerServerPatch.timeToNotDamage = Time.time + 1f; DamagePlayerClientPatch.timeToNotDamage = Time.time + 1f; } else { Plugin.instance.LogInfo("[ShootGunClientRpc] Not held by a player, damaging"); } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerServerRpc")] internal class DamagePlayerServerPatch { public static float timeToNotDamage; private static void Prefix(PlayerControllerB __instance, ref int damageNumber, ref int newHealthAmount) { Plugin.instance.LogInfo($"[DamagePlayerServer] Instance: {__instance} | damageNumber: {damageNumber} | newHealthAmount: {newHealthAmount}"); if (Plugin.instance.ignorePlayers.Contains(__instance)) { Plugin.instance.LogInfo($"[DamagePlayerServer] Applying normal FF damage to {__instance}"); return; } Plugin.instance.LogInfo($"[DamagePlayerServer] Changing damage values? {timeToNotDamage > Time.time}"); if (timeToNotDamage > Time.time) { newHealthAmount += damageNumber; damageNumber = Mathf.RoundToInt((float)damageNumber * Plugin.instance.damageScaleConfig.Value); newHealthAmount -= damageNumber; } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerClientRpc")] internal class DamagePlayerClientPatch { public static float timeToNotDamage; private static void Prefix(PlayerControllerB __instance, ref int damageNumber, ref int newHealthAmount) { Plugin.instance.LogInfo($"[DamagePlayerClient] Instance: {__instance} | damageNumber: {damageNumber} | newHealthAmount: {newHealthAmount}"); if (Plugin.instance.ignorePlayers.Contains(__instance)) { Plugin.instance.LogInfo($"[DamagePlayerClient] Applying normal FF damage to {__instance}"); return; } Plugin.instance.LogInfo($"[DamagePlayerClient] Changing damage values? {timeToNotDamage > Time.time}"); if (timeToNotDamage > Time.time) { newHealthAmount += damageNumber; damageNumber = Mathf.RoundToInt((float)damageNumber * Plugin.instance.damageScaleConfig.Value); newHealthAmount -= damageNumber; } } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] internal class DamagePlayerPatch { public static float timeToNotDamage; public static bool forceAllowFF; private static void Prefix(PlayerControllerB __instance, ref int damageNumber, CauseOfDeath causeOfDeath) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if (((NetworkBehaviour)__instance).IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath() && !forceAllowFF && (int)causeOfDeath == 7 && timeToNotDamage > Time.time) { Plugin.instance.LogInfo($"Multiplying the damage by the value: {(SyncFFCValues.useServerFF ? SyncFFCValues.serverFFValue : Plugin.instance.damageScaleConfig.Value)}"); damageNumber = Mathf.RoundToInt((float)damageNumber * ((!SyncFFCValues.useServerFF) ? SyncFFCValues.serverFFValue : Plugin.instance.damageScaleConfig.Value)); } } } [HarmonyPatch(typeof(HauntedMaskItem), "AttachToPlayerOnLocalClient")] internal class SCP035ClientAttachPatch { private static void Prefix(HauntedMaskItem __instance) { DamagePlayerPatch.forceAllowFF = true; } } [HarmonyPatch(typeof(HauntedMaskItem), "FinishAttaching")] internal class SCP035SpawnClientPatch { private static void Prefix(HauntedMaskItem __instance) { DamagePlayerPatch.forceAllowFF = false; } } [HarmonyPatch(typeof(HauntedMaskItem), "AttachServerRpc")] internal class SCP035ServerAttachPatch { private static void Prefix(HauntedMaskItem __instance) { Plugin.instance.ignorePlayers.Add(((GrabbableObject)__instance).playerHeldBy); } } [HarmonyPatch(typeof(HauntedMaskItem), "CreateMimicServerRpc")] internal class SCP035SpawnPatch { private static void Prefix(HauntedMaskItem __instance) { Plugin.instance.ignorePlayers.Remove(((GrabbableObject)__instance).playerHeldBy); } } public static class PluginInfo { public const string PLUGIN_GUID = "FriendlyFirelessCompany"; public const string PLUGIN_NAME = "FriendlyFirelessCompany"; public const string PLUGIN_VERSION = "0.1.0"; } }
BepInEx/plugins/GroanTubeScrap.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LaserTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LaserTweaks")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4963e0ea-7a99-4390-9cae-a4bdd01b6b43")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace GroanTubeScrap { public class Assets { public static AssetBundle MainAssetBundle; public static Item Item; internal static Stream GetEmbededResource(string name) { return Assembly.GetExecutingAssembly().GetManifestResourceStream("GroanTubeScrap." + name); } public static void Init() { MainAssetBundle = AssetBundle.LoadFromStream(GetEmbededResource("groantube.bundle")); Item = MainAssetBundle.LoadAsset<Item>("Assets/Mods/GroanTubeScrap/GroanTube.asset"); } } internal class GroanTubeItem : NoisemakerProp { private bool localState; [Header("Horrible Color Sync")] [Tooltip("Seekers made me do this. Look at implementation of (Item.materialVariants)")] public Material[] altMaterials; public int altSelect = -1; public override int GetItemDataToSave() { return altSelect; } public override void LoadItemSaveData(int saveData) { altSelect = Mathf.Clamp(saveData, 0, altMaterials.Length - 1); Material sharedMaterial = altMaterials[altSelect]; ((Renderer)((GrabbableObject)this).mainObjectRenderer).sharedMaterial = sharedMaterial; } public override void Start() { ((NoisemakerProp)this).Start(); if (((NetworkBehaviour)this).IsOwner && altMaterials.Length != 0) { if (altSelect < 0) { altSelect = Random.Range(0, altMaterials.Length); } ((GrabbableObject)this).SyncBatteryServerRpc(altSelect); } } public override void ChargeBatteries() { if (!(((GrabbableObject)this).insertedBattery.charge < 0f)) { int num = Mathf.RoundToInt(((GrabbableObject)this).insertedBattery.charge * 100f); num = Mathf.Clamp(num, 0, altMaterials.Length - 1); ((GrabbableObject)this).LoadItemSaveData(num); ((GrabbableObject)this).insertedBattery.charge = -1f; } } public override void ItemActivate(bool used, bool buttonDown = true) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { if (((NetworkBehaviour)this).IsOwner) { buttonDown = !localState; ((GrabbableObject)this).isSendingItemRPC = ((GrabbableObject)this).isSendingItemRPC + 1; ((GrabbableObject)this).ActivateItemServerRpc(false, buttonDown); } OnItemUseLocal(buttonDown); } } private void OnItemUseLocal(bool state) { localState = state; base.triggerAnimator.SetTrigger("Spin"); PlayAudio((!state) ? 1 : 0); } private void PlayAudio(int index) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) AudioClip val = base.noiseSFX[index]; float num = (float)base.noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f; float pitch = (float)base.noisemakerRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f; base.noiseAudio.pitch = pitch; base.noiseAudio.PlayOneShot(val, num); WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, val, num); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (base.minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f; } } } [BepInPlugin("Kittenji.GroanTubeScrap", "Groan Tube Scrap", "1.0.0")] public class Loader : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.Item.spawnPrefab); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref StartOfRound __instance) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Assets.Item)) { continue; } int num = SpawnRateOverride.Value; if (num < 1) { SpawnableItemWithRarity val2 = val.spawnableScrap.Find((SpawnableItemWithRarity s) => Object.op_Implicit((Object)(object)s.spawnableItem) && Object.op_Implicit((Object)(object)s.spawnableItem.spawnPrefab) && ((Object)s.spawnableItem.spawnPrefab).name == "RobotToy"); if (val2 != null) { num = val2.rarity; } else if (val.spawnableScrap.Count > 0) { int num2 = int.MaxValue; foreach (SpawnableItemWithRarity item2 in val.spawnableScrap) { if (item2.rarity < num2) { num2 = item2.rarity; } } num = num2; } } num = Mathf.Clamp(num, 1, 100); SpawnableItemWithRarity item = new SpawnableItemWithRarity { spawnableItem = Assets.Item, rarity = num }; val.spawnableScrap.Add(item); } if (!__instance.allItemsList.itemsList.Contains(Assets.Item)) { __instance.allItemsList.itemsList.Add(Assets.Item); } } } private const string modGUID = "Kittenji.GroanTubeScrap"; private readonly Harmony harmony = new Harmony("Kittenji.GroanTubeScrap"); private static ConfigEntry<int> SpawnRateOverride; private const string ItemReferenceName = "RobotToy"; private void Awake() { Assets.Init(); SpawnRateOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rate Override", -1, "Override the spawn rate for this item, this affects all moons. By default, it uses the spawn rate of the Toy Cube item so it spawns in coordination with other toys."); harmony.PatchAll(); } } }
BepInEx/plugins/HandMirror.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 HandMirror.Patches; 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: AssemblyTitle("HandMirror")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HandMirror")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d947fd9d-387f-4245-b08d-49f9a1c8a2f1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HandMirror { [BepInPlugin("spiderbuttons.HandMirror", "HandMirror", "1.0.0")] public class HandMirrorBase : BaseUnityPlugin { private const string modGUID = "spiderbuttons.HandMirror"; private const string modName = "HandMirror"; private const string modVersion = "1.0.0"; public static ManualLogSource logger; private readonly Harmony harmony = new Harmony("spiderbuttons.HandMirror"); private static HandMirrorBase Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin spiderbuttons.HandMirror is loaded!"); harmony.PatchAll(typeof(HandMirrorBase)); harmony.PatchAll(typeof(MirrorCoilheadPatch)); harmony.PatchAll(typeof(MagnifyingGlassRenamePatch)); } } } namespace HandMirror.Patches { public class MirrorCoilheadPatch { [HarmonyPatch(typeof(PlayerControllerB), "HasLineOfSightToPosition")] [HarmonyPostfix] public static void CheckRear(ref Vector3 pos, ref int range, ref float proximityAwareness, ref GrabbableObject ___currentlyHeldObjectServer, ref bool __result, ref PlayerControllerB __instance, ref Transform ___playerEye, ref Camera ___gameplayCamera) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)__instance).transform.position, pos); if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName.Equals("Hand-Mirror") && num < (float)range && (Vector3.Angle(-((Component)___playerEye).transform.forward, pos - ((Component)___gameplayCamera).transform.position) < 180f || num < proximityAwareness) && !Physics.Linecast(((Component)___playerEye).transform.position, pos, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1)) { __result = true; } } } public class MagnifyingGlassRenamePatch { [HarmonyPatch(typeof(GrabbableObject), "Start")] [HarmonyPrefix] public static bool RenameToMirror(ref GrabbableObject __instance) { if (__instance.itemProperties.itemName.Equals("Magnifying glass")) { __instance.itemProperties.itemName = "Hand-Mirror"; } return true; } [HarmonyPatch(typeof(HUDManager), "DisplayScrapItemsOnHud")] [HarmonyPrefix] public static bool RenameCollectedMirror(ref ScrapItemHUDDisplay[] ___ScrapItemBoxes) { for (int i = 0; i < ___ScrapItemBoxes.Length; i++) { if (((TMP_Text)___ScrapItemBoxes[i].headerText).text.Equals("Magnifying glass")) { ((TMP_Text)___ScrapItemBoxes[i].headerText).text = "Hand-Mirror"; } } return true; } [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")] [HarmonyPrefix] public static bool RenameScannedMirror(ref Dictionary<RectTransform, ScanNodeProperties> ___scanNodes) { foreach (KeyValuePair<RectTransform, ScanNodeProperties> ___scanNode in ___scanNodes) { if (___scanNode.Value.headerText.Equals("Magnifying glass")) { ___scanNode.Value.headerText = "Hand-Mirror"; } } return true; } } }
BepInEx/plugins/HideChat.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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HideChat")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HideChat")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fa900f4d-71b1-433a-ad23-a10fc53dc3d8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HideChat { [BepInPlugin("Miodec.HideChat", "Hide Chat", "1.0.0")] public class HidePlayerNames : BaseUnityPlugin { private const string modGUID = "Miodec.HideChat"; private const string modName = "Hide Chat"; private const string modVersion = "1.0.0"; private static HidePlayerNames Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Miodec.HideChat"); mls.LogDebug((object)"hidechat is awake"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } } namespace HideChat.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("OpenMenu_performed")] [HarmonyPatch("SubmitChat_performed")] [HarmonyPatch("AddChatMessage")] [HarmonyPostfix] public static void FadeToNothing(ref HUDManager __instance) { __instance.PingHUDElement(__instance.Chat, 5f, 1f, 0f); } } }
BepInEx/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/ItemClippingFix.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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.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("ItemClippingFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes ground/storage clipping & rotation on almost all items")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4")] [assembly: AssemblyProduct("ItemClippingFix")] [assembly: AssemblyTitle("ItemClippingFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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 ItemClippingFix { [BepInPlugin("viviko.ItemClippingFix", "ItemClippingFix", "1.1.4")] public class ItemClippingFix : BaseUnityPlugin { [HarmonyPatch(typeof(PlaceableObjectsSurface))] public class PlaceableObjectsSurfacePatch { [HarmonyPrefix] [HarmonyPatch("itemPlacementPosition")] public static bool itemPlacementPositionPatch(ref PlaceableObjectsSurface __instance, ref Vector3 __result, ref Transform gameplayCamera, ref GrabbableObject heldObject) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_0085: 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_0055: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(gameplayCamera.position, gameplayCamera.forward, ref val, 7f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { Bounds bounds = __instance.placeableBounds.bounds; if (((Bounds)(ref bounds)).Contains(((RaycastHit)(ref val)).point)) { __result = FixPlacement(((RaycastHit)(ref val)).point, ((Component)__instance).transform, heldObject); return false; } Vector3 hitPoint = __instance.placeableBounds.ClosestPoint(((RaycastHit)(ref val)).point); __result = FixPlacement(hitPoint, ((Component)__instance).transform, heldObject); return false; } __result = Vector3.zero; return false; } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] public static void AwakePatch(ref StartOfRound __instance) { foreach (Item items in __instance.allItemsList.itemsList) { if (ItemFixes.TryGetValue($"{items.itemName}[{items.itemId}]", out List<float> value)) { items.verticalOffset = value[0]; if (value.Count > 1) { ((Vector3)(ref items.restingRotation)).Set(value[1], value[2], value[3]); } } } } } private const string modGUID = "viviko.ItemClippingFix"; private const string modName = "ItemClippingFix"; private const string modVersion = "1.1.4"; private readonly Harmony harmony = new Harmony("viviko.ItemClippingFix"); private static ItemClippingFix Instance; public static ManualLogSource mls; private static readonly Dictionary<string, List<float>> ItemFixes = new Dictionary<string, List<float>> { { "Flashlight[6]", new List<float>(4) { 0.02f, 270f, 0f, 90f } }, { "Jetpack[13]", new List<float>(4) { 0.25f, 45f, 0f, 0f } }, { "Key[14]", new List<float>(4) { 0.07f, 180f, 0f, 90f } }, { "Apparatus[3]", new List<float>(4) { 0.25f, 0f, 0f, 135f } }, { "Pro-flashlight[1]", new List<float>(4) { 0.03f, 0f, 0f, 90f } }, { "Shovel[7]", new List<float>(4) { 0f, 0f, -90f, -90f } }, { "Stun grenade[12]", new List<float>(4) { 0.03f, 0f, 0f, 90f } }, { "Extension ladder[17]", new List<float>(4) { -0.01f, 0f, 0f, 0f } }, { "TZP-Inhalant[15]", new List<float>(4) { 0.05f, 0f, 0f, -90f } }, { "Walkie-talkie[7]", new List<float>(1) { 0.05f } }, { "Zap gun[5]", new List<float>(4) { 0.06f, 95f, 0f, 90f } }, { "Magic 7 ball[0]", new List<float>(4) { 0.1f, 0f, 0f, 0f } }, { "Airhorn[0]", new List<float>(4) { 0.05f, 0f, 90f, 270f } }, { "Big bolt[0]", new List<float>(4) { 0.15f, -21f, 0f, 0f } }, { "Bottles[0]", new List<float>(4) { 0.25f, -90f, 0f, 0f } }, { "Brush[0]", new List<float>(4) { 0.01f, 90f, 0f, 0f } }, { "Candy[0]", new List<float>(4) { -0.01f, 90f, 0f, 0f } }, { "Chemical jug[0]", new List<float>(4) { 0.3f, -90f, 0f, 0f } }, { "Clown horn[0]", new List<float>(4) { 0.07f, -90f, 0f, 0f } }, { "Large axle[0]", new List<float>(4) { 0.55f, 7f, 0f, 0f } }, { "Teeth[0]", new List<float>(4) { 0.03f, -90f, 0f, 0f } }, { "V-type engine[0]", new List<float>(4) { 0.3f, -90f, 0f, 0f } }, { "Plastic fish[0]", new List<float>(4) { 0.08f, -45f, 0f, 90f } }, { "Laser pointer[1]", new List<float>(4) { 0f, 0f, 0f, 0f } }, { "Gold bar[0]", new List<float>(4) { 0.05f, -90f, 0f, -90f } }, { "Magnifying glass[0]", new List<float>(4) { 0.01f, 0f, 90f, -90f } }, { "Metal sheet[0]", new List<float>(1) { 0.024f } }, { "Cookie mold pan[0]", new List<float>(4) { -0.01f, -90f, 0f, 90f } }, { "Mug[0]", new List<float>(4) { 0.05f, -90f, 0f, 0f } }, { "Perfume bottle[0]", new List<float>(4) { 0.05f, -90f, 0f, 0f } }, { "Old phone[0]", new List<float>(4) { 0.04f, -90f, 0f, -90f } }, { "Jar of pickles[0]", new List<float>(4) { 0.25f, -90f, 0f, 0f } }, { "Pill bottle[0]", new List<float>(4) { 0.01f, -90f, 0f, 0f } }, { "Ring[0]", new List<float>(4) { -0.01f, 0f, -90f, 90f } }, { "Toy robot[0]", new List<float>(4) { 0.4f, -90f, 0f, 0f } }, { "Rubber Ducky[0]", new List<float>(4) { 0.05f, -90f, 0f, -90f } }, { "Steering wheel[0]", new List<float>(4) { 0f, -90f, 0f, 0f } }, { "Toothpaste[0]", new List<float>(4) { 0f, -90f, 0f, 0f } }, { "Hive[1531]", new List<float>(4) { 0.3f, 7f, 0f, 0f } }, { "Radar-booster[16]", new List<float>(4) { -0.02f, 0f, 0f, 0f } }, { "Shotgun[17]", new List<float>(4) { 0.08f, 180f, 0f, -5f } }, { "Ammo[17]", new List<float>(4) { 0f, 0f, 0f, 90f } }, { "Spray paint[18]", new List<float>(4) { 0.03f, 0f, 0f, 195f } }, { "Homemade flashbang[0]", new List<float>(4) { 0.05f, 0f, 0f, 90f } }, { "Gift[152767]", new List<float>(4) { 0.4f, -90f, 0f, 0f } }, { "Flask[0]", new List<float>(4) { 0.19f, 25f, 0f, 0f } }, { "Tragedy[0]", new List<float>(4) { 0.05f, -90f, 0f, 0f } }, { "Comedy[0]", new List<float>(4) { 0.05f, -90f, 0f, 0f } }, { "Whoopie cushion[0]", new List<float>(4) { -0.01f, -90f, 0f, 0f } } }; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("ItemClippingFix"); mls.LogInfo((object)"Checking for LobbyControl"); if (Chainloader.PluginInfos.Values.ToList().Exists((PluginInfo x) => x.Metadata.GUID.Contains("mattymatty.LobbyControl"))) { mls.LogInfo((object)"LobbyControl found! Disabling patches for compatibility"); return; } harmony.PatchAll(); mls.LogInfo((object)"Plugin ItemClippingFix is loaded!"); } public static Vector3 FixPlacement(Vector3 hitPoint, Transform transform, GrabbableObject heldObject) { //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_0024: 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_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) hitPoint.y = transform.position.y + transform.localScale.z / 2f; return hitPoint + Vector3.up * heldObject.itemProperties.verticalOffset; } } internal static class GeneratedPluginInfo { public const string Identifier = "viviko.ItemClippingFix"; public const string Name = "ItemClippingFix"; public const string Version = "1.1.4"; } } 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/jaaj.DarkSoulSnail.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 DarkSoulSnail; using HarmonyLib; using ImmortalSnail; using LCSoundTool; 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: AssemblyCompany("jaaj.DarkSoulSnail")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dc8111b331b16e38a3ad6e3ff61b36912c65e465")] [assembly: AssemblyProduct("DarkSoulSnail")] [assembly: AssemblyTitle("jaaj.DarkSoulSnail")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class SnailMusicController : MonoBehaviour { public SnailAI SnailInstance; public void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!DarkSoulSnailBase.configPlayWhenLookingAtSnail.Value) { return; } if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)SnailInstance).transform.position, 70f, DarkSoulSnailBase.configDistance.Value, -1f)) { if (!((EnemyAI)SnailInstance).creatureSFX.isPlaying) { ((EnemyAI)SnailInstance).creatureSFX.Play(); } } else if (DarkSoulSnailBase.configPauseWhenNotLooking.Value) { ((EnemyAI)SnailInstance).creatureSFX.Pause(); } else { ((EnemyAI)SnailInstance).creatureSFX.Stop(); } } } namespace DarkSoulSnail { [BepInPlugin("org.jaaj.darksoulsnail", "DarkSoulSnail", "1.0.0")] public class DarkSoulSnailBase : BaseUnityPlugin { private const string modGUID = "org.jaaj.darksoulsnail"; private const string modName = "DarkSoulSnail"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("org.jaaj.darksoulsnail"); public static ConfigEntry<float> configVolume; public static ConfigEntry<bool> configPlayWhenLookingAtSnail; public static ConfigEntry<int> configDistance; public static ConfigEntry<bool> configPauseWhenNotLooking; public static ConfigEntry<string> configAudioFile; public static AudioClip bossMusic; public static DarkSoulSnailBase PluginInstance { get; private set; } public static ManualLogSource LoggerInstance { get; private set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)PluginInstance == (Object)null) { PluginInstance = this; } LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger; LoggerInstance.LogDebug((object)"Plugin DarkSoulSnail loaded successfully."); configVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "MusicVolume", 1f, "Volume of the music. Must be between 0 and 1."); configPlayWhenLookingAtSnail = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PlayWhenLookingAtSnail", true, "Play the music only when the player is looking at the snail. Everything below this only works if this is set to true."); configDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Looking Mechanic", "Distance", 50, "Play the music only when the player is looking at a certain distance of the snail."); configPauseWhenNotLooking = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PauseWhenNotLooking", true, "Wether to pause the music when not looking at the snail, or stop it and start it over again when looking again. true = Pause, false = Stop."); configAudioFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio to play", "AudioFilePath", "bossMusic.wav", "Path to the audio file to play when looking at the snail."); string directoryName = Path.GetDirectoryName(Path.GetFullPath(configAudioFile.Value, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))); string fileName = Path.GetFileName(configAudioFile.Value); LoggerInstance.LogDebug((object)("AudioFile : " + fileName)); LoggerInstance.LogDebug((object)("AudioFilePath : " + directoryName)); bossMusic = SoundTool.GetAudioClip(directoryName, fileName); LoggerInstance.LogDebug((object)$"Loaded bossMusic: {bossMusic}"); harmony.PatchAll(); LoggerInstance.LogInfo((object)"jaaj.DarkSoulSnail v1.0.0 has loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "jaaj.DarkSoulSnail"; public const string PLUGIN_NAME = "DarkSoulSnail"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace DarkSoulSnail.Patches { [HarmonyPatch(typeof(SnailAI))] internal class SnailAIPatch { private static ManualLogSource LoggerInstance = DarkSoulSnailBase.LoggerInstance; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(SnailAI __instance) { ((EnemyAI)__instance).creatureSFX = ((Component)__instance).gameObject.AddComponent<AudioSource>(); ((EnemyAI)__instance).creatureSFX.clip = DarkSoulSnailBase.bossMusic; ((EnemyAI)__instance).creatureSFX.loop = true; ((EnemyAI)__instance).creatureSFX.volume = 1f; ((EnemyAI)__instance).creatureSFX.spatialBlend = 1f; SnailMusicController snailMusicController = ((Component)__instance).gameObject.AddComponent<SnailMusicController>(); snailMusicController.SnailInstance = __instance; if (!DarkSoulSnailBase.configPlayWhenLookingAtSnail.Value) { ((EnemyAI)__instance).creatureSFX.Play(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/JetpackFallFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using IL.GameNetcodeStuff; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.GameNetcodeStuff; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JetpackFallFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A lethal company mod which fixes buggy jetpack fall damage logic.")] [assembly: AssemblyFileVersion("2.0.1.0")] [assembly: AssemblyInformationalVersion("2.0.1")] [assembly: AssemblyProduct("JetpackFallFix")] [assembly: AssemblyTitle("JetpackFallFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JetpackFallFix { internal class Patches { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__PlayerControllerB_Awake; public static Manipulator <1>__PlayerControllerB_Update; public static Manipulator <2>__PlayerControllerB_PlayerHitGroundEffects; public static hook_PlayerHitGroundEffects <3>__On_PlayerControllerB_PlayerHitGroundEffects; } private static void LogIfDebugBuild(string text) { } internal static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_Awake; if (obj == null) { hook_Awake val = PlayerControllerB_Awake; <>O.<0>__PlayerControllerB_Awake = val; obj = (object)val; } PlayerControllerB.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__PlayerControllerB_Update; if (obj2 == null) { Manipulator val2 = PlayerControllerB_Update; <>O.<1>__PlayerControllerB_Update = val2; obj2 = (object)val2; } PlayerControllerB.Update += (Manipulator)obj2; object obj3 = <>O.<2>__PlayerControllerB_PlayerHitGroundEffects; if (obj3 == null) { Manipulator val3 = PlayerControllerB_PlayerHitGroundEffects; <>O.<2>__PlayerControllerB_PlayerHitGroundEffects = val3; obj3 = (object)val3; } PlayerControllerB.PlayerHitGroundEffects += (Manipulator)obj3; object obj4 = <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects; if (obj4 == null) { hook_PlayerHitGroundEffects val4 = On_PlayerControllerB_PlayerHitGroundEffects; <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects = val4; obj4 = (object)val4; } PlayerControllerB.PlayerHitGroundEffects += (hook_PlayerHitGroundEffects)obj4; } private static void PlayerControllerB_Awake(orig_Awake orig, PlayerControllerB self) { orig.Invoke(self); self.velocityAverageCount = 21; } private static void PlayerControllerB_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[8] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "gameplayCamera"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f), (Instruction x) => ILPatternMatchingExt.MatchCall<StartOfRound>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<StartOfRound>(x, "collidersAndRoomMaskAndDefault"), (Instruction x) => ILPatternMatchingExt.MatchCall<Physics>(x, "CheckSphere") }); val.Index += 7; val.Remove(); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Call, (MethodBase)(from x in typeof(Physics).GetMethods() where x.Name == "CheckSphere" select x).FirstOrDefault()); } private static void On_PlayerControllerB_PlayerHitGroundEffects(orig_PlayerHitGroundEffects orig, PlayerControllerB self) { orig.Invoke(self); self.averageVelocity = 0f; } private static void PlayerControllerB_PlayerHitGroundEffects(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val5 = default(ILLabel); ILLabel val4 = default(ILLabel); ILLabel val3 = default(ILLabel); ILLabel val2 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[12] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "takingFallDamage"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val5), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "jetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "disablingJetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "isSpeedCheating"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2) }); val.Index += 4; val.RemoveRange(4); val.EmitDelegate<Func<PlayerControllerB, bool>>((Func<PlayerControllerB, bool>)delegate(PlayerControllerB self) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!self.jetpackControls && !self.disablingJetpackControls) { LogIfDebugBuild("Take normal fall damage."); return false; } if (self.thisController.velocity.y < -15f) { LogIfDebugBuild("Take fall damage with jetpack."); self.fallValueUncapped = self.thisController.velocity.y; return false; } LogIfDebugBuild("Prevented fall damage bug!"); self.takingFallDamage = false; return true; }); } } [BepInPlugin("JetpackFallFix", "JetpackFallFix", "2.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin JetpackFallFix is loaded!"); Patches.Init(); } } public static class PluginInfo { public const string PLUGIN_GUID = "JetpackFallFix"; public const string PLUGIN_NAME = "JetpackFallFix"; public const string PLUGIN_VERSION = "2.0.1"; } }
BepInEx/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/LCFartLizards.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using LCFartLizards.Properties; 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("LCFartLizards")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Spore lizards fart instead")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: AssemblyInformationalVersion("1.2.1+0e5b5b266cd12247451733a48a210dfba5fe1c79")] [assembly: AssemblyProduct("LCFartLizards")] [assembly: AssemblyTitle("LCFartLizards")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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 LCFartLizards { [BepInPlugin("LCFartLizards", "LCFartLizards", "1.2.1")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(PufferAI), "Start")] public static class PufferAIPatch { public static void Prefix(ref PufferAI __instance) { __instance.puff = audioClip; } } private Harmony harmony; public static AudioClip audioClip; public static bool audioClipLoaded; public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCFartLizards is loaded!"); harmony = new Harmony("LCFartLizards"); harmony.PatchAll(); LoadAudioClip(); } private void LoadAudioClip() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.lcfartlizards); if ((Object)(object)val != (Object)null) { audioClip = val.LoadAsset<AudioClip>("Assets/LizardSound.mp3"); if ((Object)(object)audioClip != (Object)null) { audioClipLoaded = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Audio clip loaded successfully!"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load audio clip!"); } } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load asset bundle!"); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LCFartLizards"; public const string PLUGIN_NAME = "LCFartLizards"; public const string PLUGIN_VERSION = "1.2.1"; } } namespace LCFartLizards.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] public class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] public static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LCFartLizards.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] public static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } public static byte[] lcfartlizards { get { object @object = ResourceManager.GetObject("lcfartlizards", resourceCulture); return (byte[])@object; } } internal Resources() { } } }
BepInEx/plugins/LCOuijaBoard.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using LCOuijaBoard.Properties; using LethalCompanyInputUtils; using LethalLib.Modules; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCOuijaBoard")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCOuijaBoard")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1c1acc88-8f86-45d6-beb9-9b98f2302980")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { } } namespace LCOuijaBoard { [BepInPlugin("Electric.OuijaBoard", "OuijaBoard", "1.5.3")] public class Plugin : BaseUnityPlugin { private class UIHandler { public static GameObject inputObject; public static TMP_InputField input; public static bool registered; public static float lastError; public static TMP_InputField GetInput() { if (registered && (Object)(object)input != (Object)null) { return input; } inputObject = ((Component)OuijaTextUI.transform.GetChild(2)).gameObject; input = inputObject.GetComponent<TMP_InputField>(); ((UnityEvent<string>)(object)input.onSubmit).AddListener((UnityAction<string>)SubmitUI); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)EndEditUI); registered = true; return input; } public static void hide() { OuijaTextUI.SetActive(false); Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue(); input.text = ""; } public static void ToggleUI(CallbackContext context) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!Object.op_Implicit((Object)(object)localPlayerController)) { return; } Debug.Log((object)"Ouija Text UI Toggle Requested"); if (!DEVDEBUG && ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerDead)) { Debug.Log((object)"Ouija Text UI Toggle Denied: Not Dead"); return; } if ((Object)(object)OuijaTextUI == (Object)null) { Debug.LogError((object)"Ouija Text UI Toggle Denied: No UI"); return; } bool flag = !OuijaTextUI.active; GetInput(); Debug.Log((object)$"Ouija Text UI Toggle Accepted: New State is {flag}"); if (!flag) { if (!input.isFocused || !OuijaTextUI.active) { OuijaTextUI.SetActive(false); Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue(); } } else { Traverse.Create(typeof(LcInputActionApi)).Method("DisableForRebind", Array.Empty<object>()).GetValue(); OuijaTextUI.SetActive(true); input.ActivateInputField(); ((Selectable)input).Select(); } } public static void SubmitUI(string msg) { AttemptSend(msg); } public static void EndEditUI(string msg) { hide(); } public static bool AttemptSend(string msg) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) string[] value = msg.Split(new char[1] { ' ' }).ToArray(); Object[] array = Object.FindObjectsOfType(typeof(GameObject)); List<GameObject> list = new List<GameObject>(); Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { GameObject val = (GameObject)array2[i]; if ((((Object)val).name == "OuijaBoardScrap(Clone)" || ((Object)val).name == "OuijaBoardStore(Clone)") && !((GrabbableObject)(PhysicsProp)val.GetComponent(typeof(PhysicsProp))).isHeld) { list.Add(val); } } if (list.Count > 0) { if (!StartOfRoundPatch.complete) { ShowError("Boards on cooldown"); return false; } string text = string.Join("", value); if (Regex.Match(text, "([A-Za-z\\d ])+").Value.Length != text.Length) { ShowError("Invalid character(s)"); return false; } text = text.Replace(" ", ""); if (text.Length > 10) { ShowError("Too many characters"); return false; } OuijaNetworker.Instance.WriteOut(text); return true; } ShowError("No valid boards"); return false; } public static void ShowError(string msg) { if ((Object)(object)OuijaErrorUI != (Object)null) { Debug.Log((object)("Ouija Board showing erorr: " + msg)); ((Component)OuijaErrorUI.transform.GetChild(0)).GetComponent<TMP_Text>().text = msg; OuijaErrorUI.SetActive(true); lastError = Time.time; } } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { public static int writeIndex = 0; public static List<string> names = new List<string>(); public static List<GameObject> boards = new List<GameObject>(); public static float timer = 0f; public static double amount = 0.0; public static bool complete = true; [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(ref StartOfRound __instance) { PlayerControllerB localPlayerController = __instance.localPlayerController; if (!Object.op_Implicit((Object)(object)localPlayerController)) { return; } if (!DEVDEBUG && !localPlayerController.isPlayerDead && Object.op_Implicit((Object)(object)OuijaTextUI) && OuijaTextUI.active) { Debug.Log((object)"Ouija Text UI closed since player is not dead"); OuijaTextUI.SetActive(false); Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue(); } if (Object.op_Implicit((Object)(object)OuijaErrorUI) && OuijaErrorUI.active && Time.time - UIHandler.lastError > 2f) { Debug.Log((object)"Ouija Error UI closed"); OuijaErrorUI.SetActive(false); Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue(); } if (writeIndex < names.Count) { amount = Mathf.Clamp(timer / 1.2f, 0f, 1f); MoveUpdate(names[writeIndex]); timer += Time.deltaTime; if (timer >= 3f) { amount = 1.0; MoveUpdate(names[writeIndex]); timer = 0f; writeIndex++; } } else if (!complete) { if (timer < 5f) { timer += Time.deltaTime; } else { complete = true; timer = 0f; amount = 0.0; } } if ((Object)(object)OuijaTextUI != (Object)null) { ((Component)OuijaTextUI.transform.GetChild(3)).gameObject.SetActive(!complete); } } public static void MoveUpdate(string name) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown int num = -1; bool flag = false; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; foreach (GameObject board in boards) { if (!Object.op_Implicit((Object)(object)board) || ((GrabbableObject)(PhysicsProp)board.GetComponent(typeof(PhysicsProp))).isHeld) { continue; } flag = true; if (num == -1) { num = 0; foreach (Transform item in board.transform.GetChild(0).GetChild(3)) { Transform val = item; GameObject gameObject = ((Component)val).gameObject; if (((Object)gameObject).name == name) { break; } num++; } if (num == -1) { amount = 0.0; writeIndex++; break; } } Vector3 localPosition = board.transform.GetChild(0).GetChild(3).GetChild(num) .localPosition; Vector3 localPosition2 = board.transform.GetChild(0).GetChild(4).localPosition; GameObject gameObject2 = ((Component)board.transform.GetChild(0).GetChild(2)).gameObject; if (amount == 0.0) { gameObject2.GetComponent<AudioSource>().Play(); if (makesSound) { RoundManager.Instance.PlayAudibleNoise(board.transform.position, 8f, 0.3f, 0, false, 8925); } } Vector3 val2 = localPosition + new Vector3(0f, 0.166f, 0f); gameObject2.transform.localPosition = Vector3.Lerp(localPosition2, val2, (float)amount); if (amount == 1.0) { board.transform.GetChild(0).GetChild(4).localPosition = val2; } if (Vector3.Distance(((Component)localPlayerController).transform.position, board.transform.position) < 5f) { localPlayerController.insanityLevel += Time.deltaTime * 0.5f; } } if (!flag) { writeIndex = names.Count; } } } [HarmonyPatch(typeof(PlayerControllerB))] [HarmonyPriority(500)] public class PlayerPatch { [HarmonyPatch("Interact_performed")] [HarmonyPrefix] private static void InteractPrefixPatch(ref PlayerControllerB __instance, out bool __state) { __state = __instance.isPlayerDead; if (Object.op_Implicit((Object)(object)OuijaTextUI) && OuijaTextUI.active) { __instance.isPlayerDead = false; } } [HarmonyPatch("Interact_performed")] [HarmonyPostfix] private static void InteractPostfixPatch(ref PlayerControllerB __instance, bool __state) { __instance.isPlayerDead = __state; } } public class OuijaNetworker : NetworkBehaviour { public static OuijaNetworker Instance; private void Awake() { Instance = this; } public void WriteOut(string message) { if (((NetworkBehaviour)this).IsOwner) { WriteOutClientRpc(message); } else { WriteOutServerRpc(message); } } [ClientRpc] public void WriteOutClientRpc(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3508306228u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3508306228u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Object[] array = Object.FindObjectsOfType(typeof(GameObject)); List<GameObject> list = new List<GameObject>(); Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { GameObject val3 = (GameObject)array2[i]; if ((((Object)val3).name == "OuijaBoardScrap(Clone)" || ((Object)val3).name == "OuijaBoardStore(Clone)") && !((GrabbableObject)(PhysicsProp)val3.GetComponent(typeof(PhysicsProp))).isHeld) { list.Add(val3); } } List<string> list2 = new List<string>(); switch (message) { case "yes": case "y": list2.Add("Yes"); break; case "no": case "n": list2.Add("No"); break; case "goodbye": case "bye": list2.Add("Goodbye"); break; default: list2 = (from c in message.ToUpper().ToCharArray() select c.ToString()).ToList(); break; } StartOfRoundPatch.amount = 0.0; StartOfRoundPatch.complete = false; StartOfRoundPatch.writeIndex = 0; StartOfRoundPatch.names = list2; StartOfRoundPatch.boards = list; } [ServerRpc(RequireOwnership = false)] public void WriteOutServerRpc(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3320529116u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3320529116u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { WriteOutClientRpc(message); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_OuijaNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3508306228u, new RpcReceiveHandler(__rpc_handler_3508306228)); NetworkManager.__rpc_func_table.Add(3320529116u, new RpcReceiveHandler(__rpc_handler_3320529116)); } private static void __rpc_handler_3508306228(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((OuijaNetworker)(object)target).WriteOutClientRpc(message); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3320529116(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((OuijaNetworker)(object)target).WriteOutServerRpc(message); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "OuijaNetworker"; } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref RoundManager __instance) { if (((NetworkBehaviour)__instance).IsServer && (Object)(object)OuijaNetworker.Instance == (Object)null) { GameObject val = Object.Instantiate<GameObject>(OuijaNetworkerPrefab); val.GetComponent<NetworkObject>().Spawn(true); } OuijaTextUI = Object.Instantiate<GameObject>(OuijaTextUIPrefab); OuijaTextUI.SetActive(false); Traverse.Create(typeof(LcInputActionApi)).Method("ReEnableFromRebind", Array.Empty<object>()).GetValue(); OuijaErrorUI = Object.Instantiate<GameObject>(OuijaErrorUIPrefab); OuijaErrorUI.SetActive(false); } } private const string modGUID = "Electric.OuijaBoard"; private const string modName = "OuijaBoard"; private const string modVersion = "1.5.3"; private readonly Harmony harmony = new Harmony("Electric.OuijaBoard"); public static bool storeEnabled; public static int storeCost; public static bool scrapEnabled; public static int scrapRarity; public static bool makesSound; private static bool DEVDEBUG; public static GameObject OuijaNetworkerPrefab; public static GameObject OuijaTextUIPrefab; public static GameObject OuijaTextUI; public static GameObject OuijaErrorUIPrefab; public static GameObject OuijaErrorUI; private void Awake() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown AssetBundle val = AssetBundle.LoadFromMemory(Resources.fullboard); OuijaNetworkerPrefab = val.LoadAsset<GameObject>("Assets/OuijaNetworker.prefab"); OuijaNetworkerPrefab.AddComponent<OuijaNetworker>(); OuijaTextUIPrefab = val.LoadAsset<GameObject>("Assets/OuijaTextUI.prefab"); OuijaErrorUIPrefab = val.LoadAsset<GameObject>("Assets/OuijaErrorUI.prefab"); GameObject val2 = val.LoadAsset<GameObject>("Assets/OuijaBoardStore.prefab"); GameObject val3 = val.LoadAsset<GameObject>("Assets/OuijaBoardScrap.prefab"); NetworkPrefabs.RegisterNetworkPrefab(OuijaNetworkerPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2); NetworkPrefabs.RegisterNetworkPrefab(val3); InputAction val4 = new InputAction((string)null, (InputActionType)0, "<Keyboard>/#(" + ((BaseUnityPlugin)this).Config.Bind<string>("General", "Keybind", "o", "(Clientside) The key that will open the Ouija Board UI. Note: This will NOT change the tooltip on the item").Value + ")", (string)null, (string)null, (string)null); val4.performed += UIHandler.ToggleUI; val4.Enable(); storeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Store", "Enabled", true, "Allow Ouija Board to be bought in the store").Value; storeCost = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "Cost", 100, "Cost of a Ouija Board in the store (Store must be enabled)").Value; scrapEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap", "Enabled", false, "Allow the Ouija Board to spawn in the facility").Value; scrapRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Rarity Weight", 20, "Chance for a Ouija Board to spawn as scrap").Value; if (storeCost < 0) { storeCost = 0; } if (scrapRarity < 0) { scrapRarity = 0; } makesSound = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Makes Sound", true, "Enables the Ouija Board's sliding to be heard by enemies").Value; Item val5 = val.LoadAsset<Item>("Assets/OuijaBoardStoreItem.asset"); Item val6 = val.LoadAsset<Item>("Assets/OuijaBoardScrapItem.asset"); if (storeEnabled) { Debug.Log((object)$"Ouija Board store enabled at {storeCost} credits"); Items.RegisterShopItem(val5, storeCost); } if (scrapEnabled) { Debug.Log((object)$"Ouija Board scrap spawn enabled at {scrapRarity} rarity weight"); val6.minValue = Mathf.Max(((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Min Value", 60, "The minimum value of the Ouija Board (must be > 0)").Value, 1); val6.maxValue = Mathf.Max(((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "Max Value", 80, "The maximum value of the Ouija Board (must be > min value)").Value, val6.minValue); Items.RegisterScrap(val6, scrapRarity, (LevelTypes)(-1)); } NetcodeWeaver(); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"OuijaBoard loaded!"); } private static void NetcodeWeaver() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace LCOuijaBoard.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LCOuijaBoard.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] fullboard { get { object @object = ResourceManager.GetObject("fullboard", resourceCulture); return (byte[])@object; } } internal Resources() { } } }
BepInEx/plugins/LethalPaintings.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.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.7", FrameworkDisplayName = ".NET Framework 4.7")] [assembly: AssemblyCompany("LethalPaintings")] [assembly: AssemblyConfiguration("release")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalPaintings")] [assembly: AssemblyTitle("LethalPaintings")] [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 LethalPaintings { internal class Patches { private static ManualLogSource Logger { get; set; } public static void Init(ManualLogSource logger) { Logger = logger; } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPostfix] private static void SetScrapValuePatch(GrabbableObject __instance) { if (__instance.itemProperties.itemName == "Painting") { UpdateTexture(Plugin.PaintingFiles, __instance.itemProperties.materialVariants[0]); UpdateTexture(Plugin.PaintingFiles, __instance.itemProperties.materialVariants[1]); } } private static void UpdateTexture(IReadOnlyList<string> files, Material material) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (files.Count != 0) { int index = Plugin.Rand.Next(files.Count); Texture2D val = new Texture2D(2, 2); Logger.LogInfo((object)("Patching " + ((Object)material).name + " with " + files[index])); ImageConversion.LoadImage(val, File.ReadAllBytes(files[index])); material.mainTexture = (Texture)(object)val; } } } [BepInPlugin("LethalPaintings", "LethalPaintings", "1.0.0")] public class Plugin : BaseUnityPlugin { private static List<string> PosterFolders = new List<string>(); public static readonly List<string> PaintingFiles = new List<string>(); public static Random Rand = new Random(); private void Awake() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) PosterFolders = Directory.GetDirectories(Paths.PluginPath, "LethalPaintings", SearchOption.AllDirectories).ToList(); foreach (string posterFolder in PosterFolders) { string[] files = Directory.GetFiles(Path.Combine(posterFolder, "paintings")); foreach (string text in files) { if (Path.GetExtension(text) != ".old") { PaintingFiles.Add(text); } } } Patches.Init(((BaseUnityPlugin)this).Logger); new Harmony("LethalPaintings").PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalPaintings is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalPaintings"; public const string PLUGIN_NAME = "LethalPaintings"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/LethalPosters.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7", FrameworkDisplayName = ".NET Framework 4.7")] [assembly: AssemblyCompany("LethalPosters")] [assembly: AssemblyConfiguration("release")] [assembly: AssemblyDescription("LethalCopmany posters API")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalPosters")] [assembly: AssemblyTitle("LethalPosters")] [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 LethalPosters { internal class Config { private static ConfigFile ConfigFile { get; set; } static Config() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown ConfigFile = new ConfigFile(Paths.ConfigPath + "\\LethalPosters.cfg", true); foreach (string posterFolder in Plugin.PosterFolders) { int num = posterFolder.IndexOf("plugins\\", StringComparison.Ordinal) + "plugins\\".Length; int num2 = posterFolder.IndexOf("\\LethalPosters", num, StringComparison.Ordinal); string text = posterFolder.Substring(num, num2 - num); if (!ConfigFile.Bind<bool>(text, "Enabled", true, "Enable or disable " + text).Value) { Directory.Move(posterFolder, posterFolder + ".Disabled"); } } } } internal class Patches { private static ManualLogSource Logger { get; set; } public static void Init(ManualLogSource logger) { Logger = logger; } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartPatch() { Logger.LogInfo((object)"Patching Start in StartOfRound"); UpdateMaterials(0); } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] private static void GenerateNewLevelClientRpcPatch(int randomSeed) { Logger.LogInfo((object)"Patching GenerateNewLevelClientRpc in RoundManager"); UpdateMaterials(randomSeed); } private static void UpdateMaterials(int seed) { Logger.LogInfo((object)"Patching the textures"); Plugin.Rand = new Random(seed); Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials; UpdateTexture(Plugin.PosterFiles, materials[0]); UpdateTexture(Plugin.TipFiles, materials[1]); } private static void UpdateTexture(IReadOnlyList<string> files, Material material) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (files.Count != 0) { int index = Plugin.Rand.Next(files.Count); Texture2D val = new Texture2D(2, 2); Logger.LogInfo((object)("Patching " + ((Object)material).name + " with " + files[index])); ImageConversion.LoadImage(val, File.ReadAllBytes(files[index])); material.mainTexture = (Texture)(object)val; } } } [BepInPlugin("LethalPosters", "LethalPosters", "1.0.0")] public class Plugin : BaseUnityPlugin { public static List<string> PosterFolders = new List<string>(); public static readonly List<string> PosterFiles = new List<string>(); public static readonly List<string> TipFiles = new List<string>(); public static Random Rand = new Random(); private void Awake() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) PosterFolders = Directory.GetDirectories(Paths.PluginPath, "LethalPosters", SearchOption.AllDirectories).ToList(); foreach (string posterFolder in PosterFolders) { string[] files = Directory.GetFiles(Path.Combine(posterFolder, "posters")); foreach (string text in files) { if (Path.GetExtension(text) != ".old") { PosterFiles.Add(text); } } files = Directory.GetFiles(Path.Combine(posterFolder, "tips")); foreach (string text2 in files) { if (Path.GetExtension(text2) != ".old") { TipFiles.Add(text2); } } } Patches.Init(((BaseUnityPlugin)this).Logger); new Harmony("LethalPosters").PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalPosters (1.0.0) is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalPosters"; public const string PLUGIN_NAME = "LethalPosters"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/MonitorLabels.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using MonitorLabels.BaseClasses; using MonitorLabels.Components; using MonitorLabels.Components.Tools; using MonitorLabels.Constants; using MonitorLabels.Dependencies.LethalConfig; using MonitorLabels.ExtensionMethods; using MonitorLabels.Structs; using MonitorLabels.Utils; using MonitorLabels.Utils.ModUtils; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DannyVD")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds a label to the icons on the monitor for players, radar boosters, enemies and scrap")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+0bbf54eabf9e2f14bfcf5bd92e03759ea900af7d")] [assembly: AssemblyProduct("MonitorLabels")] [assembly: AssemblyTitle("MonitorLabels")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MonitorLabels { public static class AIMapLabelManager { public static readonly Dictionary<Type, CustomLabelData> CustomAINames = new Dictionary<Type, CustomLabelData>(); public static bool TryAddNewAI(Type type, CustomLabelData labelData) { return CustomAINames.TryAdd(type, labelData); } public static bool TryAddNewAI(Type type, string label, bool showLabel = true) { return CustomAINames.TryAdd(type, new CustomLabelData(label, showLabel)); } public static void SetAI(Type type, CustomLabelData customLabelData) { CustomAINames[type] = customLabelData; } public static void SetAI(Type type, string label, bool showLabel = true) { SetAI(type, new CustomLabelData(label, showLabel)); } public static void RemoveAI(Type type) { CustomAINames.Remove(type); } public static void AddLabelToAI(EnemyAI enemyAI) { //IL_008a: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0060: 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) bool showLabel; string aILabel = GetAILabel(enemyAI, out showLabel); if (!showLabel) { return; } Transform mapDot = MapLabelUtil.GetMapDot(((Component)enemyAI).transform); if (mapDot == null) { LoggerUtil.LogWarning("Child MapDot cannot be found for enemy: " + ((Object)((Component)enemyAI).gameObject).name); return; } if (enemyAI is SandSpiderAI) { Vector3 localScale = mapDot.localScale; float num = Mathf.Max(new float[3] { localScale.x, localScale.y, localScale.z }); mapDot.localScale = new Vector3(num, num, num); } TMP_Text obj = MapLabelUtil.AddLabelObject(((Component)mapDot).gameObject, ConfigUtil.EnemyLabelOffset.Value); ((Graphic)obj).color = ConfigUtil.EnemyLabelColour.Value; obj.text = aILabel; } public static void UpdateAILabel(EnemyAI enemyAI) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) Transform mapDot = MapLabelUtil.GetMapDot(((Component)enemyAI).transform); if (mapDot == null) { return; } MapLabelUtil.GetRadarLabel(mapDot, out var label); if (label != null) { if (!ConfigUtil.ShowLabelOnDeadEnemies.Value) { Object.Destroy((Object)(object)((Component)label).gameObject); } else { ((Graphic)label).color = ConfigUtil.DeadEnemyLabelColour.Value; } } } private static string GetAILabel(EnemyAI enemyAI, out bool showLabel) { showLabel = true; if (!(enemyAI is BaboonBirdAI)) { if (!(enemyAI is BlobAI)) { if (!(enemyAI is CentipedeAI)) { if (!(enemyAI is CrawlerAI)) { if (!(enemyAI is DocileLocustBeesAI)) { if (!(enemyAI is DoublewingAI)) { if (!(enemyAI is DressGirlAI)) { if (!(enemyAI is FlowermanAI)) { if (!(enemyAI is ForestGiantAI)) { if (!(enemyAI is HoarderBugAI)) { if (!(enemyAI is JesterAI)) { if (!(enemyAI is LassoManAI)) { if (!(enemyAI is MaskedPlayerEnemy)) { if (!(enemyAI is MouthDogAI)) { if (!(enemyAI is NutcrackerEnemyAI)) { if (!(enemyAI is PufferAI)) { if (!(enemyAI is SandSpiderAI)) { if (!(enemyAI is SandWormAI)) { if (!(enemyAI is SpringManAI)) { if (!(enemyAI is TestEnemy)) { if (!(enemyAI is ButlerEnemyAI)) { if (!(enemyAI is RadMechAI)) { if (enemyAI is FlowerSnakeEnemy) { if (ConfigUtil.HideLabelOnSomeEnemies.Value) { showLabel = false; } return ConfigUtil.FlowerSnakeLabel.Value; } return GetUnknownAILabel(enemyAI, out showLabel); } return ConfigUtil.RadMechLabel.Value; } return ConfigUtil.ButlerLabel.Value; } return "Obunga"; } return ConfigUtil.CoilHeadLabel.Value; } if (ConfigUtil.HideLabelOnSomeEnemies.Value) { showLabel = false; } return ConfigUtil.SandWormLabel.Value; } return ConfigUtil.SpiderLabel.Value; } return ConfigUtil.SporeLizardLabel.Value; } return ConfigUtil.NutCrackerLabel.Value; } return ConfigUtil.DogLabel.Value; } return ConfigUtil.MaskedLabel.Value; } return "Lasso"; } return ConfigUtil.JesterLabel.Value; } return ConfigUtil.HoarderBugLabel.Value; } return ConfigUtil.ForestGiantLabel.Value; } return ConfigUtil.BrackenLabel.Value; } showLabel = false; return "Girl"; } if (ConfigUtil.HideLabelOnSomeEnemies.Value) { showLabel = false; } return ConfigUtil.ManticoilLabel.Value; } showLabel = false; return "Bees"; } return ConfigUtil.CrawlerLabel.Value; } return ConfigUtil.CentipedeLabel.Value; } return ConfigUtil.BlobLabel.Value; } return ConfigUtil.BaboonHawkLabel.Value; } private static string GetUnknownAILabel(EnemyAI enemyAISubclassInstance, out bool showLabel) { foreach (KeyValuePair<Type, CustomLabelData> customAIName in CustomAINames) { if (customAIName.Key.IsInstanceOfType(enemyAISubclassInstance)) { showLabel = customAIName.Value.ShowLabel; return customAIName.Value.Label; } } showLabel = true; string value = ConfigUtil.UnknownLabel.Value; if (!value.Equals(string.Empty)) { return value; } return MapLabelUtil.RemoveCloneFromString(((Object)((Component)enemyAISubclassInstance).gameObject).name).InsertSpaceBeforeCapitals(); } } [BepInPlugin("DannyVD.mods.LethalCompany.MonitorLabels", "MonitorLabels", "2.0.0")] [BepInProcess("Lethal Company.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MonitorLabelsPlugin : BaseUnityPlugin { public const string GUID = "DannyVD.mods.LethalCompany.MonitorLabels"; public const string PLUGIN_NAME = "MonitorLabels"; public const string PLUGIN_VERSION = "2.0.0"; public const string DEPENDENCY_STRING = "DannyVD-MonitorLabels-2.0.0"; private void Awake() { ConfigUtil.Initialize(((BaseUnityPlugin)this).Config); ConfigUtil.ReadConfig(); LoggerUtil.Initialize(ConfigUtil.LoggingLevel, ((BaseUnityPlugin)this).Logger); LoggerUtil.Log((LogLevel)16, "Plugin DannyVD-MonitorLabels-2.0.0 is loaded!"); PatchUtil.PatchFunctions(); DependencyUtils.CheckDependencies(); } } internal static class ObjectLabelManager { internal static void TryAddLabelToScrap(GrabbableObject item) { Transform radarIcon = item.radarIcon; if (!((Object)(object)radarIcon == (Object)null)) { AddLabelToScrap(item, ((Component)radarIcon).gameObject); } } internal static void UpdateScrapLabel(GrabbableObject item) { UpdateItemSlotLabel(item, null, null); } internal static void UpdateItemSlotLabel(GrabbableObject item, GrabbableObject firstToolInItemSlots, GrabbableObject firstToolInUseInItemSlots) { Transform radarIcon = item.radarIcon; if ((Object)(object)radarIcon == (Object)null) { return; } ContinuouslyUpdateToolLabel component = ((Component)item).GetComponent<ContinuouslyUpdateToolLabel>(); if (!((Object)(object)component != (Object)null) || !component.IsUpdating) { MapLabelUtil.GetRadarLabel(radarIcon, out var label); if (label != null) { SetScrapLabel(item, label, firstToolInItemSlots, firstToolInUseInItemSlots); } } } internal static void SetScrapLabel(GrabbableObject item, TMP_Text radarLabel, GrabbableObject firstToolInItemSlots = null, GrabbableObject firstToolInUseInItemSlots = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) radarLabel.text = GetScrapLabelString(item, out var labelColour, firstToolInItemSlots, firstToolInUseInItemSlots); ((Graphic)radarLabel).color = labelColour; } private static void AddLabelToScrap(GrabbableObject item, GameObject radarParent) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) bool isScrap = item.itemProperties.isScrap; TMP_Text val = MapLabelUtil.AddLabelObject(radarParent, isScrap ? ConfigUtil.ScrapLabelOffset.Value : ConfigUtil.ToolLabelOffset.Value, continuouslyUpdateRotationAndOffset: false); if (isScrap) { val.fontSize *= ConfigUtil.ScrapLabelScaleFactor.Value; } else { val.fontSize = ConfigUtil.ToolLabelFontSize.Value; } SetScrapLabel(item, val); if (item.itemProperties.requiresBattery && ConfigUtil.ShowBatteryChargeOnLabel.Value) { ((Component)item).gameObject.AddComponent<ContinuouslyUpdateToolLabel>().Initialize(item, val); } } private static string GetScrapLabelString(GrabbableObject item, out Color labelColour, GrabbableObject firstToolInItemSlots, GrabbableObject firstToolInUseInItemSlots) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { labelColour = Color.white; return string.Empty; } bool flag = !item.itemProperties.isScrap; int scrapValue = item.scrapValue; if (item.isHeld) { if (flag && (Object)(object)item.playerHeldBy != (Object)null) { labelColour = ConfigUtil.CarriedToolLabelColour.Value; GrabbableObject currentlyHeldObjectServer = item.playerHeldBy.currentlyHeldObjectServer; bool flag2 = (Object)(object)currentlyHeldObjectServer != (Object)null && !currentlyHeldObjectServer.itemProperties.isScrap; if (item.isPocketed && ConfigUtil.HideToolLabelIfPocketed.Value) { if (!item.isBeingUsed || !ConfigUtil.ShowToolIfInUseAndNoOtherToolHeld.Value || flag2) { return string.Empty; } if (ConfigUtil.OnlyShow1PocketedLabel.Value) { GrabbableObject val = ((IEnumerable<GrabbableObject>)item.playerHeldBy.ItemSlots).FirstOrDefault((Func<GrabbableObject, bool>)((GrabbableObject grabbableObject) => (Object)(object)grabbableObject != (Object)null && grabbableObject.isBeingUsed)); if ((Object)(object)item != (Object)(object)val) { return string.Empty; } } } else if (item.isPocketed && ConfigUtil.OnlyShow1PocketedLabel.Value) { if (flag2 && !ConfigUtil.HideToolLabelIfInHand.Value) { return string.Empty; } if (ConfigUtil.ShowToolIfInUseAndNoOtherToolHeld.Value) { if ((Object)(object)firstToolInUseInItemSlots != (Object)null) { if ((Object)(object)firstToolInUseInItemSlots != (Object)(object)item) { return string.Empty; } } else if ((Object)(object)firstToolInItemSlots != (Object)(object)item) { return string.Empty; } } else if ((Object)(object)item != (Object)(object)firstToolInItemSlots) { return string.Empty; } } else if (!item.isPocketed && ConfigUtil.HideToolLabelIfInHand.Value) { return string.Empty; } } else if (flag) { labelColour = ConfigUtil.CarriedToolLabelColour.Value; if (ConfigUtil.HideToolLabelIfInHand.Value) { return string.Empty; } } else { labelColour = ConfigUtil.CarriedScrapLabelColour.Value; if (ConfigUtil.HideScrapLabelIfCarried.Value) { return string.Empty; } } } else if (item.isInShipRoom) { if (flag) { labelColour = ConfigUtil.InShipToolLabelColour.Value; if (ConfigUtil.HideToolLabelIfOnShip.Value) { return string.Empty; } } else { labelColour = ConfigUtil.InShipScrapLabelColour.Value; if (ConfigUtil.HideScrapLabelIfOnShip.Value) { return string.Empty; } } } else if (flag) { labelColour = ConfigUtil.ToolLabelColour.Value; } else { labelColour = ((scrapValue >= ConfigUtil.HighValueScrapThreshold.Value) ? ConfigUtil.HighValueScrapLabelColour.Value : ConfigUtil.ScrapLabelColour.Value); } if (TryGetCustomLabel(item, out var label)) { return label; } return GetFormattedScrapLabel(item, scrapValue, flag); } private static bool TryGetCustomLabel(GrabbableObject item, out string label) { label = string.Empty; if (ConfigUtil.HideScrapLabelOnNutcracker.Value && item is ShotgunItem && item.isHeldByEnemy) { return true; } return false; } private static string GetFormattedScrapLabel(GrabbableObject item, int scrapValue, bool isTool) { string scrapName = GetScrapName(item); if (isTool) { string arg = string.Empty; if (item.itemProperties.requiresBattery && ConfigUtil.ShowBatteryChargeOnLabel.Value && item.insertedBattery != null) { float num = (item.insertedBattery.empty ? 0f : item.insertedBattery.charge); arg = string.Format(ConfigUtil.ToolBatteryStringFormat.Value, num); } return string.Format(ConfigUtil.ToolLabelStringFormat.Value, scrapName, arg); } return string.Format(ConfigUtil.ScrapLabelStringFormat.Value, scrapName, scrapValue); } private static string GetScrapName(GrabbableObject item) { Item itemProperties = item.itemProperties; if (Object.op_Implicit((Object)(object)itemProperties) && !string.IsNullOrEmpty(itemProperties.itemName)) { return itemProperties.itemName; } ScanNodeProperties componentInChildren = ((Component)item).GetComponentInChildren<ScanNodeProperties>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { return componentInChildren.headerText; } return MapLabelUtil.RemoveCloneFromString(((Object)((Component)item).gameObject).name).InsertSpaceBeforeCapitals(); } } internal static class Patches { [HarmonyPatch(typeof(ManualCameraRenderer), "Awake")] [HarmonyPostfix] [HarmonyPriority(200)] private static void ManualCameraRendererAwakePatch(ManualCameraRenderer __instance) { LoggerUtil.LogDebug("ManualCameraRenderer.Awake patch run"); NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening) { RadarTargetLabelManager.UpdateLabels(); if (__instance.mapCamera != null) { ((Component)__instance.mapCamera).gameObject.AddComponent<MapCameraRotationObserver>(); } } } [HarmonyPatch(typeof(ManualCameraRenderer), "AddTransformAsTargetToRadar")] [HarmonyPostfix] [HarmonyPriority(200)] private static void ManualCameraRendererAddTransformAsTargetToRadarPatch() { LoggerUtil.LogDebug("ManualCameraRenderer.AddTransformAsTargetToRadar patch run"); RadarTargetLabelManager.UpdateLabels(); } [HarmonyPatch(typeof(ManualCameraRenderer), "updateMapTarget")] [HarmonyPostfix] [HarmonyPriority(200)] private static void ManualCameraRendererUpdateMapTargetPatch(int setRadarTargetIndex, bool calledFromRPC = true) { if (calledFromRPC) { LoggerUtil.LogDebug("ManualCameraRenderer.updateMapTarget patch run"); RadarTargetLabelManager.UpdateLabels(setRadarTargetIndex); } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBSendNewPlayerValuesClientRpcPatch(PlayerControllerB __instance) { LoggerUtil.LogDebug("PlayerControllerB.SendNewPlayerValuesClientRpc patch run"); RadarTargetLabelManager.UpdateLabels(); } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerClientRpc")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBDamagePlayerPatch(PlayerControllerB __instance) { LoggerUtil.LogDebug("PlayerControllerB.DamagePlayer patch run"); RadarTargetLabelManager.UpdateLabel(((Component)__instance).transform); } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBKillPlayerClientRpcPatch(PlayerControllerB __instance) { LoggerUtil.LogDebug("PlayerControllerB.KillPlayerClientRpc patch run"); RadarTargetLabelManager.UpdateLabel(((Component)__instance).transform); } [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] [HarmonyPriority(200)] private static void EnemyAIStartPatch(EnemyAI __instance) { LoggerUtil.LogDebug("EnemyAI.Start patch run"); if (ConfigUtil.ShowLabelOnEnemies.Value) { AIMapLabelManager.AddLabelToAI(__instance); } } [HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")] [HarmonyPostfix] [HarmonyPriority(200)] private static void MaskedPlayerEnemyStartPatch(MaskedPlayerEnemy __instance) { LoggerUtil.LogDebug("MaskedPlayerEnemy.Start patch run"); if (ConfigUtil.ShowLabelOnEnemies.Value) { AIMapLabelManager.AddLabelToAI((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] [HarmonyPostfix] [HarmonyPriority(200)] private static void EnemyAIKillEnemyPatch(EnemyAI __instance, bool destroy = false) { LoggerUtil.LogDebug("EnemyAI.KillEnemy patch run"); if (!destroy && ConfigUtil.ShowLabelOnEnemies.Value && !((Object)(object)__instance == (Object)null)) { AIMapLabelManager.UpdateAILabel(__instance); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "GrabGun")] [HarmonyPostfix] [HarmonyPriority(200)] private static void NutcrackerEnemyAIGrabGunPatch(NutcrackerEnemyAI __instance) { LoggerUtil.LogDebug("NutcrackerEnemyAI.GrabGun patch run"); if (ConfigUtil.ShowLabelOnScrap.Value && !((Object)(object)__instance.gun == (Object)null)) { ObjectLabelManager.UpdateScrapLabel((GrabbableObject)(object)__instance.gun); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "DropGun")] [HarmonyPostfix] [HarmonyPriority(200)] private static void NutcrackerEnemyAIDropGunPatch(NutcrackerEnemyAI __instance) { LoggerUtil.LogDebug("NutcrackerEnemyAI.DropGun patch run"); if (ConfigUtil.ShowLabelOnScrap.Value && !((Object)(object)__instance.gun == (Object)null)) { ObjectLabelManager.UpdateScrapLabel((GrabbableObject)(object)__instance.gun); } } [HarmonyPatch(typeof(GrabbableObject), "Start")] [HarmonyPostfix] [HarmonyPriority(200)] private static void GrabbableObjectStartPatch(GrabbableObject __instance) { LoggerUtil.LogDebug("GrabbableObject.Start patch run"); if (!__instance.itemProperties.isScrap) { if (ConfigUtil.ShowIconOnTools.Value && (Object)(object)__instance.radarIcon == (Object)null) { ToolIconSpawner.SpawnIcon(__instance); } if (ConfigUtil.ShowLabelOnTools.Value) { ObjectLabelManager.TryAddLabelToScrap(__instance); } } else if (ConfigUtil.ShowLabelOnScrap.Value) { ObjectLabelManager.TryAddLabelToScrap(__instance); } } [HarmonyPatch(typeof(GrabbableObject), "OnBroughtToShip")] [HarmonyPrefix] [HarmonyPriority(200)] private static bool GrabbableObjectOnBroughtToShipPatch(GrabbableObject __instance) { LoggerUtil.LogDebug("GrabbableObject.OnBroughtToShip patch run"); return __instance.itemProperties.isScrap; } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPostfix] [HarmonyPriority(200)] private static void GrabbableObjectSetScrapValuePatch(GrabbableObject __instance) { LoggerUtil.LogDebug("GrabbableObject.SetScrapValue patch run"); if (ConfigUtil.ShowLabelOnScrap.Value) { PlayerControllerB playerHeldBy = __instance.playerHeldBy; if ((Object)(object)playerHeldBy != (Object)null) { RadarTargetLabelManager.UpdateLabel(((Component)playerHeldBy).transform); PlayerItemSlotsUtil.GetFirstToolAndFirstToolInUse(playerHeldBy, out var firstTool, out var firstToolInUse); ObjectLabelManager.UpdateItemSlotLabel(__instance, firstTool, firstToolInUse); } else { ObjectLabelManager.UpdateScrapLabel(__instance); } } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBSwitchToItemSlotPatch(PlayerControllerB __instance) { LoggerUtil.LogDebug("PlayerControllerB.SwitchToItemSlot patch run"); if (__instance != null) { PlayerItemSlotsUtil.UpdateLabelsOfItemSlots(__instance); } } [HarmonyPatch(typeof(GrabbableObject), "UseItemOnClient")] [HarmonyPostfix] [HarmonyPriority(200)] private static void GrabbableObjectUseItemOnClientPatch(GrabbableObject __instance) { LoggerUtil.LogDebug("GrabbableObject.UseItemOnClient patch run"); PlayerControllerB playerHeldBy = __instance.playerHeldBy; if (playerHeldBy != null) { PlayerItemSlotsUtil.UpdateLabelsOfItemSlots(playerHeldBy); } else if (!__instance.itemProperties.isScrap && ConfigUtil.ShowLabelOnTools.Value) { ObjectLabelManager.UpdateScrapLabel(__instance); } } [HarmonyPatch(typeof(PlayerControllerB), "SetItemInElevator")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBSetItemInElevatorPatch(PlayerControllerB __instance, GrabbableObject gObject) { LoggerUtil.LogDebug("PlayerControllerB.SetItemInElevator patch run"); RadarTargetLabelManager.UpdateLabel(((Component)__instance).transform); if ((Object)(object)gObject == (Object)null) { return; } if (gObject.itemProperties.isScrap) { if (!ConfigUtil.ShowLabelOnScrap.Value) { return; } } else if (!ConfigUtil.ShowLabelOnTools.Value) { return; } ObjectLabelManager.UpdateScrapLabel(gObject); } [HarmonyPatch(typeof(GrabbableObject), "DiscardItemOnClient")] [HarmonyPostfix] [HarmonyPriority(200)] private static void GrabbableObjectDiscardItemOnClientPatch(GrabbableObject __instance) { LoggerUtil.LogDebug("GrabbableObject.DiscardItemOnClient patch run"); ObjectLabelManager.UpdateScrapLabel(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBDiscardHeldObjectPatch(PlayerControllerB __instance) { LoggerUtil.LogDebug("PlayerControllerB.DiscardHeldObject patch run"); RadarTargetLabelManager.UpdateLabel(((Component)__instance).transform); PlayerItemSlotsUtil.UpdateLabelsOfItemSlots(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] [HarmonyPriority(200)] private static void PlayerControllerBGrabObjectClientRpcPatch(PlayerControllerB __instance, NetworkObjectReference grabbedObject) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) LoggerUtil.LogDebug("PlayerControllerB.GrabObjectClientRpc patch run"); RadarTargetLabelManager.UpdateLabel(((Component)__instance).transform); GrabbableObject componentInChildren = ((Component)NetworkObjectReference.op_Implicit(grabbedObject)).GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren == (Object)null) { return; } if (componentInChildren.itemProperties.isScrap) { if (ConfigUtil.ShowLabelOnScrap.Value) { ObjectLabelManager.UpdateScrapLabel(componentInChildren); } } else if (ConfigUtil.ShowLabelOnTools.Value) { PlayerItemSlotsUtil.UpdateLabelsOfItemSlots(__instance); } } [HarmonyPatch(typeof(Landmine), "Detonate")] [HarmonyPostfix] [HarmonyPriority(200)] private static void LandMineDetonatePatch(Landmine __instance) { LoggerUtil.LogDebug("Landmine.Detonate patch run"); if (ConfigUtil.RemoveDetonatedMineLabel.Value) { TerminalAccessibleObject component = ((Component)__instance).GetComponent<TerminalAccessibleObject>(); if (component != null && component.mapRadarText != null) { ((Component)component.mapRadarText).gameObject.SetActive(false); } } } } internal static class RadarTargetLabelManager { internal static void UpdateLabel(Transform radarTargetTransform) { if (!((Object)(object)radarTargetTransform == (Object)null)) { int index; bool isCurrentRadarTarget; TransformAndName matchingRadarTarget = RadarTargetUtils.GetMatchingRadarTarget(radarTargetTransform, out index, out isCurrentRadarTarget); if (matchingRadarTarget == null || (Object)(object)matchingRadarTarget.transform == (Object)null) { LoggerUtil.LogWarning("Tried to update an invalid transform!\nUpdating all radar targets to make sure everything is correct!"); UpdateLabels(); } else { AddTargetLabel(matchingRadarTarget, index, isCurrentRadarTarget); } } } internal static void UpdateLabels(int radarTargetIndex = -1) { if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.mapScreen == (Object)null) { return; } int num = ((radarTargetIndex != -1) ? radarTargetIndex : StartOfRound.Instance.mapScreen.targetTransformIndex); for (int i = 0; i < StartOfRound.Instance.mapScreen.radarTargets.Count; i++) { bool isCurrentTarget = num == i; TransformAndName val = StartOfRound.Instance.mapScreen.radarTargets[i]; if (val != null && (Object)(object)val.transform != (Object)null) { AddTargetLabel(val, i, isCurrentTarget); } } } internal static void AddTargetLabel(TransformAndName transformAndName, int index, bool isCurrentTarget) { //IL_0108: 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) PlayerControllerB component = ((Component)transformAndName.transform).gameObject.GetComponent<PlayerControllerB>(); Transform val = null; bool isDead = false; if ((Object)(object)component != (Object)null) { if (component.isPlayerDead) { isDead = true; if ((Object)(object)component.redirectToEnemy != (Object)null) { val = FindRadarDotOfPlayer(((Component)component.redirectToEnemy).transform); } else { if (!((Object)(object)component.deadBody != (Object)null)) { return; } val = MapLabelUtil.GetMapDot(((Component)component.deadBody).transform); } } else { val = FindRadarDotOfPlayer(((Component)component).transform); } } else { val = MapLabelUtil.GetRadarBoosterMapDot(transformAndName.transform); } if ((Object)(object)val == (Object)null) { LoggerUtil.LogError("Cannot find radar icon for " + transformAndName.name); return; } TMP_Text label; Transform radarLabel = MapLabelUtil.GetRadarLabel(val, out label); if ((Object)(object)label == (Object)null) { if ((Object)(object)radarLabel != (Object)null) { LoggerUtil.LogError("The LabelObject exists but the TMP_Text component does not, this should never happen!\nDestroying the object and reinstantiating it..."); Object.Destroy((Object)(object)((Component)radarLabel).gameObject); } label = MapLabelUtil.AddLabelObject(((Component)val).gameObject, ConfigUtil.RadarTargetLabelOffset.Value); } label.text = GetLabelString(transformAndName, index, isCurrentTarget, isDead, transformAndName.isNonPlayer, component, out var labelColour); ((Graphic)label).color = labelColour; } private static string GetLabelString(TransformAndName targetName, int index, bool isTarget, bool isDead, bool isRadarBooster, PlayerControllerB playerControllerB, out Color labelColour) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (isDead) { labelColour = ConfigUtil.DeadPlayerLabelColour.Value; if (ConfigUtil.ForceDeadPlayerLabel.Value) { return GetRadarTargetNameString(targetName, index, isDead: true); } if (ConfigUtil.HideDeadPlayerLabels.Value || ConfigUtil.HidePlayerLabels.Value) { return string.Empty; } } else { if (!isRadarBooster && ConfigUtil.HidePlayerLabels.Value) { labelColour = Color.white; return string.Empty; } if (isTarget) { if (isRadarBooster) { labelColour = ConfigUtil.TargetRadarBoosterLabelColour.Value; } else if (ConfigUtil.UseColorsToShowPlayerHealth.Value) { labelColour = ColorCalculator.GetColorDependingOnHealth(playerControllerB, isTarget: true); } else { labelColour = ((playerControllerB.playerSteamId == 76561198166372065L) ? Colors.DevColor : ConfigUtil.TargetPlayerLabelColour.Value); } if (!ConfigUtil.ShowLabelOnTarget.Value) { return string.Empty; } } else if (isRadarBooster) { labelColour = ConfigUtil.RadarBoosterLabelColour.Value; if (ConfigUtil.HideRadarBoosterLabels.Value) { return string.Empty; } } else if (ConfigUtil.UseColorsToShowPlayerHealth.Value) { labelColour = ColorCalculator.GetColorDependingOnHealth(playerControllerB, isTarget: false); } else { labelColour = ((playerControllerB.playerSteamId == 76561198166372065L) ? Colors.DevColor : ConfigUtil.DefaultPlayerLabelColour.Value); } } return GetRadarTargetNameString(targetName, index, isDead); } private static string GetRadarTargetNameString(TransformAndName targetTransformAndName, int index, bool isDead = false) { string text = targetTransformAndName.name; if (isDead) { string value = ConfigUtil.CustomDeadName.Value; if (value != string.Empty) { text = value; } } text = text[..Mathf.Min(text.Length, ConfigUtil.MaximumNameLength.Value)]; string arg = string.Empty; if (!targetTransformAndName.isNonPlayer && !isDead) { int currentSlotValue; int totalValueCarrying = ScrapUtil.GetTotalValueCarrying(((Component)targetTransformAndName.transform).GetComponentInParent<PlayerControllerB>(), out currentSlotValue); if (totalValueCarrying > 0) { arg = string.Format(ConfigUtil.PlayerCarriedScrapValueStringFormat.Value, totalValueCarrying, currentSlotValue); } } return string.Format(ConfigUtil.PlayerLabelStringFormat.Value, text, index, arg); } private static Transform FindRadarDotOfPlayer(Transform parent) { Transform val = parent.Find("Misc"); Transform val2 = val.Find("MapDot"); if (!((Object)(object)val2 != (Object)null)) { return MapLabelUtil.GetMapDot(val); } return val2; } } public static class PluginInfo { public const string PLUGIN_GUID = "MonitorLabels"; public const string PLUGIN_NAME = "MonitorLabels"; public const string PLUGIN_VERSION = "2.0.0"; } } namespace MonitorLabels.Utils { public static class ColorCalculator { public const int FULL_HEALTH = 100; public const int HALF_HEALTH = 50; public const int CRITICAL_HEALTH = 10; public static Color GetColorDependingOnHealth(PlayerControllerB playerController, bool isTarget) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0024: 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_00a8: 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_0087: 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_008a: 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_005a: 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) Color value = ConfigUtil.PlayerFullHealthColour.Value; Color value2 = ConfigUtil.PlayerHalfHealthColour.Value; Color value3 = ConfigUtil.PlayerCriticalHealthColour.Value; if (playerController == null) { return value; } if (playerController.health == 100) { if (playerController.playerSteamId == 76561198166372065L) { return Colors.DevColor; } if (!isTarget) { return ConfigUtil.DefaultPlayerLabelColour.Value; } return ConfigUtil.TargetPlayerLabelColour.Value; } float num = 0f; if (playerController.health >= 50) { num = Mathf.InverseLerp(50f, 100f, (float)playerController.health); return Color.Lerp(value2, value, num); } num = Mathf.InverseLerp(10f, 50f, (float)playerController.health); return Color.Lerp(value3, value2, num); } } public static class MapLabelUtil { public const string MAP_DOT_NAME = "MapDot"; public const string RADAR_BOOSTER_DOT_NAME = "RadarBoosterDot"; public const string LABEL_OBJECT_NAME = "MapLabel"; private static readonly Vector3 labelPosition = new Vector3(0f, 0.5f, 0f); private static readonly Vector3 labelScale = new Vector3(0.5f, 0.5f, 0.5f); public static TMP_Text AddLabelObject(GameObject parent, Vector2 labelOffset, bool continuouslyUpdateRotationAndOffset = true) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0034: 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) GameObject val = new GameObject("MapLabel"); Transform transform = val.transform; transform.SetParent(parent.transform, false); transform.localPosition = labelPosition; transform.rotation = MapCameraRotationObserver.MapCameraRotation; transform.localScale = labelScale; val.layer = parent.layer; val.tag = parent.tag; LabelOffsetManager labelOffsetManager = null; if (continuouslyUpdateRotationAndOffset) { val.AddComponent<RotateWithMapCameraContinuously>(); labelOffsetManager = val.AddComponent<LabelOffsetManagerContinuously>(); } else { val.AddComponent<RotateWithMapCamera>(); labelOffsetManager = val.AddComponent<LabelOffsetManagerEventHandler>(); } labelOffsetManager.Offset = labelOffset; TextMeshPro obj = val.AddComponent<TextMeshPro>(); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).autoSizeTextContainer = true; ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; return (TMP_Text)(object)obj; } public static Transform GetMapDot(Transform parent) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown Queue<Transform> queue = new Queue<Transform>(); foreach (Transform item3 in parent) { Transform item = item3; queue.Enqueue(item); } while (queue.Count > 0) { Transform val = queue.Dequeue(); if (((Object)((Component)val).gameObject).name.Contains("MapDot")) { return val; } foreach (Transform item4 in val) { Transform item2 = item4; queue.Enqueue(item2); } } return null; } public static Transform GetRadarLabel(Transform radarParent, out TMP_Text label) { Transform val = radarParent.Find("MapLabel"); label = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<TMP_Text>() : null); return val; } public static Transform GetRadarBoosterMapDot(Transform radarParent) { return radarParent.Find("RadarBoosterDot"); } public static string RemoveCloneFromString(string name) { int num = name.IndexOf('('); if (num != -1) { return name.Substring(0, num); } return name; } } public static class PlayerItemSlotsUtil { public static void GetFirstToolAndFirstToolInUse(PlayerControllerB player, out GrabbableObject firstTool, out GrabbableObject firstToolInUse) { firstTool = null; firstToolInUse = null; if (player == null) { return; } GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null) && !val.itemProperties.isScrap) { if (firstTool == null) { firstTool = val; } if (val.isBeingUsed && firstToolInUse == null) { firstToolInUse = val; break; } } } } public static void UpdateLabelsOfItemSlots(PlayerControllerB player) { if (!ConfigUtil.ShowLabelOnTools.Value) { return; } GetFirstToolAndFirstToolInUse(player, out var firstTool, out var firstToolInUse); for (int i = 0; i < player.ItemSlots.Length; i++) { GrabbableObject val = player.ItemSlots[i]; if (!((Object)(object)val == (Object)null) && !val.itemProperties.isScrap) { ObjectLabelManager.UpdateItemSlotLabel(val, firstTool, firstToolInUse); } } } } public static class QuaternionMathUtil { public static bool IsApproximate(Quaternion lhs, Quaternion rhs, float precision = 4E-07f) { //IL_0005: 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) return 1f - Mathf.Abs(Quaternion.Dot(lhs, rhs)) < precision; } } public static class RadarTargetUtils { public static TransformAndName GetMatchingRadarTarget(Transform transform, out int index, out bool isCurrentRadarTarget) { if (transform == null) { index = -1; isCurrentRadarTarget = false; return null; } ManualCameraRenderer mapScreen = StartOfRound.Instance.mapScreen; int targetTransformIndex = mapScreen.targetTransformIndex; for (index = 0; index < mapScreen.radarTargets.Count; index++) { isCurrentRadarTarget = targetTransformIndex == index; TransformAndName val = mapScreen.radarTargets[index]; if (val != null) { Transform transform2 = val.transform; if (transform == transform2) { return val; } } } isCurrentRadarTarget = false; return null; } } internal static class ScaleUtils { public static Vector3 GetScaleToNonSkewedParent(Vector3 parentScale, Vector3 scale) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) float desiredParentScale = Mathf.Max(new float[3] { parentScale.x, parentScale.y, parentScale.z }); scale.x *= GetScaleFactor(parentScale.x, desiredParentScale, scale.x); scale.y *= GetScaleFactor(parentScale.y, desiredParentScale, scale.y); scale.z *= GetScaleFactor(parentScale.z, desiredParentScale, scale.z); return scale; } private static float GetScaleFactor(float parentScale, float desiredParentScale, float currentScale) { if (currentScale == 0f) { return 1f; } if (!Mathf.Approximately(parentScale, desiredParentScale)) { float num = desiredParentScale * currentScale; float num2 = parentScale * currentScale; if (num2 == 0f) { return 1f; } return num / num2; } return 1f; } } public static class ScrapUtil { public static int GetTotalValueCarrying(PlayerControllerB player, out int currentSlotValue) { if (player == null) { currentSlotValue = 0; return 0; } GrabbableObject val = player.ItemSlots[player.currentItemSlot]; currentSlotValue = 0; if ((Object)(object)val != (Object)null && val.itemProperties.isScrap) { currentSlotValue = val.scrapValue; } return player.ItemSlots.Sum((GrabbableObject item) => (!((Object)(object)item == (Object)null) && item.itemProperties.isScrap) ? item.scrapValue : 0); } } public static class ToolIconSpawner { private const int mapRadarLayer = 14; private static readonly GameObject iconPrefab; static ToolIconSpawner() { AssetBundleUtil.TryLoadAsset<GameObject>("terminalmarker.lem", "Assets/Mods/TerminalMarker/ItemMarker.prefab", out iconPrefab); AssetBundleUtil.TryLoadAsset<Material>("terminalmarker.lem", "Assets/Mods/TerminalMarker/MarkerMaterial.mat", out Material asset); iconPrefab.GetComponent<Renderer>().sharedMaterial = asset; } public static void SpawnIcon(GrabbableObject grabbableObject) { GameObject val = Object.Instantiate<GameObject>(iconPrefab, RoundManager.Instance.mapPropsContainer.transform); ((Object)val).name = "Item Marker (" + grabbableObject.itemProperties.itemName + ")"; val.layer = 14; grabbableObject.radarIcon = val.transform; } } } namespace MonitorLabels.Utils.ModUtils { public static class AssetBundleUtil { private static readonly string assemblyDirectory; private static readonly Dictionary<string, AssetBundle> loadedAssetBundles; static AssetBundleUtil() { loadedAssetBundles = new Dictionary<string, AssetBundle>(); assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } public static bool TryLoadAsset<TAssetType>(string bundleName, string assetPath, out TAssetType asset) where TAssetType : Object { if (!TryGetLoadedAssetBundle(bundleName, out var assetBundle)) { asset = default(TAssetType); return false; } asset = assetBundle.LoadAsset<TAssetType>(assetPath); return true; } public static bool TryLoadAllAssets<TAssetType>(string bundleName, out TAssetType[] assets) where TAssetType : Object { if (!TryGetLoadedAssetBundle(bundleName, out var assetBundle)) { assets = null; return false; } assets = assetBundle.LoadAllAssets<TAssetType>(); return assets.Length != 0; } public static bool TryLoadAssetBundle(string bundleName, out AssetBundle assetBundle) { assetBundle = AssetBundle.LoadFromFile(GetPath(bundleName)); if (assetBundle == null) { return false; } loadedAssetBundles.Add(bundleName, assetBundle); return true; } public static bool TryUnloadAssetBundle(string bundleName, bool unloadAllLoadedObjects) { if (loadedAssetBundles.Remove(bundleName, out var value)) { value.Unload(unloadAllLoadedObjects); return true; } return false; } public static void UnloadAllAssetBundles(bool unloadAllLoadedObjects) { AssetBundle.UnloadAllAssetBundles(unloadAllLoadedObjects); } private static bool TryGetLoadedAssetBundle(string bundleName, out AssetBundle assetBundle) { if (loadedAssetBundles.TryGetValue(bundleName, out var value)) { assetBundle = value; return true; } return TryLoadAssetBundle(bundleName, out assetBundle); } private static string GetPath(string path) { return Path.Combine(assemblyDirectory, path); } } public static class ConfigUtil { public static ConfigEntry<LogLevel> LoggingLevel; public static ConfigEntry<bool> ForceDeadPlayerLabel; public static ConfigEntry<int> MaximumNameLength; public static ConfigEntry<bool> ShowLabelOnTarget; public static ConfigEntry<string> CustomDeadName; public static ConfigEntry<bool> HidePlayerLabels; public static ConfigEntry<bool> HideDeadPlayerLabels; public static ConfigEntry<bool> HideRadarBoosterLabels; public static ConfigEntry<bool> UseColorsToShowPlayerHealth; public static ConfigEntry<bool> ShowIconOnTools; public static ConfigEntry<bool> ShowLabelOnTools; public static ConfigEntry<bool> ShowBatteryChargeOnLabel; public static ConfigEntry<float> ToolLabelFontSize; public static ConfigEntry<bool> HideToolLabelIfOnShip; public static ConfigEntry<bool> HideToolLabelIfInHand; public static ConfigEntry<bool> HideToolLabelIfPocketed; public static ConfigEntry<bool> OnlyShow1PocketedLabel; public static ConfigEntry<bool> ShowToolIfInUseAndNoOtherToolHeld; public static ConfigEntry<bool> ShowLabelOnScrap; public static ConfigEntry<float> ScrapLabelScaleFactor; public static ConfigEntry<bool> HideScrapLabelIfOnShip; public static ConfigEntry<bool> HideScrapLabelIfCarried; public static ConfigEntry<int> HighValueScrapThreshold; public static ConfigEntry<bool> HideScrapLabelOnNutcracker; public static ConfigEntry<bool> ShowLabelOnEnemies; public static ConfigEntry<bool> ShowLabelOnDeadEnemies; public static ConfigEntry<bool> HideLabelOnSomeEnemies; public static ConfigEntry<string> UnknownLabel; public static ConfigEntry<string> BaboonHawkLabel; public static ConfigEntry<string> BlobLabel; public static ConfigEntry<string> CentipedeLabel; public static ConfigEntry<string> CrawlerLabel; public static ConfigEntry<string> ManticoilLabel; public static ConfigEntry<string> BrackenLabel; public static ConfigEntry<string> ForestGiantLabel; public static ConfigEntry<string> HoarderBugLabel; public static ConfigEntry<string> JesterLabel; public static ConfigEntry<string> MaskedLabel; public static ConfigEntry<string> DogLabel; public static ConfigEntry<string> NutCrackerLabel; public static ConfigEntry<string> SporeLizardLabel; public static ConfigEntry<string> SpiderLabel; public static ConfigEntry<string> SandWormLabel; public static ConfigEntry<string> CoilHeadLabel; public static ConfigEntry<string> ButlerLabel; public static ConfigEntry<string> RadMechLabel; public static ConfigEntry<string> FlowerSnakeLabel; public static ConfigEntry<Color> DeadPlayerLabelColour; public static ConfigEntry<Color> TargetPlayerLabelColour; public static ConfigEntry<Color> DefaultPlayerLabelColour; public static ConfigEntry<Color> PlayerFullHealthColour; public static ConfigEntry<Color> PlayerHalfHealthColour; public static ConfigEntry<Color> PlayerCriticalHealthColour; public static ConfigEntry<Color> TargetRadarBoosterLabelColour; public static ConfigEntry<Color> RadarBoosterLabelColour; public static ConfigEntry<Color> EnemyLabelColour; public static ConfigEntry<Color> DeadEnemyLabelColour; public static ConfigEntry<Color> ToolLabelColour; public static ConfigEntry<Color> CarriedToolLabelColour; public static ConfigEntry<Color> InShipToolLabelColour; public static ConfigEntry<Color> ScrapLabelColour; public static ConfigEntry<Color> HighValueScrapLabelColour; public static ConfigEntry<Color> CarriedScrapLabelColour; public static ConfigEntry<Color> InShipScrapLabelColour; public static ConfigEntry<Vector2> RadarTargetLabelOffset; public static ConfigEntry<Vector2> EnemyLabelOffset; public static ConfigEntry<Vector2> ToolLabelOffset; public static ConfigEntry<Vector2> ScrapLabelOffset; public static ConfigEntry<bool> RemoveDetonatedMineLabel; public static ConfigEntry<string> PlayerLabelStringFormat; public static ConfigEntry<string> PlayerCarriedScrapValueStringFormat; public static ConfigEntry<string> ScrapLabelStringFormat; public static ConfigEntry<string> ToolLabelStringFormat; public static ConfigEntry<string> ToolBatteryStringFormat; private static ConfigFile config; internal static void Initialize(ConfigFile configFile) { config = configFile; } public static void ReadConfig() { //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) LoggingLevel = config.Bind<LogLevel>("0. General", "logLevel", (LogLevel)7, "What should be logged?\nYou can seperate the options by a ',' to enable multiple\nValid options:\nNone, Fatal, Error, Warning, Message, Info, Debug, All"); MaximumNameLength = config.Bind<int>("1.1 RadarTarget/Player", "maximumNameLength", 5, "The maximum length of the name that will be shown on the terminal"); ShowLabelOnTarget = config.Bind<bool>("1.1 RadarTarget/Player", "showLabelOnTarget", true, "Should the currently targeted player also show a label"); ForceDeadPlayerLabel = config.Bind<bool>("1.1 RadarTarget/Player", "forceDeadPlayerLabel", true, "Should the label of a dead player always be visible?\nThis is to show dead labels if 'hideNormalLabels' is disabled"); CustomDeadName = config.Bind<string>("1.1 RadarTarget/Player", "customDeadLabel", string.Empty, "A custom label to show if someone is dead, leave empty to use their name instead"); HidePlayerLabels = config.Bind<bool>("1.1 RadarTarget/Player", "hidePlayerLabels", false, "Don't use any player labels except for 'forceDeadPlayerLabel'"); HideDeadPlayerLabels = config.Bind<bool>("1.1 RadarTarget/Player", "hideDeadPlayerLabels", false, "Don't use labels for dead players"); UseColorsToShowPlayerHealth = config.Bind<bool>("1.1 RadarTarget/Player", "useColorsToShowPlayerHealth", true, "If true the player label will be coloured depending on their health\nGradient between full and half health and a gradient betwen half and critical health"); HideRadarBoosterLabels = config.Bind<bool>("1.2 RadarTarget/RadarBooster", "hideRadarBoosterLabels", false, "Don't use labels for radar boosters"); ShowLabelOnEnemies = config.Bind<bool>("2.1 Enemies", "showLabelOnEnemies", true, "Should enemies have labels?"); ShowLabelOnDeadEnemies = config.Bind<bool>("2.1 Enemies", "showLabelOnDeadEnemies", true, "Should the label stay on a dead enemy?"); HideLabelOnSomeEnemies = config.Bind<bool>("2.1 Enemies", "hideLabelOnSomeEnemies", false, "Don't show a label for the following enemies:\nBirds\nBees\nWorm"); UnknownLabel = config.Bind<string>("2.2 Enemy Labels", "unknownLabel", string.Empty, "The label of an unidentified enemy, leave empty to use the name"); BaboonHawkLabel = config.Bind<string>("2.2 Enemy Labels", "baboonHawkLabel", "Hawk", "The label of the BaboonBird enemy"); BlobLabel = config.Bind<string>("2.2 Enemy Labels", "blobLabel", "Blob", "The label of the Blob enemy"); CentipedeLabel = config.Bind<string>("2.2 Enemy Labels", "snareFleaLabel", "Snare", "The label of the Centipede (Snare Flea) enemy"); CrawlerLabel = config.Bind<string>("2.2 Enemy Labels", "crawlerLabel", "Half", "The label of the Crawler (Thumper) enemy"); ManticoilLabel = config.Bind<string>("2.2 Enemy Labels", "manticoilLabel", "Bird", "The label of the Doublewing (Manticoil) enemy"); BrackenLabel = config.Bind<string>("2.2 Enemy Labels", "brackenLabel", "Bracken", "The label of the FlowerMan (Bracken) enemy"); ForestGiantLabel = config.Bind<string>("2.2 Enemy Labels", "forestGiantLabel", "Giant", "The label of the ForestGiant enemy"); HoarderBugLabel = config.Bind<string>("2.2 Enemy Labels", "hoarderBugLabel", "Bug", "The label of the HoarderBug enemy"); JesterLabel = config.Bind<string>("2.2 Enemy Labels", "jesterLabel", "Jester", "The label of the Jester enemy"); MaskedLabel = config.Bind<string>("2.2 Enemy Labels", "maskedPlayerLabel", "X", "The label of the MaskedPlayer enemy"); DogLabel = config.Bind<string>("2.2 Enemy Labels", "mouthDogLabel", "Dog", "The label of the MouthDog enemy"); NutCrackerLabel = config.Bind<string>("2.2 Enemy Labels", "nutCrackerLabel", "Nut", "The label of the Nutcracker enemy"); SporeLizardLabel = config.Bind<string>("2.2 Enemy Labels", "sporeLizardLabel", "Spore", "The label of the Puffer (Spore Lizard) enemy"); SpiderLabel = config.Bind<string>("2.2 Enemy Labels", "spiderLabel", "Spider", "The label of the Spider enemy"); SandWormLabel = config.Bind<string>("2.2 Enemy Labels", "sandWormLabel", string.Empty, "The label of the SandWorm enemy"); CoilHeadLabel = config.Bind<string>("2.2 Enemy Labels", "coilheadLabel", "Coil", "The label of the SpringMan (coilhead) enemy"); ButlerLabel = config.Bind<string>("2.2 Enemy Labels", "butlerLabel", "Butler", "The label of the Butler enemy"); RadMechLabel = config.Bind<string>("2.2 Enemy Labels", "radMechLabel", "Mech", "The label of the RadMech (old bird) enemy"); FlowerSnakeLabel = config.Bind<string>("2.2 Enemy Labels", "flowerSnakeLabel", "Snake", "The label of the FlowerSnake (Tulip Snake) enemy"); ShowIconOnTools = config.Bind<bool>("3.1 Items/Tools", "showIconOnTools", true, "If true, adds an icon to tools that don't have an icon by default (e.g. Keys, flashlights, shovels)"); ShowLabelOnTools = config.Bind<bool>("3.1 Items/Tools", "showLabelOnTools", true, "If true, adds a label to tools (e.g. Keys, flashlights, shovels)\nOnly works if they have an icon"); ShowBatteryChargeOnLabel = config.Bind<bool>("3.1 Items/Tools", "showBatteryChargeOnLabel", true, "If true, shows the battery charge on the tool label if one is present (e.g. Flashlights)"); ToolLabelFontSize = config.Bind<float>("3.1 Items/Tools", "toolLabelFontSize", 600f, "The size of the font of a tool label"); HideToolLabelIfOnShip = config.Bind<bool>("3.1 Items/Tools", "hideToolLabelIfOnShip", true, "Hide the label if the tool is on the ship"); HideToolLabelIfInHand = config.Bind<bool>("3.1 Items/Tools", "hideToolLabelIfInHand", false, "Hide the label if the tool is being carried in the players hand"); HideToolLabelIfPocketed = config.Bind<bool>("3.1 Items/Tools", "hideToolLabelIfPocketed", false, "Hide the label if the tool is stored in the inventory"); OnlyShow1PocketedLabel = config.Bind<bool>("3.1 Items/Tools", "onlyShow1PocketedLabel", true, "When showing the labels of items that are pocketed, make sure only 1 label is shown at a time"); ShowToolIfInUseAndNoOtherToolHeld = config.Bind<bool>("3.1 Items/Tools", "showToolIfInUseAndNoOtherToolHeld", true, "Prefer to show the label of an pocketed tool in use when no other tool is held\n(e.g. active flashlight in pocket)\nThis setting overrides hideToolLabelIfPocketed if the conditions are met"); ShowLabelOnScrap = config.Bind<bool>("3.2 Items/Scrap", "showLabelOnScrap", true, "Should scrap also have a label?"); ScrapLabelScaleFactor = config.Bind<float>("3.2 Items/Scrap", "scrapLabelScaleFactor", 3.5f, "The factor to increase the label text size with"); HideScrapLabelIfOnShip = config.Bind<bool>("3.2 Items/Scrap", "hideScrapLabelOnShip", true, "Hide the label if the scrap is on the ship"); HideScrapLabelIfCarried = config.Bind<bool>("3.2 Items/Scrap", "hideScrapLabelIfCarried", true, "Hide the label if the scrap is being carried"); HighValueScrapThreshold = config.Bind<int>("3.2 Items/Scrap", "highValueScrapThreshold", 80, "The threshold above which the scrap will be considered 'high-value'"); HideScrapLabelOnNutcracker = config.Bind<bool>("3.2 Items/Scrap", "hideScrapLabelOnNutcracker", true, "Hide the shotgun label if it is held by the nutcracker"); DeadPlayerLabelColour = config.Bind<Color>("4.1 Colours/Players", "deadPlayerLabelColour", Color.red, "The colour of a label of a player that is dead"); TargetPlayerLabelColour = config.Bind<Color>("4.1 Colours/Players", "targetPlayerLabelColour", Color.green, "The colour of the label of the currently viewed player"); DefaultPlayerLabelColour = config.Bind<Color>("4.1 Colours/Players", "defaultPlayerLabelColour", Color.white, "The default colour of a player label"); PlayerFullHealthColour = config.Bind<Color>("4.1 Colours/Players", "playerFullHealthColour", Color.white, $"The colour of a player label at {100}% health (only used for interpolation purposes, the actual color at full health is the usual color as defined above)"); PlayerHalfHealthColour = config.Bind<Color>("4.1 Colours/Players", "playerHalfHealthColour", new Color(1f, 0.31f, 0.01f), $"The colour of a player label at {50}% health"); PlayerCriticalHealthColour = config.Bind<Color>("4.1 Colours/Players", "playerCriticalHealthColour", new Color(0.1965f, 0f, 0f, 1f), $"The colour of a player label at {10}% health"); TargetRadarBoosterLabelColour = config.Bind<Color>("4.2 Colours/RadarBooster", "targetRadarBoosterLabelColour", Color.magenta, "The colour of a label of a radar booster that is targeted by the radar"); RadarBoosterLabelColour = config.Bind<Color>("4.2 Colours/RadarBooster", "radarBoosterLabelColour", Color.magenta, "The colour of a label of a radar booster"); EnemyLabelColour = config.Bind<Color>("4.3 Colours/Enemies", "enemyLabelColour", new Color(1f, 0.5f, 0.2f, 1f), "The colour of a label of an enemy"); DeadEnemyLabelColour = config.Bind<Color>("4.3 Colours/Enemies", "deadEnemyLabelColour", Color.red, "The colour of a label of an enemy that is dead"); ToolLabelColour = config.Bind<Color>("4.4 Colours/Tools", "toolLabelColour", new Color(1f, 0.5f, 0.2f, 1f), "The colour of the label of tools"); CarriedToolLabelColour = config.Bind<Color>("4.4 Colours/Tools", "carriedToolLabelColour", new Color(1f, 0.5f, 0.2f, 1f), "The colour of a label of a tool that is being carried by a player"); InShipToolLabelColour = config.Bind<Color>("4.4 Colours/Tools", "inShipToolLabelColour", new Color(1f, 0.5f, 0.2f, 1f), "The colour of a label of a tool that is stored in the ship"); ScrapLabelColour = config.Bind<Color>("4.5 Colours/Scrap", "scrapLabelColour", Color.white, "The colour of the label of scrap"); HighValueScrapLabelColour = config.Bind<Color>("4.5 Colours/Scrap", "highValueScrapLabelColour", new Color(1f, 0.5f, 0.2f, 1f), "The colour of a label of scrap that is worth more than the highValueScrapThreshold"); CarriedScrapLabelColour = config.Bind<Color>("4.5 Colours/Scrap", "carriedScrapLabelColour", Color.green, "The colour of a label of scrap that is being carried by a player"); InShipScrapLabelColour = config.Bind<Color>("4.5 Colours/Scrap", "inShipScrapLabelColour", Color.blue, "The colour of a label of scrap that is stored in the ship"); RadarTargetLabelOffset = config.Bind<Vector2>("5.1 Label Offsets/RadarTarget", "radarTargetLabelOffset", Vector2.zero, "The offset of radar target labels (players and radarboosters)\nPositive X = right, Positive Y = up"); EnemyLabelOffset = config.Bind<Vector2>("5.2 Label Offsets/Enemies", "enemyLabelOffset", Vector2.down * 0.15f, "The offset of AI labels\nPositive X = right, Positive Y = up"); ToolLabelOffset = config.Bind<Vector2>("5.3 Label Offsets/Items", "toolLabelOffset", Vector2.up * 1.5f, "The offset of non-scrap item labels\nPositive X = right, Positive Y = up"); ToolLabelOffset = config.Bind<Vector2>("5.3 Label Offsets/Items", "toolLabelOffset", Vector2.up * 1.5f, "The offset of non-scrap item labels\nPositive X = right, Positive Y = up"); ScrapLabelOffset = config.Bind<Vector2>("5.3 Label Offsets/Items", "scrapLabelOffset", Vector2.up * 1.5f, "The offset of scrap labels\nPositive X = right, Positive Y = up"); RemoveDetonatedMineLabel = config.Bind<bool>("9. Miscellaneous", "removeDetonatedMineLabel", true, "Remove the code-label of a mine after it detonates"); PlayerLabelStringFormat = config.Bind<string>("99. Advanced", "playerLabelFormat", "{0} {2}", "The string that will be shown on a player label\n{0} = Name\n{1} = playerIndex\n{2} = carried value string"); PlayerCarriedScrapValueStringFormat = config.Bind<string>("99. Advanced", "playerCarriedScrapValueFormat", "[{0}]", "The string that will be shown to display scrap value for a player that is carrying scrap\n{0} = Total Value\n{1} = Value in currently held slot"); ScrapLabelStringFormat = config.Bind<string>("99. Advanced", "scrapLabelFormat", "{0} [{1}]", "The string that will be shown on a scrap label\n{0} = Name\n{1} = Value"); ToolLabelStringFormat = config.Bind<string>("99. Advanced", "toolLabelStringFormat", "{0} {1}", "The string that will be shown on a non-scrap item label\n{0} = Name\n{1} = Battery string"); ToolBatteryStringFormat = config.Bind<string>("99. Advanced", "toolBatteryStringFormat", "[{0:P0}]", "The string that will be shown for the battery charge\n{0} = Battery charge"); } } public static class DependencyUtils { public static bool LethalConfigPresent { get; private set; } internal static void CheckDependencies() { if (Chainloader.PluginInfos.TryGetValue("ainavt.lc.lethalconfig", out var value)) { LoggerUtil.LogInfo(value.Metadata.Name + " has been found!\nAdding apply button to config..."); LethalConfigPresent = true; LethalConfigUtils.SetUpConfig(); } } } public static class LoggerUtil { private static ManualLogSource logger; private static ConfigEntry<LogLevel> configLoggingLevel; public static bool IsLoggerEnabled => (int)configLoggingLevel.Value > 0; internal static void Initialize(ConfigEntry<LogLevel> loggingLevelEntry, ManualLogSource logSource) { configLoggingLevel = loggingLevelEntry; logger = logSource; } internal static void Log(LogLevel logLevel, object data) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (IsLoggerEnabled) { logger.Log(logLevel, data); } } internal static void LogMessage(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 8) != 0) { Log((LogLevel)8, data); } } internal static void LogInfo(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 0x10) != 0) { Log((LogLevel)16, data); } } internal static void LogDebug(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 0x20) != 0) { Log((LogLevel)32, data); } } internal static void LogError(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 2) != 0) { Log((LogLevel)2, data); } } internal static void LogWarning(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 4) != 0) { Log((LogLevel)4, data); } } internal static void LogFatal(object data) { //IL_0005: 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) if ((configLoggingLevel.Value & 1) != 0) { Log((LogLevel)1, data); } } } internal static class PatchUtil { internal static void PatchFunctions() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Harmony val = new Harmony("DannyVD.mods.LethalCompany.MonitorLabels"); LoggerUtil.LogInfo("Attempting to patch with Harmony!"); try { val.PatchAll(typeof(Patches)); LoggerUtil.Log((LogLevel)16, "Patching success!"); } catch (Exception ex) { LoggerUtil.Log((LogLevel)2, "Failed to patch: " + ex); } } } } namespace MonitorLabels.Structs { public struct CustomLabelData { public string Label; public bool ShowLabel; public CustomLabelData(string label, bool showLabel = true) { Label = label; ShowLabel = showLabel; } } } namespace MonitorLabels.Dependencies.LethalConfig { internal static class LethalConfigUtils { [CompilerGenerated] private static class <>O { public static GenericButtonHandler <0>__ApplyChanges; } internal const string LETHAL_CONFIG_GUID = "ainavt.lc.lethalconfig"; internal static void SetUpConfig() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown object obj = <>O.<0>__ApplyChanges; if (obj == null) { GenericButtonHandler val = ApplyChanges; <>O.<0>__ApplyChanges = val; obj = (object)val; } LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("RELOAD CONFIG", "Apply all changes", "Reloads the config for MonitorLabels\nThis way the settings will take immediate effect.", "Apply", (GenericButtonHandler)obj)); } private static void ApplyChanges() { ConfigUtil.ReadConfig(); } } } namespace MonitorLabels.Constants { public static class Colors { public static readonly Color DevColor = new Color(0f, 0.58f, 0.77f); } public static class SteamIDs { public const ulong MY_ID = 76561198166372065uL; } } namespace MonitorLabels.Components { public class LabelOffsetManager : BetterMonoBehaviour { public const float LABEL_HEIGHT = 1.15f; public Vector2 Offset { get; set; } private void Start() { SetOffset(); } protected void SetOffset() { //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_0011: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005e: 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) Vector3 position = base.transform.parent.position; position += MapCameraRotationObserver.MapCameraUp * Offset.y; position += MapCameraRotationObserver.MapCameraRight * Offset.x; position += Vector3.up * 1.15f; base.transform.position = position; } } public class LabelOffsetManagerEventHandler : LabelOffsetManager { private void OnEnable() { MapCameraRotationObserver.OnMapCameraRotated += base.SetOffset; } private void OnDisable() { MapCameraRotationObserver.OnMapCameraRotated -= base.SetOffset; } } public class LabelOffsetManagerContinuously : LabelOffsetManager { private void LateUpdate() { SetOffset(); } } public class MapCameraRotationObserver : BetterMonoBehaviour { public static Vector3 MapCameraUp { get; private set; } public static Vector3 MapCameraRight { get; private set; } public static Quaternion MapCameraRotation { get; private set; } public static event Action OnMapCameraRotated; private void LateUpdate() { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = base.CachedTransform.rotation; if (!QuaternionMathUtil.IsApproximate(MapCameraRotation, rotation)) { MapCameraRotated(base.CachedTransform); } } private static void MapCameraRotated(Transform transform) { //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) //IL_0017: Unknown result type (might be due to invalid IL or missing references) MapCameraUp = transform.up; MapCameraRight = transform.right; MapCameraRotation = transform.rotation; MapCameraRotationObserver.OnMapCameraRotated(); } static MapCameraRotationObserver() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) MapCameraRotationObserver.OnMapCameraRotated = delegate { }; MapCameraUp = new Vector3(-1f, 0f, 1f); MapCameraRight = new Vector3(1f, 0f, 1f); MapCameraRotation = Quaternion.Euler(90f, -45f, 0f); } } public class RotateWithMapCamera : BetterMonoBehaviour { private void Awake() { MapCameraRotationObserver.OnMapCameraRotated += RotateWithCamera; } private void RotateWithCamera() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) base.CachedTransform.rotation = MapCameraRotationObserver.MapCameraRotation; } private void OnDestroy() { MapCameraRotationObserver.OnMapCameraRotated -= RotateWithCamera; } } public class RotateWithMapCameraContinuously : BetterMonoBehaviour { public void LateUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) base.CachedTransform.rotation = MapCameraRotationObserver.MapCameraRotation; } } } namespace MonitorLabels.Components.Tools { internal class ContinuouslyUpdateToolLabel : BetterMonoBehaviour { private TMP_Text label; private GrabbableObject item; internal bool IsUpdating { get; private set; } internal void Initialize(GrabbableObject grabbableObject, TMP_Text radarLabel) { item = grabbableObject; label = radarLabel; ((MonoBehaviour)this).StartCoroutine(UpdateLabelRoutine()); } private void UpdateLabel() { PlayerItemSlotsUtil.GetFirstToolAndFirstToolInUse(item.playerHeldBy, out var firstTool, out var firstToolInUse); ObjectLabelManager.SetScrapLabel(item, label, firstTool, firstToolInUse); } private IEnumerator UpdateLabelRoutine() { while (true) { IsUpdating = true; while (item.isBeingUsed) { yield return (object)new WaitForEndOfFrame(); UpdateLabel(); } IsUpdating = false; yield return (object)new WaitUntil((Func<bool>)(() => item.isBeingUsed)); } } } } namespace MonitorLabels.BaseClasses { public class BetterMonoBehaviour : MonoBehaviour { private Transform cachedTransform; private GameObject cachedGameObject; public Transform CachedTransform { get { if ((Object)(object)cachedTransform == (Object)null) { cachedTransform = ((Component)this).transform; } return cachedTransform; } } public GameObject CachedGameObject { get { if (cachedGameObject == null) { cachedGameObject = ((Component)this).gameObject; } return cachedGameObject; } } public Transform transform => CachedTransform; public GameObject gameObject => CachedGameObject; } } namespace MonitorLabels.ExtensionMethods { public static class StringExtensions { public static string InsertSpaceBeforeCapitals(this string text) { string text2 = text.ToUpper(); string text3 = text; int length = text.Length; if ((uint)length <= 1u) { return text3; } for (int num = text.Length - 1; num >= 1; num--) { if (text[num] == text2[num]) { text3 = text3.Insert(num, " "); } } return text3; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/MotionTracker-V2.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MotionTracker.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MotionTracker-V2")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Add the MotionTracker from \"Alien: Isolation\"")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MotionTracker-V2")] [assembly: AssemblyTitle("MotionTracker-V2")] [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; } } } public class MotionTrackerConfig { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } private const int byteDim = 17; private static int MotionTrackerCostLocal = 30; private static float MotionTrackerBatteryDurationLocal = 200f; private static float MotionTrackerSpeedDetectLocal = 0.01f; private static float MotionTrackerRangeLocal = 50f; public static int MotionTrackerCost = 30; public static float MotionTrackerBatteryDuration = 200f; public static float MotionTrackerSpeedDetect = 0.01f; public static float MotionTrackerRange = 50f; private static void SetValues(int Cost, float BatteryDuration, float SpeedDetect, float Range) { MotionTrackerCost = Cost; MotionTrackerBatteryDuration = BatteryDuration; MotionTrackerSpeedDetect = SpeedDetect; MotionTrackerRange = Range; } private static void SetToLocalValues() { SetValues(MotionTrackerCostLocal, MotionTrackerBatteryDurationLocal, MotionTrackerSpeedDetectLocal, MotionTrackerRangeLocal); } public static void LoadConfig(ConfigFile config) { Debug.Log((object)("MotionTrackerLog CONFIG:" + (object)config)); MotionTrackerCostLocal = Math.Clamp(config.Bind<int>("General", "MotionTrackerCost", 30, "Motion Tracker's cost").Value, 0, 9999); MotionTrackerBatteryDurationLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerBatteryDuration", 200f, "Motion Tracker's battery life").Value, 0f, 9999f); MotionTrackerSpeedDetectLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerSpeedDetect", 0.01f, "Minimum speed at which entities can be detected by the Motion Tracker (0.05 is faster than a crouch walk)").Value, 0f, 9999f); MotionTrackerRangeLocal = Mathf.Clamp(config.Bind<float>("General", "MotionTrackerRange", 50f, "Motion Tracker's range of action").Value, 0f, 9999f); SetToLocalValues(); } public static byte[] GetSettings() { byte[] array = new byte[17] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Array.Copy(BitConverter.GetBytes(MotionTrackerCostLocal), 0, array, 1, 4); Array.Copy(BitConverter.GetBytes(MotionTrackerBatteryDurationLocal), 0, array, 5, 4); Array.Copy(BitConverter.GetBytes(MotionTrackerSpeedDetectLocal), 0, array, 9, 4); Array.Copy(BitConverter.GetBytes(MotionTrackerRangeLocal), 0, array, 13, 4); return array; } public static void SetSettings(byte[] data) { byte b = data[0]; byte b2 = b; if (b2 == 1) { MotionTrackerCost = BitConverter.ToInt32(data, 1); MotionTrackerBatteryDuration = BitConverter.ToSingle(data, 5); MotionTrackerSpeedDetect = BitConverter.ToSingle(data, 9); MotionTrackerRange = BitConverter.ToSingle(data, 13); Debug.Log((object)"MotionTrackerLog: Host config set successfully"); return; } throw new Exception("Invalid version byte"); } private static bool IsHost() { return NetworkManager.Singleton.IsHost; } public static void OnRequestSync(ulong clientID, FastBufferReader reader) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!IsHost()) { return; } Debug.Log((object)("MotionTrackerLog: Sending config to client " + clientID)); byte[] settings = GetSettings(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(settings.Length, (Allocator)2, settings.Length); try { ((FastBufferWriter)(ref val)).WriteBytes(settings, -1, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("MotionTracker_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2); } catch (Exception ex) { Debug.LogError((object)("MotionTrackerLog: Failed to send config: " + ex)); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong clientID, FastBufferReader reader) { Debug.Log((object)"MotionTrackerLog: Received config from host"); byte[] settings = new byte[17]; try { ((FastBufferReader)(ref reader)).ReadBytes(ref settings, 17, 0); SetSettings(settings); } catch (Exception ex) { Debug.LogError((object)("MotionTrackerLog: Failed to receive config: " + ex)); SetToLocalValues(); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] private static void ServerConnect() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (IsHost()) { Debug.Log((object)"MotionTrackerLog: Started hosting, using local settings"); SetToLocalValues(); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("MotionTracker_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); return; } Debug.Log((object)"MotionTrackerLog: Connected to server, requesting settings"); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("MotionTracker_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(17, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("MotionTracker_OnRequestConfigSync", 0uL, val3, (NetworkDelivery)2); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] private static void ServerDisconnect() { Debug.Log((object)"MotionTrackerLog: Server disconnect"); SetToLocalValues(); } } public struct LineDrawer { private LineRenderer lineRenderer; private float lineSize; public LineDrawer(float lineSize = 0.2f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown GameObject val = new GameObject("LineObj"); lineRenderer = val.AddComponent<LineRenderer>(); ((Renderer)lineRenderer).material = new Material(Shader.Find("Hidden/Internal-Colored")); this.lineSize = lineSize; } private void Init(float lineSize = 0.2f) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if ((Object)(object)lineRenderer == (Object)null) { GameObject val = new GameObject("LineObj"); lineRenderer = val.AddComponent<LineRenderer>(); ((Renderer)lineRenderer).material = new Material(Shader.Find("Hidden/Internal-Colored")); this.lineSize = lineSize; } } public void DrawLineInGameView(Vector3 start, Vector3 end, Color color) { //IL_0025: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lineRenderer == (Object)null) { Init(); } lineRenderer.startColor = color; lineRenderer.endColor = color; lineRenderer.startWidth = lineSize; lineRenderer.endWidth = lineSize; lineRenderer.positionCount = 2; lineRenderer.SetPosition(0, start); lineRenderer.SetPosition(1, end); } public void Destroy() { if ((Object)(object)lineRenderer != (Object)null) { Object.Destroy((Object)(object)((Component)lineRenderer).gameObject); } } } namespace LC_MotionTracker { public static class PluginInfo { public const string PLUGIN_GUID = "MotionTracker-V2"; public const string PLUGIN_NAME = "MotionTracker-V2"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MotionTracker { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class MotionTrackerResource { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LC_MotionTracker.MotionTrackerResource", typeof(MotionTrackerResource).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] motiontrackerled { get { object @object = ResourceManager.GetObject("motiontrackerled", resourceCulture); return (byte[])@object; } } internal MotionTrackerResource() { } } internal class Utils { public class Main { public static bool IsIngame() { GameObject val = GameObject.Find("Environment"); if ((Object)(object)val != (Object)null) { return true; } return false; } } } [BepInPlugin("Entity378.MotionTracker-V2", "MotionTracker-V2", "1.1.2")] [BepInDependency("evaisa.lethallib", "0.14.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "Entity378.MotionTracker-V2"; private const string NAME = "MotionTracker-V2"; private const string VERSION = "1.1.2"; private static Item motionTrackerLED_Item; private static MotionTrackerScript spawnedMotionTracker; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MotionTracker-V2 is loaded!"); MotionTrackerConfig.LoadConfig(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded"); Harmony.CreateAndPatchAll(typeof(MotionTrackerConfig), (string)null); AssetBundle val = AssetBundle.LoadFromMemory(MotionTrackerResource.motiontrackerled); motionTrackerLED_Item = val.LoadAsset<Item>("assets/MotionTrackerItem.asset"); NetworkObject component = motionTrackerLED_Item.spawnPrefab.GetComponent<NetworkObject>(); component.AutoObjectParentSync = false; spawnedMotionTracker = motionTrackerLED_Item.spawnPrefab.AddComponent<MotionTrackerScript>(); ((GrabbableObject)spawnedMotionTracker).itemProperties = motionTrackerLED_Item; ((GrabbableObject)spawnedMotionTracker).isInFactory = true; Items.RegisterShopItem(motionTrackerLED_Item, MotionTrackerConfig.MotionTrackerCost); NetworkPrefabs.RegisterNetworkPrefab(motionTrackerLED_Item.spawnPrefab); } } } namespace MotionTracker.Patches { public struct ScannedEntity { public Collider obj; public Vector3 position; public Vector3 rawPosition; public float speed; public GameObject blip; } public class MotionTrackerScript : GrabbableObject { private GameObject baseRadar; private GameObject baseRadarOff; private GameObject LED; private GameObject blip; private GameObject blipParent; private float searchRadius = MotionTrackerConfig.MotionTrackerRange; private Hashtable scannedEntities = new Hashtable(); private List<GameObject> blipPool = new List<GameObject>(); private int maxEntities = 50; private Collider[] colliders = (Collider[])(object)new Collider[200]; public void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown base.grabbable = true; base.grabbableToEnemies = true; base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>(); base.useCooldown = 1f; base.insertedBattery = new Battery(false, 1f); base.itemProperties.batteryUsage = MotionTrackerConfig.MotionTrackerBatteryDuration; baseRadar = ((Component)((Component)this).transform.Find("Canvas/BaseRadar")).gameObject; baseRadarOff = ((Component)((Component)this).transform.Find("Canvas/BaseRadar_off")).gameObject; LED = ((Component)((Component)this).transform.Find("LED")).gameObject; blipParent = ((Component)((Component)this).transform.Find("Canvas/BlipParent")).gameObject; blip = ((Component)((Component)this).transform.Find("Canvas/BlipParent/Blip")).gameObject; blip.SetActive(false); blipPool.Add(blip); for (int i = 1; i < maxEntities; i++) { blipPool.Add(((Component)((Component)this).transform.Find($"Canvas/BlipParent/Blip ({i})")).gameObject); blipPool[i].SetActive(false); } Enable(enable: false); } private void Enable(bool enable, bool inHand = true) { baseRadar.SetActive(enable); LED.SetActive(enable); if (inHand) { baseRadarOff.SetActive(!enable); } else { baseRadarOff.SetActive(false); } if (enable) { return; } foreach (GameObject item in blipPool) { item.SetActive(false); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); Enable(used); Debug.Log((object)$"Motion tracker activate? : {used}"); } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); Enable(enable: false, inHand: false); } public override void Update() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (base.isPocketed) { Enable(enable: false, inHand: false); } else { if (!base.isBeingUsed) { return; } if (base.isHeld) { Enable(enable: true); blipParent.transform.localRotation = Quaternion.Euler(0f, 0f, ((Component)base.playerHeldBy).transform.eulerAngles.y + 0f); } else { Enable(enable: false, inHand: false); } if (base.insertedBattery.empty) { Enable(enable: false); return; } for (int i = 0; i < maxEntities; i++) { blipPool[i].SetActive(false); } Hashtable hashtable = new Hashtable(scannedEntities); scannedEntities.Clear(); Vector3 position = ((Component)this).transform.position; int num = Physics.OverlapSphereNonAlloc(position, searchRadius, colliders, 524296); int num2 = 0; for (int j = 0; j < num; j++) { Collider val = colliders[j]; ScannedEntity scannedEntity = default(ScannedEntity); scannedEntity.obj = val; scannedEntity.position = ((Component)val).transform.position - baseRadar.transform.position; scannedEntity.rawPosition = ((Component)val).transform.position; ScannedEntity scannedEntity2 = scannedEntity; if (hashtable.Contains(((object)((Component)scannedEntity2.obj).transform).GetHashCode())) { Vector3 val2 = ((Component)val).transform.position - ((ScannedEntity)hashtable[((object)((Component)scannedEntity2.obj).transform).GetHashCode()]).rawPosition; scannedEntity2.speed = ((Vector3)(ref val2)).magnitude; } else { scannedEntity2.speed = 0f; } if (!scannedEntities.Contains(((object)((Component)scannedEntity2.obj).transform).GetHashCode())) { scannedEntity2.blip = blipPool[num2]; num2++; Vector3 localPosition = scannedEntity2.blip.transform.localPosition; localPosition = scannedEntity2.position; scannedEntity2.blip.transform.localPosition = new Vector3(Remap(localPosition.x, 0f - searchRadius, searchRadius, -45f, 45f), Remap(localPosition.z, 0f - searchRadius, searchRadius, -45f, 45f), -0.1f); scannedEntity2.blip.SetActive(scannedEntity2.speed > MotionTrackerConfig.MotionTrackerSpeedDetect); scannedEntities.Add(((object)((Component)scannedEntity2.obj).transform).GetHashCode(), scannedEntity2); } } } } public float Remap(float from, float fromMin, float fromMax, float toMin, float toMax) { float num = from - fromMin; float num2 = fromMax - fromMin; float num3 = num / num2; float num4 = toMax - toMin; float num5 = num4 * num3; return num5 + toMin; } } }
BepInEx/plugins/NameplateTweaks.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 Dissonance; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("NameplateTweaks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Configurable client-side mod for player username billboards. Speaking indicators, better visibility, etc.")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6+c97f76d05208be5c08fc6b88bca796c1fe5bcf02")] [assembly: AssemblyProduct("NameplateTweaks")] [assembly: AssemblyTitle("NameplateTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.6.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 NameplateTweaks { [BepInPlugin("taffyko.NameplateTweaks", "NameplateTweaks", "1.0.6")] public class Plugin : BaseUnityPlugin { public const string modGUID = "taffyko.NameplateTweaks"; public const string modName = "NameplateTweaks"; public const string modVersion = "1.0.6"; public static ConfigEntry<bool> ConfigEnableSpeakingIndicator; public static ConfigEntry<bool> ConfigVariableSpeakingIndicatorOpacity; public static ConfigEntry<bool> ConfigSpeakingIndicatorAlwaysVisible; public static ConfigEntry<bool> ConfigHideNameplates; public static ConfigEntry<float> ConfigNameplateScale; public static ConfigEntry<float> ConfigNameplateVisibilityDistance; public static ConfigEntry<bool> ConfigNameplateScaleWithDistance; public static ManualLogSource log; private readonly Harmony harmony = new Harmony("taffyko.NameplateTweaks"); public static Vector3? OriginalNameplateScale = new Vector3(-0.0025f, 0.0025f, 0.0025f); private void Awake() { log = Logger.CreateLogSource("NameplateTweaks"); log.LogInfo((object)"Loading taffyko.NameplateTweaks"); ConfigEnableSpeakingIndicator = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "EnableSpeakingIndicator", true, "Enable a voice-activity speaking indicator above player nameplates"); ConfigVariableSpeakingIndicatorOpacity = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "VariableSpeakingIndicatorOpacity", true, "Speaking indicator opacity changes depending on volume"); ConfigSpeakingIndicatorAlwaysVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("Speaking Indicator", "SpeakingIndicatorAlwaysVisible", true, "Display speaking indicators even when the nameplate is hidden"); ConfigHideNameplates = ((BaseUnityPlugin)this).Config.Bind<bool>("Nameplate", "HideNameplates", false, "Do not show player nameplates at all"); ConfigNameplateScale = ((BaseUnityPlugin)this).Config.Bind<float>("Nameplate", "NameplateScale", 1.5f, "Nameplate size multiplier (1.0 is the vanilla size)"); ConfigNameplateVisibilityDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Nameplate", "NameplateVisibilityDistance", 20f, "Distance from the camera within which nameplates are visible (0.0 reverts to vanilla behavior). The length of the ship is ~20 units, for reference"); ConfigNameplateScaleWithDistance = ((BaseUnityPlugin)this).Config.Bind<bool>("Nameplate", "NameplateScaleWithDistance", false, "Scale nameplates so that they retain their apparent size as they get further away"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } private void OnDestroy() { } } public class SpeakingIndicator : MonoBehaviour { public PlayerControllerB player; public Canvas canvas; public GameObject canvasItem; public CanvasGroup canvasItemAlpha; public static Dictionary<PlayerControllerB, SpeakingIndicator> speakingIndicators = new Dictionary<PlayerControllerB, SpeakingIndicator>(); private static Texture2D speakingIconTexture = null; public static Texture2D GetSpeakingIconTexture() { if ((Object)(object)speakingIconTexture != (Object)null) { return speakingIconTexture; } return GameObject.Find("PTTIcon").GetComponent<Image>().sprite.texture; } public static SpeakingIndicator GetSpeakingIndicator(PlayerControllerB player) { //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_0028: Unknown result type (might be due to invalid IL or missing references) speakingIndicators.TryGetValue(player, out var value); if ((Object)(object)value == (Object)null) { GameObject val = new GameObject("SpeakingIndicator"); val.SetActive(false); value = val.AddComponent<SpeakingIndicator>(); value.player = player; ((Component)value).transform.SetParent(((Component)player).transform, false); speakingIndicators.Add(player, value); val.SetActive(true); } return value; } public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) canvasItem = new GameObject("SpeakingIndicatorCanvasItem"); canvasItem.transform.SetParent(player.usernameBillboard, false); canvasItem.AddComponent<CanvasRenderer>(); canvasItemAlpha = canvasItem.AddComponent<CanvasGroup>(); canvasItemAlpha.alpha = 0f; canvasItem.transform.localPosition = new Vector3(0f, 60f, 0f); canvasItem.AddComponent<Image>().sprite = Sprite.Create(GetSpeakingIconTexture(), new Rect(0f, 0f, 260f, 280f), new Vector2(130f, 140f), 100f); } private float lexp(float a, float b, float t) { return Mathf.Lerp(a, b, Mathf.Exp(0f - t)); } public void Update() { VoicePlayerState voicePlayerState = player.voicePlayerState; if (voicePlayerState != null) { float num = Mathf.Clamp(voicePlayerState.Amplitude * 35f, 0f, 1f); if (Plugin.ConfigVariableSpeakingIndicatorOpacity.Value) { if (num > 0.01f) { canvasItemAlpha.alpha = lexp(canvasItemAlpha.alpha, num, Time.deltaTime * 100f); } else { canvasItemAlpha.alpha = lexp(canvasItemAlpha.alpha, num, Time.deltaTime * 50f); } } else if (num > 0.05f) { canvasItemAlpha.alpha = 1f; } else if (num < 0.01f) { canvasItemAlpha.alpha = 0f; } } if (!Plugin.ConfigSpeakingIndicatorAlwaysVisible.Value) { canvasItemAlpha.alpha = Math.Min(canvasItemAlpha.alpha, player.usernameAlpha.alpha); } if (((NetworkBehaviour)player).IsOwner) { canvasItemAlpha.alpha = 0f; } if (!Plugin.ConfigEnableSpeakingIndicator.Value) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void OnDestroy() { speakingIndicators.Remove(player); Object.Destroy((Object)(object)canvasItem); } } [HarmonyPatch] public class Patches { [HarmonyPatch(typeof(HUDManager), "UpdateSpectateBoxSpeakerIcons")] [HarmonyPostfix] public static void UpdateSpectateBoxSpeakerIcons(HUDManager __instance, ref Dictionary<Animator, PlayerControllerB> ___spectatingPlayerBoxes) { foreach (var (val3, val4) in ___spectatingPlayerBoxes) { if (!((NetworkBehaviour)val4).IsOwner) { continue; } if (!(IngamePlayerSettings.Instance?.settings?.pushToTalk).GetValueOrDefault()) { break; } PlayerInput playerInput = IngamePlayerSettings.Instance.playerInput; bool? obj; if (playerInput == null) { obj = null; } else { InputActionAsset actions = playerInput.actions; if (actions == null) { obj = null; } else { InputAction obj2 = actions.FindAction("VoiceButton", false); obj = ((obj2 != null) ? new bool?(obj2.IsPressed()) : null); } } bool? flag = obj; bool valueOrDefault = flag.GetValueOrDefault(); val3.SetBool("speaking", valueOrDefault); break; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void PlayerUpdate(PlayerControllerB __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0094: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) if (Plugin.ConfigEnableSpeakingIndicator.Value) { SpeakingIndicator.GetSpeakingIndicator(__instance); } __instance.usernameBillboard.position = new Vector3(__instance.playerGlobalHead.position.x, __instance.playerGlobalHead.position.y + 0.55f, __instance.playerGlobalHead.position.z); if (Plugin.ConfigHideNameplates.Value || (Object)(object)__instance == (Object)(object)StartOfRound.Instance?.localPlayerController) { __instance.usernameAlpha.alpha = 0f; __instance.usernameBillboard.localScale = Vector3.zero; } else if ((Object)(object)StartOfRound.Instance?.localPlayerController != (Object)null) { float num = Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController.gameplayCamera).transform.position, __instance.usernameBillboard.position); if (num < Plugin.ConfigNameplateVisibilityDistance.Value) { __instance.usernameAlpha.alpha = 1f; ((Behaviour)__instance.usernameBillboardText).enabled = true; ((Component)__instance.usernameCanvas).gameObject.SetActive(true); } float num2 = 1f; if (Plugin.ConfigNameplateScaleWithDistance.Value) { num2 = 1f + Math.Max(0f, (num - 4f) * 0.11f); } __instance.usernameBillboard.localScale = Plugin.OriginalNameplateScale.Value * Plugin.ConfigNameplateScale.Value * num2; } } } public static class PluginInfo { public const string PLUGIN_GUID = "NameplateTweaks"; public const string PLUGIN_NAME = "NameplateTweaks"; public const string PLUGIN_VERSION = "1.0.6"; } }
BepInEx/plugins/PintoBoy.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using PintoMod; using PintoMod.Assets.Scripts.FacilityDash; using PintoMod.Assets.Scripts.LethalJumpany; using PintoMod.Properties; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Pinto_Mod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Pinto_Mod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ff99ad61-38a5-4085-a181-d080e129d86e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyInformationalVersion("1.0.0+f9eca185b5c14cd34eb891515f55ee4f58f8a0ae")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Color32>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<Color32>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<FDHallwayState>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<FDHallwayState>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<FDPlayerState>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<FDPlayerState>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public enum PintoEnemyType { Spider, Slime, Lootbug } public class LJEnemy : NetworkBehaviour { public PintoEnemyType enemyType; public float speed = 5f; private float distance; public LethalJumpany game; public UnityEvent<LJEnemy> onDeath = new UnityEvent<LJEnemy>(); public Animator animator; public bool paused = false; public bool killedPlayer = false; private AudioClip[] movementSounds; private float currentMovementSoundTimer = 0f; private int currentMovementSoundIndex = 0; public NetworkVariable<int> parentNetworkID = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private void Awake() { distance = 10f; animator = ((Component)this).GetComponent<Animator>(); } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) if (!((GrabbableObject)game).isBeingUsed) { return; } if (killedPlayer) { if (enemyType == PintoEnemyType.Spider) { ((Behaviour)animator).enabled = false; } return; } float num = speed * Time.deltaTime; Transform transform = ((Component)this).transform; transform.position += Vector3.left * num; distance -= num; if (distance < 0f) { onDeath.Invoke(this); } currentMovementSoundTimer -= Time.deltaTime; if (currentMovementSoundTimer < 0f) { game.PlaySound(movementSounds[currentMovementSoundIndex]); currentMovementSoundIndex++; if (currentMovementSoundIndex >= movementSounds.Length) { currentMovementSoundIndex = 0; } currentMovementSoundTimer = movementSounds[currentMovementSoundIndex].length; } } private void OnTriggerEnter2D(Collider2D collision) { if (((Component)collision).gameObject.CompareTag("Player") && (Object)(object)game != (Object)null) { game.PlayerGotHit(); } } public void SetMovementSounds(AudioClip[] audioClips) { movementSounds = audioClips; currentMovementSoundTimer = movementSounds[0].length; game.PlaySound(movementSounds[0]); } protected override void __initializeVariables() { if (parentNetworkID == null) { throw new Exception("LJEnemy.parentNetworkID cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)parentNetworkID).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)parentNetworkID, "parentNetworkID"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)parentNetworkID); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "LJEnemy"; } } public enum FadeState { FadeOff, FadeOn, FadeIn, FadeOut } public class PintoBoy : GrabbableObject { private AudioSource audioSource; private bool isButtonPressing = false; protected bool isHoldingButton = false; public GameObject cam; private Transform trCam2DScene; private GameObject modelScreen; private Transform cartridgeLocation; private Animator animButton; private ScanNodeProperties scanNodeProperties; private float hideStartHoldTime = 0.2f; private float hideStartHoldTimer = 0f; public bool pressButton = false; private bool spawnScreen = true; private Material matRenderTex = null; private RenderTexture texRenderTex = null; public bool isActive; public bool isPaused; public bool isInGame; public bool wasInitialized = false; private Renderer rendModelScreen; private float newGameOffset = 20f; private Coroutine coroutineButtonBeingPressed; public NetworkVariable<float> highScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<float> currentScore = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<int> health = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<Color32> color = new NetworkVariable<Color32>(default(Color32), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private Color32 bodyColor; private bool colorSet = false; private bool testcolor = false; protected void PintoAwake() { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) audioSource = ((Component)this).GetComponent<AudioSource>(); Debug.Log((object)"PintoBoy Awake"); base.propColliders = (Collider[])(object)new Collider[2]; base.propColliders[0] = ((Component)this).GetComponent<Collider>(); base.propColliders[1] = ((Component)((Component)this).transform.Find("ScanNode")).GetComponent<Collider>(); Debug.Log((object)(((Object)this).name + " propColliders Length:" + base.propColliders.Length)); Debug.Log((object)(((Object)this).name + " propColliders Length:" + base.propColliders.Length + ", item 0:" + (object)base.propColliders[0])); base.mainObjectRenderer = ((Component)((Component)this).transform.Find("Model")).GetComponent<MeshRenderer>(); base.originalScale = new Vector3(0.25f, 0.25f, 0.25f); Debug.Log((object)(((Object)this).name + " mainObjectRenderer: " + ((Object)base.mainObjectRenderer).name)); scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)scanNodeProperties == (Object)null) { Debug.Log((object)"scanNodePoperties null af tbh"); } base.useCooldown = 0.1f; base.grabbable = true; base.parentObject = ((Component)this).transform; Debug.Log((object)"scannode start"); base.grabbableToEnemies = true; Debug.Log((object)"scannode done"); modelScreen = ((Component)((Component)this).transform.Find("Model/Screen")).gameObject; animButton = ((Component)((Component)this).transform.Find("Model/Button")).GetComponent<Animator>(); base.startFallingPosition = new Vector3(0f, 0f, 0f); base.targetFloorPosition = new Vector3(0f, 0f, 0f); base.insertedBattery = new Battery(false, 1f); ((GrabbableObject)this).EnableItemMeshes(true); cartridgeLocation = ((Component)base.mainObjectRenderer).transform.Find("Cartridge"); Debug.Log((object)("cartLoc.childcount:" + cartridgeLocation.childCount)); if (Color32.op_Implicit(color.Value) != Color.black) { SetBodyColor(color.Value); } } protected void PintoBoyUpdate() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (Color32.op_Implicit(color.Value) != Color.black) { SetBodyColor(color.Value); } if (((NetworkBehaviour)this).IsServer && (!colorSet || testcolor)) { Debug.Log((object)"PintoBoy: setting body color"); string[] array = new string[10] { "#FFFFFF", "#575757", "#FF6B6B", "#FFDAB9", "#FFFFCC", "#98FF98", "#008080", "#5999BE", "#CBCBFF", "#D9AEDD" }; Color32[] array2 = (Color32[])(object)new Color32[array.Length]; Color val = default(Color); for (int i = 0; i < array.Length; i++) { ColorUtility.TryParseHtmlString(array[i], ref val); array2[i] = Color32.op_Implicit(val); } ChangeBodyColorServerRpc(Color32.op_Implicit(array2[Random.Range(0, array2.Length)])); colorSet = true; testcolor = false; } if (spawnScreen) { SpawnScreen(); Debug.Log((object)$"PintoBoy: spawning screen. cam: {cam}"); spawnScreen = false; cam.transform.parent = null; cam.GetComponent<Camera>().orthographicSize = 1.5f; cam.transform.position = ((Component)this).transform.position + Vector3.down * 400f; cam.transform.rotation = Quaternion.identity; cam.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); if (cam.transform.position.x == 0f || cam.transform.position.z == 0f) { cam.transform.position = new Vector3(Random.Range(-500f, 500f), cam.transform.position.y, Random.Range(-500f, 500f)); } SetScreenToOffTexture(); base.isBeingUsed = true; TurnOff(checkBeingUsed: true); } if (!base.isBeingUsed) { return; } isHoldingButton = false; if (base.isBeingUsed) { if (isButtonPressing) { if (hideStartHoldTimer > 0f) { hideStartHoldTimer -= Time.deltaTime; } else { isHoldingButton = true; } } GameUpdate(); } if (pressButton) { ButtonPress(); pressButton = false; } } public virtual void GameUpdate() { } public virtual void TurnedOn() { } public virtual void InitializeObjects(Transform gameRoot) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Intiailizing PintoBoyGame: " + ((Object)this).name)); wasInitialized = true; gameRoot.localPosition = Vector3.zero; gameRoot.localRotation = Quaternion.identity; gameRoot.localScale = Vector3.one; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right) { ToggleOnOff(); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } base.isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.equippedUsableItemQE = true; } public virtual void ButtonPress() { } public virtual void ButtonRelease(float timeHeld) { } public override void UseUpBatteries() { Debug.Log((object)"PintoBoy battery used up"); ((GrabbableObject)this).UseUpBatteries(); TurnOff(checkBeingUsed: false); } private void TogglePause() { if (isPaused) { UnPause(); } else { Pause(); } } private void Pause() { if (base.isBeingUsed) { isPaused = true; SetScreenToOffTexture(); audioSource.Stop(); } } private void UnPause() { if (!base.isBeingUsed) { isPaused = false; } } private void ToggleOnOff() { if (!base.isBeingUsed) { TurnOn(); } else { TurnOff(checkBeingUsed: true); } } private void TurnOff(bool checkBeingUsed) { if (!(!base.isBeingUsed && checkBeingUsed)) { base.isBeingUsed = false; SetScreenToOffTexture(); audioSource.Stop(); ResetGame(); } } private void TurnOn() { if (!base.isBeingUsed) { base.isBeingUsed = true; SetScreenToRenderTexture(); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); isButtonPressing = buttonDown; if (buttonDown) { animButton.SetBool("Press", true); ButtonPress(); if (coroutineButtonBeingPressed != null) { ((MonoBehaviour)this).StopCoroutine(coroutineButtonBeingPressed); } coroutineButtonBeingPressed = ((MonoBehaviour)this).StartCoroutine(ButtonBeingPressed()); } } private IEnumerator ButtonBeingPressed() { Debug.Log((object)("Pinto Button being pressed" + Time.time)); float buttonStartPress = Time.time; yield return (object)new WaitUntil((Func<bool>)(() => !isButtonPressing || !base.isHeld)); Debug.Log((object)("Pinto Button end press " + Time.deltaTime)); animButton.SetBool("Press", false); if (base.isBeingUsed) { ButtonRelease(Time.time - buttonStartPress); } } public void PlaySound(AudioClip clip) { audioSource.PlayOneShot(clip); } public void StopSounds() { audioSource.Stop(); } public void MakeScreenNOTSpawnable() { spawnScreen = false; } [ServerRpc] private void SpawnScreenServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2495713638u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2495713638u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.Log((object)"SpawnScreenServerRpc Called"); int currentId = Pinto_ModBase.Instance.Value.currentId; PintoBoy[] array = (PintoBoy[])(object)Object.FindObjectsByType(typeof(PintoBoy), (FindObjectsSortMode)0); for (int i = currentId; i < array.Length + currentId; i++) { Debug.Log((object)"SpawnScreenServerRpc Called"); } Pinto_ModBase.Instance.Value.currentId += array.Length; SpawnScreenClientRpc(); } } [ClientRpc] private void SpawnScreenClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(491405224u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 491405224u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"SpawnScreenClientRpc Called"); SpawnScreen(); } } } private void SpawnScreen() { Debug.Log((object)"Trying spawn screen"); if (!((Object)(object)cam != (Object)null)) { Debug.Log((object)"Spawning Screen"); cam = ((Component)((Component)this).transform.Find("2D Cam")).gameObject; if ((Object)(object)cam == (Object)null) { Debug.Log((object)"Screen in Pintoboy is null even after instantiate"); } SetScreenToRenderTexture(); trCam2DScene = cam.transform.Find("2D Scene"); Debug.Log((object)"Initializing currentGame"); InitializeObjects(cam.transform.Find("2D Scene/Game")); spawnScreen = false; } } private void GetChildRecursive(Transform obj, int level) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if ((Object)null == (Object)(object)obj) { return; } foreach (Transform item in ((Component)obj).transform) { Transform val = item; if (!((Object)null == (Object)(object)val)) { Debug.Log((object)string.Concat(string.Concat(Enumerable.Repeat("*", level)), ((Object)obj).name)); GetChildRecursive(((Component)val).transform, level++); } } } private void SetScreenToRenderTexture() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown Debug.Log((object)"SetScreenRendTex: checking if texRenderTex null"); if ((Object)(object)texRenderTex == (Object)null) { Debug.Log((object)("SetScreenRendTex: texRenderTex is null. Setting. cam:" + (object)cam)); texRenderTex = new RenderTexture(120, 120, 16); ((Object)texRenderTex).name = "PintoBoyScreen"; ((Texture)texRenderTex).filterMode = (FilterMode)0; cam.GetComponent<Camera>().targetTexture = texRenderTex; } Debug.Log((object)"SetScreenRendTex: checking if matRenderTex null"); if ((Object)(object)matRenderTex == (Object)null) { Debug.Log((object)"SetScreenRendTex: matRenderTex is null. Setting"); matRenderTex = Object.Instantiate<Material>(Pinto_ModBase.matOnScreen); matRenderTex.SetTexture("_MainTex", (Texture)(object)texRenderTex); matRenderTex.mainTexture = (Texture)(object)texRenderTex; } Debug.Log((object)"SetScreenRendTex: checking if rendModelScreen is null"); if ((Object)(object)rendModelScreen == (Object)null) { Debug.Log((object)"SetScreenRendTex: rendModelScreen is null"); rendModelScreen = modelScreen.GetComponent<Renderer>(); } Debug.Log((object)"SetScreenRendTex: setting rendModelScreen to matRenderTex"); rendModelScreen.material = matRenderTex; } private void SetScreenToOffTexture() { if ((Object)(object)rendModelScreen == (Object)null) { rendModelScreen = modelScreen.GetComponent<Renderer>(); } rendModelScreen.material = Pinto_ModBase.matOffScreen; ResetGame(); } public virtual void ResetGame() { } [ServerRpc] private void ChangeBodyColorServerRpc(Color newColor) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1860633010u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1860633010u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((Renderer)base.mainObjectRenderer).materials[0].color = newColor; Debug.Log((object)("PintoBoy: server body color to:" + ((object)(Color)(ref newColor)).ToString())); color.Value = Color32.op_Implicit(newColor); SetBodyColorClientRpc(newColor.r, newColor.g, newColor.b); } } [ClientRpc] private void SetBodyColorClientRpc(float r, float g, float b) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(724987829u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref r, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref g, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref b, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 724987829u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"PintoBoy: client body color"); ((Renderer)base.mainObjectRenderer).materials[0].color = new Color(r, g, b); } } } private void SetBodyColor(Color32 newColor) { //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) ((Renderer)base.mainObjectRenderer).materials[0].color = Color32.op_Implicit(newColor); } protected override void __initializeVariables() { if (highScore == null) { throw new Exception("PintoBoy.highScore cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)highScore).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)highScore, "highScore"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)highScore); if (currentScore == null) { throw new Exception("PintoBoy.currentScore cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)currentScore).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentScore, "currentScore"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentScore); if (health == null) { throw new Exception("PintoBoy.health cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)health).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)health, "health"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)health); if (color == null) { throw new Exception("PintoBoy.color cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)color).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)color, "color"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)color); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PintoBoy() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2495713638u, new RpcReceiveHandler(__rpc_handler_2495713638)); NetworkManager.__rpc_func_table.Add(491405224u, new RpcReceiveHandler(__rpc_handler_491405224)); NetworkManager.__rpc_func_table.Add(1860633010u, new RpcReceiveHandler(__rpc_handler_1860633010)); NetworkManager.__rpc_func_table.Add(724987829u, new RpcReceiveHandler(__rpc_handler_724987829)); } private static void __rpc_handler_2495713638(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((PintoBoy)(object)target).SpawnScreenServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_491405224(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((PintoBoy)(object)target).SpawnScreenClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1860633010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); target.__rpc_exec_stage = (__RpcExecStage)1; ((PintoBoy)(object)target).ChangeBodyColorServerRpc(newColor); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_724987829(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float r = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref r, default(ForPrimitives)); float g = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref g, default(ForPrimitives)); float b = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref b, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((PintoBoy)(object)target).SetBodyColorClientRpc(r, g, b); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PintoBoy"; } } namespace PintoMod { [BepInPlugin("Pinta.PintoBoy", "PintoBoy", "2.0.0")] public class Pinto_ModBase : BaseUnityPlugin { public const string MODGUID = "Pinta.PintoBoy"; public const string MODNAME = "PintoBoy"; public const string MODVERSION = "2.0.0"; private readonly Harmony harmony = new Harmony("Pinta.PintoBoy"); public ManualLogSource logger; public static ConfigEntry<float> config_PintoBoyLethalJumpanyRarity; public static ConfigEntry<float> config_PintoBoyFacilityDashRarity; public static ConfigEntry<float> config_PintoBoy; public static readonly Lazy<Pinto_ModBase> Instance = new Lazy<Pinto_ModBase>(() => new Pinto_ModBase()); public static AssetBundle pintoBundle; public static Item itemPintoBoyPrefab; public static Material matOffScreen; public static Material matOnScreen; public static Item itemPintoBoyLJ; public static Item itemLJCartridgePrefab; public static LethalJumpany gameLethalJumpanyPrefab; public static GameObject ljSpiderPrefab; public static GameObject ljSlimePrefab; public static GameObject ljLootbugPrefab; public static Item itemPintoBoyFD; public static Item itemFDCartridgePrefab; public static FacilityDash gameFacilityDashPrefab; public static GameObject fdBrackenPrefab; public static GameObject fdBunkerSpiderPrefab; public static GameObject fdLootBugPrefab; public static GameObject fdNutcrackerPrefab; public static GameObject fdSnareFleaPrefab; public static GameObject fdThumperPrefab; public int currentId = 0; public static string basePath = "assets/pintoboy"; public static string devicePath = basePath + "/device"; public static string gamesPath = basePath + "/games"; public static string ljBasePath = gamesPath + "/lethal jumpany"; public static string ljAudioPath = ljBasePath + "/audio/"; public static string ljSpritesPath = ljBasePath + "/2d"; public static string fdBasePath = gamesPath + "/facility dash"; public static string fdAudioPath = fdBasePath + "/audio/"; public static string fdSpritesPath = fdBasePath + "/sprites/monsters"; private void Awake() { logger = Logger.CreateLogSource("Pinto Mod"); ConfigSetup(); LoadBundle(); SetVariables(); harmony.PatchAll(typeof(Pinto_ModBase)); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } Debug.Log((object)"Pintoboy initialized"); } private void ConfigSetup() { config_PintoBoyLethalJumpanyRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Lethal Jumpany PintoBoy", "Value", 25f, "How rare is the PintoBoy with Lethal Jumpany"); config_PintoBoyFacilityDashRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Facility Dash PintoBoy", "Value", 12f, "How rare is the PintoBoy with Facility Dash"); } private void SetVariables() { NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyPrefab.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyLJ.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(itemPintoBoyFD.spawnPrefab); Items.RegisterScrap(itemPintoBoyLJ, (int)config_PintoBoyLethalJumpanyRarity.Value, (LevelTypes)(-1)); Items.RegisterScrap(itemPintoBoyFD, (int)config_PintoBoyFacilityDashRarity.Value, (LevelTypes)(-1)); } private void LoadBundle() { pintoBundle = AssetBundle.LoadFromMemory(Resources.pintobund); if ((Object)(object)pintoBundle == (Object)null) { throw new Exception("Failed to load Pinto Bundle!"); } itemPintoBoyPrefab = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy.asset"); if ((Object)(object)itemPintoBoyPrefab == (Object)null) { throw new Exception("Failed to load Pinto Item!"); } PintoBoy pintoBoy = itemPintoBoyPrefab.spawnPrefab.AddComponent<PintoBoy>(); if ((Object)(object)pintoBoy == (Object)null) { throw new Exception("Failed to load Pinto Boy!"); } ((GrabbableObject)pintoBoy).itemProperties = itemPintoBoyPrefab; matOffScreen = pintoBundle.LoadAsset<Material>(devicePath + "/off screen.mat"); if ((Object)(object)matOffScreen == (Object)null) { throw new Exception("Failed to load off screen material!"); } matOnScreen = pintoBundle.LoadAsset<Material>("Screen Mat.mat"); if ((Object)(object)matOnScreen == (Object)null) { throw new Exception("Failed to load Screen Mat material!"); } GameObject val = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/spider/spider.prefab"); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Spider Prefab Object!"); } val.AddComponent<LJEnemy>(); ljSpiderPrefab = val; if ((Object)(object)ljSpiderPrefab == (Object)null) { throw new Exception("Failed to load Spider Prefab!"); } GameObject val2 = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/slime/slime.prefab"); if ((Object)(object)val2 == (Object)null) { throw new Exception("Failed to load Slime Prefab Object!"); } val2.AddComponent<LJEnemy>(); ljSlimePrefab = val2; if ((Object)(object)ljSlimePrefab == (Object)null) { throw new Exception("Failed to load Slime Prefab!"); } GameObject val3 = pintoBundle.LoadAsset<GameObject>(ljSpritesPath + "/loot bug/loot bug.prefab"); if ((Object)(object)val3 == (Object)null) { throw new Exception("Failed to load Lootbug Prefab Object!"); } val3.AddComponent<LJEnemy>(); ljLootbugPrefab = val3; if ((Object)(object)ljLootbugPrefab == (Object)null) { throw new Exception("Failed to load Lootbug Prefab!"); } string text = ""; AudioClip audioClip = GetAudioClip(fdAudioPath + "67_knock (Player hit)"); text = "Bracken"; fdBrackenPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdBrackenPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); fdBrackenPrefab.AddComponent<FD_Bracken>(); text = "Bunker Spider"; fdBunkerSpiderPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdBunkerSpiderPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); fdBunkerSpiderPrefab.AddComponent<FD_BunkerSpider>(); text = "Loot Bug"; fdLootBugPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdLootBugPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); fdLootBugPrefab.AddComponent<FD_LootBug>(); text = "Snare Flea"; fdSnareFleaPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdSnareFleaPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); fdSnareFleaPrefab.AddComponent<FD_SnareFlea>(); text = "Thumper"; fdThumperPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdThumperPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); FD_Thumper fD_Thumper = fdThumperPrefab.AddComponent<FD_Thumper>(); fD_Thumper.acEntrance = GetAudioClip(fdAudioPath + "monster sounds/thumper yell"); fD_Thumper.acDefaultAttack = audioClip; text = "Nutcracker"; fdNutcrackerPrefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + text + ".prefab"); if ((Object)(object)fdNutcrackerPrefab == (Object)null) { throw new Exception("PintoBoy FD: Failed to load " + text + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + text + " Prefab")); fdNutcrackerPrefab.AddComponent<FD_Nutcracker>(); itemPintoBoyLJ = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy lj.asset"); if ((Object)(object)itemPintoBoyLJ == (Object)null) { throw new Exception("Failed to load Pinto LJ Item!"); } PintoBoy pintoBoy2 = itemPintoBoyLJ.spawnPrefab.AddComponent<LethalJumpany>(); if ((Object)(object)pintoBoy2 == (Object)null) { throw new Exception("Failed to load Pinto Boy!"); } ((GrabbableObject)pintoBoy2).itemProperties = itemPintoBoyLJ; itemPintoBoyFD = pintoBundle.LoadAsset<Item>(basePath + "/pintoboy fd.asset"); if ((Object)(object)itemPintoBoyFD == (Object)null) { throw new Exception("Failed to load Pinto FD Item!"); } FacilityDash facilityDash = itemPintoBoyFD.spawnPrefab.AddComponent<FacilityDash>(); if ((Object)(object)facilityDash == (Object)null) { throw new Exception("Failed to load Pinto Boy!"); } ((GrabbableObject)facilityDash).itemProperties = itemPintoBoyFD; facilityDash.prefabBracken = fdBrackenPrefab; facilityDash.prefabBunkerSpider = fdBunkerSpiderPrefab; facilityDash.prefabLootBug = fdLootBugPrefab; facilityDash.prefabNutcracker = fdNutcrackerPrefab; facilityDash.prefabSnareFlea = fdSnareFleaPrefab; facilityDash.prefabThumper = fdThumperPrefab; } private GameObject LoadFDPrefab(MonoBehaviour component, string prefabName) { GameObject val = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + prefabName + ".prefab"); if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load " + prefabName + " Prefab Object!"); } Debug.Log((object)("PintoBoy FD: Loading " + prefabName + " Prefab. Component type is:" + ((object)component).GetType())); val.AddComponent(((object)component).GetType()); return val; } private void LoadPrefabObject(GameObject prefab, MonoBehaviour component, string prefabName) { prefab = pintoBundle.LoadAsset<GameObject>(fdSpritesPath + "/" + prefabName + ".prefab"); if ((Object)(object)prefab == (Object)null) { throw new Exception("Failed to load " + prefabName + " Prefab Object!"); } prefab.AddComponent(((object)component).GetType()); if ((Object)(object)prefab == (Object)null) { throw new Exception("Failed to load " + prefabName + " Prefab!"); } } public static AudioClip GetAudioClip(string path) { AudioClip val = pintoBundle.LoadAsset<AudioClip>(path + ".wav"); if ((Object)(object)val == (Object)null) { val = pintoBundle.LoadAsset<AudioClip>(path + ".mp3"); } if ((Object)(object)val == (Object)null) { throw new Exception("Failed to load Audio Clip " + path); } return val; } [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "CollectNewScrapForThisRound")] public static void PintoBoyAddedToShip(GrabbableObject scrapObject) { if (scrapObject is PintoBoy) { PintoBoy pintoBoy = (PintoBoy)(object)scrapObject; pintoBoy.MakeScreenNOTSpawnable(); Debug.Log((object)"PintoBoy added to ship and screen not spawned"); } } [HarmonyPrefix] [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] public static void DespawnPintoBoyScreens(RoundManager __instance, ref bool despawnAllItems) { if (!((NetworkBehaviour)__instance).IsServer) { return; } PintoBoy[] array = Object.FindObjectsOfType<PintoBoy>(); for (int i = 0; i < array.Length; i++) { if (despawnAllItems || (!((GrabbableObject)array[i]).isHeld && !((GrabbableObject)array[i]).isInShipRoom)) { if (((GrabbableObject)array[i]).isHeld && (Object)(object)((GrabbableObject)array[i]).playerHeldBy != (Object)null) { ((GrabbableObject)array[i]).playerHeldBy.DropAllHeldItemsAndSync(); } NetworkObject component = ((Component)array[i]).gameObject.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { Object.Destroy((Object)(object)array[i].cam.gameObject); ((Component)array[i]).gameObject.GetComponent<NetworkObject>().Despawn(true); } else { Debug.Log((object)("Error/warning: prop '" + ((Object)((Component)array[i]).gameObject).name + "' was not spawned or did not have a NetworkObject component! Skipped despawning and destroyed it instead.")); Object.Destroy((Object)(object)array[i].cam.gameObject); Object.Destroy((Object)(object)((Component)array[i]).gameObject); } } else { ((GrabbableObject)array[i]).scrapPersistedThroughRounds = true; } if (__instance.spawnedSyncedObjects.Contains(((Component)array[i]).gameObject)) { __instance.spawnedSyncedObjects.Remove(((Component)array[i]).gameObject); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Pinto Mod"; public const string PLUGIN_NAME = "Pinto Mod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace PintoMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("PintoMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] pintobund { get { object @object = ResourceManager.GetObject("pintobund", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace PintoMod.Assets.Scripts { [HarmonyPatch(typeof(GrabbableObject))] public static class GrabbableObject_Patches { [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "Start")] private static void Start(GrabbableObject __instance) { if (((Object)__instance).name == "Pinto") { Debug.Log((object)"Instance is Pinto"); PintoBoy pintoBoy = (PintoBoy)(object)__instance; } } } [HarmonyPatch] public class NetworkHandler { private static GameObject pintoObject; private static GameObject ljObject; [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void Init() { Debug.Log((object)"Pintoboy NetworkHandler Init starting"); Debug.Log((object)"Pintoboy NetworkHandler Init ending"); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkPrefab() { //IL_005d: 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) try { if (NetworkManager.Singleton.IsServer) { Debug.Log((object)"Trying to spawn PintoBoy test objs"); pintoObject = Object.Instantiate<GameObject>(Pinto_ModBase.itemPintoBoyPrefab.spawnPrefab); pintoObject.GetComponent<NetworkObject>().Spawn(true); pintoObject.transform.position = new Vector3(3.0792f, 0.2899f, -14.6918f); Debug.Log((object)"PintoBoy test obj 1 hopefully spawned"); ljObject = Object.Instantiate<GameObject>(Pinto_ModBase.itemLJCartridgePrefab.spawnPrefab); ljObject.GetComponent<NetworkObject>().Spawn(true); ljObject.transform.position = new Vector3(2.6302f, 0.2875f, -14.4498f); Debug.Log((object)"PintoBoy test objs hopefully spawned"); } } catch { Pinto_ModBase.Instance.Value.logger.LogError((object)"Failed to instantiate network prefab!"); } } } public abstract class PintoBoyGame : MonoBehaviour { public PintoBoy pintoBoy; public bool isActive; public bool isPaused; public bool isInGame; public bool isHoldingButton; public bool wasInitialized = false; public virtual void ButtonPress() { } public virtual void ButtonRelease(float timeHeld) { } public virtual void GameUpdate() { } public virtual void UnPause() { } public virtual void Pause() { } public virtual void TurnedOff() { } public virtual void TurnedOn() { } public virtual void InitializeObjects(Transform gameRoot) { Debug.Log((object)("Intiailizing PintoBoyGame: " + ((Object)this).name)); wasInitialized = true; } public virtual void TakenOutPintoBoy() { pintoBoy = null; DisableChildren(); } public virtual void DisableChildren() { for (int i = 0; i < ((Component)this).transform.childCount; i++) { ((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(false); } } public virtual void EnableChildren() { for (int i = 0; i < ((Component)this).transform.childCount; i++) { ((Component)((Component)this).transform.GetChild(i)).gameObject.SetActive(true); } } public virtual void StopSounds() { pintoBoy.StopSounds(); } public void PlaySound(AudioClip clip) { pintoBoy.PlaySound(clip); } } } namespace PintoMod.Assets.Scripts.LethalJumpany { public enum LJState { MainMenu, InGame, Paused, Lost } public class LethalJumpany : PintoBoy { private Animator fadeAnim; private LJState gameState = LJState.MainMenu; private Transform mainMenu; private Animator mainMenuAnim; private float mainmenuTime = 2f; private float mainmenuTimer = 0f; private float mainmenuWaitTime = 1.5f; private float mainmenuWaitTimer = 0f; private string SelectedString = "Selected"; private string FadeString = "Fade"; private string DoAnimString = "DoAnim"; private Transform inGame; private Vector3 playerStart; private GameObject player; private Rigidbody2D playerRb; private Collider2D playerCol; private Animator playerAnim; private SpriteRenderer playerSprite; private int[] playerPositions = new int[4] { 0, 5, 10, 15 }; private Vector3 brackenStart; private GameObject bracken; private Animator brackenAnim; private Collider2D groundCol; private Animator groundAnim; private string InAirString = "InAir"; private string DeathString = "Death"; private string ResetString = "Reset"; public float jumpHeight = 8f; public float fastFallSpeed = 15f; public float rayCastDistance = 0.25f; public float rayCastOffset = -0.05f; private bool isGrounded = false; private bool doOnce = false; private Transform paused; private Transform playerSpawnpoint; private Transform topSpawnpoint; private Transform midSpawnpoint; private Transform bottomSpawnpoint; private TMP_Text scoreText; private TMP_Text endScreenText; public GameObject spiderPrefab; public GameObject lootbugPrefab; public GameObject slimePrefab; private float spiderSpeed = 2.5f; private float lootbugSpeed = 3f; private float slimeSpeed = 2f; private float spiderLootBugSpawnChance = 0.4f; private float spiderLootBugDistance = 2.75f; private float scoreIncreaseRate = 15f; private float increaseSpeedAddition = 0.25f; private float increaseAdditionRate = 100f; private int speedAdditionMultiplier = 1; private int speedAdditionMultiplierDefault = 1; private int timesIncreased = 0; private float spawnEnemyEveryMin = 40f; private float spawnEnemyEveryMax = 100f; private float lastTimeSpawned = 0f; private List<LJEnemy> enemies = new List<LJEnemy>(); private bool invincible = false; private float invincibleTime = 2f; private float invincibleTimer = 0f; private bool dead; private bool deadHitGround; private bool deadAnimStarted; private bool endScreenShown; private float deathAnimTime = 2.5f; private float deathAnimTimer = 0f; private int deathAnimIndex = 0; public AudioClip acPlayerStep1; public AudioClip acPlayerStep2; public AudioClip acPlayerJump; public AudioClip acSnapNeck; public AudioClip acSnapNeckLand; public AudioClip acSpiderStep1; public AudioClip acSpiderStep2; public AudioClip acSpiderStep3; public AudioClip acSpiderStep4; public AudioClip acLootbugStep; public AudioClip acSlimeStep; public AudioClip acConfirm; public AudioClip acNewHighscore; public AudioClip acNoHighscore; public AudioClip acBackgroundSong; private float stepSoundTimer = 0f; private float stepSoundTime = 0.25f; private int stepSoundIndex = 0; private float backgroundMusicTimer = 0f; private float backgroundMusicTime = 0f; public bool jump = false; public Transform trGameRoot; private float jumpTimer = 0f; private float maxJumpTime = 0.5f; private float jumpForce = 8f; private bool jumping = false; private void Awake() { PintoAwake(); acPlayerStep1 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "21_walk1 (player step 1)"); acPlayerStep2 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "22_walk2 (player step 2)"); acPlayerJump = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "23_ladder (player land)"); acSnapNeck = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "12_exchange (snap neck)"); acSnapNeckLand = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "67_knock (fall after neck snap)"); acSpiderStep1 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "52_step1 (spider movement)"); acSpiderStep2 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "53_step2 (spider movement)"); acSpiderStep3 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "54_step3 (spider movement)"); acSpiderStep4 = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "55_step4 (spider movement)"); acLootbugStep = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "47_grass (lootbug movement)"); acSlimeStep = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "30_triangle (slime movement)"); acConfirm = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "59_confirm (start game)"); acNewHighscore = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "24_levelclear (new highscore)"); acNoHighscore = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "64_lose2 (no highscore)"); acBackgroundSong = Pinto_ModBase.GetAudioClip(Pinto_ModBase.ljAudioPath + "danger_streets"); backgroundMusicTime = acBackgroundSong.length; spiderPrefab = Pinto_ModBase.ljSpiderPrefab; lootbugPrefab = Pinto_ModBase.ljLootbugPrefab; slimePrefab = Pinto_ModBase.ljSlimePrefab; mainmenuWaitTimer = mainmenuWaitTime; } private void Update() { PintoBoyUpdate(); if (jump) { ButtonPress(); jump = false; } } public override void GameUpdate() { base.GameUpdate(); if (fadeAnim.GetBool(DoAnimString)) { fadeAnim.SetBool(DoAnimString, false); } switch (gameState) { case LJState.MainMenu: if (mainmenuWaitTimer > 0f) { mainmenuWaitTimer -= Time.deltaTime; } if (mainmenuTimer > 0f) { mainmenuTimer -= Time.deltaTime; } if (mainmenuTimer > 1f && !doOnce) { SetFade(FadeState.FadeOut); doOnce = true; } if (mainmenuTimer <= 1f && mainmenuTimer > 0f && doOnce) { mainmenuTimer = 0f; StartGame(); SetFade(FadeState.FadeIn); doOnce = false; } break; case LJState.InGame: LJinGameUpdate(); break; case LJState.Paused: break; case LJState.Lost: break; } } private void LJinGameUpdate() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) if (endScreenShown) { return; } if (!deadAnimStarted) { RaycastHit2D val = Physics2D.Raycast(Vector2.op_Implicit(player.transform.position - rayCastOffset * Vector3.down), Vector2.down, rayCastDistance); if ((Object)(object)((RaycastHit2D)(ref val)).collider == (Object)(object)groundCol) { isGrounded = true; Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.green); playerAnim.SetBool(InAirString, false); deadHitGround = true; } else { isGrounded = false; Debug.DrawRay(player.transform.position - rayCastOffset * Vector3.down, Vector2.op_Implicit(Vector2.down * rayCastDistance), Color.red); playerAnim.SetBool(InAirString, true); deadHitGround = false; } } if (dead) { if (deadHitGround) { PlayDeathAnim(); } if (deadAnimStarted) { deathAnimTimer -= Time.deltaTime; if (deathAnimTimer <= 0f) { deadAnimStarted = false; ShowEndScreen(); } else if (deathAnimTimer < deathAnimTime - 0.25f && deathAnimIndex == 0) { deathAnimIndex++; PlaySound(acSnapNeck); } else if (deathAnimTimer < deathAnimTime - 1.75f && deathAnimIndex == 1) { deathAnimIndex++; PlaySound(acSnapNeckLand); } } return; } if (((NetworkBehaviour)this).IsOwner) { NetworkVariable<float> obj = currentScore; obj.Value += scoreIncreaseRate * Time.deltaTime; } if (currentScore.Value > (float)speedAdditionMultiplier * increaseAdditionRate && speedAdditionMultiplier > timesIncreased) { timesIncreased++; speedAdditionMultiplier++; } if (((NetworkBehaviour)this).IsOwner && currentScore.Value > lastTimeSpawned + Random.Range(spawnEnemyEveryMin, spawnEnemyEveryMax)) { SpawnRandomEnemyServerRpc(); lastTimeSpawned = currentScore.Value; } scoreText.text = Mathf.Round(currentScore.Value).ToString(); if (player.transform.localPosition.y < playerStart.y - 0.5f || player.transform.localPosition.y > playerStart.y + 100f) { player.transform.localPosition = playerSpawnpoint.localPosition; } if (invincible) { invincibleTimer -= Time.deltaTime; if (invincibleTimer <= 0f) { invincible = false; ((Renderer)playerSprite).enabled = true; } else if (invincibleTimer % 0.25f < 0.05f) { ((Renderer)playerSprite).enabled = !((Renderer)playerSprite).enabled; } } if (health.Value > -1) { player.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x + (float)playerPositions[health.Value], player.transform.localPosition.y, 0f); bracken.transform.localPosition = new Vector3(playerSpawnpoint.localPosition.x - (float)(playerPositions[health.Value] * 3), brackenStart.y, 0f); } if (isGrounded && !jumping) { PlayStepSound(); jumpTimer = 0f; } else if (isHoldingButton) { if (jumpTimer > 0f) { jumpTimer -= Time.deltaTime; } } else { jumpTimer = 0f; } if (backgroundMusicTimer > 0f) { backgroundMusicTimer -= Time.deltaTime; return; } backgroundMusicTimer = backgroundMusicTime; if ((Object)(object)acBackgroundSong != (Object)null) { PlaySound(acBackgroundSong); } else { Debug.Log((object)"PintoBoy LJ: acBackgroundSong is null"); } } [ServerRpc] private void SpawnRandomEnemyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1051520683u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1051520683u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { switch (Random.Range(0, 3)) { case 0: SpawnSpider(); break; case 1: SpawnLootbug(); break; case 2: SpawnSlime(); break; } } } public void SetFade(FadeState state) { switch (state) { case FadeState.FadeOff: fadeAnim.SetInteger(FadeString, 0); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeOn: fadeAnim.SetInteger(FadeString, 1); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeIn: fadeAnim.SetInteger(FadeString, 2); fadeAnim.SetBool(DoAnimString, true); break; case FadeState.FadeOut: fadeAnim.SetInteger(FadeString, 3); fadeAnim.SetBool(DoAnimString, true); break; } } public void EnableFade(bool enabled) { ((Behaviour)fadeAnim).enabled = enabled; } private LJEnemy EnumToJumpanyEnemy(PintoEnemyType enemyType) { LJEnemy result = new LJEnemy(); switch (enemyType) { case PintoEnemyType.Spider: result = Pinto_ModBase.ljSpiderPrefab.GetComponent<LJEnemy>(); break; case PintoEnemyType.Slime: result = Pinto_ModBase.ljSlimePrefab.GetComponent<LJEnemy>(); break; case PintoEnemyType.Lootbug: result = Pinto_ModBase.ljLootbugPrefab.GetComponent<LJEnemy>(); break; } return result; } private Transform EnumToEnemySpawnPoint(PintoEnemyType enemyType) { Transform result = null; switch (enemyType) { case PintoEnemyType.Spider: result = topSpawnpoint; break; case PintoEnemyType.Lootbug: result = midSpawnpoint; break; case PintoEnemyType.Slime: result = bottomSpawnpoint; break; } return result; } private AudioClip[] EnumToEnemySounds(PintoEnemyType enemyType) { AudioClip[] result = null; switch (enemyType) { case PintoEnemyType.Spider: result = (AudioClip[])(object)new AudioClip[4] { acSpiderStep1, acSpiderStep2, acSpiderStep3, acSpiderStep4 }; break; case PintoEnemyType.Slime: result = (AudioClip[])(object)new AudioClip[1] { acSlimeStep }; break; case PintoEnemyType.Lootbug: result = (AudioClip[])(object)new AudioClip[1] { acLootbugStep }; break; } return result; } [ServerRpc] private void SpawnEnemyServerRpc(float speed, string enemy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_011b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3307819638u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = enemy != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3307819638u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.Log((object)"PintoBoy LJ: Spawning enemy serverside"); PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy); SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), 0f, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType)); SpawnEnemyClientRpc(speed, enemy); } } [ServerRpc] private void SpawnEnemyServerRpc(float speed, float distance, string enemy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(806374586u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives)); bool flag = enemy != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 806374586u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Debug.Log((object)"PintoBoy LJ: Spawning enemy serverside"); PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy); SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), distance, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType)); SpawnEnemyClientRpc(speed, enemy); } } [ClientRpc] private void SpawnEnemyClientRpc(float speed, string enemy) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3997892232u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives)); bool flag = enemy != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(enemy, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3997892232u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"PintoBoy LJ: Spawning enemy clientside"); PintoEnemyType pintoEnemyType = Enum.Parse<PintoEnemyType>(enemy); if (!((NetworkBehaviour)this).IsServer) { SpawnEnemy(EnumToJumpanyEnemy(pintoEnemyType), EnumToEnemySpawnPoint(pintoEnemyType), 0f, speed, pintoEnemyType, EnumToEnemySounds(pintoEnemyType)); } } } private LJEnemy SpawnEnemy(LJEnemy prefab, Transform position, float spawnOffset, float speed, PintoEnemyType enemy, AudioClip[] audioClips) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) LJEnemy lJEnemy = Object.Instantiate<LJEnemy>(prefab, position.position, Quaternion.identity, position); Transform transform = ((Component)lJEnemy).transform; transform.position += Vector3.right * spawnOffset; lJEnemy.speed = speed + increaseSpeedAddition * (float)speedAdditionMultiplier; lJEnemy.game = this; lJEnemy.onDeath.AddListener((UnityAction<LJEnemy>)OnEnemyDeath); lJEnemy.enemyType = enemy; lJEnemy.SetMovementSounds(audioClips); enemies.Add(lJEnemy); return lJEnemy; } private void OnEnemyDeath(LJEnemy enemy) { enemies.Remove(enemy); enemy.onDeath.RemoveListener((UnityAction<LJEnemy>)OnEnemyDeath); Object.Destroy((Object)(object)((Component)enemy).gameObject); } private void SpawnSpider() { SpawnEnemyServerRpc(spiderSpeed, PintoEnemyType.Spider.ToString()); } private void SpawnLootbug() { SpawnEnemyServerRpc(lootbugSpeed, PintoEnemyType.Lootbug.ToString()); if (currentScore.Value > 700f) { float value = Random.value; Debug.Log((object)"PintoBoy LJ: rolling for Spider after lootbug"); if (value < spiderLootBugSpawnChance) { Debug.Log((object)"PintoBoy LJ: spider rolled"); SpawnEnemyServerRpc(spiderSpeed, spiderLootBugDistance, PintoEnemyType.Spider.ToString()); } } } private void SpawnSlime() { SpawnEnemyServerRpc(slimeSpeed, PintoEnemyType.Slime.ToString()); } public override void ButtonPress() { if (!((GrabbableObject)this).isBeingUsed) { return; } switch (gameState) { case LJState.MainMenu: if (mainmenuWaitTimer <= 0f && mainmenuTimer <= 0f) { StartFromTitleScreen(); } break; case LJState.InGame: if (dead) { if (!endScreenShown) { ShowEndScreen(); } else { ShowTitleScreen(); } } else { Jump(); } break; case LJState.Paused: break; case LJState.Lost: break; } } private void StartFromTitleScreen() { mainMenuAnim.SetTrigger(SelectedString); mainmenuTimer = mainmenuTime; PlaySound(acConfirm); } private void ShowTitleScreen() { SwitchState(LJState.MainMenu); mainmenuWaitTimer = mainmenuWaitTime; } [ServerRpc] private void StartGameServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1034126670u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1034126670u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StartGame(); StartGameClientRpc(); } } [ClientRpc] private void StartGameClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1479370155u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1479370155u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StartGame(); } } } private void StartGame() { SwitchState(LJState.InGame); playerRb.bodyType = (RigidbodyType2D)0; speedAdditionMultiplier = speedAdditionMultiplierDefault; brackenAnim.SetTrigger(ResetString); playerAnim.SetTrigger(ResetString); ClearEnemies(); ((Behaviour)groundAnim).enabled = true; dead = false; endScreenText.text = ""; deadAnimStarted = false; endScreenShown = false; deathAnimTimer = 0f; if (((NetworkBehaviour)this).IsOwner) { health.Value = 3; currentScore.Value = 0f; } timesIncreased = 0; lastTimeSpawned = 0f; deathAnimIndex = 0; backgroundMusicTimer = 0f; } private void ClearEnemies() { if (enemies.Count <= 0) { return; } foreach (LJEnemy enemy in enemies) { Object.Destroy((Object)(object)((Component)enemy).gameObject); } enemies.Clear(); } private void ClearEnemiesExcept(LJEnemy enemy) { if (enemies.Count <= 0) { return; } foreach (LJEnemy enemy2 in enemies) { if (!((Object)(object)enemy2 == (Object)(object)enemy)) { Object.Destroy((Object)(object)((Component)enemy2).gameObject); enemies.Remove(enemy2); } } } [ServerRpc] private void SwitchStateServerRpc(LJState newState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1886143849u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<LJState>(ref newState, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1886143849u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SwitchState(newState); SwitchStateClientRpc(newState); } } [ClientRpc] private void SwitchStateClientRpc(LJState newState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4275040666u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<LJState>(ref newState, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4275040666u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SwitchState(newState); } } } private void SwitchState(LJState newState) { switch (newState) { case LJState.MainMenu: ((Component)mainMenu).gameObject.SetActive(true); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(false); doOnce = false; break; case LJState.InGame: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(true); ((Component)paused).gameObject.SetActive(false); break; case LJState.Paused: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(true); break; case LJState.Lost: ((Component)mainMenu).gameObject.SetActive(false); ((Component)inGame).gameObject.SetActive(false); ((Component)paused).gameObject.SetActive(false); break; } gameState = newState; } private void Jump() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (isGrounded) { playerRb.velocity = new Vector2(0f, jumpHeight); isGrounded = false; jumpTimer = maxJumpTime; jumping = true; PlaySound(acPlayerJump); } else { playerRb.velocity = new Vector2(0f, 0f - fastFallSpeed); PlaySound(acPlayerJump); } } public override void ButtonRelease(float timeHeld) { //IL_0007: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (playerRb.velocity.y > 0f) { playerRb.velocity = new Vector2(playerRb.velocity.x, playerRb.velocity.y / 4f); } jumping = false; if (!isGrounded && !(playerRb.velocity.y > 0.1f)) { } } public override void TurnedOn() { EnableAllAnimators(); ClearEnemies(); ShowTitleScreen(); } public override void ResetGame() { base.ResetGame(); } private void EnableAllAnimators() { ((Behaviour)groundAnim).enabled = true; ((Behaviour)brackenAnim).enabled = true; ((Behaviour)mainMenuAnim).enabled = true; ((Behaviour)playerAnim).enabled = true; EnableFade(enabled: true); for (int i = 0; i < enemies.Count; i++) { ((Behaviour)enemies[i].animator).enabled = true; enemies[i].paused = true; } } private void DisableAllAnimators() { ((Behaviour)groundAnim).enabled = false; ((Behaviour)brackenAnim).enabled = false; ((Behaviour)mainMenuAnim).enabled = false; ((Behaviour)playerAnim).enabled = false; EnableFade(enabled: false); for (int i = 0; i < enemies.Count; i++) { ((Behaviour)enemies[i].animator).enabled = false; enemies[i].paused = false; } } public void PlayerGotHit() { if (((NetworkBehaviour)this).IsOwner && !invincible) { NetworkVariable<int> obj = health; int value = obj.Value; obj.Value = value - 1; if (health.Value <= 0) { DieServerRpc(); return; } invincible = true; invincibleTimer = invincibleTime; } } [ServerRpc] public void DieServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1600077284u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1600077284u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Die(); DieClientRpc(); } } [ClientRpc] public void DieClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1025572591u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1025572591u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Die(); } } } public void Die() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)groundAnim).enabled = false; dead = true; for (int i = 0; i < enemies.Count; i++) { enemies[i].killedPlayer = true; } if (Mathf.Abs(player.transform.localPosition.x - playerSpawnpoint.localPosition.x) < 5f) { playerRb.velocity = new Vector2(0f, 0f); player.transform.localPosition = new Vector3(player.transform.localPosition.x, playerSpawnpoint.localPosition.y, 0f); } } public void PlayDeathAnim() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) player.transform.localPosition = playerSpawnpoint.localPosition; brackenAnim.SetTrigger(DeathString); playerAnim.SetTrigger(DeathString); deathAnimTimer = deathAnimTime; deadAnimStarted = true; deadHitGround = false; deathAnimIndex = 0; StopSounds(); } private void ShowEndScreen() { if (currentScore.Value > highScore.Value) { endScreenText.text = "New Best!\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Last Best\n" + $"{Mathf.Round(highScore.Value)}"; if (((NetworkBehaviour)this).IsOwner) { highScore.Value = currentScore.Value; } PlaySound(acNewHighscore); } else { endScreenText.text = "Score\n" + $"{Mathf.Round(currentScore.Value)}\n" + "Best\n" + $"{Mathf.Round(highScore.Value)}"; PlaySound(acNoHighscore); } endScreenShown = true; } private void PlayStepSound() { stepSoundTimer -= Time.deltaTime; if (stepSoundTimer <= 0f) { stepSoundTimer = stepSoundTime; stepSoundIndex++; if (stepSoundIndex > 1) { stepSoundIndex = 0; } switch (stepSoundIndex) { case 0: PlaySound(acPlayerStep1); break; case 1: PlaySound(acPlayerStep2); break; } } } public override void InitializeObjects(Transform gameRoot) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) base.InitializeObjects(gameRoot); Debug.Log((object)"PintoBoy LJ: intiializing LethalJumpany"); if ((Object)(object)gameRoot != (Object)null) { Debug.Log((object)("PintoBoy LJ: root name: " + ((Object)gameRoot).name)); } else { Debug.Log((object)"PintoBoy LJ: gameRoot null"); } mainMenu = ((Component)gameRoot).transform.Find("Main Menu"); mainMenuAnim = ((Component)((Component)mainMenu).transform.Find("Main Menu Sprite")).GetComponent<Animator>(); inGame = ((Component)gameRoot).transform.Find("Game"); player = ((Component)((Component)inGame).transform.Find("PintoEmployee")).gameObject; playerStart = player.transform.localPosition; playerRb = player.GetComponent<Rigidbody2D>(); playerAnim = player.GetComponent<Animator>(); Debug.Log((object)("PintoBoy LJ: playerAnim:" + (object)playerAnim)); playerCol = player.GetComponent<Collider2D>(); playerSprite = player.GetComponent<SpriteRenderer>(); bracken = ((Component)((Component)inGame).transform.Find("Bracken")).gameObject; brackenAnim = bracken.GetComponent<Animator>(); brackenStart = bracken.transform.localPosition; groundCol = ((Component)((Component)inGame).transform.Find("RailingGround")).GetComponent<Collider2D>(); groundAnim = ((Component)groundCol).gameObject.GetComponent<Animator>(); scoreText = ((Component)((Component)inGame).transform.Find("UI/Score")).GetComponent<TMP_Text>(); endScreenText = ((Component)((Component)inGame).transform.Find("UI/Death Screen/Text")).GetComponent<TMP_Text>(); paused = ((Component)gameRoot).transform.Find("Paused"); playerRb.bodyType = (RigidbodyType2D)1; topSpawnpoint = ((Component)inGame).transform.Find("Top Spawnpoint"); midSpawnpoint = ((Component)inGame).transform.Find("Mid Spawnpoint"); bottomSpawnpoint = ((Component)inGame).transform.Find("Bottom Spawnpoint"); playerSpawnpoint = ((Component)inGame).transform.Find("Player Spawnpoint"); fadeAnim = ((Component)((Component)gameRoot).transform.Find("Fade")).GetComponent<Animator>(); ((Component)fadeAnim).gameObject.SetActive(true); endScreenText.text = ""; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LethalJumpany() { //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:
BepInEx/plugins/RouteRandom.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 Microsoft.CodeAnalysis; using RouteRandom.Helpers; using TMPro; using UnityEngine; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("RouteRandom")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Route Random adds a couple commands for routing to a random moon, including modded moons. 'route random' will get a random moon. 'route randomfilterweather' will get a random moon, filtering out disallowed weathers")] [assembly: AssemblyFileVersion("1.3.2.0")] [assembly: AssemblyInformationalVersion("1.3.2+b39d9e3de8ab4e532a843dadf969a9865daf1154")] [assembly: AssemblyProduct("RouteRandom")] [assembly: AssemblyTitle("RouteRandom")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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 RouteRandom { [BepInPlugin("stormytuna.RouteRandom", "RouteRandom", "1.3.2")] public class RouteRandomBase : BaseUnityPlugin { public const string ModGuid = "stormytuna.RouteRandom"; public const string ModName = "RouteRandom"; public const string ModVersion = "1.3.2"; public static readonly ManualLogSource Log = Logger.CreateLogSource("stormytuna.RouteRandom"); private readonly Harmony harmony = new Harmony("stormytuna.RouteRandom"); public static ConfigEntry<bool> ConfigAllowMildWeather; public static ConfigEntry<bool> ConfigAllowDustCloudsWeather; public static ConfigEntry<bool> ConfigAllowRainyWeather; public static ConfigEntry<bool> ConfigAllowStormyWeather; public static ConfigEntry<bool> ConfigAllowFoggyWeather; public static ConfigEntry<bool> ConfigAllowFloodedWeather; public static ConfigEntry<bool> ConfigAllowEclipsedWeather; public static ConfigEntry<bool> ConfigAllowCostlyPlanets; public static ConfigEntry<bool> ConfigRemoveCostOfCostlyPlanets; public static ConfigEntry<bool> ConfigSkipConfirmation; public static ConfigEntry<bool> ConfigDifferentPlanetEachTime; public static ConfigEntry<bool> ConfigHidePlanet; private void Awake() { Log.LogInfo((object)"RouteRandom has awoken!"); LoadConfigs(); harmony.PatchAll(); } private void LoadConfigs() { ConfigAllowMildWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowMildWeather", true, "Whether or not to allow the 'Mild' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowDustCloudsWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowDustCloudsWeather", false, "Whether or not to allow the 'Dust Clouds' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowRainyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowRainyWeather", false, "Whether or not to allow the 'Rainy' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowStormyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowStormyWeather", false, "Whether or not to allow the 'Stormy' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowFoggyWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowFoggyWeather", false, "Whether or not to allow the 'Foggy' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowFloodedWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowFloodedWeather", false, "Whether or not to allow the 'Flooded' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowEclipsedWeather = ((BaseUnityPlugin)this).Config.Bind<bool>("Allowed Weathers", "AllowEclipsedWeather", false, "Whether or not to allow the 'Eclipsed' weather to be chosen by the 'route randomfilterweather' command"); ConfigAllowCostlyPlanets = ((BaseUnityPlugin)this).Config.Bind<bool>("Costly Planets", "AllowCostlyPlanets", false, "Whether or not to allow costly planets (85-Rend, 7-Dine, 8-Titan). NOTE: You will still be prompted to pay the fee to fly there, enable the MakeCostlyPlanetsFree option to avoid that"); ConfigRemoveCostOfCostlyPlanets = ((BaseUnityPlugin)this).Config.Bind<bool>("Costly Planets", "RemoveCostOfCostlyPlanets", false, "Whether or not to remove the cost of costly planets when they're chosen randomly and allows them to be chosen even when AllowCostlyPlanets is false"); ConfigSkipConfirmation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SkipConfirmation", false, "Whether or not to skip the confirmation screen when using 'route random' or 'route randomwithweather' commands"); ConfigDifferentPlanetEachTime = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DifferentPlanetEachTime", false, "Prevents 'route random' and 'route randomwithweather' commands from choosing the same planet you're on"); ConfigHidePlanet = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HidePlanet", false, "Hides the planet you get randomly routed to, both in the terminal response and at the helm. NOTE: This will ALWAYS hide the orbited planet (even when selected manually) and will skip the confirmation screen"); } } } namespace RouteRandom.Patches { [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPostfix] [HarmonyPatch("SetMapScreenInfoToCurrentLevel")] public static void HideMapScreenInfo(StartOfRound __instance, VideoPlayer ___screenLevelVideoReel, TextMeshProUGUI ___screenLevelDescription) { if (!(((Object)__instance.currentLevel).name == "CompanyBuildingLevel") && RouteRandomBase.ConfigHidePlanet.Value) { ((TMP_Text)___screenLevelDescription).text = "Orbiting: [REDACTED]\nPopulation: Unknown\nConditions: Unknown\nFauna: Unknown\nWeather: Unknown"; ((Behaviour)___screenLevelVideoReel).enabled = false; ___screenLevelVideoReel.clip = null; ((Component)___screenLevelVideoReel).gameObject.SetActive(false); ___screenLevelVideoReel.Stop(); } } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { private static readonly TerminalNode noSuitablePlanetsNode = new TerminalNode { name = "NoSuitablePlanets", displayText = "\nNo suitable planets found.\nConsider route random.\n\n\n", clearPreviousText = true }; private static readonly TerminalNode hidePlanetHackNode = new TerminalNode { name = "HidePlanetHack", displayText = "\nRouting autopilot to [REDACTED].\nYour new balance is [playerCredits].\n\nPlease enjoy your flight.\n\n\n", clearPreviousText = true }; private static TerminalKeyword routeKeyword; private static TerminalKeyword randomKeyword; private static TerminalKeyword randomFilterWeatherKeyword; private static CompatibleNoun routeRandomCompatibleNoun; private static CompatibleNoun routeRandomFilterWeatherCompatibleNoun; private static readonly Random rand = new Random(); [HarmonyPostfix] [HarmonyPatch("Awake")] public static void AddNewTerminalWords(Terminal __instance) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0049: Expected O, but got Unknown //IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0080: 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_0090: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d4: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00fc: Expected O, but got Unknown try { routeKeyword = __instance.GetKeyword("Route"); randomKeyword = new TerminalKeyword { word = "random", name = "Random", defaultVerb = routeKeyword, compatibleNouns = Array.Empty<CompatibleNoun>() }; randomFilterWeatherKeyword = new TerminalKeyword { word = "randomfilterweather", name = "RandomFilterWeather", defaultVerb = routeKeyword, compatibleNouns = Array.Empty<CompatibleNoun>() }; routeRandomCompatibleNoun = new CompatibleNoun { noun = randomKeyword, result = new TerminalNode { name = "routeRandom", buyRerouteToMoon = -1, terminalOptions = Array.Empty<CompatibleNoun>() } }; routeRandomFilterWeatherCompatibleNoun = new CompatibleNoun { noun = randomFilterWeatherKeyword, result = new TerminalNode { name = "routeRandomFilterWeather", buyRerouteToMoon = -1, terminalOptions = Array.Empty<CompatibleNoun>() } }; TerminalKeyword keyword = __instance.GetKeyword("Moons"); TerminalNode specialKeywordResult = keyword.specialKeywordResult; specialKeywordResult.displayText += "* Random // Routes you to a random moon, regardless of weather conditions\n* RandomFilterWeather // Routes you to a random moon, filtering out disallowed weather conditions\n\n"; __instance.AddKeywords(randomKeyword, randomFilterWeatherKeyword); __instance.AddCompatibleNounsToKeyword("Route", routeRandomCompatibleNoun, routeRandomFilterWeatherCompatibleNoun); } catch (Exception ex) { RouteRandomBase.Log.LogError((object)"Failed to add Terminal keywords and compatible nouns!"); RouteRandomBase.Log.LogError((object)ex); } } [HarmonyPostfix] [HarmonyPatch("ParsePlayerSentence")] public static TerminalNode RouteToRandomPlanet(TerminalNode __result, Terminal __instance) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (__result == null || __instance == null) { RouteRandomBase.Log.LogInfo((object)$"Terminal node was null? ({__result == null})"); RouteRandomBase.Log.LogInfo((object)$"Terminal was null? ({__instance == null})"); return __result; } bool flag = ((Object)__result).name == "routeRandom"; bool flag2 = ((Object)__result).name == "routeRandomFilterWeather"; if (!flag && !flag2) { RouteRandomBase.Log.LogInfo((object)("Didn't choose random or randomfilterweather (chose " + ((Object)__result).name + ")")); return __result; } List<CompatibleNoun> list = routeKeyword.compatibleNouns.Where((CompatibleNoun noun) => noun.ResultIsRealMoon() && noun.ResultIsAffordable()).Distinct(new CompatibleNounComparer()).ToList(); RouteRandomBase.Log.LogInfo((object)$"Moons before filtering: {list.Count}"); if (flag2) { foreach (CompatibleNoun item in list.ToList()) { TerminalNode nodeAfterConfirmation = item.result.GetNodeAfterConfirmation(); SelectableLevel val = StartOfRound.Instance.levels[nodeAfterConfirmation.buyRerouteToMoon]; if (!WeatherIsAllowed(val.currentWeather)) { list.Remove(item); } } RouteRandomBase.Log.LogInfo((object)$"Moons after filtering weather: {list.Count}"); } if (RouteRandomBase.ConfigDifferentPlanetEachTime.Value) { list.RemoveAll((CompatibleNoun rpn) => rpn.result.GetNodeAfterConfirmation().NodeRoutesToCurrentOrbitedMoon()); RouteRandomBase.Log.LogInfo((object)$"Moons after filtering orbited moon: {list.Count}"); } if (list.Count <= 0) { RouteRandomBase.Log.LogInfo((object)"No suitable moons found D:"); return noSuitablePlanetsNode; } TerminalNode val2 = rand.NextFromCollection(list).result; RouteRandomBase.Log.LogInfo((object)("Chosen moon: " + ((Object)val2).name)); if (RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value) { if (TerminalHelper.TryMakeRouteMoonNodeFree(val2, out var freeMoonNode)) { val2 = freeMoonNode; } RouteRandomBase.Log.LogInfo((object)"Made moon free!"); } if (RouteRandomBase.ConfigHidePlanet.Value) { TerminalNode nodeAfterConfirmation2 = val2.GetNodeAfterConfirmation(); hidePlanetHackNode.buyRerouteToMoon = nodeAfterConfirmation2.buyRerouteToMoon; hidePlanetHackNode.itemCost = ((!RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value) ? nodeAfterConfirmation2.itemCost : 0); RouteRandomBase.Log.LogInfo((object)"Hidden moon!"); return hidePlanetHackNode; } return RouteRandomBase.ConfigSkipConfirmation.Value ? val2.GetNodeAfterConfirmation() : val2; } private static bool WeatherIsAllowed(LevelWeatherType weatherType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown if (1 == 0) { } bool result = (weatherType - -1) switch { 0 => RouteRandomBase.ConfigAllowMildWeather.Value, 1 => RouteRandomBase.ConfigAllowDustCloudsWeather.Value, 2 => RouteRandomBase.ConfigAllowRainyWeather.Value, 3 => RouteRandomBase.ConfigAllowStormyWeather.Value, 4 => RouteRandomBase.ConfigAllowFoggyWeather.Value, 5 => RouteRandomBase.ConfigAllowFloodedWeather.Value, 6 => RouteRandomBase.ConfigAllowEclipsedWeather.Value, _ => false, }; if (1 == 0) { } return result; } } internal class CompatibleNounComparer : EqualityComparer<CompatibleNoun> { public override bool Equals(CompatibleNoun x, CompatibleNoun y) { return x != null && ((Object)x.result).name.Equals((y != null) ? ((Object)y.result).name : null, StringComparison.InvariantCultureIgnoreCase); } public override int GetHashCode(CompatibleNoun obj) { return ((object)obj.result).GetHashCode(); } } } namespace RouteRandom.Helpers { public static class RandomHelper { public static TSource NextFromCollection<TSource>(this Random rand, List<TSource> collection) { int index = rand.Next(collection.Count); return collection[index]; } } public static class TerminalHelper { public static TerminalKeyword GetKeyword(this Terminal terminal, string keywordName) { return terminal.terminalNodes.allKeywords.First((TerminalKeyword kw) => ((Object)kw).name == keywordName); } public static TerminalNode GetNodeAfterConfirmation(this TerminalNode node) { return node.terminalOptions.First((CompatibleNoun cn) => ((Object)cn.noun).name == "Confirm").result; } public static bool NodeRoutesToCurrentOrbitedMoon(this TerminalNode node) { return (Object)(object)StartOfRound.Instance.levels[node.buyRerouteToMoon] == (Object)(object)StartOfRound.Instance.currentLevel; } public static void AddKeyword(this Terminal terminal, TerminalKeyword newKeyword) { terminal.terminalNodes.allKeywords = CollectionExtensions.AddToArray<TerminalKeyword>(terminal.terminalNodes.allKeywords, newKeyword); } public static void AddKeywords(this Terminal terminal, params TerminalKeyword[] newKeywords) { foreach (TerminalKeyword newKeyword in newKeywords) { terminal.AddKeyword(newKeyword); } } public static void AddCompatibleNounToKeyword(this Terminal terminal, string keywordName, CompatibleNoun newCompatibleNoun) { TerminalKeyword val = ((IEnumerable<TerminalKeyword>)terminal.terminalNodes.allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword kw) => ((Object)kw).name == keywordName)) ?? throw new ArgumentException("Failed to find keyword with name " + keywordName); val.compatibleNouns = CollectionExtensions.AddToArray<CompatibleNoun>(val.compatibleNouns, newCompatibleNoun); } public static void AddCompatibleNounsToKeyword(this Terminal terminal, string keywordName, params CompatibleNoun[] newCompatibleNouns) { foreach (CompatibleNoun newCompatibleNoun in newCompatibleNouns) { terminal.AddCompatibleNounToKeyword(keywordName, newCompatibleNoun); } } public static bool ResultIsRealMoon(this CompatibleNoun compatibleNoun) { return compatibleNoun.result.buyRerouteToMoon == -2; } public static bool ResultIsAffordable(this CompatibleNoun compatibleNoun) { return compatibleNoun.result.itemCost <= 0 || RouteRandomBase.ConfigAllowCostlyPlanets.Value || RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value; } public static bool TryMakeRouteMoonNodeFree(TerminalNode routeMoonNode, out TerminalNode freeMoonNode) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown CompatibleNoun val = ((IEnumerable<CompatibleNoun>)routeMoonNode.terminalOptions).FirstOrDefault((Func<CompatibleNoun, bool>)((CompatibleNoun node) => ((Object)node.noun).name == "Confirm")); CompatibleNoun val2 = ((IEnumerable<CompatibleNoun>)routeMoonNode.terminalOptions).FirstOrDefault((Func<CompatibleNoun, bool>)((CompatibleNoun node) => ((Object)node.noun).name == "Deny")); if (val == null || val2 == null) { freeMoonNode = null; return false; } TerminalNode result = new TerminalNode { name = ((Object)val.result).name + "Free", buyRerouteToMoon = val.result.buyRerouteToMoon, clearPreviousText = true, displayText = val.result.displayText, itemCost = 0 }; TerminalNode val3 = new TerminalNode(); ((Object)val3).name = ((Object)routeMoonNode).name + "Free"; val3.buyRerouteToMoon = -2; val3.clearPreviousText = true; val3.displayPlanetInfo = routeMoonNode.displayPlanetInfo; val3.displayText = routeMoonNode.displayText; val3.itemCost = 0; val3.overrideOptions = true; val3.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { val2, new CompatibleNoun { noun = val.noun, result = result } }; freeMoonNode = val3; return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/ScannableCodes.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using 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("ScannableCodes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+af1036b901b022f8d6aaaeb48a5c7a9ef8dcd614")] [assembly: AssemblyProduct("ScannableCodes")] [assembly: AssemblyTitle("ScannableCodes")] [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 ScannableCodes { internal static class MyPluginInfo { public const string PLUGIN_GUID = "ScannableCodes"; public const string PLUGIN_NAME = "ScannableCodes"; public const string PLUGIN_VERSION = "1.0.3"; } } namespace ScanCodes { [BepInPlugin("Dev1A3.ScanCodes", "ScanCodes", "1.0.0")] internal class PluginLoader : BaseUnityPlugin { internal const string modGUID = "Dev1A3.ScanCodes"; private readonly Harmony harmony = new Harmony("Dev1A3.ScanCodes"); private const string modVersion = "1.0.0"; private static bool initialized; internal static ManualLogSource logSource; public static PluginLoader Instance { get; private set; } private void Awake() { if (!initialized) { initialized = true; Instance = this; Assembly executingAssembly = Assembly.GetExecutingAssembly(); harmony.PatchAll(executingAssembly); logSource = Logger.CreateLogSource("Dev1A3.ScanCodes"); logSource.LogInfo((object)"Loaded ScanCodes"); } } } [HarmonyPatch] internal static class ScanPatch { [HarmonyPatch(typeof(TerminalAccessibleObject), "SetCodeTo")] [HarmonyPostfix] private static void SetCodeTo(ref TerminalAccessibleObject __instance, int codeIndex) { if (__instance.objectCode == null) { return; } Transform val = (Object.op_Implicit((Object)(object)((Component)__instance).transform.parent) ? ((Component)__instance).transform.parent : ((Component)__instance).transform); ScanNodeProperties componentInChildren = ((Component)val).GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = " " + __instance.objectCode; if (__instance.isBigDoor) { componentInChildren.maxRange = 8; } else if ((Object)(object)((Component)__instance).GetComponent<Turret>() != (Object)null) { componentInChildren.maxRange = 10; } PluginLoader.logSource.LogDebug((object)$"Set code of {((Object)val).name}: {__instance.objectCode} (Range: {componentInChildren.maxRange})"); } } } }
BepInEx/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/shovelFix.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 GameNetcodeStuff; using IL; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On; using ShovelFixPatch; using UnityEngine; using shovelFix; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("shovelFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("shovelFix")] [assembly: AssemblyTitle("shovelFix")] [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 shovelFix { [BepInPlugin("shovelFix", "shovelFix", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string modName = "Shovel Hotfix"; private const string modVersion = "1.0.0"; private const string modGUID = "Rocksnotch.ShovelHotfix"; internal static Plugin Instance; public static ManualLogSource logSrc = Logger.CreateLogSource("loggingSource"); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } try { ShovelFix.Init(); logSrc.LogInfo((object)"Patched ShovelFix!"); } catch (Exception ex) { logSrc.LogError((object)("Error Patching Files: " + ex.Message)); } logSrc.LogInfo((object)"Plugin Rocksnotch.ShovelHotfix is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "shovelFix"; public const string PLUGIN_NAME = "shovelFix"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ShovelFixPatch { internal class ShovelFix { [CompilerGenerated] private static class <>O { public static Manipulator <0>__HitShovel; public static hook_Start <1>__Start; } public GameObject MapCamera = null; public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__HitShovel; if (obj == null) { Manipulator val = HitShovel; <>O.<0>__HitShovel = val; obj = (object)val; } Shovel.HitShovel += (Manipulator)obj; object obj2 = <>O.<1>__Start; if (obj2 == null) { hook_Start val2 = Start; <>O.<1>__Start = val2; obj2 = (object)val2; } StartOfRound.Start += (hook_Start)obj2; } private static void Start(orig_Start orig, StartOfRound self) { orig.Invoke(self); try { Plugin.logSrc.LogWarning((object)("VolumeMain (1) LayerMask Name: " + LayerMask.LayerToName(8))); } catch (NullReferenceException) { Plugin.logSrc.LogError((object)"NullReferenceException: VolumeMain (1) not found!"); } } private static void HitShovel(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); Plugin.logSrc.LogMessage((object)"HitShovel IL Patch Start!"); if (val.TryGotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Shovel>(x, "previousPlayerHeldBy"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "gameplayCamera"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position") })) { Plugin.logSrc.LogMessage((object)"Try Goto Next Success!"); int index = val.Index; val.Index = index + 1; val.RemoveRange(25); val.EmitDelegate<Action<Shovel>>((Action<Shovel>)delegate(Shovel instance) { //IL_0012: 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_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_0050: Unknown result type (might be due to invalid IL or missing references) instance.objectsHitByShovel = Physics.SphereCastAll(((Component)instance.previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)instance.previousPlayerHeldBy.gameplayCamera).transform.forward * 0.5f, 0.3f, ((Component)instance.previousPlayerHeldBy.gameplayCamera).transform.forward, 1.85f, instance.shovelMask, (QueryTriggerInteraction)2); }); } else { Plugin.logSrc.LogError((object)"Try Goto Next Failed! Bad IL Code!"); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/ShowAmmoCount.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 HarmonyLib; using Unity.Netcode; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("ShowAmmoCount")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Show Ammo Count")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("ShowAmmoCount")] [assembly: AssemblyTitle("ShowAmmoCount")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] namespace ShowAmmoCount { [BepInPlugin("ShowAmmoCount", "ShowAmmoCount", "1.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource logger; private void Awake() { logger = ((BaseUnityPlugin)this).Logger; logger.LogInfo((object)"Plugin ShowAmmoCount is loaded!"); Harmony.CreateAndPatchAll(typeof(Plugin), (string)null); } [HarmonyPrefix] [HarmonyPatch(typeof(ShotgunItem), "SetControlTipsForItem")] private static bool SetControlTipsForItem(ShotgunItem __instance) { string[] toolTips = ((GrabbableObject)__instance).itemProperties.toolTips; if (toolTips.Length <= 2) { logger.LogError((object)"Shotgun control tips array length is too short to set tips!"); return false; } if (__instance.safetyOn) { toolTips[2] = $"Turn safety off ({__instance.shellsLoaded}/0): [Q]"; } else { toolTips[2] = $"Turn safety on ({__instance.shellsLoaded}/2): [Q]"; } HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)__instance).itemProperties); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(ShotgunItem), "SetSafetyControlTip")] private static bool SetSafetyControlTip(ShotgunItem __instance) { string text = ((!__instance.safetyOn) ? $"Turn safety on ({__instance.shellsLoaded}/2): [Q]" : $"Turn safety off ({__instance.shellsLoaded}/0): [Q]"); if (((NetworkBehaviour)__instance).IsOwner) { HUDManager.Instance.ChangeControlTip(3, text, false); } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyPatch(typeof(ShotgunItem), "ReloadGunEffectsClientRpc")] private static void UpdateControlTips(ShotgunItem __instance) { __instance.SetSafetyControlTip(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShowAmmoCount"; public const string PLUGIN_NAME = "ShowAmmoCount"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/TerminalColors.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using TMPro; 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: AssemblyTitle("TerminalColors")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TerminalColors")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9459ebaf-e3ed-4687-a13b-bcca1661bd3b")] [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 TerminalColors; [BepInPlugin("com.n8bits.TerminalColors", "Terminal Colors", "1.0.3")] public class TerminalColors : BaseUnityPlugin { public static ConfigEntry<string> color_cfg; public static ConfigEntry<float> ship_light_brightness; public static TextMeshProUGUI quota_txt; public static ManualLogSource log; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown log = Logger.CreateLogSource("Terminal Colors"); Harmony val = new Harmony("com.n8bits.TerminalColors"); val.PatchAll(typeof(TerminalPatches)); log.LogInfo((object)"Patched & Terminal Colors Plugin!"); } public static string SetTerminalColor(string color) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Environment/HangarShip/Terminal/Canvas/"); if ((Object)(object)val != (Object)null) { log.LogInfo((object)"Found terminal canvas!"); } TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true); if (componentsInChildren != null) { log.LogInfo((object)"Found text meshes!"); } Light component = GameObject.Find("Environment/HangarShip/Terminal/terminalLight").GetComponent<Light>(); if ((Object)(object)component != (Object)null) { log.LogInfo((object)"Found terminal light!"); } Color c = Color.green; switch (color) { case "red": c = Color.red; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "green": c = Color.green; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "blue": c = Color.blue; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "magenta": c = Color.magenta; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "yellow": c = Color.yellow; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "cyan": c = Color.cyan; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); case "white": c = Color.white; LoopAndSetTerminalColor(componentsInChildren, component, c); log.LogInfo((object)("Executed loop and set to " + ((object)(Color)(ref c)).ToString())); return "Executed loop and set to " + ((object)(Color)(ref c)).ToString(); default: return "Uhh, color no exist :("; } } private static void LoopAndSetTerminalColor(TextMeshProUGUI[] tmeshes, Light tlight, Color c) { //IL_004a: 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_00aa: Unknown result type (might be due to invalid IL or missing references) log.LogInfo((object)"Executing LoopAndSet"); GameObject val = GameObject.Find("Environment/HangarShip/Terminal/Canvas/"); Canvas component = val.GetComponent<Canvas>(); component.pixelPerfect = true; component.referencePixelsPerUnit = 10f; GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube/Canvas (1)/MainContainer/HeaderText"); TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>(); ((Graphic)component2).color = Color.yellow; TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true); log.LogInfo((object)("Found " + componentsInChildren.Length + " TMPUGUI components under Terminal/Canvas")); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val3 in array) { ((Behaviour)val3).enabled = false; ((Graphic)val3).color = c; tlight.color = c; ((Behaviour)val3).enabled = true; } } } public static class TerminalPatches { [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] [HarmonyPostfix] private static void HandleTP(Terminal __instance, TerminalNode __result) { //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown TerminalColors.log.LogInfo((object)"Executing ParsePlayerSentence Patch"); string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded); string text2 = "No color set"; TerminalColors.log.LogInfo((object)"Detected "); string text3 = text.ToLower(); string text4 = text3; if (text4 == null) { return; } switch (text4.Length) { default: return; case 6: switch (text4[1]) { default: return; case 'g': if (!(text4 == "tgreen")) { return; } text2 = TerminalColors.SetTerminalColor("green"); break; case 'w': if (!(text4 == "twhite")) { return; } text2 = TerminalColors.SetTerminalColor("white"); break; } break; case 5: switch (text4[1]) { default: return; case 'b': if (!(text4 == "tblue")) { return; } text2 = TerminalColors.SetTerminalColor("blue"); break; case 'c': if (!(text4 == "tcyan")) { return; } text2 = TerminalColors.SetTerminalColor("cyan"); break; } break; case 4: if (!(text4 == "tred")) { return; } text2 = TerminalColors.SetTerminalColor("red"); break; case 8: if (!(text4 == "tmagenta")) { return; } text2 = TerminalColors.SetTerminalColor("magenta"); break; case 7: if (!(text4 == "tyellow")) { return; } text2 = TerminalColors.SetTerminalColor("yellow"); break; } TerminalNode val = new TerminalNode(); val.displayText = text2; val.clearPreviousText = true; __result = val; } }
BepInEx/plugins/TermSpeak.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; 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("TermSpeak")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Automatically speak on talkie-walkies in your inventory while you're in the terminal")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("TermSpeak")] [assembly: AssemblyTitle("TermSpeak")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TermMacros { [BepInPlugin("me.kdcf.termspeak", "TermSpeak", "1.1.0")] [BepInProcess("Lethal Company.exe")] [HarmonyPatch(typeof(Terminal))] public class TermSpeak : BaseUnityPlugin { private static ConfigEntry<bool> needWalkieInHand; private Harmony _harmony = new Harmony("me.kdcf.termspeak"); private static ManualLogSource _log = Logger.CreateLogSource("TermSpeak"); private void Awake() { needWalkieInHand = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "needWalkieInHand", false, "If set to 'true', you must have the walkie in your hand to activate it. If set to 'false', it only needs to be in your inventory."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin me.kdcf.termspeak is loaded!"); _harmony.PatchAll(typeof(TermSpeak)); } [HarmonyPatch("BeginUsingTerminal")] [HarmonyPostfix] public static void OpenTerminal(Terminal __instance) { SetWalkieMode(enabled: true); } [HarmonyPatch("QuitTerminal")] [HarmonyPostfix] public static void CloseTerminal(Terminal __instance) { SetWalkieMode(enabled: false); } public static void SetWalkieMode(bool enabled) { _log.LogInfo((object)"Terminal opened! Trying to find walkie talkie..."); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; _log.LogInfo((object)$"There are {localPlayerController.ItemSlots.Length} item slots to check."); GrabbableObject val = null; if (!needWalkieInHand.Value) { for (int i = 0; i < localPlayerController.ItemSlots.Length; i++) { if (localPlayerController.ItemSlots[i] is WalkieTalkie && (!enabled || localPlayerController.ItemSlots[i].isBeingUsed)) { val = localPlayerController.ItemSlots[i]; break; } } } else { _log.LogInfo((object)"Terminal opened! Checking for walkie talkie..."); if (localPlayerController.ItemSlots[localPlayerController.currentItemSlot] is WalkieTalkie && (!enabled || localPlayerController.ItemSlots[localPlayerController.currentItemSlot].isBeingUsed)) { val = localPlayerController.ItemSlots[localPlayerController.currentItemSlot]; } } if ((Object)(object)val == (Object)null) { _log.LogInfo((object)"No walkie talkie found!"); return; } _log.LogInfo((object)"Found walkie talkie! Trying to set its mode..."); val.UseItemOnClient(enabled); } } public static class PluginInfo { public const string PLUGIN_GUID = "TermSpeak"; public const string PLUGIN_NAME = "TermSpeak"; public const string PLUGIN_VERSION = "1.1.0"; } }
BepInEx/plugins/YippeeMod.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using YippeeMod.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("YippeeMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("YippeeMod")] [assembly: AssemblyTitle("YippeeMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace YippeeMod { [BepInPlugin("sunnobunno.YippeeMod", "Yippee tbh mod", "1.2.3")] public class YippeeModBase : BaseUnityPlugin { private const string modGUID = "sunnobunno.YippeeMod"; private const string modName = "Yippee tbh mod"; private const string modVersion = "1.2.3"; private readonly Harmony harmony = new Harmony("sunnobunno.YippeeMod"); private static YippeeModBase? Instance; internal ManualLogSource? mls; internal static AudioClip[]? newSFX; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("sunnobunno.YippeeMod"); mls.LogInfo((object)"sunnobunno.YippeeMod is loading."); string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "YippeeMod.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "yippeesound"; AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3"); harmony.PatchAll(typeof(HoarderBugPatch)); mls.LogInfo((object)"sunnobunno.YippeeMod is loaded. Yippee!!!"); } } } namespace YippeeMod.Patches { [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX) { AudioClip[] newSFX = YippeeModBase.newSFX; ___chitterSFX = newSFX; } } }