Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CripplegaX2 v1.0.3
BepInEx/plugins/aot/AttackOnGiant.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using AttackOnGiant.Patches; 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("AttackOnGiant")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AttackOnGiant")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2f4e7db9-a7dc-4331-bef1-a81c3a6ba60f")] [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 AttackOnGiant { [BepInPlugin("EerieXanthic.AttackOnGiant", "Attack on Giant", "1.0.0.0")] public class AttackOnGiantBase : BaseUnityPlugin { private const string modGUID = "EerieXanthic.AttackOnGiant"; private const string modName = "Attack on Giant"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("EerieXanthic.AttackOnGiant"); private static AttackOnGiantBase I; internal ManualLogSource mls; internal static AudioClip newSFX; private void Awake() { if ((Object)(object)I == (Object)null) { I = this; } mls = Logger.CreateLogSource("EerieXanthic.AttackOnGiant"); string location = ((BaseUnityPlugin)I).Info.Location; string text = "AttackOnGiant.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "attackongiantsound"; mls.LogInfo((object)("Attack on Giant is loading from " + text3)); AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newSFX = val.LoadAsset<AudioClip>("Assets/tunes to listen to while being eaten.mp3"); if ((Object)(object)newSFX != (Object)null) { mls.LogInfo((object)"Attack on Giant is loaded. Run."); } harmony.PatchAll(typeof(AttackOnGiantBase)); harmony.PatchAll(typeof(ForestGiantAIPatch)); } } } namespace AttackOnGiant.Patches { [HarmonyPatch(typeof(ForestGiantAI))] internal class ForestGiantAIPatch { [HarmonyPatch("EatPlayerAnimation")] [HarmonyPostfix] public static void hoarderBugAudioPatch(ref AudioSource ___creatureVoice) { ___creatureVoice.PlayOneShot(AttackOnGiantBase.newSFX); } } }
BepInEx/plugins/Base/CoilHeadStare.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TDP.CoilHeadStare.Patch; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CoilHeadStare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadStare")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace TDP.CoilHeadStare { [BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.0.3")] public class ModBase : BaseUnityPlugin { private const string modGUID = "TDP.CoilHeadStare"; private const string modName = "CoilHeadStare"; private const string modVersion = "1.0.3"; private Harmony harmony; internal static ModBase instance; internal ManualLogSource mls; public static ConfigEntry<float> config_timeUntilStare; public static ConfigEntry<float> config_maxStareDistance; public static ConfigEntry<float> config_turnHeadSpeed; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } else { Object.Destroy((Object)(object)this); } ConfigFile(); harmony = new Harmony("TDP.CoilHeadStare"); harmony.PatchAll(typeof(CoilHeadPatch)); mls = Logger.CreateLogSource("TDP.CoilHeadStare"); mls.LogInfo((object)"CoilHeadStare 1.0.3 loaded."); } private void ConfigFile() { config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)"); config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)"); config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player"); Stare.timeUntilStare = config_timeUntilStare.Value; Stare.maxStareDistance = config_maxStareDistance.Value; Stare.turnHeadSpeed = config_turnHeadSpeed.Value; } private void ConfigureDoorControls() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("HangarDoorButtonPanel"); GameObject val2 = new GameObject("PlacementCollider"); val2.transform.SetParent(val.transform, false); BoxCollider val3 = val2.AddComponent<BoxCollider>(); val3.size = new Vector3(0.881444f, 0.147624f, 0.7243316f); val3.center = new Vector3(0.2525222f, 0.06033165f, -0.06168448f); PlaceableShipObject val4 = val2.AddComponent<PlaceableShipObject>(); val4.unlockableID = 1212; val4.parentObject = val.AddComponent<AutoParentToShip>(); val4.mainMesh = val.GetComponent<MeshFilter>(); val4.mainTransform = val.transform; val4.placeObjectCollider = (Collider)(object)val3; val4.yOffset = 0f; val4.AllowPlacementOnWalls = true; val2.AddComponent<AudioSource>(); } } } namespace TDP.CoilHeadStare.Patch { internal class CoilHeadPatch { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] private static void StartPostFix(EnemyAI __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (__instance is SpringManAI) { Debug.Log((object)"CoilHead found. Adding stare script."); Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>(); stare.Initialize((SpringManAI)__instance); } } } public class Stare : MonoBehaviour { private SpringManAI coilHeadInstance; public static float timeUntilStare; public static float maxStareDistance; public static float turnHeadSpeed; private Transform head; private float timeSinceMoving; private bool isTurningHead; private PlayerControllerB stareTarget; public void Initialize(SpringManAI instance) { Debug.Log((object)"Initializing Stare on Coilhead."); coilHeadInstance = instance; head = ((Component)coilHeadInstance).transform.GetChild(0).GetChild(2).GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(2) .GetChild(0) .GetChild(0) .GetChild(1); if (((Object)head).name != "springBone.002_end") { Debug.LogError((object)"CoilHeadStare could not find head transform. Destroying script."); Object.Destroy((Object)(object)this); } } private void Update() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coilHeadInstance == (Object)null) { return; } if ((Object)(object)head == (Object)null) { Debug.LogError((object)"CoilHeadStare head transform missing. Destroying script."); Object.Destroy((Object)(object)this); return; } if (!isTurningHead) { stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false); } if (!((Object)(object)stareTarget == (Object)null)) { Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position; float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position); if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f) { timeSinceMoving = 0f; } else { timeSinceMoving += Time.deltaTime; } if (timeSinceMoving > timeUntilStare) { isTurningHead = true; } else { isTurningHead = false; } if (isTurningHead) { head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f); } } } } }
BepInEx/plugins/Base/LethalRegeneration.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.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalRegeneration.config; using LethalRegeneration.patches; using LethalRegeneration.utils; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("LethalRegeneration")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Natural health regeneration mod with customizable parameters that syncs with host")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("LethalRegeneration")] [assembly: AssemblyTitle("LethalRegeneration")] [assembly: AssemblyVersion("1.2.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalRegeneration { [BepInPlugin("Toskan4134.LethalRegeneration", "LethalRegeneration", "1.2.0")] public class LethalRegenerationBase : BaseUnityPlugin { private const string modGUID = "Toskan4134.LethalRegeneration"; private const string modName = "LethalRegeneration"; private const string modVersion = "1.2.0"; private readonly Harmony patcher = new Harmony("Toskan4134.LethalRegeneration"); public static LethalRegenerationBase Instance; public static Configuration Config { get; internal set; } public static ManualLogSource Logger { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = Logger.CreateLogSource("LethalRegeneration"); Config = new Configuration(((BaseUnityPlugin)this).Config); try { patcher.PatchAll(typeof(HUDManagerPatch)); patcher.PatchAll(typeof(Configuration)); patcher.PatchAll(typeof(TerminalPatch)); patcher.PatchAll(typeof(GameNetworkManagerPatch)); patcher.PatchAll(typeof(StartOfRoundPatch)); patcher.PatchAll(typeof(StartMatchLeverPatch)); Logger.LogInfo((object)"Loaded Succesfully\r\n ___________________\r\n / |\r\n |_______ _______|\r\n ___ | |\r\n | |___| |______\r\n | \\\r\n \\______ ___ |\r\n ___ | | | |\r\n | |__ | | __| |\r\n | || || |\r\n \\_____||____||_____/\r\n LethalRegeneration 1.2.0\r\n By Toskan4134\r\n"); } catch (Exception ex) { Logger.LogError((object)ex); } } } } namespace LethalRegeneration.utils { public class TerminalUtils { public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false) { TerminalKeyword val = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)val).name = word; val.word = word; val.isVerb = isVerb; val.compatibleNouns = compatibleNouns; val.specialKeywordResult = specialKeywordResult; val.defaultVerb = defaultVerb; val.accessTerminalObjects = accessTerminalObjects; return val; } public static TerminalKeyword GetTerminalKeyword(Terminal __instance, string word) { return __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == word); } } } namespace LethalRegeneration.patches { [HarmonyPatch(typeof(GameNetworkManager))] public class GameNetworkManagerPatch { [HarmonyPatch("SaveGameValues")] [HarmonyPostfix] public static void SaveGameValuesPatch(GameNetworkManager __instance) { if (!__instance.isHostingGame) { return; } try { ES3.Save<bool>("LethalRegeneration_healingUpgradeUnlocked", ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked, __instance.currentSaveFileName); } catch (Exception arg) { Debug.LogError((object)$"Error while trying to save game values when disconnecting as host: {arg}"); } } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { private static PlayerControllerB playerControllerB; private static int currentTicksPerRegeneration; private static int currentTicksPerRegenerationOutsideShip; private static int ticksPerRegeneration => ConfigurationSync<Configuration>.Instance.TicksPerRegeneration; private static int regenerationPower => ConfigurationSync<Configuration>.Instance.RegenerationPower; private static bool regenerationOutsideShip => ConfigurationSync<Configuration>.Instance.RegenerationOutsideShip; private static int ticksPerRegenerationOutsideShip => ConfigurationSync<Configuration>.Instance.TicksPerRegenerationOutsideShip; private static int regenerationPowerOutsideShip => ConfigurationSync<Configuration>.Instance.RegenerationPowerOutsideShip; private static bool healingUpgradeUnlocked => ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked; private static bool healingUpgradeEnabled => ConfigurationSync<Configuration>.Instance.HealingUpgradeEnabled; private static int maxHealth => StartMatchLeverPatch.maxHealth; [HarmonyPatch("SetClock")] [HarmonyPostfix] public static void healingPostfix() { playerControllerB = GameNetworkManager.Instance.localPlayerController; if ((healingUpgradeEnabled && !healingUpgradeUnlocked) || !((NetworkBehaviour)playerControllerB).IsOwner || playerControllerB.isPlayerDead || !playerControllerB.AllowPlayerDeath() || playerControllerB.health >= maxHealth) { return; } if (playerControllerB.isInHangarShipRoom) { if (currentTicksPerRegeneration == 0) { currentTicksPerRegeneration = ticksPerRegeneration; LethalRegenerationBase.Logger.LogInfo((object)("Healed " + regenerationPower)); int num = playerControllerB.health + regenerationPower; playerControllerB.health = ((num > maxHealth) ? maxHealth : num); HUDManager.Instance.UpdateHealthUI(playerControllerB.health, false); playerControllerB.DamagePlayerClientRpc(-regenerationPower, playerControllerB.health); if (playerControllerB.health >= 10 && playerControllerB.criticallyInjured) { playerControllerB.MakeCriticallyInjured(false); } } currentTicksPerRegeneration--; } else { if (!regenerationOutsideShip || playerControllerB.isInHangarShipRoom) { return; } if (currentTicksPerRegenerationOutsideShip == 0) { currentTicksPerRegenerationOutsideShip = ticksPerRegenerationOutsideShip; LethalRegenerationBase.Logger.LogInfo((object)("Healed " + regenerationPowerOutsideShip)); int num2 = playerControllerB.health + regenerationPowerOutsideShip; playerControllerB.health = ((num2 > maxHealth) ? maxHealth : num2); HUDManager.Instance.UpdateHealthUI(playerControllerB.health, false); playerControllerB.DamagePlayerClientRpc(-regenerationPowerOutsideShip, playerControllerB.health); if (playerControllerB.health >= 10 && playerControllerB.criticallyInjured) { playerControllerB.MakeCriticallyInjured(false); } } currentTicksPerRegenerationOutsideShip--; } } } [HarmonyPatch(typeof(StartMatchLever))] public class StartMatchLeverPatch { public static int maxHealth = 100; [HarmonyPatch("PlayLeverPullEffectsClientRpc")] [HarmonyPostfix] public static void StartGameHpPostfix(ref StartOfRound ___playersManager, ref bool ___leverHasBeenPulled) { if (___leverHasBeenPulled) { maxHealth = ___playersManager.localPlayerController.health; } } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPatch("ResetShip")] [HarmonyPostfix] public static void ResetShip() { ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = false; } } [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { private static Item item; private static TerminalNode buyNode1; private static TerminalNode buyNode2; private static TerminalNode CannotAfford; private static TerminalNode AlreadyUnlocked; [HarmonyPatch("Start")] [HarmonyPrefix] public static void StartTerminalPatch(Terminal __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Expected O, but got Unknown //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Expected O, but got Unknown if (ConfigurationSync<Configuration>.Instance.HealingUpgradeEnabled) { item = new Item { itemName = "Natural Regeneration", creditsWorth = ConfigurationSync<Configuration>.Instance.HealingUpgradePrice, saveItemVariable = true }; TerminalKeyword terminalKeyword = TerminalUtils.GetTerminalKeyword(__instance, "buy"); TerminalNode result = terminalKeyword.compatibleNouns[0].result.terminalOptions[1].result; CannotAfford = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)CannotAfford).name = "LethalRegeneration_CannotAfford"; CannotAfford.displayText = $"You could not afford these items!\nYour balance is [playerCredits]. Total cost of these items is ${item.creditsWorth}\r\n\r\n"; CannotAfford.clearPreviousText = false; CannotAfford.maxCharactersToType = 25; CannotAfford.playSyncedClip = 1; AlreadyUnlocked = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)AlreadyUnlocked).name = "LethalRegeneration_AlreadyUnlocked"; AlreadyUnlocked.displayText = "This has already been unlocked for your ship!\r\n\r\n"; AlreadyUnlocked.clearPreviousText = true; AlreadyUnlocked.maxCharactersToType = 25; AlreadyUnlocked.playSyncedClip = 1; TerminalKeyword terminalKeyword2 = TerminalUtils.GetTerminalKeyword(__instance, "info"); string itemName = item.itemName; TerminalKeyword keyword3 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, terminalKeyword); if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword kw) => kw.word == keyword3.word)) { LethalRegenerationBase.Logger.LogInfo((object)("Keyword " + keyword3.word + " already registed, skipping.")); } int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem unlockable) => unlockable.unlockableName == item.itemName); buyNode2 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)buyNode2).name = "LethalRegeneration_" + itemName.Replace(" ", "-") + "BuyNode2"; buyNode2.displayText = "Ordered the " + itemName + ". Your new balance is [playerCredits].\n\nFrom now on you will regenerate health as time goes by.\r\n\r\n"; buyNode2.clearPreviousText = true; buyNode2.maxCharactersToType = 15; buyNode2.buyItemIndex = -1; buyNode2.shipUnlockableID = shipUnlockableID; buyNode2.buyUnlockable = true; buyNode2.creatureName = itemName; buyNode2.isConfirmationNode = false; buyNode2.itemCost = item.creditsWorth; buyNode2.playSyncedClip = 0; buyNode1 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)buyNode1).name = "LethalRegeneration_" + itemName.Replace(" ", "-") + "BuyNode1"; buyNode1.displayText = "You have requested to order the " + itemName + " upgrade.\nTotal cost of items: " + item.creditsWorth + ".\n\nPlease CONFIRM or DENY.\r\n\r\n"; buyNode1.clearPreviousText = true; buyNode1.maxCharactersToType = 35; buyNode1.buyItemIndex = -1; buyNode1.shipUnlockableID = shipUnlockableID; buyNode1.creatureName = itemName; buyNode1.isConfirmationNode = true; buyNode1.overrideOptions = true; buyNode1.itemCost = item.creditsWorth; buyNode1.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun { noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"), result = buyNode2 }, new CompatibleNoun { noun = __instance.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"), result = result } }; List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList(); list.Add(keyword3); __instance.terminalNodes.allKeywords = list.ToArray(); List<CompatibleNoun> list2 = terminalKeyword.compatibleNouns.ToList(); list2.Add(new CompatibleNoun { noun = keyword3, result = buyNode1 }); terminalKeyword.compatibleNouns = list2.ToArray(); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val).name = "LethalRegeneration_" + itemName.Replace(" ", "-") + "InfoNode"; if (ConfigurationSync<Configuration>.Instance.RegenerationOutsideShip) { val.displayText = $"Your health regenerates inside and outside the ship\n\nINSIDE THE SHIP\nThe healing is activated each {ConfigurationSync<Configuration>.Instance.TicksPerRegeneration} ticks\nThe healing power is {ConfigurationSync<Configuration>.Instance.RegenerationPower}hp per tick\n\nOUTSIDE THE SHIP\nThe healing is activated each {ConfigurationSync<Configuration>.Instance.TicksPerRegenerationOutsideShip} ticks\nThe healing power is {ConfigurationSync<Configuration>.Instance.RegenerationPowerOutsideShip}hp per tick\n\n"; } else { val.displayText = $"Your health regenerates only inside the ship\n\nThe healing is activated each {ConfigurationSync<Configuration>.Instance.TicksPerRegeneration} ticks\nThe healing power is {ConfigurationSync<Configuration>.Instance.RegenerationPower}hp per tick\n\n"; } val.clearPreviousText = true; val.maxCharactersToType = 25; __instance.terminalNodes.allKeywords = list.ToArray(); List<CompatibleNoun> list3 = terminalKeyword2.compatibleNouns.ToList(); list3.Add(new CompatibleNoun { noun = keyword3, result = val }); terminalKeyword2.compatibleNouns = list3.ToArray(); LethalRegenerationBase.Logger.LogInfo((object)("Registered " + itemName)); } } [HarmonyPatch("TextPostProcess")] [HarmonyPrefix] public static void TextPostProcessPatch_Prefix(ref string modifiedDisplayText, TerminalNode node, ref string __result) { if (ConfigurationSync<Configuration>.Instance.HealingUpgradeEnabled && modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]")) { int num = modifiedDisplayText.IndexOf(":"); string itemName = item.itemName; int creditsWorth = item.creditsWorth; string value = $"\n* {itemName} // Price: ${creditsWorth}"; modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value); } } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] public static void LoadNewNodePatch_Prefix(ref TerminalNode node, Terminal __instance) { if (!((Object)node).name.StartsWith("LethalRegeneration")) { return; } string text = ((Object)node).name.Split(new char[1] { '_' })[1]; string text2 = text; string text3 = text2; if (!(text3 == "Natural-RegenerationBuyNode2")) { if (text3 == "Natural-RegenerationBuyNode1" && __instance.groupCredits < item.creditsWorth) { node = CannotAfford; } return; } if (ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked) { node = AlreadyUnlocked; return; } int num = __instance.groupCredits - item.creditsWorth; __instance.SyncGroupCreditsServerRpc(num, __instance.numberOfItemsInDropship); ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = true; ConfigurationSync<Configuration>.Synced = false; if (ConfigurationSync<Configuration>.IsHost) { ConfigurationSync<Configuration>.Instance.BroadcastHealingUpgradeStatusToClients(); } else { ConfigurationSync<Configuration>.Instance.SendHealingUpgradeStatusToHost(); } } } } namespace LethalRegeneration.config { [Serializable] public class Configuration : ConfigurationSync<Configuration> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnReceiveBroadcastedHealingUpgradeStatus; public static HandleNamedMessageDelegate <1>__OnRequestSync; public static HandleNamedMessageDelegate <2>__OnReceiveHealingUpgradeStatus; public static HandleNamedMessageDelegate <3>__OnReceiveSync; } public const int DefaultTicksPerRegeneration = 2; public const int DefaultRegenerationPower = 5; public const bool DefaultregenerationOutsideShip = false; public const bool DefaultHealingUpgradeEnabled = false; public const int DefaultHealingUpgradePrice = 800; [NonSerialized] private readonly ConfigFile configFile; public bool HealingUpgradeUnlocked { get; set; } public int TicksPerRegeneration { get; private set; } public int RegenerationPower { get; private set; } public bool RegenerationOutsideShip { get; private set; } public int TicksPerRegenerationOutsideShip { get; private set; } public int RegenerationPowerOutsideShip { get; private set; } public bool HealingUpgradeEnabled { get; private set; } public int HealingUpgradePrice { get; private set; } public Configuration(ConfigFile cfg) { ConfigurationSync<Configuration>.Instance = this; configFile = cfg; InitConfigEntries(); LethalRegenerationBase.Logger.LogInfo((object)"Configuration Set"); } private void InitConfigEntries() { RegenerationPower = NewEntry("Values", "Regeneration Power", 5, "Amount of health regenerated INSIDE the ship each time triggered (Between 1 an 100)"); TicksPerRegeneration = NewEntry("Values", "Ticks Per Regeneration", 2, "Number of ticks until the regeneration is triggered INSIDE the ship (1 tick equals each time the minutes of the clock are changed)"); RegenerationOutsideShip = NewEntry("Values", "Enable Regeneration Outside Ship", defaultVal: false, "Whether health is regenerated also outside the ship or only inside."); RegenerationPowerOutsideShip = NewEntry("Values", "Regeneration Power Outside Ship", 5, "Amount of health regenerated OUTSIDE the ship each time triggered, requires Regeneration Outside The Ship enabled (Between 1 an 100)"); TicksPerRegenerationOutsideShip = NewEntry("Values", "Ticks Per Regeneration Outside Ship", 2, "Number of ticks until the regeneration is triggered OUTSIDE the ship, requires Regeneration Outside The Ship enabled (1 tick equals each time the minutes of the clock are changed)"); HealingUpgradeEnabled = NewEntry("Values", "Regeneration As Upgrade", defaultVal: false, "Makes natural health regeneration an upgrade for the ship and has to be purchased to make it work."); HealingUpgradePrice = NewEntry("Values", "Upgrade Price", 800, "Changes the price of ship upgrade for health regeneration. Only works if ship upgrade is enabled"); RegenerationPower = ((100 >= RegenerationPower && RegenerationPower > 0) ? RegenerationPower : 5); TicksPerRegeneration = ((TicksPerRegeneration > 0) ? TicksPerRegeneration : 2); RegenerationPowerOutsideShip = ((100 >= RegenerationPowerOutsideShip && RegenerationPowerOutsideShip > 0) ? RegenerationPowerOutsideShip : 5); TicksPerRegenerationOutsideShip = ((TicksPerRegenerationOutsideShip > 0) ? TicksPerRegenerationOutsideShip : 2); HealingUpgradePrice = ((HealingUpgradePrice > 0) ? HealingUpgradePrice : 800); } private T NewEntry<T>(string category, string key, T defaultVal, string desc) { return configFile.Bind<T>(category, key, defaultVal, desc).Value; } public static void RequestSync() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!ConfigurationSync<Configuration>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); try { ConfigurationSync<Configuration>.MessageManager.SendNamedMessage("LethalRegeneration_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!ConfigurationSync<Configuration>.IsHost) { return; } LethalRegenerationBase.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = ConfigurationSync<Configuration>.SerializeToBytes(ConfigurationSync<Configuration>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(array.Length + 4, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); ConfigurationSync<Configuration>.MessageManager.SendNamedMessage("LethalRegeneration_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { LethalRegenerationBase.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(4)) { LethalRegenerationBase.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { LethalRegenerationBase.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); ConfigurationSync<Configuration>.UpdateInstance(data); LethalRegenerationBase.Logger.LogInfo((object)"Successfully synced config with host."); } public void SendHealingUpgradeStatusToHost() { //IL_0028: 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_0041: Unknown result type (might be due to invalid IL or missing references) if (ConfigurationSync<Configuration>.IsClient) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); try { int num = (HealingUpgradeUnlocked ? 1 : 0); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ConfigurationSync<Configuration>.MessageManager.SendNamedMessage("LethalRegeneration_SendHealingUpgradeStatus", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } } public static void OnReceiveHealingUpgradeStatus(ulong _, FastBufferReader reader) { //IL_001e: 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) if (ConfigurationSync<Configuration>.IsHost) { if (((FastBufferReader)(ref reader)).TryBeginRead(4)) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = num == 1; LethalRegenerationBase.Logger.LogInfo((object)$"Received sent HealingUpgrade status: {ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked}"); ConfigurationSync<Configuration>.Instance.BroadcastHealingUpgradeStatusToClients(); } else { LethalRegenerationBase.Logger.LogError((object)"Error reading healingUpgradeUnlocked status."); } } } public void BroadcastHealingUpgradeStatusToClients() { //IL_002c: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (!ConfigurationSync<Configuration>.IsHost) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); try { int num = (HealingUpgradeUnlocked ? 1 : 0); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); foreach (ulong key in NetworkManager.Singleton.ConnectedClients.Keys) { ConfigurationSync<Configuration>.MessageManager.SendNamedMessage("LethalRegeneration_BroadcastHealingUpgradeStatus", key, val, (NetworkDelivery)3); } } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveBroadcastedHealingUpgradeStatus(ulong _, FastBufferReader reader) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (ConfigurationSync<Configuration>.IsClient && !ConfigurationSync<Configuration>.IsHost) { if (((FastBufferReader)(ref reader)).TryBeginRead(4)) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = num == 1; LethalRegenerationBase.Logger.LogInfo((object)$"Received broadcasted healingUpgradeUnlocked status: {ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked}"); ConfigurationSync<Configuration>.Synced = true; } else { LethalRegenerationBase.Logger.LogError((object)"Error reading broadcasted healingUpgradeUnlocked status."); } } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //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) //IL_006f: Expected O, but got Unknown //IL_008f: 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_009a: Expected O, but got Unknown ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = false; CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnReceiveBroadcastedHealingUpgradeStatus; if (obj == null) { HandleNamedMessageDelegate val = OnReceiveBroadcastedHealingUpgradeStatus; <>O.<0>__OnReceiveBroadcastedHealingUpgradeStatus = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("LethalRegeneration_BroadcastHealingUpgradeStatus", (HandleNamedMessageDelegate)obj); if (ConfigurationSync<Configuration>.IsHost) { CustomMessagingManager messageManager = ConfigurationSync<Configuration>.MessageManager; object obj2 = <>O.<1>__OnRequestSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnRequestSync; <>O.<1>__OnRequestSync = val2; obj2 = (object)val2; } messageManager.RegisterNamedMessageHandler("LethalRegeneration_OnRequestConfigSync", (HandleNamedMessageDelegate)obj2); CustomMessagingManager messageManager2 = ConfigurationSync<Configuration>.MessageManager; object obj3 = <>O.<2>__OnReceiveHealingUpgradeStatus; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnReceiveHealingUpgradeStatus; <>O.<2>__OnReceiveHealingUpgradeStatus = val3; obj3 = (object)val3; } messageManager2.RegisterNamedMessageHandler("LethalRegeneration_SendHealingUpgradeStatus", (HandleNamedMessageDelegate)obj3); ConfigurationSync<Configuration>.Synced = true; ConfigurationSync<Configuration>.Instance.HealingUpgradeUnlocked = ES3.Load<bool>("LethalRegeneration_healingUpgradeUnlocked", GameNetworkManager.Instance.currentSaveFileName, false); } else { CustomMessagingManager messageManager3 = ConfigurationSync<Configuration>.MessageManager; object obj4 = <>O.<3>__OnReceiveSync; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnReceiveSync; <>O.<3>__OnReceiveSync = val4; obj4 = (object)val4; } messageManager3.RegisterNamedMessageHandler("LethalRegeneration_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj4); ConfigurationSync<Configuration>.Synced = false; RequestSync(); } } } [Serializable] public class ConfigurationSync<T> { public static T Instance { get; internal set; } public static bool Synced { get; internal set; } internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; internal static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { LethalRegenerationBase.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } internal static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { LethalRegenerationBase.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } internal static void UpdateInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } } }
BepInEx/plugins/Base/PestControl.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PestControl")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PestControl")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d2469a2d-0fe3-463e-9f8c-ba7b095962cf")] [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 PestControl; internal static class Config { private static ConfigFile _configFile; private static string _configPath = Path.Combine(Paths.ConfigPath, "PestControl.cfg"); public static Dictionary<string, Vector2> GetWeights(Terminal terminal) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) CheckFile(); HashSet<EnemyType> enemies = new HashSet<EnemyType>(); SelectableLevel[] moonsCatalogueList = terminal.moonsCatalogueList; foreach (SelectableLevel obj in moonsCatalogueList) { Action<EnemyType> action = delegate(EnemyType x) { if (!enemies.TryGetValue(x, out var _)) { enemies.Add(x); } }; obj.Enemies.Select((SpawnableEnemyWithRarity x) => x.enemyType).ToList().ForEach(action); obj.DaytimeEnemies.Select((SpawnableEnemyWithRarity x) => x.enemyType).ToList().ForEach(action); obj.OutsideEnemies.Select((SpawnableEnemyWithRarity x) => x.enemyType).ToList().ForEach(action); } Dictionary<string, Vector2> dictionary = new Dictionary<string, Vector2>(); foreach (EnemyType item in enemies) { string enemyName = item.enemyName; dictionary[enemyName] = new Vector2(_configFile.Bind<float>(enemyName, "Multiplier", 1f, "Scales spawn weight. Set to 0 to override with Addition.").Value, _configFile.Bind<float>(enemyName, "Addition", 0f, "Adjusts weight after Multiplier. Use for precise control.").Value); Plugin.Log.LogInfo((object)(enemyName + ":")); Plugin.Log.LogInfo((object)$"Multiplier:{dictionary[enemyName].x} Addition:{dictionary[enemyName].y}"); } return dictionary; } private static void CheckFile() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (_configFile == null) { _configFile = new ConfigFile(_configPath, true); } } } internal static class Patch { private static Dictionary<string, Vector2> weights = new Dictionary<string, Vector2>(); [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> LoadNewLevel(IEnumerable<CodeInstruction> instructions) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown Plugin.Log.LogInfo((object)"Started Transpiling [LoadNewLevel]."); List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = list.FindIndex((CodeInstruction x) => x.opcode == OpCodes.Stfld); list.InsertRange(num + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)typeof(Patch).GetMethod("SetWeights", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) }); Plugin.Log.LogInfo((object)"Transpiled method successfully."); return list; } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void Start(Terminal __instance) { weights = Config.GetWeights(__instance); } public static void SetWeights() { //IL_0096: 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) SelectableLevel currentLevel = RoundManager.Instance.currentLevel; Plugin.Log.LogInfo((object)"Setting adjusted weights!"); foreach (SpawnableEnemyWithRarity item in currentLevel.Enemies.Concat(currentLevel.DaytimeEnemies).Concat(currentLevel.OutsideEnemies).ToList()) { foreach (KeyValuePair<string, Vector2> weight in weights) { string key = weight.Key; if (key == item.enemyType.enemyName) { int rarity = item.rarity; item.rarity = (int)((float)item.rarity * weight.Value.x + weight.Value.y); Plugin.Log.LogInfo((object)$"{key}, old rarity: {rarity}, new rariy: {item.rarity}"); break; } } } } } [BepInPlugin("niceh.PestControl", "PestControl", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string GUID = "niceh.PestControl"; public const string Name = "PestControl"; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; new Harmony("niceh.PestControl").PatchAll(typeof(Patch)); } }
BepInEx/plugins/BunyaPineTree-MikuModelReplacement/HatsuneMikuModelReplacement.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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ModelReplacement; 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("HatsuneMikuModelReplacement")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+52df4b97138c7408b9ad8f545147d8fc94484cf5")] [assembly: AssemblyProduct("HatsuneMikuModelReplacement")] [assembly: AssemblyTitle("HatsuneMikuModelReplacement")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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 HatsuneMikuModelReplacement { public class BodyReplacementMiku : BodyReplacementBase { private List<string> baseMatNames = new List<string> { "Body", "Eye", "Costume", "Hair", "HairF", "Transparent" }; protected override GameObject LoadAssetsAndReturnModel() { string text = "HatsuneMikuNT"; GameObject val = Assets.MainAssetBundle.LoadAsset<GameObject>(text); int currentSuitID = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID; string value = StartOfRound.Instance.unlockablesList.unlockables[currentSuitID].unlockableName.ToLower().Replace(" ", ""); string[] source = Plugin.suitNamesToEnableEvilMiku.Value.Split(','); source = source.Select((string x) => x.ToLower().Replace(" ", "")).ToArray(); if (source.Contains(value)) { SkinnedMeshRenderer componentInChildren = val.GetComponentInChildren<SkinnedMeshRenderer>(); string text2 = "D"; List<Material> list = new List<Material>(); foreach (string baseMatName in baseMatNames) { list.Add(Assets.MainAssetBundle.LoadAsset<Material>(baseMatName + text2)); } ((Renderer)componentInChildren).SetMaterials(list); } else { SkinnedMeshRenderer componentInChildren2 = val.GetComponentInChildren<SkinnedMeshRenderer>(); string text3 = ""; List<Material> list2 = new List<Material>(); foreach (string baseMatName2 in baseMatNames) { list2.Add(Assets.MainAssetBundle.LoadAsset<Material>(baseMatName2 + text3)); } ((Renderer)componentInChildren2).SetMaterials(list2); } return val; } protected override void OnDeath() { base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(83, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(84, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(25, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(45, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(29, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(44, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(49, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(58, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(60, 0f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(29, 100f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(52, 100f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(61, 100f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(67, 12f); base.replacementDeadBody.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(72, 100f); } protected override void OnEmoteStart(int emoteId) { base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(29, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(44, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(49, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(58, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(60, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(83, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(84, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(25, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(45, 0f); if (emoteId == 1) { base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(83, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(84, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(25, 60f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(45, 100f); } if (emoteId == 2) { base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(29, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(44, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(49, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(58, 100f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(60, 70f); } } protected override void OnEmoteEnd() { base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(83, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(84, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(25, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(45, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(29, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(44, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(49, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(58, 0f); base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(60, 0f); } } [BepInPlugin("meow.MikuModelReplacement", "Miku Model", "1.5.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigFile config; public static ConfigEntry<bool> enableMikuForAllSuits { get; private set; } public static ConfigEntry<bool> enableMikuAsDefault { get; private set; } public static ConfigEntry<string> suitNamesToEnableMiku { get; private set; } public static ConfigEntry<string> suitNamesToEnableEvilMiku { get; private set; } public static ConfigEntry<float> UpdateRate { get; private set; } public static ConfigEntry<float> distanceDisablePhysics { get; private set; } public static ConfigEntry<bool> disablePhysicsAtRange { get; private set; } private static void InitConfig() { enableMikuForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable Miku for all Suits", false, "Enable to replace every suit with Miku. Set to false to specify suits"); enableMikuAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable Miku as default", false, "Enable to replace every suit that hasn't been otherwise registered with Miku."); suitNamesToEnableMiku = config.Bind<string>("Suits to Replace Settings", "Suits to enable Miku for", "Default,Orange suit", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])"); suitNamesToEnableEvilMiku = config.Bind<string>("Suits to Replace Settings", "Suits to enable Evil Miku for", "Green suit", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])"); UpdateRate = config.Bind<float>("Dynamic Bone Settings", "Update rate", 60f, "Refreshes dynamic bones more times per second the higher the number"); disablePhysicsAtRange = config.Bind<bool>("Dynamic Bone Settings", "Disable physics at range", false, "Enable to disable physics past the specified range"); distanceDisablePhysics = config.Bind<float>("Dynamic Bone Settings", "Distance to disable physics", 20f, "If Disable physics at range is enabled, this is the range after which physics is disabled."); } private void Awake() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; InitConfig(); Assets.PopulateAssets(); if (enableMikuForAllSuits.Value) { ModelReplacementAPI.RegisterModelReplacementOverride(typeof(BodyReplacementMiku)); } if (enableMikuAsDefault.Value) { ModelReplacementAPI.RegisterModelReplacementDefault(typeof(BodyReplacementMiku)); } string[] array = suitNamesToEnableMiku.Value.Split(','); string[] array2 = array; foreach (string text in array2) { ModelReplacementAPI.RegisterSuitModelReplacement(text, typeof(BodyReplacementMiku)); } string[] array3 = suitNamesToEnableEvilMiku.Value.Split(','); string[] array4 = array3; foreach (string text2 in array4) { ModelReplacementAPI.RegisterSuitModelReplacement(text2, typeof(BodyReplacementMiku)); } ModelReplacementAPI.RegisterSuitModelReplacement("Green Suit", typeof(BodyReplacementMiku)); Harmony val = new Harmony("meow.MikuModelReplacement"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin meow.MikuModelReplacement is loaded!"); } } public static class Assets { public static string mainAssetBundleName = "mbundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().GetName().Name; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName); MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/QOL/FireExitFlip.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("FireExitFlip")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FireExitFlip")] [assembly: AssemblyTitle("FireExitFlip")] [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 FireExitFlip { [BepInPlugin("PC.FireExitFlip", "FireExitFlip", "1.0.0")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FireExitFlipped is loaded!"); instance = this; _harmony = new Harmony("MyFirstPlugin"); _harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "FireExitFlip"; public const string PLUGIN_NAME = "FireExitFlip"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace FireExitFlip.Patches { [HarmonyPatch] internal class FireExitFlipPatcher { [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")] [HarmonyPostfix] public static void FlipPlayer(EntranceTeleport __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (__instance.isEntranceToBuilding && __instance.entranceId > 0) { Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody; thisPlayerBody.RotateAround(((Component)thisPlayerBody).transform.position, Vector3.up, 180f); } } } }
BepInEx/plugins/FlipMods/ReservedFlashlightSlot.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using ReservedFlashlightSlot.Patches; using ReservedItemSlotCore; using ReservedItemSlotCore.Networking; using ReservedItemSlotCore.Patches; 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("ReservedFlashlightSlot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ReservedFlashlightSlot")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5b7d6563-4e51-4a69-bcf9-fa1dea6eff75")] [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 ReservedFlashlightSlot { public static class ConfigSettings { public static ConfigEntry<string> activateFlashlightKey; public static ConfigEntry<bool> hideFlashlightMeshShoulder; public static string activateFlashlightDisplayName; public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>(); public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); activateFlashlightKey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedFlashlightSlot", "ActivateFlashlightKey", "<Keyboard>/f", "This setting will be ignored if InputUtils is installed and enabled. (I recommend running InputUtils to edit keybinds in the in-game settings)"); hideFlashlightMeshShoulder = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedFlashlightSlot", "HideFlashlightOnShoulder", false, "Hides the flashlight mesh while on your shoulder. Only applies in scenarios where you can view your player in third person."); activateFlashlightDisplayName = GetDisplayName(activateFlashlightKey.Value); currentConfigEntries.Add(((ConfigEntryBase)activateFlashlightKey).Definition.Key, (ConfigEntryBase)(object)activateFlashlightKey); currentConfigEntries.Add(((ConfigEntryBase)hideFlashlightMeshShoulder).Definition.Key, (ConfigEntryBase)(object)hideFlashlightMeshShoulder); TryRemoveOldConfigSettings(); } public static string GetDisplayName(string key) { key = key.Replace("<Keyboard>/", ""); key = key.Replace("<Mouse>/", ""); string text = key; text = text.Replace("leftAlt", "Alt"); text = text.Replace("rightAlt", "Alt"); text = text.Replace("leftCtrl", "Ctrl"); text = text.Replace("rightCtrl", "Ctrl"); text = text.Replace("leftShift", "Shift"); text = text.Replace("rightShift", "Shift"); text = text.Replace("leftButton", "LMB"); text = text.Replace("rightButton", "RMB"); return text.Replace("middleButton", "MMB"); } public static void TryRemoveOldConfigSettings() { HashSet<string> hashSet = new HashSet<string>(); HashSet<string> hashSet2 = new HashSet<string>(); foreach (ConfigEntryBase value in currentConfigEntries.Values) { hashSet.Add(value.Definition.Section); hashSet2.Add(value.Definition.Key); } try { Plugin.Log("Cleaning old config entries"); ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config; string configFilePath = config.ConfigFilePath; if (!File.Exists(configFilePath)) { return; } string text = File.ReadAllText(configFilePath); string[] array = File.ReadAllLines(configFilePath); string text2 = ""; for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ""); if (array[i].Length <= 0) { continue; } if (array[i].StartsWith("[")) { if (text2 != "" && !hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num = text.IndexOf(text2); int num2 = text.IndexOf(array[i]); text = text.Remove(num, num2 - num); } text2 = array[i].Replace("[", "").Replace("]", "").Trim(); } else { if (!(text2 != "")) { continue; } if (i <= array.Length - 4 && array[i].StartsWith("##")) { int j; for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++) { } if (hashSet.Contains(text2)) { int num3 = array[i + j - 1].IndexOf("="); string item = array[i + j - 1].Substring(0, num3 - 1); if (!hashSet2.Contains(item)) { int num4 = text.IndexOf(array[i]); int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length; text = text.Remove(num4, num5 - num4); } } i += j - 1; } else if (array[i].Length > 3) { text = text.Replace(array[i], ""); } } } if (!hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num6 = text.IndexOf(text2); text = text.Remove(num6, text.Length - num6); } while (text.Contains("\n\n\n")) { text = text.Replace("\n\n\n", "\n\n"); } File.WriteAllText(configFilePath, text); config.Reload(); } catch { } } } [BepInPlugin("FlipMods.ReservedFlashlightSlot", "ReservedFlashlightSlot", "1.6.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony _harmony; public static ReservedItemInfo proFlashlightInfo = new ReservedItemInfo("Pro-flashlight", 120, true, true, true, true); public static ReservedItemInfo flashlightInfo = new ReservedItemInfo("Flashlight", 120, true, true, true, true); public static ReservedItemInfo laserPointerInfo = new ReservedItemInfo("Laser pointer", 120, true, true, true, true); private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("ReservedFlashlightSlot"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ReservedFlashlightSlot loaded"); } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } public static void LogWarning(string message) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)message); } public static void LogError(string message) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.ReservedFlashlightSlot"; public const string PLUGIN_NAME = "ReservedFlashlightSlot"; public const string PLUGIN_VERSION = "1.6.2"; } } namespace ReservedFlashlightSlot.Input { internal class IngameKeybinds : LcInputActions { internal static IngameKeybinds Instance = new IngameKeybinds(); [InputAction("<Keyboard>/f", Name = "[ReservedItemSlots]\nToggle flashlight")] public InputAction ToggleFlashlightHotkey { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } internal class InputUtilsCompat { internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils"); public static InputAction ToggleFlashlightHotkey => IngameKeybinds.Instance.ToggleFlashlightHotkey; } [HarmonyPatch] internal static class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; private static InputAction ActivateFlashlightAction; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { InitKeybinds(); } public static void InitKeybinds() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Plugin.Log("Initializing hotkeys."); if (InputUtilsCompat.Enabled) { Asset = InputUtilsCompat.Asset; ActionMap = Asset.actionMaps[0]; ActivateFlashlightAction = InputUtilsCompat.ToggleFlashlightHotkey; } else { Asset = new InputActionAsset(); ActionMap = new InputActionMap("ReservedItemSlots"); InputActionSetupExtensions.AddActionMap(Asset, ActionMap); ActivateFlashlightAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedItemSlots.ToggleFlashlight", (InputActionType)0, ConfigSettings.activateFlashlightKey.Value, (string)null, (string)null, (string)null, (string)null); } } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { Asset.Enable(); ActivateFlashlightAction.performed += OnActivateFlashlightPerformed; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { Asset.Disable(); ActivateFlashlightAction.performed -= OnActivateFlashlightPerformed; } private static void OnActivateFlashlightPerformed(CallbackContext context) { if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject)) { return; } FlashlightItem mainFlashlight = FlashlightPatcher.GetMainFlashlight(localPlayerController); if (((CallbackContext)(ref context)).performed && !((Object)(object)mainFlashlight == (Object)null) && !ShipBuildModeManager.Instance.InBuildMode && !localPlayerController.inTerminalMenu) { float num = (float)Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").GetValue(); if (!(num < 0.075f)) { ((GrabbableObject)mainFlashlight).UseItemOnClient(!((GrabbableObject)mainFlashlight).isBeingUsed); Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").SetValue((object)0); } } } } } namespace ReservedFlashlightSlot.Patches { [HarmonyPatch] internal static class FlashlightPatcher { public static Vector3 playerShoulderPositionOffset = new Vector3(0.2f, 0.25f, 0f); public static Vector3 playerShoulderRotationOffset = new Vector3(90f, 0f, 0f); public static PlayerControllerB localPlayerController => PlayerPatcher.localPlayerController; public static PlayerControllerB GetPreviousPlayerHeldBy(FlashlightItem flashlightItem) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return (PlayerControllerB)Traverse.Create((object)flashlightItem).Field("previousPlayerHeldBy").GetValue(); } public static FlashlightItem GetMainFlashlight(PlayerControllerB playerController) { return GetCurrentlySelectedFlashlight(playerController) ?? GetReservedFlashlight(playerController); } public static FlashlightItem GetReservedFlashlight(PlayerControllerB playerController) { ReservedPlayerData value; return (FlashlightItem)((SyncManager.syncReservedItemsList.Contains(Plugin.flashlightInfo) && PlayerPatcher.allPlayerData.TryGetValue(playerController, out value)) ? /*isinst with value type is only supported in some contexts*/: null); } public static FlashlightItem GetCurrentlySelectedFlashlight(PlayerControllerB playerController) { return (FlashlightItem)((playerController.currentItemSlot >= 0 && playerController.currentItemSlot < playerController.ItemSlots.Length) ? /*isinst with value type is only supported in some contexts*/: null); } public static bool IsFlashlightOn(PlayerControllerB playerController) { return ((GrabbableObject)(GetMainFlashlight(playerController)?)).isBeingUsed ?? false; } [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] [HarmonyPostfix] public static void OnSwitchOnOffFlashlight(bool on, FlashlightItem __instance) { if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null)) { UpdateAllFlashlightStates(((GrabbableObject)__instance).playerHeldBy, on); } } [HarmonyPatch(typeof(FlashlightItem), "PocketItem")] [HarmonyPostfix] public static void OnPocketFlashlightLocal(FlashlightItem __instance) { OnPocketFlashlight(__instance, ((GrabbableObject)__instance).isBeingUsed); } [HarmonyPatch(typeof(FlashlightItem), "PocketFlashlightClientRpc")] [HarmonyPrefix] public static void OnPocketFlashlightClientRpc(bool stillUsingFlashlight, FlashlightItem __instance) { if (NetworkHelper.IsValidClientRpcExecStage((NetworkBehaviour)(object)__instance) && !((NetworkBehaviour)__instance).IsOwner && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController)) { OnPocketFlashlight(__instance, stillUsingFlashlight); } } private static void OnPocketFlashlight(FlashlightItem flashlightItem, bool stillUsingFlashlight = false) { if ((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)null) { return; } FlashlightItem currentlySelectedFlashlight = GetCurrentlySelectedFlashlight(((GrabbableObject)flashlightItem).playerHeldBy); FlashlightItem reservedFlashlight = GetReservedFlashlight(((GrabbableObject)flashlightItem).playerHeldBy); bool flag = stillUsingFlashlight || ((Object)(object)currentlySelectedFlashlight != (Object)null && ((GrabbableObject)currentlySelectedFlashlight).isBeingUsed); if ((Object)(object)currentlySelectedFlashlight != (Object)null && ((GrabbableObject)currentlySelectedFlashlight).isBeingUsed) { ((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight = null; } else if (((GrabbableObject)flashlightItem).isBeingUsed) { ((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight = (GrabbableObject)(object)flashlightItem; } else if ((Object)(object)reservedFlashlight != (Object)null && ((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight == (Object)null || !((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight.isBeingUsed)) { ((GrabbableObject)flashlightItem).playerHeldBy.pocketedFlashlight = (GrabbableObject)(object)reservedFlashlight; } MeshRenderer[] componentsInChildren = ((Component)flashlightItem).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = (((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)(object)localPlayerController) ? 23 : 6); } } if ((Object)(object)flashlightItem == (Object)(object)reservedFlashlight) { ((GrabbableObject)flashlightItem).parentObject = ((GrabbableObject)flashlightItem).playerHeldBy.playerGlobalHead.parent; } } [HarmonyPatch(typeof(FlashlightItem), "EquipItem")] [HarmonyPostfix] public static void OnEquipFlashlight(FlashlightItem __instance) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) { return; } bool mainFlashlightActive = ((Object)(object)((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight != (Object)null && ((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight.isBeingUsed) || ((GrabbableObject)__instance).isBeingUsed; FlashlightItem reservedFlashlight = GetReservedFlashlight(((GrabbableObject)__instance).playerHeldBy); if (((GrabbableObject)__instance).isBeingUsed || (Object)(object)__instance == (Object)(object)((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight) { ((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight = null; } else if ((Object)(object)reservedFlashlight != (Object)null && ((Object)(object)((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight == (Object)null || !((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight.isBeingUsed)) { ((GrabbableObject)__instance).playerHeldBy.pocketedFlashlight = (GrabbableObject)(object)reservedFlashlight; } MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = 6; } } ((GrabbableObject)__instance).parentObject = (((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) ? ((GrabbableObject)__instance).playerHeldBy.localItemHolder : ((GrabbableObject)__instance).playerHeldBy.serverItemHolder); UpdateAllFlashlightStates(((GrabbableObject)__instance).playerHeldBy, mainFlashlightActive); } [HarmonyPatch(typeof(FlashlightItem), "DiscardItem")] [HarmonyPrefix] public static void ResetPocketedFlashlight(FlashlightItem __instance) { PlayerControllerB previousPlayerHeldBy = GetPreviousPlayerHeldBy(__instance); if ((Object)(object)previousPlayerHeldBy == (Object)null) { return; } FlashlightItem reservedFlashlight = GetReservedFlashlight(previousPlayerHeldBy); if ((Object)(object)reservedFlashlight != (Object)null && ((Object)(object)__instance == (Object)(object)previousPlayerHeldBy.pocketedFlashlight || (Object)(object)previousPlayerHeldBy.pocketedFlashlight == (Object)null)) { previousPlayerHeldBy.pocketedFlashlight = (GrabbableObject)(object)reservedFlashlight; } MeshRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = 6; } } } [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] [HarmonyPostfix] public static void SetPositionOffset(GrabbableObject __instance) { //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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (__instance is FlashlightItem && (Object)(object)__instance.playerHeldBy != (Object)null && (Object)(object)__instance.parentObject != (Object)null && __instance.isPocketed && (Object)(object)__instance == (Object)(object)GetReservedFlashlight(__instance.playerHeldBy) && (Object)(object)__instance != (Object)(object)GetCurrentlySelectedFlashlight(__instance.playerHeldBy)) { Transform transform = ((Component)__instance.parentObject).transform; ((Component)__instance).transform.rotation = ((Component)__instance.parentObject).transform.rotation * Quaternion.Euler(playerShoulderRotationOffset); ((Component)__instance).transform.position = transform.position + transform.rotation * playerShoulderPositionOffset; } } [HarmonyPatch(typeof(GrabbableObject), "EnableItemMeshes")] [HarmonyPrefix] public static void OnEnableItemMeshes(ref bool enable, GrabbableObject __instance) { if (__instance is FlashlightItem && (Object)(object)__instance.playerHeldBy != (Object)null && (Object)(object)__instance == (Object)(object)GetReservedFlashlight(__instance.playerHeldBy) && !ConfigSettings.hideFlashlightMeshShoulder.Value && !ReservedItemPatcher.ReservedItemIsBeingGrabbed(__instance)) { enable = true; } } private static void UpdateAllFlashlightStates(PlayerControllerB playerController, bool mainFlashlightActive = true) { FlashlightItem mainFlashlight = GetMainFlashlight(playerController); if ((Object)(object)mainFlashlight == (Object)null) { ((Behaviour)playerController.helmetLight).enabled = false; mainFlashlightActive = false; } else { playerController.ChangeHelmetLight(mainFlashlight.flashlightTypeID, mainFlashlightActive && (Object)(object)playerController == (Object)(object)localPlayerController && (Object)(object)playerController.ItemSlots[playerController.currentItemSlot] != (Object)(object)mainFlashlight); } for (int i = 0; i < playerController.ItemSlots.Length; i++) { GrabbableObject obj = playerController.ItemSlots[i]; FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if ((Object)(object)val != (Object)null) { UpdateFlashlightState(val, (Object)(object)val == (Object)(object)mainFlashlight && mainFlashlightActive); } } } private static void UpdateFlashlightState(FlashlightItem flashlightItem, bool active) { if (!((Object)(object)((GrabbableObject)flashlightItem).playerHeldBy == (Object)null)) { PlayerControllerB playerHeldBy = ((GrabbableObject)flashlightItem).playerHeldBy; ((GrabbableObject)flashlightItem).isBeingUsed = active; bool flag = (Object)(object)playerHeldBy != (Object)(object)localPlayerController || (Object)(object)playerHeldBy.ItemSlots[playerHeldBy.currentItemSlot] == (Object)(object)flashlightItem; ((Behaviour)flashlightItem.flashlightBulb).enabled = active && flag; ((Behaviour)flashlightItem.flashlightBulbGlow).enabled = active && flag; flashlightItem.usingPlayerHelmetLight = active && !flag; } } } [HarmonyPatch] public class MaskedEnemyPatcher { public static Dictionary<MaskedPlayerEnemy, GameObject> heldFlashlightsByEnemy = new Dictionary<MaskedPlayerEnemy, GameObject>(); public static HashSet<MaskedPlayerEnemy> spawnedEnemies = new HashSet<MaskedPlayerEnemy>(); [HarmonyPatch(typeof(MaskedPlayerEnemy), "OnDestroy")] [HarmonyPrefix] public static void OnDestroy(MaskedPlayerEnemy __instance) { if (heldFlashlightsByEnemy.TryGetValue(__instance, out var value)) { Plugin.LogWarning("Destroying flashlight. Enemy destroyed."); Object.DestroyImmediate((Object)(object)value); spawnedEnemies.Remove(__instance); } heldFlashlightsByEnemy.Remove(__instance); } [HarmonyPatch(typeof(MaskedPlayerEnemy), "LateUpdate")] [HarmonyPostfix] public static void ShowWalkieOnEnemy(MaskedPlayerEnemy __instance) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_013c: 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_0184: Unknown result type (might be due to invalid IL or missing references) if (!spawnedEnemies.Contains(__instance) && SyncManager.syncReservedItemsList.Contains(Plugin.proFlashlightInfo) && !((EnemyAI)__instance).isEnemyDead && !heldFlashlightsByEnemy.ContainsKey(__instance) && (Object)(object)__instance.mimickingPlayer != (Object)null && PlayerPatcher.allPlayerData.TryGetValue(__instance.mimickingPlayer, out var value)) { spawnedEnemies.Add(__instance); FlashlightItem reservedFlashlight = FlashlightPatcher.GetReservedFlashlight(value.playerController); if ((Object)(object)reservedFlashlight != (Object)null) { Plugin.LogWarning("OnMaskedEnemySpawn - MimickingPlayer: " + ((Object)value.playerController).name + " - Spawning flashlight object on enemy."); GameObject val = new GameObject("ReservedFlashlight [MaskedEnemy]"); Light[] componentsInChildren = ((Component)reservedFlashlight).GetComponentsInChildren<Light>(); MeshRenderer mainObjectRenderer = ((GrabbableObject)reservedFlashlight).mainObjectRenderer; Light[] array = componentsInChildren; foreach (Light val2 in array) { Light component = Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)val2).transform.localPosition, ((Component)val2).transform.localRotation, val.transform).GetComponent<Light>(); ((Behaviour)component).enabled = true; ((Component)component).gameObject.layer = 6; } MeshRenderer component2 = Object.Instantiate<GameObject>(((Component)mainObjectRenderer).gameObject, ((Component)mainObjectRenderer).transform.localPosition, ((Component)mainObjectRenderer).transform.localRotation, val.transform).GetComponent<MeshRenderer>(); ((Renderer)component2).enabled = true; ((Component)component2).gameObject.layer = 6; val.transform.localScale = ((Component)reservedFlashlight).transform.localScale; heldFlashlightsByEnemy.Add(__instance, val); } } if (heldFlashlightsByEnemy.TryGetValue(__instance, out var value2)) { if (((EnemyAI)__instance).isEnemyDead) { Plugin.LogWarning("Destroying flashlight. Enemy dead."); Object.DestroyImmediate((Object)(object)value2); spawnedEnemies.Remove(__instance); heldFlashlightsByEnemy.Remove(__instance); } else { Transform parent = ((EnemyAI)__instance).eye.parent.parent; value2.transform.rotation = parent.rotation * Quaternion.Euler(FlashlightPatcher.playerShoulderRotationOffset); value2.transform.position = parent.position + parent.rotation * FlashlightPatcher.playerShoulderPositionOffset; } } } } }
BepInEx/plugins/FlipMods/ReservedItemSlotCore.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using ReservedItemSlotCore.Compatibility; using ReservedItemSlotCore.Config; using ReservedItemSlotCore.Input; using ReservedItemSlotCore.Networking; using ReservedItemSlotCore.Patches; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ReservedItemSlotCore")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ReservedItemSlotCore")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("238ce080-e339-46b6-9b08-992a950453a1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("ReservedFlashlightSlot")] [assembly: InternalsVisibleTo("ReservedWalkieSlot")] [assembly: InternalsVisibleTo("ReservedBoomboxSlot")] [assembly: InternalsVisibleTo("ReservedSprayPaintSlot")] [assembly: InternalsVisibleTo("ReservedWeaponSlot")] [assembly: InternalsVisibleTo("ReservedUtilitySlot")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ReservedItemSlotCore { internal class ReservedPlayerData { public PlayerControllerB playerController; public ReservedItemInfo grabbingReservedItemInfo = null; public GrabbableObject grabbingReservedItem = null; public int previousHotbarIndex = -1; public bool inReservedHotbarSlots = false; public int hotbarSize = 4; public int reservedHotbarStartIndex = 4; public bool isLocalPlayer => (Object)(object)playerController != (Object)null && (Object)(object)playerController == (Object)(object)StartOfRound.Instance?.localPlayerController; public int currentItemSlot => playerController.currentItemSlot; public bool currentItemSlotIsReserved => currentItemSlot >= reservedHotbarStartIndex && currentItemSlot < reservedHotbarStartIndex + SyncManager.numReservedItemSlots; public GrabbableObject previouslyHeldItem => (previousHotbarIndex >= 0 && previousHotbarIndex < playerController.ItemSlots.Length) ? playerController.ItemSlots[previousHotbarIndex] : null; public bool throwingObject => (bool)Traverse.Create((object)playerController).Field("throwingObject").GetValue(); public int reservedHotbarEndIndexExcluded => reservedHotbarStartIndex + SyncManager.numReservedItemSlots; public bool IsReservedItemSlot(int index) { return index >= reservedHotbarStartIndex && index < reservedHotbarStartIndex + SyncManager.numReservedItemSlots; } public int GetNumHeldReservedItems() { int num = 0; for (int i = 0; i < playerController.ItemSlots.Length; i++) { GrabbableObject val = playerController.ItemSlots[i]; num += (((Object)(object)val != (Object)null && SyncManager.IsReservedItem(val.itemProperties.itemName)) ? 1 : 0); } return num; } public GrabbableObject GetReservedItem(ReservedItemInfo itemInfo) { if (itemInfo == null) { return null; } int num = reservedHotbarStartIndex + itemInfo.reservedItemIndex; return (num >= 0 && num < playerController.ItemSlots.Length) ? playerController.ItemSlots[num] : null; } public string DumpData() { if ((Object)(object)playerController == (Object)null) { Plugin.LogError("PLAYER NULL"); } if (SyncManager.syncReservedItemSlotReps == null) { Plugin.LogError("REPS NULL"); } string text = "[ReservedPlayerData Dump]\nPlayer: " + ((Object)playerController).name + (isLocalPlayer ? " [LocalPlayer]" : "") + "\nCurrentItemSlot: " + currentItemSlot + "\nRegisteredHotbarSize: " + hotbarSize + "\nActualHotbarSize: " + playerController.ItemSlots.Length + "\nCurrentlyGrabbingReservedItem: " + ((grabbingReservedItemInfo != null) ? grabbingReservedItemInfo.itemName : "false") + "\nReservedHotbarStartIndex: " + reservedHotbarStartIndex + "\n" + (isLocalPlayer ? ("NumItemSlotsHUD: " + HUDManager.Instance.itemSlotIconFrames.Length + "\n") : "") + "ItemsInInventory: ["; for (int i = 0; i < playerController.ItemSlots.Length; i++) { if (i > 0) { text += ", "; } text += (("[" + i + "] " + (object)playerController.ItemSlots[i] != null) ? ((Object)playerController.ItemSlots[i]).name : "Empty"); } return text + "]\nNumHeldReservedItems: " + GetNumHeldReservedItems(); } } [BepInPlugin("FlipMods.ReservedItemSlotCore", "ReservedItemSlotCore", "1.8.13")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private static ManualLogSource logger; public static Dictionary<string, ReservedItemInfo> reservedItemsDictDefault => ReservedItemInfo.reservedItemsDictDefault; public static List<ReservedItemInfo> reservedItemsListDefault => ReservedItemInfo.reservedItemsListDefault; public static List<ReservedItemInfo> reservedItemSlotRepsDefault => ReservedItemInfo.reservedItemSlotRepsDefault; public static int numReservedItemSlotsDefault => ReservedItemInfo.numReservedItemSlotsDefault; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown instance = this; CreateCustomLogger(); ConfigSettings.BindConfigSettings(); _harmony = new Harmony("ReservedItemSlotCore"); _harmony.PatchAll(); Log("ReservedItemSlotCore loaded"); } private void CreateCustomLogger() { try { logger = Logger.CreateLogSource($"{((BaseUnityPlugin)this).Info.Metadata.Name}-{((BaseUnityPlugin)this).Info.Metadata.Version}"); } catch { logger = ((BaseUnityPlugin)this).Logger; } } public static void Log(string message) { logger.LogInfo((object)message); } public static void LogError(string message) { logger.LogError((object)message); } public static void LogWarning(string message) { logger.LogWarning((object)message); } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } public static bool IsReservedItemDefault(string itemName) { return reservedItemsDictDefault.ContainsKey(itemName); } public static ReservedItemInfo GetReservedItemInfoDefault(string itemName) { return IsReservedItemDefault(itemName) ? reservedItemsDictDefault[itemName] : null; } public static ReservedItemInfo GetReservedItemInfoDefault(GrabbableObject item) { return ((Object)(object)item != (Object)null) ? GetReservedItemInfoDefault(item.itemProperties.itemName) : null; } } internal class ReservedItemInfo { public static Dictionary<string, ReservedItemInfo> reservedItemsDictDefault = new Dictionary<string, ReservedItemInfo>(); public static List<ReservedItemInfo> reservedItemsListDefault = new List<ReservedItemInfo>(); public static List<ReservedItemInfo> reservedItemSlotRepsDefault = new List<ReservedItemInfo>(); public static Dictionary<string, ReservedItemInfo> reservedItemsDict = new Dictionary<string, ReservedItemInfo>(); public static List<ReservedItemInfo> reservedItemsList = new List<ReservedItemInfo>(); public static List<ReservedItemInfo> reservedItemSlotReps = new List<ReservedItemInfo>(); public string itemName = ""; public HashSet<string> acceptedItemNames; public int hotbarSlotPriority = 0; public int reservedItemIndex = 0; public bool forceUpdateCanBeGrabbedBeforeGameStart = false; public bool canBeGrabbedBeforeGameStart = false; public bool forceUpdateRequiresBattery = false; public bool requiresBattery = false; public static int numReservedItemSlotsDefault => reservedItemSlotRepsDefault.Count; public ReservedItemInfo() { } public ReservedItemInfo(string itemName, int hotbarSlotPriority, bool forceUpdateCanBeGrabbedBeforeGameStart = false, bool canBeGrabbedBeforeGameStart = false, bool forceUpdateRequiresBattery = false, bool requiresBattery = false) { this.itemName = itemName; this.hotbarSlotPriority = hotbarSlotPriority; AddItemInfoToList(this); ReservedItemInfo info = new ReservedItemInfo(this); AddItemInfoToList(info, reservedItemsListDefault, reservedItemsDictDefault, reservedItemSlotRepsDefault); } public static void AddItemInfoToList(ReservedItemInfo info, List<ReservedItemInfo> _reservedItemsList = null, Dictionary<string, ReservedItemInfo> _reservedItemsDict = null, List<ReservedItemInfo> _reservedItemSlotReps = null) { if (_reservedItemsList == null) { _reservedItemsList = reservedItemsList; } if (_reservedItemsDict == null) { _reservedItemsDict = reservedItemsDict; } if (_reservedItemSlotReps == null) { _reservedItemSlotReps = reservedItemSlotReps; } if (!_reservedItemsDict.ContainsKey(info.itemName)) { _reservedItemsDict.Add(info.itemName, info); _reservedItemsList.Add(info); int i; for (i = 0; i < _reservedItemSlotReps.Count; i++) { ReservedItemInfo reservedItemInfo = _reservedItemSlotReps[i]; if (info.hotbarSlotPriority >= reservedItemInfo.hotbarSlotPriority) { break; } } info.reservedItemIndex = i; if (i == _reservedItemSlotReps.Count || info.hotbarSlotPriority != _reservedItemSlotReps[i].hotbarSlotPriority) { info.acceptedItemNames = new HashSet<string> { info.itemName }; _reservedItemSlotReps.Insert(i, info); { foreach (ReservedItemInfo _reservedItems in _reservedItemsList) { if (info != _reservedItems && _reservedItems.reservedItemIndex >= i) { _reservedItems.reservedItemIndex++; } } return; } } info.acceptedItemNames = _reservedItemSlotReps[i].acceptedItemNames; info.acceptedItemNames.Add(info.itemName); } else { Plugin.Log($"Tried to add duplicate item name to the ReservedItems list: {info.itemName}. Sorting instead"); } } public ReservedItemInfo(ReservedItemInfo copyFrom) { itemName = copyFrom.itemName; hotbarSlotPriority = copyFrom.hotbarSlotPriority; reservedItemIndex = copyFrom.reservedItemIndex; forceUpdateCanBeGrabbedBeforeGameStart = copyFrom.forceUpdateCanBeGrabbedBeforeGameStart; canBeGrabbedBeforeGameStart = copyFrom.canBeGrabbedBeforeGameStart; forceUpdateRequiresBattery = copyFrom.forceUpdateRequiresBattery; requiresBattery = copyFrom.requiresBattery; } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.ReservedItemSlotCore"; public const string PLUGIN_NAME = "ReservedItemSlotCore"; public const string PLUGIN_VERSION = "1.8.13"; } } namespace ReservedItemSlotCore.Config { public static class ConfigSettings { public static ConfigEntry<string> focusReservedHotbarHotkey; public static ConfigEntry<bool> toggleFocusReservedHotbar; public static ConfigEntry<bool> preventReservedItemSlotFade; public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>(); public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); focusReservedHotbarHotkey = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedItemSlotCore", "FocusReservedItemSlotsHotkey", "<Keyboard>/leftAlt", "This setting will be ignored if InputUtils is installed and enabled. (I recommend running InputUtils to edit keybinds in the in-game settings)")); toggleFocusReservedHotbar = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedItemSlotCore", "ToggleFocusReservedHotbar", false, "If set to true, swapping to the reserved hotbar slots will be toggled when pressing the hotkey rather than while holding the hotkey. Setting this option to true may have bugs at this current time.")); preventReservedItemSlotFade = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedItemSlotCore", "PreventReservedHotbarSlotFade", false, "If true, the reserved hotbar slots will not fade with the rest of the default slots.")); TryRemoveOldConfigSettings(); } public static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry) { currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry); return configEntry; } public static string GetDisplayName(string key) { try { if (key.Length <= 1) { return key; } int num = key.IndexOf(">/"); key = ((num >= 0) ? key.Substring(num + 2) : key); string text = key.ToLower(); text = text.Replace("leftalt", "Alt"); text = text.Replace("rightalt", "Alt"); text = text.Replace("leftctrl", "Ctrl"); text = text.Replace("rightctrl", "Ctrl"); text = text.Replace("leftshift", "Shift"); text = text.Replace("rightshift", "Shift"); text = text.Replace("leftbutton", "LMB"); text = text.Replace("rightbutton", "RMB"); text = text.Replace("middlebutton", "MMB"); text = text.Replace("lefttrigger", "LT"); text = text.Replace("righttrigger", "RT"); text = text.Replace("leftshoulder", "LB"); text = text.Replace("rightshoulder", "RB"); text = text.Replace("leftstickpress", "LS"); text = text.Replace("rightstickpress", "RS"); try { text = char.ToUpper(text[0]) + text.Substring(1); } catch { } return text; } catch { return ""; } } public static void TryRemoveOldConfigSettings() { HashSet<string> hashSet = new HashSet<string>(); HashSet<string> hashSet2 = new HashSet<string>(); foreach (ConfigEntryBase value in currentConfigEntries.Values) { hashSet.Add(value.Definition.Section); hashSet2.Add(value.Definition.Key); } try { Plugin.Log("Cleaning old config entries"); ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config; string configFilePath = config.ConfigFilePath; if (!File.Exists(configFilePath)) { return; } string text = File.ReadAllText(configFilePath); string[] array = File.ReadAllLines(configFilePath); string text2 = ""; for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ""); if (array[i].Length <= 0) { continue; } if (array[i].StartsWith("[")) { if (text2 != "" && !hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num = text.IndexOf(text2); int num2 = text.IndexOf(array[i]); text = text.Remove(num, num2 - num); } text2 = array[i].Replace("[", "").Replace("]", "").Trim(); } else { if (!(text2 != "")) { continue; } if (i <= array.Length - 4 && array[i].StartsWith("##")) { int j; for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++) { } if (hashSet.Contains(text2)) { int num3 = array[i + j - 1].IndexOf("="); string item = array[i + j - 1].Substring(0, num3 - 1); if (!hashSet2.Contains(item)) { int num4 = text.IndexOf(array[i]); int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length; text = text.Remove(num4, num5 - num4); } } i += j - 1; } else if (array[i].Length > 3) { text = text.Replace(array[i], ""); } } } if (!hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num6 = text.IndexOf(text2); text = text.Remove(num6, text.Length - num6); } while (text.Contains("\n\n\n")) { text = text.Replace("\n\n\n", "\n\n"); } File.WriteAllText(configFilePath, text); config.Reload(); } catch { } } } } namespace ReservedItemSlotCore.Networking { public static class NetworkHelper { private static int NONE_EXEC_STAGE = 0; private static int SERVER_EXEC_STAGE = 1; private static int CLIENT_EXEC_STAGE = 2; public static int GetExecStage(NetworkBehaviour __instance) { return (int)Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue(); } public static bool IsClientExecStage(NetworkBehaviour __instance) { return GetExecStage(__instance) == CLIENT_EXEC_STAGE; } public static bool IsServerExecStage(NetworkBehaviour __instance) { return GetExecStage(__instance) == SERVER_EXEC_STAGE; } public static bool IsValidClientRpcExecStage(NetworkBehaviour __instance) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening) { return false; } int num = (int)Traverse.Create((object)__instance).Field("__rpc_exec_stage").GetValue(); if ((singleton.IsServer || singleton.IsHost) && num != 2) { return false; } return true; } } [HarmonyPatch] internal class SyncManager { public static PlayerControllerB localPlayerController; public static bool isSynced = false; public static bool canUseModDisabledOnHost = true; public static Dictionary<string, ReservedItemInfo> syncReservedItemsDict = new Dictionary<string, ReservedItemInfo>(); public static List<ReservedItemInfo> syncReservedItemsList = new List<ReservedItemInfo>(); public static List<ReservedItemInfo> syncReservedItemSlotReps = new List<ReservedItemInfo>(); public static int numReservedItemSlots => syncReservedItemSlotReps.Count; public static bool IsReservedItem(string itemName) { return syncReservedItemsDict.ContainsKey(itemName); } public static bool TryGetReservedItemInfo(string itemName, out ReservedItemInfo info) { info = null; if (IsReservedItem(itemName)) { info = syncReservedItemsDict[itemName]; return true; } return false; } public static bool TryGetReservedItemInfo(GrabbableObject item, out ReservedItemInfo info) { info = null; return (Object)(object)item != (Object)null && TryGetReservedItemInfo(item.itemProperties.itemName, out info); } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] public static void ResetValues() { isSynced = false; localPlayerController = null; } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void Init(PlayerControllerB __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown localPlayerController = __instance; NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("ReservedItemSlots-OnSwapHotbarClientRpc", new HandleNamedMessageDelegate(OnSwapHotbarClientRpc)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("ReservedItemSlots-RequestSyncClientRpc", new HandleNamedMessageDelegate(RequestSyncClientRpc)); if (NetworkManager.Singleton.IsServer) { isSynced = true; syncReservedItemsDict = ReservedItemInfo.reservedItemsDict; syncReservedItemsList = ReservedItemInfo.reservedItemsList; syncReservedItemSlotReps = ReservedItemInfo.reservedItemSlotReps; NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("ReservedItemSlots-OnSwapHotbarServerRpc", new HandleNamedMessageDelegate(OnSwapHotbarServerRpc)); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("ReservedItemSlots-RequestSyncServerRpc", new HandleNamedMessageDelegate(RequestSyncServerRpc)); { foreach (ReservedItemInfo syncReservedItems in syncReservedItemsList) { ReservedItemInfo reservedItemInfo = ReservedItemInfo.reservedItemsDictDefault[syncReservedItems.itemName]; syncReservedItems.hotbarSlotPriority = reservedItemInfo.hotbarSlotPriority; syncReservedItems.reservedItemIndex = reservedItemInfo.reservedItemIndex; } return; } } isSynced = false; if (canUseModDisabledOnHost) { syncReservedItemsDict = ReservedItemInfo.reservedItemsDict; syncReservedItemsList = ReservedItemInfo.reservedItemsList; syncReservedItemSlotReps = ReservedItemInfo.reservedItemSlotReps; } else { syncReservedItemsDict = new Dictionary<string, ReservedItemInfo>(); syncReservedItemsList = new List<ReservedItemInfo>(); syncReservedItemSlotReps = new List<ReservedItemInfo>(); } RequestSyncWithServer(); } private static void RequestSyncWithServer() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.Log("Requesting sync with server."); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("ReservedItemSlots-RequestSyncServerRpc", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)3); } } private static void RequestSyncServerRpc(ulong clientId, FastBufferReader reader) { //IL_009b: 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_00d9: 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_0178: 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_010d: 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_0137: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } Plugin.Log("Receiving sync request from client: " + clientId); int num = 4 * syncReservedItemsList.Count; foreach (ReservedItemInfo syncReservedItems in syncReservedItemsList) { num += 4 + 2 * syncReservedItems.itemName.Length; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num, (Allocator)2, -1); int count = syncReservedItemsList.Count; ((FastBufferWriter)(ref val)).WriteValue<int>(ref count, default(ForPrimitives)); foreach (ReservedItemInfo syncReservedItems2 in syncReservedItemsList) { count = syncReservedItems2.itemName.Length; ((FastBufferWriter)(ref val)).WriteValue<int>(ref count, default(ForPrimitives)); string itemName = syncReservedItems2.itemName; for (int i = 0; i < itemName.Length; i++) { char c = itemName[i]; ((FastBufferWriter)(ref val)).WriteValue<char>(ref c, default(ForPrimitives)); } ((FastBufferWriter)(ref val)).WriteValue<int>(ref syncReservedItems2.hotbarSlotPriority, default(ForPrimitives)); } Plugin.Log("Sent sync to client."); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("ReservedItemSlots-RequestSyncClientRpc", clientId, val, (NetworkDelivery)3); } private static void RequestSyncClientRpc(ulong clientId, FastBufferReader reader) { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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) if (!NetworkManager.Singleton.IsClient || NetworkManager.Singleton.IsServer) { return; } PlayerPatcher.isSynced = false; isSynced = true; syncReservedItemsDict = new Dictionary<string, ReservedItemInfo>(); syncReservedItemsList = new List<ReservedItemInfo>(); syncReservedItemSlotReps = new List<ReservedItemInfo>(); Plugin.Log("Receiving sync from server."); int num = default(int); ((FastBufferReader)(ref reader)).ReadValue<int>(ref num, default(ForPrimitives)); int num2 = default(int); char c = default(char); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValue<int>(ref num2, default(ForPrimitives)); ((FastBufferReader)(ref reader)).TryBeginRead(2 * num2); string text = ""; for (int j = 0; j < num2; j++) { ((FastBufferReader)(ref reader)).ReadValue<char>(ref c, default(ForPrimitives)); text += c; } bool flag = ReservedItemInfo.reservedItemsDict.ContainsKey(text); ReservedItemInfo reservedItemInfo = (ReservedItemInfo.reservedItemsDict.ContainsKey(text) ? ReservedItemInfo.reservedItemsDict[text] : new ReservedItemInfo { itemName = text }); ((FastBufferReader)(ref reader)).ReadValue<int>(ref reservedItemInfo.hotbarSlotPriority, default(ForPrimitives)); Plugin.Log("Receiving sync for item: - Item: " + reservedItemInfo.itemName + " Prio: " + reservedItemInfo.hotbarSlotPriority); ReservedItemInfo.AddItemInfoToList(reservedItemInfo, syncReservedItemsList, syncReservedItemsDict, syncReservedItemSlotReps); } Plugin.Log("Received sync for " + syncReservedItemSlotReps.Count + " reserved item slots. (" + syncReservedItemsList.Count + " items total)"); } private static void SendSwapHotbarUpdate(int hotbarSlot) { //IL_003b: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.Log("Sending OnSwapReservedHotbar update to server. Hotbar slot: " + hotbarSlot); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValue<int>(ref hotbarSlot, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("ReservedItemSlots-OnSwapHotbarServerRpc", 0uL, val, (NetworkDelivery)3); } } private static void OnSwapHotbarServerRpc(ulong clientId, FastBufferReader reader) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_008a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValue<int>(ref num, default(ForPrimitives)); Plugin.Log("Receiving OnSwapReservedHotbar update from client. ClientId: " + clientId + " Slot: " + num); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(12, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref clientId, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("ReservedItemSlots-OnSwapHotbarClientRpc", val, (NetworkDelivery)3); } } private static void OnSwapHotbarClientRpc(ulong clientId, FastBufferReader reader) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { int hotbarSlot = default(int); ((FastBufferReader)(ref reader)).ReadValue<int>(ref hotbarSlot, default(ForPrimitives)); ulong num = default(ulong); ((FastBufferReader)(ref reader)).ReadValue<ulong>(ref num, default(ForPrimitives)); Plugin.Log("Receiving OnSwapReservedHotbar update from client. ClientId: " + num + " Slot: " + hotbarSlot); if (num != localPlayerController.actualClientId && !TryUpdateClientHotbarSlot(num, hotbarSlot)) { Plugin.Log("Failed to receive hotbar swap index from Client: " + num); } } } private static bool TryUpdateClientHotbarSlot(ulong clientId, int hotbarSlot) { for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (val.actualClientId == clientId) { CallSwitchToItemSlotMethod(val, hotbarSlot); return true; } } return false; } public static void SwapHotbarSlot(int hotbarIndex) { SendSwapHotbarUpdate(hotbarIndex); CallSwitchToItemSlotMethod(localPlayerController, hotbarIndex); } private static void CallSwitchToItemSlotMethod(PlayerControllerB playerController, int hotbarIndex) { if (!((Object)(object)playerController == (Object)null) && playerController.ItemSlots != null && hotbarIndex >= 0 && hotbarIndex < playerController.ItemSlots.Length) { if ((Object)(object)playerController == (Object)(object)localPlayerController) { ShipBuildModeManager.Instance.CancelBuildMode(true); playerController.playerBodyAnimator.SetBool("GrabValidated", false); } ReservedItemPatcher.SwitchToItemSlot(playerController, hotbarIndex); if ((Object)(object)playerController.currentlyHeldObjectServer != (Object)null) { ((Component)playerController.currentlyHeldObjectServer).gameObject.GetComponent<AudioSource>().PlayOneShot(playerController.currentlyHeldObjectServer.itemProperties.grabSFX, 0.6f); } } } } } namespace ReservedItemSlotCore.Input { internal class IngameKeybinds : LcInputActions { internal static IngameKeybinds Instance = new IngameKeybinds(); [InputAction("<Keyboard>/leftAlt", Name = "[ReservedItemSlots]\nSwap hotbar")] public InputAction FocusReservedHotbarHotkey { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } internal class InputUtilsCompat { internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils"); internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); public static InputAction FocusReservedHotbarHotkey => IngameKeybinds.Instance.FocusReservedHotbarHotkey; } [HarmonyPatch] internal class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; public static InputAction FocusReservedHotbarAction; public static InputAction RawScrollAction; public static bool holdingModifierKey; public static bool scrollingReservedHotbar; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { InitKeybinds(); } public static void InitKeybinds() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown if (InputUtilsCompat.Enabled) { Asset = InputUtilsCompat.Asset; FocusReservedHotbarAction = InputUtilsCompat.FocusReservedHotbarHotkey; } else { Asset = ScriptableObject.CreateInstance<InputActionAsset>(); ActionMap = new InputActionMap("ReservedItemSlots"); InputActionSetupExtensions.AddActionMap(Asset, ActionMap); FocusReservedHotbarAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedItemSlots.FocusReservedHotbar", (InputActionType)0, ConfigSettings.focusReservedHotbarHotkey.Value, (string)null, (string)null, (string)null, (string)null); } RawScrollAction = new InputAction("ReservedItemSlots.RawScroll", (InputActionType)0, "<Mouse>/scroll/y", (string)null, (string)null, (string)null); } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPrefix] public static void OnEnable() { Asset.Enable(); RawScrollAction.Enable(); FocusReservedHotbarAction.performed += FocusReservedHotbarSlotsAction; if (!ConfigSettings.toggleFocusReservedHotbar.Value) { FocusReservedHotbarAction.canceled += UnfocusReservedHotbarSlotsPerformed; } RawScrollAction.performed += OnScrollReservedHotbar; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPrefix] public static void OnDisable() { Asset.Disable(); RawScrollAction.Disable(); FocusReservedHotbarAction.performed -= FocusReservedHotbarSlotsAction; if (!ConfigSettings.toggleFocusReservedHotbar.Value) { FocusReservedHotbarAction.canceled -= UnfocusReservedHotbarSlotsPerformed; } RawScrollAction.performed -= OnScrollReservedHotbar; } private static void FocusReservedHotbarSlotsAction(CallbackContext context) { if ((Object)(object)localPlayerController == (Object)null || !((NetworkBehaviour)localPlayerController).IsOwner || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject) || SyncManager.numReservedItemSlots <= 0 || !HUDPatcher.hasReservedItemSlotsAndEnabled) { return; } if (!ConfigSettings.toggleFocusReservedHotbar.Value) { holdingModifierKey = true; } if (((CallbackContext)(ref context)).performed && ReservedItemPatcher.CanSwapToReservedHotbarSlot()) { if (!ConfigSettings.toggleFocusReservedHotbar.Value) { ReservedItemPatcher.FocusReservedHotbarSlots(active: true); } else { ReservedItemPatcher.FocusReservedHotbarSlots(!PlayerPatcher.playerDataLocal.currentItemSlotIsReserved); } } } private static void UnfocusReservedHotbarSlotsPerformed(CallbackContext context) { if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject)) { holdingModifierKey = false; if (((CallbackContext)(ref context)).canceled && ReservedItemPatcher.CanSwapToReservedHotbarSlot()) { ReservedItemPatcher.FocusReservedHotbarSlots(active: false); } } } private static void OnScrollReservedHotbar(CallbackContext context) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)localPlayerController == (Object)null) && ((NetworkBehaviour)localPlayerController).IsOwner && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && ((CallbackContext)(ref context)).performed && !PlayerPatcher.playerDataLocal.throwingObject && !scrollingReservedHotbar && PlayerPatcher.playerDataLocal.currentItemSlotIsReserved && PlayerPatcher.playerDataLocal.grabbingReservedItemInfo == null) { scrollingReservedHotbar = true; MethodInfo method = ((object)localPlayerController).GetType().GetMethod("ScrollMouse_performed", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(localPlayerController, new object[1] { context }); ((MonoBehaviour)localPlayerController).StartCoroutine(ResetScrollDelayed()); } static IEnumerator ResetScrollDelayed() { yield return null; yield return (object)new WaitForEndOfFrame(); scrollingReservedHotbar = false; } } } } namespace ReservedItemSlotCore.Patches { [HarmonyPatch] public static class HUDPatcher { private static bool usingController; private static float iconWidth; private static float xPos; private static TextMeshProUGUI hotkeyTooltip; public static List<Image> reservedItemSlots; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; public static bool localPlayerUsingController => (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.localPlayerUsingController; public static bool hasReservedItemSlotsAndEnabled => reservedItemSlots != null && reservedItemSlots.Count > 0 && ((Component)reservedItemSlots[0]).gameObject.activeSelf && ((Behaviour)reservedItemSlots[0]).enabled; [HarmonyPatch(typeof(HUDManager), "Awake")] [HarmonyPostfix] public static void Initialize(HUDManager __instance) { //IL_002a: 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) CanvasScaler componentInParent = ((Component)__instance.itemSlotIconFrames[0]).GetComponentInParent<CanvasScaler>(); AspectRatioFitter componentInParent2 = ((Component)__instance.itemSlotIconFrames[0]).GetComponentInParent<AspectRatioFitter>(); iconWidth = ((Component)__instance.itemSlotIconFrames[0]).GetComponent<RectTransform>().sizeDelta.x; xPos = componentInParent.referenceResolution.x / 2f / componentInParent2.aspectRatio - iconWidth / 4f; reservedItemSlots = new List<Image>(); } [HarmonyPatch(typeof(StartOfRound), "Update")] [HarmonyPostfix] public static void UpdateUsingController(StartOfRound __instance) { if (!((Object)(object)__instance.localPlayerController == (Object)null) && !((Object)(object)hotkeyTooltip == (Object)null) && ((Component)hotkeyTooltip).gameObject.activeSelf && ((Behaviour)hotkeyTooltip).enabled && __instance.localPlayerUsingController != usingController) { usingController = __instance.localPlayerUsingController; UpdateHotkeyTooltipText(); } } public static void AddNewHotbarSlotsHud() { //IL_0048: 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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) if (PlayerPatcher.reservedHotbarSize <= 0) { return; } List<Image> list = new List<Image>(HUDManager.Instance.itemSlotIconFrames); List<Image> list2 = new List<Image>(HUDManager.Instance.itemSlotIcons); float y = ((Component)HUDManager.Instance.itemSlotIconFrames[0]).GetComponent<RectTransform>().sizeDelta.y; Vector3 eulerAngles = ((Transform)((Component)HUDManager.Instance.itemSlotIconFrames[0]).GetComponent<RectTransform>()).eulerAngles; Vector3 eulerAngles2 = ((Transform)((Component)HUDManager.Instance.itemSlotIcons[0]).GetComponent<RectTransform>()).eulerAngles; Plugin.Log($"Adding {SyncManager.syncReservedItemSlotReps.Count} reserved item slots to the inventory HUD. Previous inventory HUD size: {PlayerPatcher.playerDataLocal.reservedHotbarStartIndex}"); int num = 0; int num2 = 0; for (int i = 0; i < SyncManager.syncReservedItemSlotReps.Count; i++) { ReservedItemInfo reservedItemInfo = SyncManager.syncReservedItemSlotReps[i]; Plugin.Log($"Adding Reserved item slot for item types [{reservedItemInfo.itemName}]. Inventory index: {list.Count}"); float num3 = ((Graphic)HUDManager.Instance.itemSlotIconFrames[0]).rectTransform.anchoredPosition.y + 1.125f * y * (float)((reservedItemInfo.hotbarSlotPriority >= 0) ? num : num2); Image val = Object.Instantiate<Image>(HUDManager.Instance.itemSlotIconFrames[0], ((Component)HUDManager.Instance.itemSlotIconFrames[0]).transform.parent); ((Object)val).name = "Slot" + list.Count + " [ReservedItemSlot]"; ((Graphic)val).rectTransform.anchoredPosition = new Vector2((reservedItemInfo.hotbarSlotPriority >= 0) ? xPos : (0f - xPos), num3); ((Transform)((Graphic)val).rectTransform).eulerAngles = eulerAngles; CanvasGroup val2 = ((Component)val).gameObject.AddComponent<CanvasGroup>(); val2.ignoreParentGroups = ConfigSettings.preventReservedItemSlotFade.Value; val2.alpha = 1f; Image component = ((Component)((Component)val).transform.GetChild(0)).GetComponent<Image>(); ((Object)component).name = "Icon"; ((Transform)((Graphic)component).rectTransform).eulerAngles = eulerAngles2; reservedItemSlots.Add(val); list.Insert(PlayerPatcher.playerDataLocal.reservedHotbarStartIndex + i, val); list2.Insert(PlayerPatcher.playerDataLocal.reservedHotbarStartIndex + i, component); if (reservedItemInfo.hotbarSlotPriority >= 0) { num++; } else { num2++; } } if (SyncManager.numReservedItemSlots > 0 && (Object)(object)hotkeyTooltip == (Object)null) { hotkeyTooltip = new GameObject("ReservedItemSlotTooltip", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)hotkeyTooltip).rectTransform; ((Component)rectTransform).transform.parent = ((Component)list[PlayerPatcher.playerDataLocal.reservedHotbarStartIndex]).transform; ((Transform)rectTransform).localScale = Vector3.one; rectTransform.sizeDelta = new Vector2(((Graphic)list[0]).rectTransform.sizeDelta.x * 2f, 10f); rectTransform.pivot = Vector2.one / 2f; rectTransform.anchoredPosition3D = new Vector3(0f, (0f - rectTransform.sizeDelta.x / 2f) * 1.2f, 0f); ((TMP_Text)hotkeyTooltip).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font; ((TMP_Text)hotkeyTooltip).fontSize = 7f; ((TMP_Text)hotkeyTooltip).alignment = (TextAlignmentOptions)514; UpdateHotkeyTooltipText(); } HUDManager.Instance.itemSlotIconFrames = list.ToArray(); HUDManager.Instance.itemSlotIcons = list2.ToArray(); Plugin.Log($"Finished adding {PlayerPatcher.reservedHotbarSize} Reserved Item slots in the inventory HUD."); } [HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")] [HarmonyPostfix] public static void UpdateHotkeyTextOnMenuClosed(QuickMenuManager __instance) { if (!__instance.isMenuOpen) { UpdateHotkeyTooltipText(); } } private static void UpdateHotkeyTooltipText() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)localPlayerController == (Object)null) && !((Object)(object)hotkeyTooltip == (Object)null) && Keybinds.FocusReservedHotbarAction != null) { int num = (localPlayerUsingController ? 1 : 0); InputBinding val; string key; if (!InputUtilsCompat.Enabled) { val = Keybinds.FocusReservedHotbarAction.bindings[num]; key = ((InputBinding)(ref val)).path; } else { val = Keybinds.FocusReservedHotbarAction.bindings[num]; key = ((InputBinding)(ref val)).overridePath; } string displayName = ConfigSettings.GetDisplayName(key); TextMeshProUGUI obj = hotkeyTooltip; string text3; if (!ConfigSettings.toggleFocusReservedHotbar.Value) { string text2 = (((TMP_Text)hotkeyTooltip).text = string.Format($"Hold: [{displayName}]")); text3 = text2; } else { text3 = string.Format($"Toggle: [{displayName}]"); } ((TMP_Text)obj).text = text3; } } public static void UpdateHUD() { //IL_0047: 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) if (AdvancedCompanyPatcher.Enabled) { return; } int num = 0; int num2 = 0; for (int i = 0; i < PlayerPatcher.reservedHotbarSize; i++) { ReservedItemInfo reservedItemInfo = SyncManager.syncReservedItemSlotReps[i]; int num3 = PlayerPatcher.playerDataLocal.reservedHotbarStartIndex + i; float num4 = ((Graphic)HUDManager.Instance.itemSlotIconFrames[0]).rectTransform.anchoredPosition.y + 1.125f * iconWidth * (float)((reservedItemInfo.hotbarSlotPriority >= 0) ? num : num2); ((Graphic)HUDManager.Instance.itemSlotIconFrames[num3]).rectTransform.anchoredPosition = new Vector2((reservedItemInfo.hotbarSlotPriority >= 0) ? xPos : (0f - xPos), num4); if (reservedItemInfo.hotbarSlotPriority >= 0) { num++; } else { num2++; } } } } [HarmonyPatch] public static class ReservedItemPatcher { public static int indexInHotbar; public static int indexInReservedHotbar; public static PlayerControllerB localPlayerController => PlayerPatcher.localPlayerController; public static int reservedHotbarSize => SyncManager.numReservedItemSlots; private static GrabbableObject GetCurrentlyGrabbingObject(PlayerControllerB playerController) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return (GrabbableObject)Traverse.Create((object)playerController).Field("currentlyGrabbingObject").GetValue(); } private static void SetCurrentlyGrabbingObject(PlayerControllerB playerController, GrabbableObject grabbable) { Traverse.Create((object)playerController).Field("currentlyGrabbingObject").SetValue((object)grabbable); } [HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")] [HarmonyPrefix] public static bool GrabReservedItemPrefix(PlayerControllerB __instance) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if ((!SyncManager.isSynced && !SyncManager.canUseModDisabledOnHost) || !HUDPatcher.hasReservedItemSlotsAndEnabled) { return true; } PlayerPatcher.playerDataLocal.grabbingReservedItemInfo = null; PlayerPatcher.playerDataLocal.grabbingReservedItem = null; PlayerPatcher.playerDataLocal.previousHotbarIndex = -1; if (PlayerPatcher.playerDataLocal.currentItemSlotIsReserved && !ConfigSettings.toggleFocusReservedHotbar.Value) { return false; } if (__instance.twoHanded || __instance.sinkingValue > 0.73f) { return true; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, __instance.grabDistance, PlayerPatcher.INTERACTABLE_OBJECT_MASK) && ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val2)).collider).tag == "PhysicsProp") { GrabbableObject component = ((Component)((Component)((RaycastHit)(ref val2)).collider).transform).gameObject.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null && !__instance.inSpecialInteractAnimation && !component.isHeld && !component.isPocketed) { NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject; if ((Object)(object)networkObject != (Object)null && networkObject.IsSpawned && SyncManager.TryGetReservedItemInfo(component, out var info)) { Plugin.Log("Beginning grab on reserved item: " + info.itemName); PlayerPatcher.playerDataLocal.grabbingReservedItemInfo = info; PlayerPatcher.playerDataLocal.grabbingReservedItem = component; PlayerPatcher.playerDataLocal.previousHotbarIndex = __instance.currentItemSlot; } } } return true; } [HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")] [HarmonyPostfix] public static void GrabReservedItemPostfix(PlayerControllerB __instance) { if (PlayerPatcher.playerDataLocal.grabbingReservedItemInfo != null) { SetSpecialGrabAnimationBool(__instance, setTrue: false); } } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPrefix] public static void GrabReservedItemClientRpcPrefix(bool grabValidated, NetworkObjectReference grabbedObject, PlayerControllerB __instance) { if ((!SyncManager.isSynced && !SyncManager.canUseModDisabledOnHost) || !NetworkHelper.IsClientExecStage((NetworkBehaviour)(object)__instance)) { return; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; NetworkObject val = default(NetworkObject); if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening && grabValidated && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null)) { GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>(); if (SyncManager.TryGetReservedItemInfo(component, out var info)) { if (IsItemSlotEmpty(info, __instance)) { Plugin.Log("OnGrabReservedItem for Player: " + ((Object)__instance).name + " Item: " + info.itemName); reservedPlayerData.grabbingReservedItemInfo = info; reservedPlayerData.grabbingReservedItem = component; reservedPlayerData.previousHotbarIndex = __instance.currentItemSlot; return; } Plugin.LogWarning("OnGrabReservedItem SlotFilled. Player: " + ((Object)__instance).name + " Item: " + info.itemName + " Slot: " + (reservedPlayerData.reservedHotbarStartIndex + info.reservedItemIndex)); } } reservedPlayerData.grabbingReservedItemInfo = null; reservedPlayerData.grabbingReservedItem = null; reservedPlayerData.previousHotbarIndex = -1; } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] public static void GrabReservedItemClientRpcPostfix(bool grabValidated, NetworkObjectReference grabbedObject, PlayerControllerB __instance) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((!SyncManager.isSynced && SyncManager.canUseModDisabledOnHost) || !NetworkHelper.IsClientExecStage((NetworkBehaviour)(object)__instance)) { return; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; if (reservedPlayerData.grabbingReservedItemInfo == null) { return; } if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsListening) { NetworkObject val = default(NetworkObject); if (grabValidated && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null)) { GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>(); if (SyncManager.TryGetReservedItemInfo(component, out var info)) { SetSpecialGrabAnimationBool(__instance, (Object)(object)reservedPlayerData.previouslyHeldItem != (Object)null, reservedPlayerData.previouslyHeldItem); Animator playerBodyAnimator = __instance.playerBodyAnimator; AnimatorStateInfo currentAnimatorStateInfo = __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(2); playerBodyAnimator.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash, 2, 1f); if ((Object)(object)reservedPlayerData.previouslyHeldItem != (Object)null) { reservedPlayerData.previouslyHeldItem.EnableItemMeshes(true); } ForceDisableItemMesh(reservedPlayerData.grabbingReservedItem); Traverse.Create((object)component).Field("previousPlayerHeldBy").SetValue((object)__instance); if ((Object)(object)__instance != (Object)(object)localPlayerController) { Plugin.Log("OnGrabReservedItem completed. Player: " + ((Object)__instance).name + " Item: " + info.itemName + " Switching to previous slot: " + reservedPlayerData.previousHotbarIndex); SwitchToItemSlot(__instance, reservedPlayerData.previousHotbarIndex); Animator playerBodyAnimator2 = __instance.playerBodyAnimator; currentAnimatorStateInfo = __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(2); playerBodyAnimator2.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash, 2, 1f); reservedPlayerData.grabbingReservedItemInfo = null; reservedPlayerData.grabbingReservedItem = null; reservedPlayerData.previousHotbarIndex = -1; } else { int num = reservedPlayerData.reservedHotbarStartIndex + reservedPlayerData.grabbingReservedItemInfo.reservedItemIndex; ((Component)HUDManager.Instance.itemSlotIconFrames[num]).GetComponent<Animator>().SetBool("selectedSlot", false); ((Component)HUDManager.Instance.itemSlotIconFrames[reservedPlayerData.previousHotbarIndex]).GetComponent<Animator>().SetBool("selectedSlot", true); ((Component)HUDManager.Instance.itemSlotIconFrames[num]).GetComponent<Animator>().Play("PanelLines", 0, 1f); ((Component)HUDManager.Instance.itemSlotIconFrames[reservedPlayerData.previousHotbarIndex]).GetComponent<Animator>().Play("PanelEnlarge", 0, 1f); } return; } } else if ((Object)(object)__instance == (Object)(object)localPlayerController) { Plugin.Log("Failed to validate ReservedItemGrab by the local player. Object id: " + ((NetworkObjectReference)(ref grabbedObject)).NetworkObjectId + "."); Traverse.Create((object)localPlayerController).Field("grabInvalidated").SetValue((object)true); } else { Plugin.Log("Failed to validate ReservedItemGrab by player with id: " + ((Object)__instance).name + ". Object id: " + ((NetworkObjectReference)(ref grabbedObject)).NetworkObjectId + "."); } } reservedPlayerData.grabbingReservedItemInfo = null; reservedPlayerData.grabbingReservedItem = null; reservedPlayerData.previousHotbarIndex = -1; } [HarmonyPatch(typeof(GrabbableObject), "GrabItemOnClient")] [HarmonyPrefix] public static void OnReservedItemGrabbed(GrabbableObject __instance) { if (PlayerPatcher.playerDataLocal.grabbingReservedItemInfo != null && !((Object)(object)__instance != (Object)(object)GetCurrentlyGrabbingObject(localPlayerController))) { ((MonoBehaviour)localPlayerController).StartCoroutine(OnReservedItemGrabbedEndOfFrame()); } IEnumerator OnReservedItemGrabbedEndOfFrame() { yield return (object)new WaitForEndOfFrame(); SwitchToItemSlot(localPlayerController, PlayerPatcher.playerDataLocal.previousHotbarIndex); PlayerPatcher.playerDataLocal.grabbingReservedItemInfo = null; PlayerPatcher.playerDataLocal.grabbingReservedItem = null; PlayerPatcher.playerDataLocal.previousHotbarIndex = -1; __instance.EnableItemMeshes(false); __instance.PocketItem(); Animator playerBodyAnimator = localPlayerController.playerBodyAnimator; AnimatorStateInfo currentAnimatorStateInfo = localPlayerController.playerBodyAnimator.GetCurrentAnimatorStateInfo(2); playerBodyAnimator.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash, 2, 1f); } } [HarmonyPatch(typeof(HUDManager), "ClearControlTips")] [HarmonyPrefix] public static bool PreventClearControlTipsGrabbingReservedItem(HUDManager __instance) { return PlayerPatcher.playerDataLocal == null || (Object)(object)PlayerPatcher.playerDataLocal.grabbingReservedItem == (Object)null; } [HarmonyPatch(typeof(GrabbableObject), "SetControlTipsForItem")] [HarmonyPrefix] public static bool PreventUpdateControlTipsGrabbingReservedItem(GrabbableObject __instance) { return PlayerPatcher.playerDataLocal == null || (Object)(object)PlayerPatcher.playerDataLocal.grabbingReservedItem != (Object)(object)__instance; } [HarmonyPatch(typeof(PlayerControllerB), "SetSpecialGrabAnimationBool")] [HarmonyPrefix] public static bool PreventSpecialGrabAnimationReservedItem(bool setTrue, PlayerControllerB __instance, GrabbableObject currentItem = null) { return true; } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPrefix] public static void DebugSwitchToItemSlot(int slot, PlayerControllerB __instance) { if (!HUDPatcher.hasReservedItemSlotsAndEnabled) { return; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; if (reservedPlayerData == null) { Plugin.LogError("PlayerData null for player: " + ((Object)__instance).name); } else { if (!reservedPlayerData.IsReservedItemSlot(slot)) { return; } string text = ""; reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; if (slot < 0) { text = "Called SwitchToItemSlot on slot: " + slot; } else if (slot >= __instance.ItemSlots.Length) { text = "Called SwitchToItemSlot on slot: " + slot + " HotbarSize: " + __instance.ItemSlots.Length; } else { if (slot < HUDManager.Instance.itemSlotIconFrames.Length) { return; } text = "Called SwitchToItemSlot on slot: " + slot + " NumItemSlotsHUD: " + HUDManager.Instance.itemSlotIconFrames.Length; } text += "\n\n"; text = text + reservedPlayerData.DumpData() + "\n\nReporting this error to Flip would be greatly appreciated!"; Debug.LogError((object)text); } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] public static void UpdateFocusReservedHotbar(int slot, PlayerControllerB __instance) { if (HUDPatcher.hasReservedItemSlotsAndEnabled && PlayerPatcher.allPlayerData.TryGetValue(__instance, out var value)) { value.inReservedHotbarSlots = value.IsReservedItemSlot(__instance.currentItemSlot); } } [HarmonyPatch(typeof(PlayerControllerB), "FirstEmptyItemSlot")] [HarmonyPostfix] public static void GetReservedItemSlotPlacementIndex(ref int __result, PlayerControllerB __instance) { if (reservedHotbarSize <= 0 || !HUDPatcher.hasReservedItemSlotsAndEnabled) { return; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; ReservedItemInfo grabbingReservedItemInfo = reservedPlayerData.grabbingReservedItemInfo; if (grabbingReservedItemInfo != null) { if (IsItemSlotEmpty(grabbingReservedItemInfo, __instance)) { __result = reservedPlayerData.reservedHotbarStartIndex + grabbingReservedItemInfo.reservedItemIndex; return; } reservedPlayerData.grabbingReservedItemInfo = null; reservedPlayerData.grabbingReservedItem = null; reservedPlayerData.previousHotbarIndex = -1; } if (!reservedPlayerData.IsReservedItemSlot(__result)) { return; } __result = -1; for (int i = 0; i < __instance.ItemSlots.Length; i++) { if (!reservedPlayerData.IsReservedItemSlot(i) && (Object)(object)__instance.ItemSlots[i] == (Object)null) { __result = i; break; } } } [HarmonyPatch(typeof(PlayerControllerB), "NextItemSlot")] [HarmonyPostfix] public static void OnNextItemSlot(ref int __result, bool forward, PlayerControllerB __instance) { if (reservedHotbarSize <= 0 || !HUDPatcher.hasReservedItemSlotsAndEnabled) { return; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[__instance]; bool flag = reservedPlayerData.IsReservedItemSlot(__result); if (flag == reservedPlayerData.inReservedHotbarSlots && (!flag || (Object)(object)__instance.ItemSlots[__result] != (Object)null)) { return; } int num = (forward ? 1 : (-1)); __result = __instance.currentItemSlot + num; __result = ((__result < 0) ? (__instance.ItemSlots.Length - 1) : ((__result < __instance.ItemSlots.Length) ? __result : 0)); bool flag2 = reservedPlayerData.IsReservedItemSlot(__result); if (!reservedPlayerData.inReservedHotbarSlots) { if (flag2) { __result = (forward ? ((reservedPlayerData.reservedHotbarStartIndex + reservedHotbarSize) % __instance.ItemSlots.Length) : (reservedPlayerData.reservedHotbarStartIndex - 1)); } return; } __result = (flag2 ? __result : (forward ? reservedPlayerData.reservedHotbarStartIndex : (reservedPlayerData.reservedHotbarStartIndex + reservedHotbarSize - 1))); int numHeldReservedItems = reservedPlayerData.GetNumHeldReservedItems(); while (numHeldReservedItems > 0 && __result != reservedPlayerData.currentItemSlot && (Object)(object)__instance.ItemSlots[__result] == (Object)null) { __result += num; __result = ((!reservedPlayerData.IsReservedItemSlot(__result)) ? (forward ? reservedPlayerData.reservedHotbarStartIndex : (reservedPlayerData.reservedHotbarStartIndex + reservedHotbarSize - 1)) : __result); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] public static void RefocusReservedHotbarAfterAnimation(PlayerControllerB __instance) { if (HUDPatcher.hasReservedItemSlotsAndEnabled && !((Object)(object)__instance != (Object)(object)localPlayerController) && !ConfigSettings.toggleFocusReservedHotbar.Value && Keybinds.holdingModifierKey != PlayerPatcher.playerDataLocal.currentItemSlotIsReserved && CanSwapToReservedHotbarSlot()) { FocusReservedHotbarSlots(Keybinds.holdingModifierKey); } } public static bool CanSwapToReservedHotbarSlot() { if (!HUDPatcher.hasReservedItemSlotsAndEnabled) { return false; } bool flag = (bool)Traverse.Create((object)localPlayerController).Field("throwingObject").GetValue(); return !(PlayerPatcher.playerDataLocal.grabbingReservedItemInfo != null || localPlayerController.isGrabbingObjectAnimation || localPlayerController.quickMenuManager.isMenuOpen || localPlayerController.inSpecialInteractAnimation || flag) && !localPlayerController.isTypingChat && !localPlayerController.twoHanded && !localPlayerController.activatingItem && !localPlayerController.jetpackControls && !localPlayerController.disablingJetpackControls && !localPlayerController.inTerminalMenu && !localPlayerController.isPlayerDead && !(GetTimeSinceSwitchingSlots(localPlayerController) < 0.3f); } [HarmonyPatch(typeof(PlayerControllerB), "UpdateSpecialAnimationValue")] [HarmonyPostfix] public static void OnSpecialAnimationUpdate(bool specialAnimation, PlayerControllerB __instance) { if (HUDPatcher.hasReservedItemSlotsAndEnabled && !((Object)(object)__instance != (Object)(object)localPlayerController) && !specialAnimation && !ConfigSettings.toggleFocusReservedHotbar.Value && PlayerPatcher.playerDataLocal.currentItemSlotIsReserved != Keybinds.holdingModifierKey) { FocusReservedHotbarSlots(Keybinds.holdingModifierKey); } } public static void FocusReservedHotbarSlots(bool active) { if (!HUDPatcher.hasReservedItemSlotsAndEnabled || (reservedHotbarSize <= 0 && active) || PlayerPatcher.playerDataLocal.currentItemSlotIsReserved == active) { return; } ReservedPlayerData playerDataLocal = PlayerPatcher.playerDataLocal; indexInHotbar = Mathf.Clamp(indexInHotbar, 0, localPlayerController.ItemSlots.Length - 1); indexInHotbar = ((!playerDataLocal.IsReservedItemSlot(indexInHotbar)) ? indexInHotbar : 0); indexInReservedHotbar = Mathf.Clamp(indexInReservedHotbar, playerDataLocal.reservedHotbarStartIndex, playerDataLocal.reservedHotbarEndIndexExcluded - 1); int num = Mathf.Clamp(localPlayerController.currentItemSlot, 0, localPlayerController.ItemSlots.Length); int i = num; bool flag = active; if (flag && !playerDataLocal.IsReservedItemSlot(num)) { indexInHotbar = num; indexInHotbar = ((!playerDataLocal.IsReservedItemSlot(indexInHotbar)) ? indexInHotbar : 0); i = indexInReservedHotbar; if ((Object)(object)localPlayerController.ItemSlots[i] == (Object)null && playerDataLocal.GetNumHeldReservedItems() > 0) { for (i = playerDataLocal.reservedHotbarStartIndex; i < playerDataLocal.reservedHotbarEndIndexExcluded && !((Object)(object)localPlayerController.ItemSlots[i] != (Object)null); i++) { } } Plugin.Log("Focusing reserved hotbar slots. NewIndex: " + i + " OldIndex: " + num + " ReservedStartIndex: " + PlayerPatcher.playerDataLocal.reservedHotbarStartIndex); } else if (!flag && PlayerPatcher.playerDataLocal.IsReservedItemSlot(num)) { indexInReservedHotbar = Mathf.Clamp(num, playerDataLocal.reservedHotbarStartIndex, playerDataLocal.reservedHotbarEndIndexExcluded - 1); i = indexInHotbar; Plugin.Log("Unfocusing reserved hotbar slots. NewIndex: " + i + " OldIndex: " + num + " ReservedStartIndex: " + PlayerPatcher.playerDataLocal.reservedHotbarStartIndex); } if (i < 0) { Plugin.LogError("Swapping to hotbar slot: " + i + ". Maybe send these logs to Flip? :)"); } else if (i >= localPlayerController.ItemSlots.Length) { Plugin.LogError("Swapping to hotbar slot: " + i + " InventorySize: " + localPlayerController.ItemSlots.Length + ". Maybe send these logs to Flip? :)"); } SyncManager.SwapHotbarSlot(i); if (localPlayerController.currentItemSlot != i) { Plugin.LogWarning("OnFocusReservedHotbarSlots - New hotbar index does not match target hotbar index. Tried to swap to index: " + i + " Current index: " + localPlayerController.currentItemSlot + " Tried swapping to reserved hotbar: " + active); } } internal static bool IsItemSlotEmpty(string itemName, PlayerControllerB playerController) { if (!SyncManager.TryGetReservedItemInfo(itemName, out var info)) { return false; } return IsItemSlotEmpty(info, playerController); } internal static bool IsItemSlotEmpty(ReservedItemInfo itemInfo, PlayerControllerB playerController) { playerController = (((Object)(object)playerController == (Object)null) ? localPlayerController : playerController); if (reservedHotbarSize == 0) { return false; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[playerController]; int num = reservedPlayerData.reservedHotbarStartIndex + itemInfo.reservedItemIndex; return num >= reservedPlayerData.reservedHotbarStartIndex && num < reservedPlayerData.reservedHotbarStartIndex + reservedHotbarSize && (Object)(object)playerController.ItemSlots[num] == (Object)null; } public static bool TryGetHeldReservedObject(string itemName, PlayerControllerB playerController, ref GrabbableObject obj) { playerController = (((Object)(object)playerController == (Object)null) ? localPlayerController : playerController); if ((Object)(object)playerController == (Object)null || reservedHotbarSize == 0) { return false; } if (!SyncManager.TryGetReservedItemInfo(itemName, out var info)) { return false; } ReservedPlayerData reservedPlayerData = PlayerPatcher.allPlayerData[playerController]; int num = reservedPlayerData.reservedHotbarStartIndex + info.reservedItemIndex; obj = playerController.ItemSlots[num]; return (Object)(object)obj != (Object)null; } public static void ForceDisableItemMesh(GrabbableObject grabbableObject) { MeshRenderer[] componentsInChildren = ((Component)grabbableObject).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Renderer)val).enabled = false; } } } public static bool ReservedItemIsBeingGrabbed(GrabbableObject grabbableObject) { if ((Object)(object)grabbableObject == (Object)null) { return false; } foreach (ReservedPlayerData value in PlayerPatcher.allPlayerData.Values) { if ((Object)(object)grabbableObject == (Object)(object)value.grabbingReservedItem) { return true; } } return false; } public static float GetTimeSinceSwitchingSlots(PlayerControllerB playerController) { return (float)Traverse.Create((object)playerController).Field("timeSinceSwitchingSlots").GetValue(); } public static void SetTimeSinceSwitchingSlots(PlayerControllerB playerController, float value) { Traverse.Create((object)playerController).Field("timeSinceSwitchingSlots").SetValue((object)value); } public static void SetSpecialGrabAnimationBool(PlayerControllerB playerController, bool setTrue, GrabbableObject currentItem = null) { MethodInfo method = ((object)playerController).GetType().GetMethod("SetSpecialGrabAnimationBool", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(playerController, new object[2] { setTrue, currentItem }); } public static void SwitchToItemSlot(PlayerControllerB playerController, int slot, GrabbableObject fillSlotWithItem = null) { MethodInfo method = ((object)playerController).GetType().GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(playerController, new object[2] { slot, fillSlotWithItem }); SetTimeSinceSwitchingSlots(playerController, 0f); } } [HarmonyPatch] public static class MouseScrollPatcher { public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PlayerControllerB), "NextItemSlot")] [HarmonyPrefix] public static void CorrectReservedScrollDirectionNextItemSlot(ref bool forward) { if (Keybinds.scrollingReservedHotbar) { forward = Keybinds.RawScrollAction.ReadValue<float>() > 0f; } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchItemSlotsServerRpc")] [HarmonyPrefix] public static void CorrectReservedScrollDirectionServerRpc(ref bool forward) { if (Keybinds.scrollingReservedHotbar) { forward = Keybinds.RawScrollAction.ReadValue<float>() > 0f; } } [HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")] [HarmonyPrefix] public static bool PreventInvertedScrollingReservedHotbar(CallbackContext context) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.localPlayerUsingController || SyncManager.numReservedItemSlots <= 0) { return true; } if (PlayerPatcher.playerDataLocal.currentItemSlotIsReserved) { if (!HUDPatcher.hasReservedItemSlotsAndEnabled) { return true; } if (HUDPatcher.reservedItemSlots.Count >= 2 && ((Graphic)HUDPatcher.reservedItemSlots[1]).rectTransform.anchoredPosition.y - ((Graphic)HUDPatcher.reservedItemSlots[0]).rectTransform.anchoredPosition.y <= 5f) { return true; } if (!Keybinds.scrollingReservedHotbar || SyncManager.numReservedItemSlots == 1 || (PlayerPatcher.playerDataLocal.GetNumHeldReservedItems() == 1 && (Object)(object)localPlayerController.ItemSlots[localPlayerController.currentItemSlot] != (Object)null)) { return false; } } return true; } } [HarmonyPatch] public static class PlayerPatcher { public static PlayerControllerB localPlayerController; public static int vanillaHotbarSize = -1; public static int hotbarSizeBeforeSync = -1; internal static Dictionary<PlayerControllerB, ReservedPlayerData> allPlayerData = new Dictionary<PlayerControllerB, ReservedPlayerData>(); public static bool spawned = false; public static bool isSynced = false; public static int INTERACTABLE_OBJECT_MASK { get; private set; } public static int reservedHotbarSize => SyncManager.numReservedItemSlots; internal static ReservedPlayerData playerDataLocal => (allPlayerData != null && (Object)(object)localPlayerController != (Object)null && allPlayerData.ContainsKey(localPlayerController)) ? allPlayerData[localPlayerController] : null; [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] public static void InitSession(StartOfRound __instance) { localPlayerController = null; vanillaHotbarSize = -1; ReservedItemPatcher.indexInHotbar = 0; ReservedItemPatcher.indexInReservedHotbar = -1; Keybinds.holdingModifierKey = false; allPlayerData.Clear(); isSynced = false; spawned = false; } [HarmonyPatch(typeof(PlayerControllerB), "Awake")] [HarmonyPostfix] public static void InitializePlayerController(PlayerControllerB __instance) { if (vanillaHotbarSize == -1) { vanillaHotbarSize = __instance.ItemSlots.Length; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] [HarmonyPostfix] public static void InitializePlayerControllerLate(PlayerControllerB __instance) { allPlayerData.Add(__instance, new ReservedPlayerData { playerController = __instance, hotbarSize = __instance.ItemSlots.Length, reservedHotbarStartIndex = __instance.ItemSlots.Length }); } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void OnLocalPlayerConnect(PlayerControllerB __instance) { localPlayerController = __instance; INTERACTABLE_OBJECT_MASK = (int)Traverse.Create((object)__instance).Field("interactableObjectsMask").GetValue(); ((MonoBehaviour)__instance).StartCoroutine(UpdateHotbarSlotsAfterFirstSpawnAnimation()); } private static IEnumerator UpdateHotbarSlotsAfterFirstSpawnAnimation() { yield return (object)new WaitForSeconds(3f); spawned = true; hotbarSizeBeforeSync = localPlayerController.ItemSlots.Length; if (!isSynced && (SyncManager.isSynced || SyncManager.canUseModDisabledOnHost)) { OnSyncedWithServer(); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] public static void OnUpdate(PlayerControllerB __instance) { if (!spawned) { return; } if (SyncManager.isSynced && !isSynced) { OnSyncedWithServer(); } ReservedPlayerData reservedPlayerData = allPlayerData[__instance]; if ((!isSynced && (!SyncManager.canUseModDisabledOnHost || (Object)(object)__instance != (Object)(object)localPlayerController)) || reservedHotbarSize <= 0 || reservedPlayerData.hotbarSize == __instance.ItemSlots.Length) { return; } Plugin.Log("On update inventory size for player: " + ((Object)__instance).name + " - Old hotbar size: " + reservedPlayerData.hotbarSize + " - New hotbar size: " + __instance.ItemSlots.Length); reservedPlayerData.hotbarSize = __instance.ItemSlots.Length; int num = -1; if ((Object)(object)__instance == (Object)(object)localPlayerController) { if (HUDPatcher.reservedItemSlots != null && HUDPatcher.reservedItemSlots.Count > 0) { num = Array.IndexOf(HUDManager.Instance.itemSlotIconFrames, HUDPatcher.reservedItemSlots[0]); Plugin.Log("OnUpdateInventorySize A for player: " + ((Object)__instance).name + " NewReservedItemsStartIndex: " + num); } if (num == -1) { for (int i = 0; i < HUDManager.Instance.itemSlotIconFrames.Length; i++) { if (((Object)HUDManager.Instance.itemSlotIconFrames[i]).name.ToLower().Contains("reserved")) { num = i; Plugin.Log("OnUpdateInventorySize B for player: " + ((Object)__instance).name + " NewReservedItemsStartIndex: " + num); break; } } } } if (num == -1) { num = reservedPlayerData.reservedHotbarStartIndex; Plugin.Log("OnUpdateInventorySize C for player: " + ((Object)__instance).name + " NewReservedItemsStartIndex: " + num); } if (num == -1) { num = vanillaHotbarSize; Plugin.Log("OnUpdateInventorySize D for player: " + ((Object)__instance).name + " NewReservedItemsStartIndex: " + num); } reservedPlayerData.reservedHotbarStartIndex = num; if (reservedPlayerData.reservedHotbarStartIndex < 0) { Plugin.LogError("Set new reserved start index to slot: " + reservedPlayerData.reservedHotbarStartIndex + " . Maybe share these logs with Flip? :)"); } if (reservedPlayerData.reservedHotbarEndIndexExcluded - 1 >= reservedPlayerData.playerController.ItemSlots.Length) { Plugin.LogError("Set new reserved start index to slot: " + reservedPlayerData.reservedHotbarStartIndex + " Last reserved slot index: " + (reservedPlayerData.reservedHotbarEndIndexExcluded - 1) + " Inventory size: " + reservedPlayerData.playerController.ItemSlots.Length + ". Maybe share these logs with Flip? :)"); } if ((Object)(object)__instance == (Object)(object)localPlayerController) { HUDPatcher.UpdateHUD(); } } private static void OnSyncedWithServer() { isSynced = SyncManager.isSynced; int num = hotbarSizeBeforeSync + reservedHotbarSize; if (num != hotbarSizeBeforeSync) { } Plugin.Log("Finalizing sync with server. New hotbar size: " + num); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { allPlayerData[val].reservedHotbarStartIndex = hotbarSizeBeforeSync; if (num != val.ItemSlots.Length) { Array.Resize(ref val.ItemSlots, num); } allPlayerData[val].hotbarSize = num; } if (HUDPatcher.reservedItemSlots != null && HUDPatcher.reservedItemSlots.Count == SyncManager.numReservedItemSlots && playerDataLocal.reservedHotbarStartIndex < HUDManager.Instance.itemSlotIconFrames.Length && (Object)(object)HUDPatcher.reservedItemSlots[0] == (Object)(object)HUDManager.Instance.itemSlotIconFrames[playerDataLocal.reservedHotbarStartIndex]) { return; } if (HUDPatcher.reservedItemSlots != null && HUDPatcher.reservedItemSlots.Count > 0) { List<Image> list = new List<Image>(HUDManager.Instance.itemSlotIconFrames); List<Image> list2 = new List<Image>(HUDManager.Instance.itemSlotIcons); for (int j = 0; j < HUDManager.Instance.itemSlotIconFrames.Length; j++) { Image val2 = HUDManager.Instance.itemSlotIconFrames[j]; Image item = HUDManager.Instance.itemSlotIcons[j]; if (((Object)val2).name.Contains("Reserved")) { list.Remove(val2); list2.Remove(item); } } HUDManager.Instance.itemSlotIconFrames = list.ToArray(); HUDManager.Instance.itemSlotIcons = list2.ToArray(); } HUDPatcher.AddNewHotbarSlotsHud(); } } } namespace ReservedItemSlotCore.Compatibility { public class AdvancedCompanyPatcher { public static bool Enabled => Plugin.IsModLoaded("com.potatoepet.AdvancedCompany"); } }
BepInEx/plugins/FlipMods/ReservedWalkieSlot.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using ReservedItemSlotCore; using ReservedItemSlotCore.Networking; using ReservedItemSlotCore.Patches; using ReservedWalkieSlot.Patches; 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("ReservedWalkieSlot")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ReservedWalkieSlot")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c15c320f-d8fc-4f1c-be3c-f2d2ffc41edd")] [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 ReservedWalkieSlot { public static class ConfigSettings { public static ConfigEntry<string> activateWalkieKey; public static ConfigEntry<bool> hideWalkieMeshShoulder; public static string activateWalkieDisplayName; public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>(); public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); activateWalkieKey = ((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("ReservedWalkieSlot", "ActivateWalkieKey", "<Keyboard>/x", "This setting will be ignored if InputUtils is installed and enabled. (I recommend running InputUtils to edit keybinds in the in-game settings)"); hideWalkieMeshShoulder = ((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("ReservedWalkieSlot", "HideWalkieOnShoulder", false, "Hides the walkie mesh while on your shoulder. Only applies in scenarios where you can view your player in third person."); activateWalkieDisplayName = GetDisplayName(activateWalkieKey.Value); currentConfigEntries.Add(((ConfigEntryBase)activateWalkieKey).Definition.Key, (ConfigEntryBase)(object)activateWalkieKey); currentConfigEntries.Add(((ConfigEntryBase)hideWalkieMeshShoulder).Definition.Key, (ConfigEntryBase)(object)hideWalkieMeshShoulder); TryRemoveOldConfigSettings(); } public static string GetDisplayName(string key) { key = key.Replace("<Keyboard>/", ""); key = key.Replace("<Mouse>/", ""); string text = key; text = text.Replace("leftAlt", "Alt"); text = text.Replace("rightAlt", "Alt"); text = text.Replace("leftCtrl", "Ctrl"); text = text.Replace("rightCtrl", "Ctrl"); text = text.Replace("leftShift", "Shift"); text = text.Replace("rightShift", "Shift"); text = text.Replace("leftButton", "LMB"); text = text.Replace("rightButton", "RMB"); return text.Replace("middleButton", "MMB"); } public static void TryRemoveOldConfigSettings() { HashSet<string> hashSet = new HashSet<string>(); HashSet<string> hashSet2 = new HashSet<string>(); foreach (ConfigEntryBase value in currentConfigEntries.Values) { hashSet.Add(value.Definition.Section); hashSet2.Add(value.Definition.Key); } try { Plugin.Log("Cleaning old config entries"); ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config; string configFilePath = config.ConfigFilePath; if (!File.Exists(configFilePath)) { return; } string text = File.ReadAllText(configFilePath); string[] array = File.ReadAllLines(configFilePath); string text2 = ""; for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ""); if (array[i].Length <= 0) { continue; } if (array[i].StartsWith("[")) { if (text2 != "" && !hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num = text.IndexOf(text2); int num2 = text.IndexOf(array[i]); text = text.Remove(num, num2 - num); } text2 = array[i].Replace("[", "").Replace("]", "").Trim(); } else { if (!(text2 != "")) { continue; } if (i <= array.Length - 4 && array[i].StartsWith("##")) { int j; for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++) { } if (hashSet.Contains(text2)) { int num3 = array[i + j - 1].IndexOf("="); string item = array[i + j - 1].Substring(0, num3 - 1); if (!hashSet2.Contains(item)) { int num4 = text.IndexOf(array[i]); int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length; text = text.Remove(num4, num5 - num4); } } i += j - 1; } else if (array[i].Length > 3) { text = text.Replace(array[i], ""); } } } if (!hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num6 = text.IndexOf(text2); text = text.Remove(num6, text.Length - num6); } while (text.Contains("\n\n\n")) { text = text.Replace("\n\n\n", "\n\n"); } File.WriteAllText(configFilePath, text); config.Reload(); } catch { } } } [BepInPlugin("FlipMods.ReservedWalkieSlot", "ReservedWalkieSlot", "1.6.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony _harmony; public static ReservedItemInfo walkieInfo = new ReservedItemInfo("Walkie-talkie", 100, true, true, true, true); private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("ReservedWalkieSlot"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ReservedWalkieSlot loaded"); } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } public static void LogWarning(string message) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)message); } public static void LogError(string message) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.ReservedWalkieSlot"; public const string PLUGIN_NAME = "ReservedWalkieSlot"; public const string PLUGIN_VERSION = "1.6.1"; } } namespace ReservedWalkieSlot.Patches { [HarmonyPatch] public class MaskedEnemyPatcher { public static Dictionary<MaskedPlayerEnemy, GameObject> heldWalkiesByEnemy = new Dictionary<MaskedPlayerEnemy, GameObject>(); public static HashSet<MaskedPlayerEnemy> spawnedEnemies = new HashSet<MaskedPlayerEnemy>(); [HarmonyPatch(typeof(MaskedPlayerEnemy), "OnDestroy")] [HarmonyPrefix] public static void OnDestroy(MaskedPlayerEnemy __instance) { if (heldWalkiesByEnemy.TryGetValue(__instance, out var value)) { Plugin.LogWarning("Destroying walkie. Enemy destroyed."); Object.DestroyImmediate((Object)(object)value); spawnedEnemies.Remove(__instance); } heldWalkiesByEnemy.Remove(__instance); } [HarmonyPatch(typeof(MaskedPlayerEnemy), "LateUpdate")] [HarmonyPostfix] public static void ShowWalkieOnEnemy(MaskedPlayerEnemy __instance) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_013c: 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_0184: Unknown result type (might be due to invalid IL or missing references) if (!spawnedEnemies.Contains(__instance) && SyncManager.syncReservedItemsList.Contains(Plugin.walkieInfo) && !((EnemyAI)__instance).isEnemyDead && !heldWalkiesByEnemy.ContainsKey(__instance) && (Object)(object)__instance.mimickingPlayer != (Object)null && PlayerPatcher.allPlayerData.TryGetValue(__instance.mimickingPlayer, out var value)) { spawnedEnemies.Add(__instance); WalkieTalkie reservedWalkie = WalkiePatcher.GetReservedWalkie(value.playerController); if ((Object)(object)reservedWalkie != (Object)null) { Plugin.LogWarning("OnMaskedEnemySpawn - MimickingPlayer: " + ((Object)value.playerController).name + " - Spawning walkie object on enemy."); GameObject val = new GameObject("ReservedWalkie [MaskedEnemy]"); Light[] componentsInChildren = ((Component)reservedWalkie).GetComponentsInChildren<Light>(); MeshRenderer mainObjectRenderer = ((GrabbableObject)reservedWalkie).mainObjectRenderer; Light[] array = componentsInChildren; foreach (Light val2 in array) { Light component = Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)val2).transform.localPosition, ((Component)val2).transform.localRotation, val.transform).GetComponent<Light>(); ((Behaviour)component).enabled = true; ((Component)component).gameObject.layer = 6; } MeshRenderer component2 = Object.Instantiate<GameObject>(((Component)mainObjectRenderer).gameObject, ((Component)mainObjectRenderer).transform.localPosition, ((Component)mainObjectRenderer).transform.localRotation, val.transform).GetComponent<MeshRenderer>(); ((Renderer)component2).enabled = true; ((Component)component2).gameObject.layer = 6; val.transform.localScale = ((Component)reservedWalkie).transform.localScale; heldWalkiesByEnemy.Add(__instance, val); } } if (heldWalkiesByEnemy.TryGetValue(__instance, out var value2)) { if (((EnemyAI)__instance).isEnemyDead) { Plugin.LogWarning("Destroying walkie. Enemy dead."); Object.DestroyImmediate((Object)(object)value2); spawnedEnemies.Remove(__instance); heldWalkiesByEnemy.Remove(__instance); } else { Transform parent = ((EnemyAI)__instance).eye.parent.parent; value2.transform.rotation = parent.rotation * Quaternion.Euler(WalkiePatcher.playerShoulderRotationOffset); value2.transform.position = parent.position + parent.rotation * WalkiePatcher.playerShoulderPositionOffset; } } } } [HarmonyPatch] public static class WalkiePatcher { public static Vector3 localPlayerShoulderPositionOffset = new Vector3(0.125f, 0.4f, 0.125f); public static Vector3 playerShoulderPositionOffset = new Vector3(0.15f, -0.05f, 0.25f); public static Vector3 playerShoulderRotationOffset = new Vector3(0f, 270f, 100f); public static PlayerControllerB localPlayerController => PlayerPatcher.localPlayerController; public static WalkieTalkie GetMainWalkie(PlayerControllerB playerController) { return GetCurrentlySelectedWalkie(playerController) ?? GetReservedWalkie(playerController); } public static WalkieTalkie GetReservedWalkie(PlayerControllerB playerController) { ReservedPlayerData value; return (WalkieTalkie)((SyncManager.syncReservedItemsList.Contains(Plugin.walkieInfo) && PlayerPatcher.allPlayerData.TryGetValue(playerController, out value)) ? /*isinst with value type is only supported in some contexts*/: null); } public static WalkieTalkie GetCurrentlySelectedWalkie(PlayerControllerB playerController) { return (WalkieTalkie)((playerController.currentItemSlot >= 0 && playerController.currentItemSlot < playerController.ItemSlots.Length) ? /*isinst with value type is only supported in some contexts*/: null); } [HarmonyPatch(typeof(WalkieTalkie), "PocketItem")] [HarmonyPostfix] public static void OnPocketWalkie(WalkieTalkie __instance) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) { return; } Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = (((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) ? 23 : 6); } } ((GrabbableObject)__instance).parentObject = ((Component)((GrabbableObject)__instance).playerHeldBy.playerBadgeMesh).transform.parent; } [HarmonyPatch(typeof(WalkieTalkie), "EquipItem")] [HarmonyPostfix] public static void OnEquipWalkie(WalkieTalkie __instance) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) { return; } Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = 6; } } ((GrabbableObject)__instance).parentObject = (((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)localPlayerController) ? ((GrabbableObject)__instance).playerHeldBy.localItemHolder : ((GrabbableObject)__instance).playerHeldBy.serverItemHolder); } [HarmonyPatch(typeof(WalkieTalkie), "DiscardItem")] [HarmonyPostfix] public static void OnDiscardWalkie(WalkieTalkie __instance) { Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!((Object)val).name.Contains("ScanNode") && !((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Component)val).gameObject.layer = 6; } } } [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] [HarmonyPostfix] public static void SetPositionOffset(GrabbableObject __instance) { //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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (__instance is WalkieTalkie && (Object)(object)__instance.playerHeldBy != (Object)null && (Object)(object)__instance.parentObject != (Object)null && __instance.isPocketed && (Object)(object)__instance == (Object)(object)GetReservedWalkie(__instance.playerHeldBy) && (Object)(object)__instance != (Object)(object)GetCurrentlySelectedWalkie(__instance.playerHeldBy)) { Transform transform = ((Component)__instance.parentObject).transform; ((Component)__instance).transform.rotation = ((Component)__instance.parentObject).transform.rotation * Quaternion.Euler(playerShoulderRotationOffset); ((Component)__instance).transform.position = transform.position + transform.rotation * playerShoulderPositionOffset; } } [HarmonyPatch(typeof(GrabbableObject), "EnableItemMeshes")] [HarmonyPrefix] public static void OnEnableItemMeshes(ref bool enable, GrabbableObject __instance) { if (__instance is WalkieTalkie && (Object)(object)__instance.playerHeldBy != (Object)null && (Object)(object)__instance == (Object)(object)GetReservedWalkie(__instance.playerHeldBy) && !ConfigSettings.hideWalkieMeshShoulder.Value && !ReservedItemPatcher.ReservedItemIsBeingGrabbed(__instance)) { enable = true; } } } } namespace ReservedWalkieSlot.Input { internal class IngameKeybinds : LcInputActions { internal static IngameKeybinds Instance = new IngameKeybinds(); [InputAction("<Keyboard>/x", Name = "[ReservedItemSlots]\nActivate walkie")] public InputAction ActivateWalkieHotkey { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } internal class InputUtilsCompat { internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils"); public static InputAction ActivateWalkieHotkey => IngameKeybinds.Instance.ActivateWalkieHotkey; } [HarmonyPatch] internal static class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; private static InputAction ActivateWalkieAction; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { InitKeybinds(); } public static void InitKeybinds() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Plugin.Log("Initializing hotkeys."); if (InputUtilsCompat.Enabled) { Asset = InputUtilsCompat.Asset; ActionMap = Asset.actionMaps[0]; ActivateWalkieAction = InputUtilsCompat.ActivateWalkieHotkey; } else { Asset = new InputActionAsset(); ActionMap = new InputActionMap("ReservedItemSlots"); InputActionSetupExtensions.AddActionMap(Asset, ActionMap); ActivateWalkieAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedItemSlots.ActivateWalkie", (InputActionType)0, ConfigSettings.activateWalkieKey.Value, (string)null, (string)null, (string)null, (string)null); } } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { Asset.Enable(); ActivateWalkieAction.performed += OnPressWalkieButtonPerformed; ActivateWalkieAction.canceled += OnReleaseWalkieButtonPerformed; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { Asset.Disable(); ActivateWalkieAction.performed -= OnPressWalkieButtonPerformed; ActivateWalkieAction.canceled -= OnReleaseWalkieButtonPerformed; } private static void OnPressWalkieButtonPerformed(CallbackContext context) { if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject)) { return; } WalkieTalkie mainWalkie = WalkiePatcher.GetMainWalkie(localPlayerController); if (((CallbackContext)(ref context)).performed && !((Object)(object)mainWalkie == (Object)null) && ((GrabbableObject)mainWalkie).isBeingUsed && !ShipBuildModeManager.Instance.InBuildMode) { float num = (float)Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").GetValue(); if (!(num < 0.075f)) { Plugin.Log("Speaking into walkie"); ((GrabbableObject)mainWalkie).UseItemOnClient(true); Traverse.Create((object)localPlayerController).Field("timeSinceSwitchingSlots").SetValue((object)0); } } } private static void OnReleaseWalkieButtonPerformed(CallbackContext context) { if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject)) { WalkieTalkie mainWalkie = WalkiePatcher.GetMainWalkie(localPlayerController); if (((CallbackContext)(ref context)).canceled && !((Object)(object)mainWalkie == (Object)null)) { Plugin.Log("Not talking into walkie"); ((GrabbableObject)mainWalkie).UseItemOnClient(false); } } } } }
BepInEx/plugins/FoxGod-ModelReplacement/GigaChad.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 GigaChad.Replacements; using HarmonyLib; using Microsoft.CodeAnalysis; using ModelReplacement; 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("GigaChad")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5f20fdb99e76a4b9660992f65d1a829cece206c0")] [assembly: AssemblyProduct("GigaChad")] [assembly: AssemblyTitle("GigaChad")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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 GigaChad { [BepInPlugin("foxgod.GigaChad", "GigaChad", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigFile config; public static ConfigEntry<bool> DefaultGigaChadSkin { get; private set; } private static void InitConfig() { DefaultGigaChadSkin = config.Bind<bool>("Suits to Replace Settings", "Enable GigaChad as default", false, "Enable to replace every suit with GigaChad."); } private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; InitConfig(); Assets.PopulateAssets(); ModelReplacementAPI.RegisterSuitModelReplacement("GigaChad", typeof(GigaChadReplacement)); if (DefaultGigaChadSkin.Value) { ModelReplacementAPI.RegisterModelReplacementDefault(typeof(GigaChadReplacement)); } Harmony val = new Harmony("foxgod.GigaChad"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin foxgod.GigaChad is loaded!"); } } public static class Assets { public static string mainAssetBundleName = "gigachad_v1_0_0bundle"; 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); } } } } } namespace GigaChad.Replacements { public class GigaChadReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "GigaChad"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/FoxGod-ModelReplacement/ThiccCompany2.0.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 HarmonyLib; using Microsoft.CodeAnalysis; using ModelReplacement; using ThiccCompany.Replacements; 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("ThiccCompany2.0")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5f20fdb99e76a4b9660992f65d1a829cece206c0")] [assembly: AssemblyProduct("ThiccCompany2.0")] [assembly: AssemblyTitle("ThiccCompany2.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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 ThiccCompany { [BepInPlugin("foxgod.ThiccCompanyModelReplacement", "ThiccCompanyModelReplacement", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ConfigFile config; public static ConfigEntry<bool> DefaultOrangeThiccSkin { get; private set; } private static void InitConfig() { DefaultOrangeThiccSkin = config.Bind<bool>("Suits to Replace Settings", "Enable Orange Thicc Suit as default", false, "Enable to replace every suit with Orange Thicc Suit."); } private void Awake() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; InitConfig(); Assets.PopulateAssets(); ModelReplacementAPI.RegisterSuitModelReplacement("CatLightRed", typeof(CatLightRedReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("FoxBlue", typeof(FoxWolfBlueReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("RaccoonPurple", typeof(RaccoonPurpleReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("DragonBlack", typeof(DragonBlackReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("DevilRed", typeof(DevilRedReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("ThiccOrange", typeof(DefaultOrangeReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("FishLightBlue", typeof(FishLightBlueReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("DogGreen", typeof(DogGreenReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("BunnyPink", typeof(BunnyPinkReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("CowWhite", typeof(CowWhiteReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("HorseYellow", typeof(HorseYellowReplacement)); if (DefaultOrangeThiccSkin.Value) { ModelReplacementAPI.RegisterModelReplacementDefault(typeof(DefaultOrangeReplacement)); } Harmony val = new Harmony("foxgod.ThiccCompanyModelReplacement"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin foxgod.ThiccCompanyModelReplacement is loaded!"); } } public static class Assets { public static string mainAssetBundleName = "thicccompany_v2_0_0bundle"; 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); } } } } } namespace ThiccCompany.Replacements { public class CatLightRedReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "CatLightRed"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class FoxWolfBlueReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "FoxWolfBlue"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class RaccoonPurpleReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "RaccoonPurple"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class DragonBlackReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "DragonBlack"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class DevilRedReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "DevilRed"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class DefaultOrangeReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "DefaultOrange"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class FishLightBlueReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "FishLightBlue"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class DogGreenReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "DogGreen"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class BunnyPinkReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "BunnyPink"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class CowWhiteReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "CowWhite"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } public class HorseYellowReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { string text = "HorseYellow"; return Assets.MainAssetBundle.LoadAsset<GameObject>(text); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/QOL/AlwaysHearWalkie.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCAlwaysHearWalkieMod.Patches; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AlwaysHearWalkie")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.4.4.0")] [assembly: AssemblyInformationalVersion("1.4.4+29502bb52bcbc33187ec0645d5c274b3ffd1bc79")] [assembly: AssemblyProduct("Always Hear Active Walkies")] [assembly: AssemblyTitle("AlwaysHearWalkie")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx5.PluginTemplate { public static class MyPluginInfo { public const string PLUGIN_GUID = "AlwaysHearWalkie"; public const string PLUGIN_NAME = "Always Hear Active Walkies"; public const string PLUGIN_VERSION = "1.4.4"; } } namespace LCAlwaysHearWalkieMod { public static class PluginInfo { public const string modGUID = "suskitech.LCAlwaysHearActiveWalkie"; public const string modName = "LC Always Hear Active Walkies"; public const string modVersion = "1.4.4"; } [BepInPlugin("suskitech.LCAlwaysHearActiveWalkie", "LC Always Hear Active Walkies", "1.4.4")] public class Plugin : BaseUnityPlugin { private ConfigEntry<float> configAudibleDistance; public static float AudibleDistance; private ConfigEntry<float> configWalkieRecordingRange; public static float WalkieRecordingRange; private ConfigEntry<float> configPlayerToPlayerSpatialHearingRange; public static float PlayerToPlayerSpatialHearingRange; public static ManualLogSource Log; private static Plugin Instance; public void Awake() { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } configAudibleDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AudibleDistance", 12f, ""); AudibleDistance = configAudibleDistance.Value; configWalkieRecordingRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "WalkieRecordingRange", 20f, ""); WalkieRecordingRange = configWalkieRecordingRange.Value; configPlayerToPlayerSpatialHearingRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PlayerToPlayerSpatialHearingRange", 20f, ""); PlayerToPlayerSpatialHearingRange = configPlayerToPlayerSpatialHearingRange.Value; Log = Logger.CreateLogSource("suskitech.LCAlwaysHearActiveWalkie"); Harmony val = new Harmony("suskitech.LCAlwaysHearActiveWalkie"); val.PatchAll(typeof(Plugin)); val.PatchAll(typeof(PlayerControllerBPatch)); val.PatchAll(typeof(WalkieTalkiePatch)); Log.LogInfo((object)"\\ /"); Log.LogInfo((object)"/|\\"); Log.LogInfo((object)" |----|"); Log.LogInfo((object)" |[__]| Always Hear Active Walkies"); Log.LogInfo((object)" |. .| Version 1.4.4 Loaded"); Log.LogInfo((object)" |____|"); Log.LogInfo((object)""); Log.LogInfo((object)("AudibleDistance: " + AudibleDistance)); Log.LogInfo((object)("WalkieRecordingRange: " + WalkieRecordingRange)); Log.LogInfo((object)("PlayerToPlayerSpatialHearingRange: " + PlayerToPlayerSpatialHearingRange)); } } } namespace LCAlwaysHearWalkieMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static readonly float throttleInterval = 0.35f; private static float throttle = 0f; private static readonly float AverageDistanceToHeldWalkie = 2f; private static readonly float AudibleDistance = Plugin.AudibleDistance; private static readonly float WalkieRecordingRange = Plugin.WalkieRecordingRange; private static readonly float PlayerToPlayerSpatialHearingRange = Plugin.PlayerToPlayerSpatialHearingRange; [HarmonyPatch("Update")] [HarmonyPostfix] private static void alwaysHearWalkieTalkiesPatch(ref bool ___holdingWalkieTalkie, ref PlayerControllerB __instance) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) throttle += Time.deltaTime; if (throttle < throttleInterval) { return; } throttle = 0f; if ((Object)(object)__instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead) { List<WalkieTalkie> list = new List<WalkieTalkie>(); List<WalkieTalkie> list2 = new List<WalkieTalkie>(); for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++) { float num = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, ((Component)__instance).transform.position); if (num <= AudibleDistance) { if (((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed) { list.Add(WalkieTalkie.allWalkieTalkies[i]); } } else { list2.Add(WalkieTalkie.allWalkieTalkies[i]); } } bool flag = list.Count > 0; if (flag != __instance.holdingWalkieTalkie) { ___holdingWalkieTalkie = flag; for (int j = 0; j < list2.Count; j++) { if (j < list.Count) { list2[j].thisAudio.Stop(); } } } if (!flag) { return; } } PlayerControllerB val = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead || !((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)) ? GameNetworkManager.Instance.localPlayerController : GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript); for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[k]; if ((!val2.isPlayerControlled && !val2.isPlayerDead) || (Object)(object)val2 == (Object)(object)GameNetworkManager.Instance.localPlayerController || val2.isPlayerDead || !val2.holdingWalkieTalkie) { continue; } float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position); float num3 = float.MaxValue; float num4 = float.MaxValue; for (int l = 0; l < WalkieTalkie.allWalkieTalkies.Count; l++) { if (!((GrabbableObject)WalkieTalkie.allWalkieTalkies[l]).isBeingUsed) { continue; } float num5 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l].target).transform.position, ((Component)val).transform.position); if (num5 < num4) { num4 = num5; } if (!WalkieTalkie.allWalkieTalkies[l].speakingIntoWalkieTalkie) { float num6 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l]).transform.position, ((Component)val2).transform.position); if (num6 < num3) { num3 = num6; } } } float num7 = Mathf.Min(1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num3), 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num4)); float num8 = 1f - Mathf.InverseLerp(0f, PlayerToPlayerSpatialHearingRange, num2); val2.voicePlayerState.Volume = Mathf.Max(num7, num8); if (val2.speakingToWalkieTalkie && num7 > num8) { makePlayerSoundWalkieTalkie(val2); } else { makePlayerSoundSpatial(val2); } } static void makePlayerSoundSpatial(PlayerControllerB playerController) { AudioSource currentVoiceChatAudioSource = playerController.currentVoiceChatAudioSource; AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>(); AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>(); OccludeAudio component3 = ((Component)currentVoiceChatAudioSource).GetComponent<OccludeAudio>(); ((Behaviour)component2).enabled = false; ((Behaviour)component).enabled = true; component3.overridingLowPass = playerController.voiceMuffledByEnemy; currentVoiceChatAudioSource.spatialBlend = 1f; playerController.currentVoiceChatIngameSettings.set2D = false; currentVoiceChatAudioSource.bypassListenerEffects = false; currentVoiceChatAudioSource.bypassEffects = false; currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId]; component.lowpassResonanceQ = 1f; } static void makePlayerSoundWalkieTalkie(PlayerControllerB playerController) { AudioSource currentVoiceChatAudioSource2 = playerController.currentVoiceChatAudioSource; AudioLowPassFilter component4 = ((Component)currentVoiceChatAudioSource2).GetComponent<AudioLowPassFilter>(); AudioHighPassFilter component5 = ((Component)currentVoiceChatAudioSource2).GetComponent<AudioHighPassFilter>(); OccludeAudio component6 = ((Component)currentVoiceChatAudioSource2).GetComponent<OccludeAudio>(); ((Behaviour)component5).enabled = true; ((Behaviour)component4).enabled = true; component6.overridingLowPass = true; currentVoiceChatAudioSource2.spatialBlend = 0f; playerController.currentVoiceChatIngameSettings.set2D = true; currentVoiceChatAudioSource2.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[playerController.playerClientId]; currentVoiceChatAudioSource2.bypassListenerEffects = false; currentVoiceChatAudioSource2.bypassEffects = false; currentVoiceChatAudioSource2.panStereo = (GameNetworkManager.Instance.localPlayerController.isPlayerDead ? 0f : 0.4f); component6.lowPassOverride = 4000f; component4.lowpassResonanceQ = 3f; } } } [HarmonyPatch(typeof(WalkieTalkie))] internal class WalkieTalkiePatch { [HarmonyPatch("EnableWalkieTalkieListening")] [HarmonyPrefix] private static bool alwaysHearWalkieTalkiesEnableWalkieTalkieListeningPatch(bool enable) { if (!enable) { return false; } return true; } } }
BepInEx/plugins/QOL/AlwaysPickup.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AlwaysPickup")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AlwaysPickup")] [assembly: AssemblyTitle("AlwaysPickup")] [assembly: AssemblyVersion("1.0.0.0")] namespace AlwaysPickup; [BepInPlugin("NutNutty.AlwaysPickup", "Always Pickup", "1.0.0")] public class AlwaysPickup : BaseUnityPlugin { public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("AlwaysPickup").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Always Pickup plugin loaded!"); } } [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObjectPatch { [HarmonyTranspiler] [HarmonyPatch("Start")] private static IEnumerable<CodeInstruction> TranspileGrabbableObject(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, Array.Empty<CodeMatch>()).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(GrabbableObject), "itemProperties")), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(Item), "canBeGrabbedBeforeGameStart")) }).InstructionEnumeration(); } }
BepInEx/plugins/QOL/DeathShovel.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; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DeathShovel")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeathShovel")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ed49b4f9-dc97-411a-b2bc-ef6ec7f89bc8")] [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 DeathShovel { [BepInPlugin("Ccode.DeathShovel", "DeathShovel", "0.0.1")] public class Plugin : BaseUnityPlugin { private const string MyGuid = "Ccode.DeathShovel"; private const string PluginName = "DeathShovel"; private const string VersionString = "0.0.1"; private static readonly Harmony Harmony = new Harmony("Ccode.DeathShovel"); public static ManualLogSource Log; public void Awake() { Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"DeathShovel 0.0.1 loaded."); Log = ((BaseUnityPlugin)this).Logger; } } } namespace DeathShovel.Patches.Items { [HarmonyPatch(typeof(GrabbableObject), "Start")] internal class GrabbableObjectPatch { public static void Prefix(GrabbableObject __instance) { if (((object)__instance).GetType() == typeof(Shovel)) { Shovel val = (Shovel)(object)((__instance is Shovel) ? __instance : null); val.shovelHitForce = 99; } } } [HarmonyPatch(typeof(Shovel), "SwingShovel")] internal class ShovelPatch { public static void Prefix(Shovel __instance, bool cancel = false) { Plugin.Log.LogInfo((object)__instance.shovelHitForce); } } }
BepInEx/plugins/QOL/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/QOL/FireExitLadders.dll
Decompiled 2 years agousing System; using 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 FireExitLadders.Plugin; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FireExitLadders")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FireExitLadders")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bd78aa7e-f834-4e2f-85c3-9e9a7069c8c6")] [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 FireExitLadders { [BepInPlugin("cobster.exitdoor", "exitdoor", "1.0.0.0")] public class MainInitialiser : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("cobster.exitdoor"); private static MainInitialiser Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("cobster.exitdoor"); mls.LogInfo((object)"cobster.exitdoor ONLINE"); 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); } } } harmony.PatchAll(typeof(MainInitialiser)); harmony.PatchAll(typeof(MainPatch2)); } } } namespace FireExitLadders.Plugin { [HarmonyPatch(typeof(PlayerControllerB))] internal class MainPatch2 { [HarmonyPatch("Update")] [HarmonyPostfix] private static void updateObject() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)GameObject.Find("exitDoorLadderCreator"))) { GameObject val = new GameObject("exitDoorLadderCreator"); val.AddComponent<ladderMonoBehavior>(); } } } public class ladderMonoBehavior : MonoBehaviour { private GameObject MainTrigger; private int LoadedScene = 0; private List<GameObject> AddedLadders = new List<GameObject>(); private List<LadderDetails> LadderQueue = new List<LadderDetails>(); public bool FoundALevelScene = false; private void FixedUpdate() { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) int sceneCount = SceneManager.sceneCount; FoundALevelScene = false; for (int i = 0; i < LadderQueue.Count; i++) { if (CreateNewLadder(LadderQueue[i], LadderQueue[i].index)) { LadderQueue.Remove(LadderQueue[i]); } } GameObject val = GameObject.Find("PARENT LADDER"); if ((Object)(object)val != (Object)null) { for (int j = 0; j < val.transform.childCount; j++) { GameObject gameObject = ((Component)val.transform.GetChild(j)).gameObject; if (!(((Object)gameObject).name == "MAIN LADDER TRIGGER") && gameObject.transform.childCount != 0) { Object.Destroy((Object)(object)((Component)gameObject.transform.GetChild(0)).gameObject); } } } for (int k = 0; k < sceneCount; k++) { Scene sceneAt = SceneManager.GetSceneAt(k); if (((Scene)(ref sceneAt)).isLoaded) { switch (((Scene)(ref sceneAt)).name) { case "Level1Experimentation": CheckForLoad(1); FoundALevelScene = true; break; case "Level2Assurance": CheckForLoad(2); FoundALevelScene = true; break; case "Level3Vow": CheckForLoad(3); FoundALevelScene = true; break; case "Level4March": CheckForLoad(4); FoundALevelScene = true; break; case "Level5Rend": CheckForLoad(5); FoundALevelScene = true; break; case "Level6Dine": CheckForLoad(6); FoundALevelScene = true; break; case "Level7Offense": CheckForLoad(7); FoundALevelScene = true; break; case "Level8Titan": CheckForLoad(8); FoundALevelScene = true; break; } } } if (!FoundALevelScene) { CheckForUnload(); } } public bool CreateNewLadder(LadderDetails det, int index) { //IL_00e0: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_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) det.index = index; if ((Object)(object)GameObject.Find("OutsideShipRoom") == (Object)null) { if (!LadderQueue.Contains(det)) { LadderQueue.Add(det); } return false; } GameObject val = Object.Instantiate<GameObject>(((Component)GameObject.Find("OutsideShipRoom").transform.Find("Ladder")).gameObject); det.Created = true; det.ladderObj = val; if (index > 0) { val.transform.SetParent(MainTrigger.transform.parent); val.transform.localPosition = det.position; val.transform.localEulerAngles = Vector3.zero; } else { ((Object)val).name = "PARENT LADDER"; val.transform.position = det.position; val.transform.eulerAngles = det.rotation; MainTrigger = ((Component)val.transform.Find("LadderTrigger")).gameObject; ((Object)MainTrigger).name = "MAIN LADDER TRIGGER"; MainTrigger.transform.localPosition = det.trigPos; MainTrigger.transform.localScale = det.trigSca; } AddedLadders.Add(val); return true; } public void CreateNewWalkway(Vector3 pos, Vector3 rot, Vector3 scale) { //IL_0017: 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_0031: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(GameObject.Find("CatwalkShip")); val.transform.position = pos; val.transform.eulerAngles = rot; val.transform.localScale = scale; GameObject val2 = Object.Instantiate<GameObject>(GameObject.Find("CatwalkRailLiningB")); val2.transform.position = pos; val2.transform.eulerAngles = rot; val2.transform.localScale = scale; AddedLadders.Add(val2); AddedLadders.Add(val); } public void CreateLights(LightDetails[] lighttrail) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_002f: 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_0046: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < lighttrail.Length; i++) { LightDetails lightDetails = lighttrail[i]; GameObject val = new GameObject("cobster.exitdoor LIGHT OBJECT"); Light val2 = val.AddComponent<Light>(); val2.intensity = lightDetails.intensity; val2.color = Color.op_Implicit(lightDetails.Color); val.transform.position = lightDetails.Position; AddedLadders.Add(val); } } public void LoadLevelAdditives(int sceneid) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0103: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) LadderDetails[] array = new LadderDetails[0]; switch (sceneid) { case 1: Debug.Log((object)"Loaded Experimentation Exit Door Ladders : (cobster.exitdoor)"); array = FireExitMapDetails.ExperimentationExitLadders; break; case 2: Debug.Log((object)"Loaded Asssurance Exit Door Ladders : (cobster.exitdoor)"); CreateNewWalkway(new Vector3(109.2948f, 14.3255f, -61.5236f), new Vector3(270f, 32.7873f, 0f), new Vector3(1f, 1f, 0.0878f)); array = FireExitMapDetails.AssuranceExitLadders; break; case 3: Debug.Log((object)"Loaded Vow Exit Door Ladders : (cobster.exitdoor)"); array = FireExitMapDetails.VowExitLadders; break; case 4: Debug.Log((object)"Loaded March Exit Door Ladders : (cobster.exitdoor)"); array = FireExitMapDetails.MarchExitLadders; break; case 5: Debug.Log((object)"Loaded Rend Exit Door Ladders : (cobster.exitdoor)"); CreateNewWalkway(new Vector3(-73.6975f, -13.194f, -121.1399f), new Vector3(270f, 339.8019f, 0f), new Vector3(2f, 2f, 0.1678f)); CreateLights(FireExitMapDetails.RendLightTrail); array = FireExitMapDetails.RendExitLadders; break; case 6: Debug.Log((object)"Loaded Dine Exit Door Ladders : (cobster.exitdoor)"); CreateNewWalkway(new Vector3(-46.0223f, 4.4286f, -83.1384f), new Vector3(90f, 126.7368f, 0f), new Vector3(2f, 2f, 0.1678f)); array = FireExitMapDetails.DineExitLadders; break; case 7: Debug.Log((object)"Loaded Offense Exit Door Ladders : (cobster.exitdoor)"); array = FireExitMapDetails.OffenseExitLadders; break; case 8: Debug.Log((object)"Loaded Titan Exit Door Ladders : (cobster.exitdoor)"); array = FireExitMapDetails.TitanExitLadders; break; } for (int i = 0; i < array.Length; i++) { CreateNewLadder(array[i], i); } } public void CheckForLoad(int sceneid) { if (LoadedScene == 0) { LoadedScene = sceneid; LoadLevelAdditives(sceneid); } } public void CheckForUnload() { if (LoadedScene != 0) { ResetLadderDetails(ActiveSceneDetails()); LoadedScene = 0; for (int i = 0; i < AddedLadders.Count; i++) { GameObject val = AddedLadders[i]; Object.Destroy((Object)(object)val); } MainTrigger = null; AddedLadders = new List<GameObject>(); } } public LadderDetails[] ActiveSceneDetails() { return LoadedScene switch { 1 => FireExitMapDetails.ExperimentationExitLadders, 2 => FireExitMapDetails.AssuranceExitLadders, 3 => FireExitMapDetails.VowExitLadders, 4 => FireExitMapDetails.MarchExitLadders, 5 => FireExitMapDetails.RendExitLadders, 6 => FireExitMapDetails.DineExitLadders, 7 => FireExitMapDetails.OffenseExitLadders, 8 => FireExitMapDetails.TitanExitLadders, _ => new LadderDetails[0], }; } public void ResetLadderDetails(LadderDetails[] dets) { for (int i = 0; i < dets.Length; i++) { dets[i].Created = false; } } } public static class FireExitMapDetails { public static LadderDetails[] ExperimentationExitLadders = new LadderDetails[4] { new LadderDetails(new Vector3(-121.2548f, 3f, -52.7786f), new Vector3(0f, 180f, 0f), new Vector3(-0.2758f, 19.1444f, -0.6996f), new Vector3(1.5025f, 40f, 0.5839f)), new LadderDetails(new Vector3(0f, 9.0227f, 0f), Vector3.zero, Vector3.zero, Vector3.zero), new LadderDetails(new Vector3(0f, 18.18f, 0f), Vector3.zero, Vector3.zero, Vector3.zero), new LadderDetails(new Vector3(0f, 26.9448f, 0f), Vector3.zero, Vector3.zero, Vector3.zero) }; public static LadderDetails[] AssuranceExitLadders = new LadderDetails[2] { new LadderDetails(new Vector3(108.7475f, 4.36f, -58.9745f), new Vector3(0f, 31.6f, 0f), new Vector3(-0.2758f, 10.8932f, -0.6995f), new Vector3(1.5025f, 16f, 0.5839f)), new LadderDetails(new Vector3(0f, 8.9076f, 0f), Vector3.zero, Vector3.zero, Vector3.zero) }; public static LadderDetails[] VowExitLadders = new LadderDetails[0]; public static LadderDetails[] OffenseExitLadders = new LadderDetails[3] { new LadderDetails(new Vector3(22.4995f, 6.1249f, -43.5538f), new Vector3(0f, 3f, 0f), new Vector3(-0.2758f, 4.95f, -0.6995f), new Vector3(1.5025f, 22.5f, 0.5839f)), new LadderDetails(new Vector3(0.0163f, 6.6811f, 0f), Vector3.zero, Vector3.zero, Vector3.zero), new LadderDetails(new Vector3(0.0163f, -8.9989f, 0f), Vector3.zero, Vector3.zero, Vector3.zero) }; public static LadderDetails[] MarchExitLadders = new LadderDetails[0]; public static LadderDetails[] RendExitLadders = new LadderDetails[4] { new LadderDetails(new Vector3(-76.9147f, -33.5369f, -122.6359f), new Vector3(0f, 339.5443f, 0f), new Vector3(-0.2758f, 19.1059f, -0.6995f), new Vector3(1.5025f, 40f, 0.5839f)), new LadderDetails(new Vector3(0.0163f, 9.0048f, 0f), Vector3.zero, Vector3.zero, Vector3.zero), new LadderDetails(new Vector3(0.0163f, 17.9971f, 0f), Vector3.zero, Vector3.zero, Vector3.zero), new LadderDetails(new Vector3(0.0163f, 26.9281f, 0f), Vector3.zero, Vector3.zero, Vector3.zero) }; public static LadderDetails[] DineExitLadders = new LadderDetails[2] { new LadderDetails(new Vector3(-40.1984f, -5.9383f, -83.0799f), new Vector3(0f, 126.516f, 0f), new Vector3(-0.1009f, 12.1365f, -0.6995f), new Vector3(1.5025f, 10.1765f, 0.5839f)), new LadderDetails(new Vector3(0.0163f, 9.0048f, 0f), Vector3.zero, Vector3.zero, Vector3.zero) }; public static LadderDetails[] TitanExitLadders = new LadderDetails[0]; public static LightDetails[] RendLightTrail = new LightDetails[9] { new LightDetails(new Vector3(-68.4192f, -9.2144f, -120.6189f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-57.2119f, -9.0689f, -118.179f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-42.9938f, -9.4325f, -116.7244f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-33.0301f, -11.6325f, -120.6862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-26.0119f, -14.1598f, -124.559f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-15.1756f, -15.378f, -125.8862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-7.5574f, -15.6544f, -125.8862f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-75.6192f, -12.7598f, -122.5788f), 100f, new Vector4(1f, 1f, 0.88f, 1f)), new LightDetails(new Vector3(-77.6011f, -31.8144f, -123.128f), 20f, new Vector4(1f, 1f, 0.88f, 1f)) }; public static Vector3[] ExperimentationExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] AssuranceExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] VowExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] OffenseExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] MarchExitScans = (Vector3[])(object)new Vector3[3] { new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f) }; public static Vector3[] RendExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] DineExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; public static Vector3[] TitanExitScans = (Vector3[])(object)new Vector3[1] { new Vector3(0f, 0f, 0f) }; } public struct LadderDetails { public Vector3 position; public Vector3 rotation; public Vector3 trigPos; public Vector3 trigSca; public int index; public bool Created; public GameObject ladderObj; public LadderDetails(Vector3 pos, Vector3 rot, Vector3 trPos, Vector3 trSca) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) position = pos; rotation = rot; trigPos = trPos; trigSca = trSca; index = 0; Created = false; ladderObj = null; } } public struct LightDetails { public Vector3 Position; public float intensity; public Vector4 Color; public LightDetails(Vector3 pos, float tense, Vector4 col) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_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) Position = pos; intensity = tense; Color = col; } } }
BepInEx/plugins/QOL/fix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Dissonance; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Linkoid.Dissonance.LagFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Linkoid.Dissonance.LagFix")] [assembly: AssemblyCopyright("Copyright © linkoid 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("07f63a54-331c-49fa-870c-ee582bb74fd3")] [assembly: AssemblyFileVersion("1.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.8746.28325")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Linkoid.Dissonance.LagFix { [BepInPlugin("Linkoid.Dissonance.LagFix", "Dissonance Lag Fix", "1.0")] public sealed class DissonanceLagFixPlugin : BaseUnityPlugin { private void Awake() { Logs.SetLogLevel((LogCategory)1, (LogLevel)4); } } public static class PluginInfo { internal const string GUID = "Linkoid.Dissonance.LagFix"; internal const string NAME = "Dissonance Lag Fix"; internal const string VERSION = "1.0"; public static readonly string Guid = "Linkoid.Dissonance.LagFix"; public static readonly string Name = "Dissonance Lag Fix"; public static readonly string Version = "1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/QOL/FovAdjust.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FovAdjust")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FovAdjust")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dfb6681a-9f25-4737-a7fe-10b3c23f65b3")] [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 FovAdjust; [BepInPlugin("Rozebud.FovAdjust", "FOV Adjust", "1.1.1")] public class FovAdjustBase : BaseUnityPlugin { private const string modGUID = "Rozebud.FovAdjust"; private const string modName = "FOV Adjust"; private const string modVer = "1.1.1"; private readonly Harmony harmony = new Harmony("Rozebud.FovAdjust"); private static FovAdjustBase Instance; public static ManualLogSource log; public static ConfigEntry<float> configFov; public static ConfigEntry<bool> configHideVisor; public static bool inDebugMode; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } log = Logger.CreateLogSource("Rozebud.FovAdjust"); log.LogInfo((object)"Starting."); configFov = ((BaseUnityPlugin)this).Config.Bind<float>("General", "fov", 66f, "Change the field of view of the camera. Clamped from 66 to 130 for my sanity. Also keep in mind that this is vertical FOV."); configHideVisor = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "hideVisor", false, "Changes whether the first person visor is visible."); PlayerControllerBPatches.newTargetFovBase = Mathf.Clamp(configFov.Value, 66f, 130f); PlayerControllerBPatches.hideVisor = configHideVisor.Value; log.LogInfo((object)"Configs DONE!"); PlayerControllerBPatches.calculateVisorStuff(); harmony.PatchAll(typeof(PlayerControllerBPatches)); harmony.PatchAll(typeof(HUDManagerPatches)); log.LogInfo((object)"All FOV Adjust patches have loaded successfully."); } } public class PlayerControllerBPatches { public static float newTargetFovBase = 66f; private static float prefixCamFov = 0f; public static bool hideVisor = false; private static Vector3 visorScale; public static Vector3 visorScaleBottom = new Vector3(0.68f, 0.8f, 0.95f); public static Vector3 visorScaleTop = new Vector3(0.68f, 0.35f, 0.99f); public static float linToSinLerp = 0.6f; public static float visorScaleTopRefFOV = 130f; [HarmonyPatch(typeof(PlayerControllerB), "Awake")] [HarmonyPostfix] private static void Awake_Postfix(PlayerControllerB __instance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!filterPlayerControllers(__instance)) { __instance.localVisor.localScale = visorScale; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void Update_Prefix(PlayerControllerB __instance) { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_0099: 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_0119: 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_0199: Unknown result type (might be due to invalid IL or missing references) if (filterPlayerControllers(__instance)) { return; } prefixCamFov = __instance.gameplayCamera.fieldOfView; if (FovAdjustBase.inDebugMode) { if (((ButtonControl)Keyboard.current.minusKey).wasPressedThisFrame) { visorScale.x -= 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } else if (((ButtonControl)Keyboard.current.equalsKey).wasPressedThisFrame) { visorScale.x += 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } if (((ButtonControl)Keyboard.current.leftBracketKey).wasPressedThisFrame) { visorScale.y -= 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } else if (((ButtonControl)Keyboard.current.rightBracketKey).wasPressedThisFrame) { visorScale.y += 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } if (((ButtonControl)Keyboard.current.semicolonKey).wasPressedThisFrame) { visorScale.z -= 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } else if (((ButtonControl)Keyboard.current.quoteKey).wasPressedThisFrame) { visorScale.z += 0.00049999997f; FovAdjustBase.log.LogMessage((object)visorScale); } } if (__instance.localVisor.localScale != visorScale) { __instance.localVisor.localScale = visorScale; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void Update_Postfix(PlayerControllerB __instance) { if (!filterPlayerControllers(__instance)) { float num = newTargetFovBase; if (__instance.inTerminalMenu) { num = 60f; } else if (__instance.IsInspectingItem) { num = 46f; } else if (__instance.isSprinting) { num *= 1.03f; } __instance.gameplayCamera.fieldOfView = Mathf.Lerp(prefixCamFov, num, 6f * Time.deltaTime); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] private static void LateUpdate_Postfix(PlayerControllerB __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: Unknown result type (might be due to invalid IL or missing references) if (!filterPlayerControllers(__instance) && (newTargetFovBase > 66f || FovAdjustBase.inDebugMode)) { __instance.localVisor.position = __instance.localVisor.position + __instance.localVisor.rotation * new Vector3(0f, 0f, -0.06f); } } private static float easeOutSine(float x) { return Mathf.Sin(x * (float)Math.PI / 2f); } public static void calculateVisorStuff() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (hideVisor) { visorScale = new Vector3(0f, 0f, 0f); } else if (newTargetFovBase > 66f || FovAdjustBase.inDebugMode) { float num = (newTargetFovBase - 66f) / (visorScaleTopRefFOV - 66f); num = Mathf.Lerp(num, easeOutSine(num), linToSinLerp); visorScale = Vector3.LerpUnclamped(visorScaleBottom, visorScaleTop, num); } else { visorScale = new Vector3(0.36f, 0.49f, 0.49f); } } private static bool filterPlayerControllers(PlayerControllerB player) { return !((NetworkBehaviour)player).IsOwner || !player.isPlayerControlled || (((NetworkBehaviour)player).IsServer && !player.isHostPlayerObject && !player.isTestingPlayer); } } public class HUDManagerPatches { [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] [HarmonyPrefix] public static bool SubmitChat_performed_Prefix(HUDManager __instance) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) string text = __instance.chatTextField.text; if (text.StartsWith("/fov")) { string[] array = text.Split(new char[1] { ' ' }); if (array.Length > 1 && float.TryParse(array[1], out var result)) { result = Mathf.Clamp(result, 66f, 130f); PlayerControllerBPatches.newTargetFovBase = result; if (!FovAdjustBase.inDebugMode) { PlayerControllerBPatches.calculateVisorStuff(); } } } else if (text.StartsWith("/toggleVisor")) { PlayerControllerBPatches.hideVisor = !PlayerControllerBPatches.hideVisor; PlayerControllerBPatches.calculateVisorStuff(); } else if (text.StartsWith("/recalcVisor") && FovAdjustBase.inDebugMode) { PlayerControllerBPatches.calculateVisorStuff(); } else if (text.StartsWith("/setScaleBottom") && FovAdjustBase.inDebugMode) { string[] array2 = text.Split(new char[1] { ' ' }); PlayerControllerBPatches.visorScaleBottom = new Vector3(float.Parse(array2[1]), float.Parse(array2[2]), float.Parse(array2[3])); } else if (text.StartsWith("/setScaleTop") && FovAdjustBase.inDebugMode) { string[] array3 = text.Split(new char[1] { ' ' }); PlayerControllerBPatches.visorScaleTop = new Vector3(float.Parse(array3[1]), float.Parse(array3[2]), float.Parse(array3[3])); } else if (text.StartsWith("/setSinAmount") && FovAdjustBase.inDebugMode) { string[] array4 = text.Split(new char[1] { ' ' }); PlayerControllerBPatches.linToSinLerp = float.Parse(array4[1]); } else if (text.StartsWith("/setTopRef") && FovAdjustBase.inDebugMode) { string[] array5 = text.Split(new char[1] { ' ' }); PlayerControllerBPatches.visorScaleTopRefFOV = float.Parse(array5[1]); } else { if (!text.StartsWith("/gimmeMyValues") || !FovAdjustBase.inDebugMode) { return true; } ManualLogSource log = FovAdjustBase.log; Vector3 val = PlayerControllerBPatches.visorScaleBottom; log.LogMessage((object)("visorScaleBottom: " + ((object)(Vector3)(ref val)).ToString())); ManualLogSource log2 = FovAdjustBase.log; val = PlayerControllerBPatches.visorScaleTop; log2.LogMessage((object)("visorScaleTop: " + ((object)(Vector3)(ref val)).ToString())); FovAdjustBase.log.LogMessage((object)("linToSinLerp: " + PlayerControllerBPatches.linToSinLerp)); FovAdjustBase.log.LogMessage((object)("visorScaleTopRefFOV: " + PlayerControllerBPatches.visorScaleTopRefFOV)); } __instance.localPlayer = GameNetworkManager.Instance.localPlayerController; __instance.localPlayer.isTypingChat = false; __instance.chatTextField.text = ""; EventSystem.current.SetSelectedGameObject((GameObject)null); ((Behaviour)__instance.typingIndicator).enabled = false; return false; } }
BepInEx/plugins/QOL/FPSSpectate.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 HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FPSSpectate")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("FPS spectate camera")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ada41809ef3e18d1ac6f547212c170f1debd12d4")] [assembly: AssemblyProduct("FPSSpectate")] [assembly: AssemblyTitle("FPSSpectate")] [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 FPSSpectate { [BepInPlugin("5Bit.FPSSpectate", "FPSSpectate", "1.0.0")] public class FPSSpectate : BaseUnityPlugin { private const string modGUID = "5Bit.FPSSpectate"; private const string modName = "FPSSpectate"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("5Bit.FPSSpectate"); private static FPSSpectate Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("5Bit.FPSSpectate"); harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "FPSSpectate"; public const string PLUGIN_NAME = "FPSSpectate"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace FPSSpectate.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class FPSSpectatePatch { private const float SPECTATE_OFFSET = 1.5f; private static bool firstPerson = true; private static bool debounced = false; [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void LateUpdate(PlayerControllerB __instance) { //IL_008d: 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_0099: 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_00a7: 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_00ba: Unknown result type (might be due to invalid IL or missing references) if (((ButtonControl)Keyboard.current.vKey).wasPressedThisFrame && !debounced) { firstPerson = !firstPerson; debounced = true; } if (((ButtonControl)Keyboard.current.vKey).wasReleasedThisFrame) { debounced = false; } if ((Object)(object)__instance.spectatedPlayerScript != (Object)null && firstPerson) { Transform transform = ((Component)__instance.spectateCameraPivot).transform; Transform transform2 = ((Component)__instance.spectatedPlayerScript.visorCamera).transform; Vector3 position = transform2.position; Vector3 forward = transform2.forward; transform.position = position + ((Vector3)(ref forward)).normalized * 1.5f; transform.rotation = transform2.rotation; } } } }
BepInEx/plugins/QOL/FreeMoons.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; [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("FreeMoons")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FreeMoons")] [assembly: AssemblyTitle("FreeMoons")] [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 SRH.Mods.LC { [BepInPlugin("SlushyRH.LethalCompany.FreeMoons", "FreeMoons", "1.0.1")] public class FreeMoonsPlugin : BaseUnityPlugin { private const string GUID = "SlushyRH.LethalCompany.FreeMoons"; private const string NAME = "FreeMoons"; private const string VERSION = "1.0.1"; private readonly Harmony harmony = new Harmony("SlushyRH.LethalCompany.FreeMoons"); public static FreeMoonsPlugin Instance { get; private set; } public ManualLogSource Log { get; private set; } private void Awake() { Log = Logger.CreateLogSource("SlushyRH.LethalCompany.FreeMoons"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(typeof(MoonPricePatch)); } } [HarmonyPatch(typeof(Terminal))] internal class MoonPricePatch { private static Terminal terminal = null; private static int totalCostOfItems = -5; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void FindTerminal() { FreeMoonsPlugin.Instance.Log.LogInfo((object)"Finding terminal object!"); terminal = Object.FindObjectOfType<Terminal>(); if ((Object)(object)terminal == (Object)null) { FreeMoonsPlugin.Instance.Log.LogError((object)"Failed to find terminal object!"); } else { FreeMoonsPlugin.Instance.Log.LogInfo((object)"Found terminal object!"); } } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void LoadNewNodePatchBefore(ref TerminalNode node) { if ((!((Object)(object)terminal == (Object)null) || !((Object)(object)node == (Object)null)) && node.buyRerouteToMoon == -2) { Traverse val = Traverse.Create((object)terminal).Field("totalCostOfItems"); totalCostOfItems = (int)val.GetValue(); val.SetValue((object)0); } } [HarmonyPatch("LoadNewNode")] [HarmonyPostfix] private static void LoadNewNodePatchAfter(ref TerminalNode node) { if ((!((Object)(object)terminal == (Object)null) || !((Object)(object)node == (Object)null)) && totalCostOfItems != -5) { Traverse val = Traverse.Create((object)terminal).Field("totalCostOfItems"); val.SetValue((object)0); totalCostOfItems = -5; } } [HarmonyPatch("LoadNewNodeIfAffordable")] [HarmonyPrefix] private static void LoadNewNodeIfAffordablePatch(ref TerminalNode node) { if (!((Object)(object)node == (Object)null) && node.buyRerouteToMoon != -1) { node.itemCost = 0; } } } }
BepInEx/plugins/QOL/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/QOL/InstantShipLever.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 HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("InstantShipLever")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Instantly trigger ship lever")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("InstantShipLever")] [assembly: AssemblyTitle("InstantShipLever")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace InstantShipLever; [BepInPlugin("ViViKo.InstantShipLever", "InstantShipLever", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartMatchLever))] internal class StartMatchLeverPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartMatchLever __instance) { __instance.triggerScript.holdInteraction = false; } } private const string modGUID = "ViViKo.InstantShipLever"; private const string modName = "InstantShipLever"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("ViViKo.InstantShipLever"); private static Plugin Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin InstantShipLever is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "InstantShipLever"; public const string PLUGIN_NAME = "InstantShipLever"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/QOL/ItemDropCycler.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using ItemDropCycler.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ItemDropCycler")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ItemDropCycler")] [assembly: AssemblyTitle("ItemDropCycler")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ItemDropCycler { [BepInPlugin("LCMOD.ItemDropCycler", "ItemDropCycler", "1.1.0")] public class ItemDropCyclerBase : BaseUnityPlugin { public const string MODGUID = "LCMOD.ItemDropCycler"; public const string MODNAME = "ItemDropCycler"; public const string MODVERSION = "1.1.0"; private readonly Harmony harmony = new Harmony("LCMOD.ItemDropCycler"); public static ItemDropCyclerBase Instance; public static ManualLogSource logger; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod LCMOD.ItemDropCycler is loaded!"); harmony.PatchAll(typeof(ItemDropCyclerBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } } namespace ItemDropCycler.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("DiscardHeldObject")] [HarmonyPostfix] private static void CycleSlotsOnDrop() { ItemDropCyclerBase.logger.LogInfo((object)"Item Dropped"); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; MethodInfo method = typeof(PlayerControllerB).GetMethod("NextItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(PlayerControllerB).GetMethod("SwitchToItemSlot", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method3 = typeof(PlayerControllerB).GetMethod("SwitchItemSlotsServerRpc", BindingFlags.Instance | BindingFlags.NonPublic); object[] parameters = new object[1] { true }; object obj = method.Invoke(localPlayerController, parameters); object[] parameters2 = new object[2] { obj, null }; ItemDropCyclerBase.logger.LogInfo((object)$"Got slot at {obj} \tOld: {localPlayerController.currentItemSlot}"); method2.Invoke(localPlayerController, parameters2); method3.Invoke(localPlayerController, parameters); ItemDropCyclerBase.logger.LogInfo((object)$"Set slot at {obj}"); } } }
BepInEx/plugins/QOL/JumpDelayPatch.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("JumpDelayPatch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("JumpDelayPatch")] [assembly: AssemblyTitle("JumpDelayPatch")] [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 JumpDelayPatch { [BepInPlugin("monke.lc.jumpdelay", "Jump Delay Patch", "0.0.0.1")] public class monkeDelayPatch : BaseUnityPlugin { [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class PlayerControllerB_PlayerJump { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4) { list[i] = new CodeInstruction(OpCodes.Ldc_R4, (object)0f); } } return list; } } private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin JumpDelayPatch is loaded!"); Harmony val = new Harmony("monke.lc.jumpdelay"); val.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "JumpDelayPatch"; public const string PLUGIN_NAME = "JumpDelayPatch"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/QOL/LC_Optim.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("LC_Optim")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Source moment")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LC_Optim")] [assembly: AssemblyTitle("LC_Optim")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LC_Optim; [BepInPlugin("mnc.fixcentipedelag", "FixCentipedeLag", "2023.12.7")] public class Plugin : BaseUnityPlugin { private Harmony thisHarmony; private static Dictionary<int, ulong> instanceMap = new Dictionary<int, ulong>(); private static ulong deadtimer = 100uL; private static ManualLogSource Log; private static ConfigEntry<bool> configShowDebug; private static void Debug(object data, LogLevel logLevel = 16) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (configShowDebug.Value) { Log.Log(logLevel, data); } } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown configShowDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable debug printing", true, "Enabling this will show debug info in console, e.g. when a new centipede gets tracked or removed."); thisHarmony = new Harmony("mnc.fixcentipedelag"); thisHarmony.Patch((MethodBase)typeof(CentipedeAI).GetMethod("DoAIInterval"), new HarmonyMethod(typeof(Plugin), "RemoveLagCentipede", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug("Registered the patch method", (LogLevel)4); Log = ((BaseUnityPlugin)this).Logger; } public static void RemoveLagCentipede(CentipedeAI __instance) { if (((EnemyAI)__instance).TargetClosestPlayer(1.5f, false, 70f)) { return; } int instanceID = ((Object)__instance).GetInstanceID(); ulong num = (ulong)Time.frameCount; if (!instanceMap.ContainsKey(instanceID)) { instanceMap.Add(instanceID, num); Debug($"Tracked {instanceID}", (LogLevel)16); return; } ulong num2 = instanceMap[instanceID]; if (num - num2 <= deadtimer) { ((EnemyAI)__instance).KillEnemy(true); instanceMap.Remove(instanceID); Debug($"Removed centipede at {instanceID}", (LogLevel)16); } else { instanceMap[instanceID] = num; } } public void OnDestroy() { thisHarmony.UnpatchSelf(); } } internal class PluginMetadata { public const string PLUGIN_GUID = "mnc.fixcentipedelag"; public const string PLUGIN_NAME = "FixCentipedeLag"; public const string PLUGIN_VERSION = "2023.12.7"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "LC_Optim"; public const string PLUGIN_NAME = "LC_Optim"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/QOL/LetMeLookDown.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 BepInEx; using GameNetcodeStuff; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LetMeLookDown")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LetMeLookDown")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a9c88d54-8f01-44a7-be0d-bd61d38aadcb")] [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 LetMeLookDown { [BepInPlugin("FlipMods.LetMeLookDown", "LetMeLookDown", "1.0.1")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; private static Plugin instance; public static float maxAngle = 80f; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("LetMeLookDown"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LetMeLookDown mod loaded"); instance = this; } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.LetMeLookDown"; public const string PLUGIN_NAME = "LetMeLookDown"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace LetMeLookDown.Patches { [HarmonyPatch] internal class AdjustSmoothLookingPatcher { [HarmonyPatch(typeof(PlayerControllerB), "CalculateSmoothLookingInput")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f) { list[i].operand = Plugin.maxAngle; break; } } return list.AsEnumerable(); } } [HarmonyPatch] internal class AdjustNormalLookingPatcher { [HarmonyPatch(typeof(PlayerControllerB), "CalculateNormalLookingInput")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 60f) { list[i].operand = Plugin.maxAngle; break; } } return list.AsEnumerable(); } } }
BepInEx/plugins/QOL/NoPropShadows.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NoPropShadows")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoPropShadows")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1dbd924a-01a9-47b2-8455-ee6d1110f363")] [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 NoPropShadows; [BepInPlugin("LCMOD.NoPropShadows", "NoPropShadows", "1.0.0")] public class NoPropShadowsBase : BaseUnityPlugin { public const string MODGUID = "LCMOD.NoPropShadows"; public const string MODNAME = "NoPropShadows"; public const string MODVERSION = "1.0.0"; private readonly Harmony harmony = new Harmony("LCMOD.NoPropShadows"); public static NoPropShadowsBase Instance; public static ManualLogSource logger; private List<string> items = new List<string> { "FancyLamp", "FancyLamp(Clone)", "LungApparatusTurnedOff", "LungApparatusTurnedOff(Clone)" }; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod LCMOD.NoPropShadows is loaded!"); harmony.PatchAll(typeof(NoPropShadowsBase)); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void lightpatch() { foreach (Light item in Resources.FindObjectsOfTypeAll<Light>().ToList()) { if ((Object)(object)item != (Object)null && (Object)(object)((Component)item).transform.parent != (Object)null) { string name = ((Object)((Component)item).transform.parent).name; if (Instance.items.Contains(name)) { item.shadows = (LightShadows)0; } } } } }
BepInEx/plugins/QOL/Permanent Ladder.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 Permanent_Ladder.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Permanent Ladder")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Permanent Ladder")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3be085ce-9b50-41f6-8f0a-a66bd6406015")] [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 Permanent_Ladder { [BepInPlugin("JPSilver.EquipmentTweaks", "Equipment Tweaks", "1.0.0")] public class PLadder : BaseUnityPlugin { private const string modGUID = "JPSilver.EquipmentTweaks"; private const string modName = "Equipment Tweaks"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("JPSilver.EquipmentTweaks"); private static PLadder Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("JPSilver.EquipmentTweaks"); mls.LogInfo((object)"EquipmentTweaks is Awake"); harmony.PatchAll(typeof(PLadder)); harmony.PatchAll(typeof(LadderPatch)); } } } namespace Permanent_Ladder.Patches { [HarmonyPatch(typeof(ExtensionLadderItem))] internal class LadderPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void NoRetractPatch(ref float ___ladderTimer) { ___ladderTimer = 3f; } } }
BepInEx/plugins/QOL/ScanThruWalls.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 GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ScanThruWalls")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ScanThruWalls")] [assembly: AssemblyTitle("ScanThruWalls")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ScanThruWalls; [BepInPlugin("com.cream.lethalcompany.scanthruwalls", "Scan Thru Walls", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.cream.lethalcompany.scanthruwalls"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ScanThruWalls is loaded!"); harmony.PatchAll(); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatcher { [HarmonyPostfix] [HarmonyPatch("MeetsScanNodeRequirements")] private static void alterReqs(ScanNodeProperties node, ref bool __result, PlayerControllerB playerScript) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)node == (Object)null) { __result = false; return; } float num = Vector3.Distance(((Component)playerScript).transform.position, ((Component)node).transform.position); __result = num < (float)node.maxRange && num > (float)node.minRange; } } public static class PluginInfo { public const string PLUGIN_GUID = "ScanThruWalls"; public const string PLUGIN_NAME = "ScanThruWalls"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/QOL/ShipLoot.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShipLoot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ShipLoot")] [assembly: AssemblyCopyright("Copyright © tinyhoot 2023")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ShipLoot { [BepInPlugin("com.github.tinyhoot.ShipLoot", "ShipLoot", "1.0")] internal class ShipLoot : BaseUnityPlugin { public const string GUID = "com.github.tinyhoot.ShipLoot"; public const string NAME = "ShipLoot"; public const string VERSION = "1.0"; internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.github.tinyhoot.ShipLoot").PatchAll(Assembly.GetExecutingAssembly()); } } } namespace ShipLoot.Patches { [HarmonyPatch] internal class HudManagerPatcher { private static GameObject _totalCounter; private static TextMeshProUGUI _textMesh; private static float _displayTimeLeft; private const float DisplayTime = 5f; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] private static void OnScan(HUDManager __instance, CallbackContext context) { if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && ((CallbackContext)(ref context)).performed && __instance.CanPlayerScan() && !(__instance.playerPingingScan > -0.5f) && (StartOfRound.Instance.inShipPhase || GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)) { if (!Object.op_Implicit((Object)(object)_totalCounter)) { CopyValueCounter(); } float num = CalculateLootValue(); ((TMP_Text)_textMesh).text = $"SHIP: ${num:F0}"; _displayTimeLeft = 5f; if (!_totalCounter.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ShipLootCoroutine()); } } } private static IEnumerator ShipLootCoroutine() { _totalCounter.SetActive(true); while (_displayTimeLeft > 0f) { float displayTimeLeft = _displayTimeLeft; _displayTimeLeft = 0f; yield return (object)new WaitForSeconds(displayTimeLeft); } _totalCounter.SetActive(false); } private static float CalculateLootValue() { List<GrabbableObject> list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>() where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem" select obj).ToList(); ShipLoot.Log.LogDebug((object)"Calculating total ship scrap value."); CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)list, (Action<GrabbableObject>)delegate(GrabbableObject scrap) { ShipLoot.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}"); }); return list.Sum((GrabbableObject scrap) => scrap.scrapValue); } private static void CopyValueCounter() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!Object.op_Implicit((Object)(object)val)) { ShipLoot.Log.LogError((object)"Failed to find ValueCounter object to copy!"); } _totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false); _totalCounter.transform.Translate(0f, 1f, 0f); Vector3 localPosition = _totalCounter.transform.localPosition; _totalCounter.transform.localPosition = new Vector3(localPosition.x + 50f, -50f, localPosition.z); _textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>(); } } }
BepInEx/plugins/QOL/SnapRotateDecor.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 SnapRotateFurniture.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SnapRotateDecor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SnapRotateDecor")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f8855d2f-421c-493b-a4b8-096a44d3d8ee")] [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 SnapRotateFurniture { [BepInPlugin("SleeplessKyru.SnapRotateFurniture", "Snap Rotate Furniture", "1.0.1")] public class SleeplessModBase : BaseUnityPlugin { private const string modGUID = "SleeplessKyru.SnapRotateFurniture"; private const string modName = "Snap Rotate Furniture"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("SleeplessKyru.SnapRotateFurniture"); private static SleeplessModBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance != (Object)null) { Instance = this; } mls = Logger.CreateLogSource("SleeplessKyru.SnapRotateFurniture"); mls.LogInfo((object)"Snap Rotate Furniture by Sleepless Kyru has loaded!"); harmony.PatchAll(typeof(SleeplessModBase)); harmony.PatchAll(typeof(SnapRotateFurniturePatch)); } } } namespace SnapRotateFurniture.Patches { [HarmonyPatch(typeof(ShipBuildModeManager))] internal class SnapRotateFurniturePatch { private static bool wasButtonPressed; [HarmonyPatch("Update")] [HarmonyPostfix] private static void rotateFurniturePatch(ref PlayerActions ___playerActions, ref Transform ___ghostObject) { //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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) if (!IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).IsPressed()) { if (StartOfRound.Instance.localPlayerUsingController) { MovementActions movement = ___playerActions.Movement; if (((MovementActions)(ref movement)).ActivateItem.IsPressed()) { goto IL_004c; } } if (wasButtonPressed) { wasButtonPressed = false; float num = 45f; Vector3 eulerAngles = ___ghostObject.eulerAngles; float num2 = Mathf.Round(eulerAngles.y / num) * num + num; ___ghostObject.eulerAngles = new Vector3(eulerAngles.x, num2, eulerAngles.z); } return; } goto IL_004c; IL_004c: wasButtonPressed = true; } } }
BepInEx/plugins/QOL/unlimitedTZP.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("unlimitedTZP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("unlimitedTZP")] [assembly: AssemblyTitle("unlimitedTZP")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace unlimitedTZP { [BepInPlugin("atk.lethalcompany.unlimitedtzp", "Later Nights", "1.0.0")] public class Main : BaseUnityPlugin { public const string pluginGuid = "atk.lethalcompany.unlimitedtzp"; public const string pluginName = "Later Nights"; public const string pluginVersion = "1.0.0"; public static Harmony harmony; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("atk.lethalcompany.unlimitedtzp"); harmony.PatchAll(typeof(Patches)); } } [HarmonyPatch] internal class Patches { [HarmonyPatch(typeof(TetraChemicalItem), "Update")] [HarmonyPostfix] public static void Update(ref TetraChemicalItem __instance, ref float ___fuel) { ___fuel = 1f; } } }
BepInEx/plugins/QOL/Walkieuse.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 HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Walkie")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+1140cd6824cd255f22105cd5a33a31e275fa9407")] [assembly: AssemblyProduct("Walkie")] [assembly: AssemblyTitle("Walkie")] [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 Walkie { public class WalkieButton : LcInputActions { [InputAction("<Keyboard>/r", Name = "Walkie")] public InputAction WalkieKey { get; set; } } [BepInPlugin("rr.Walkie", "WalkieUse", "1.4.0")] [HarmonyPatch(typeof(PlayerControllerB))] public class WalkieToggle : BaseUnityPlugin { private static string path = Application.persistentDataPath + "/walkiebutton.txt"; internal static ManualLogSource logSource; internal static WalkieButton InputActionInstance = new WalkieButton(); private Harmony _harmony = new Harmony("Walkie"); private void Awake() { _harmony.PatchAll(typeof(WalkieToggle)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"------Walkie done.------"); logSource = ((BaseUnityPlugin)this).Logger; } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void ReadInput(PlayerControllerB __instance) { GrabbableObject val = null; if (((!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject)) && !__instance.isTestingPlayer) || __instance.inTerminalMenu || __instance.isTypingChat || ShipBuildModeManager.Instance.InBuildMode || !Application.isFocused) { return; } for (int i = 0; i < __instance.ItemSlots.Length; i++) { if (__instance.ItemSlots[i] is WalkieTalkie && __instance.ItemSlots[i].isBeingUsed) { val = __instance.ItemSlots[i]; break; } } if ((Object)(object)val == (Object)null) { return; } if (InputActionInstance.WalkieKey.WasPressedThisFrame()) { try { if (__instance.currentlyHeldObjectServer is WalkieTalkie) { __instance.currentlyHeldObjectServer.UseItemOnClient(true); } else if ((Object)(object)val != (Object)null) { val.UseItemOnClient(true); } } catch { } } if (!InputActionInstance.WalkieKey.WasReleasedThisFrame()) { return; } try { if (__instance.currentlyHeldObjectServer is WalkieTalkie) { __instance.currentlyHeldObjectServer.UseItemOnClient(false); } else if ((Object)(object)val != (Object)null) { val.UseItemOnClient(false); } } catch { } } } public static class PluginInfo { public const string PLUGIN_GUID = "Walkie"; public const string PLUGIN_NAME = "Walkie"; public const string PLUGIN_VERSION = "1.0.0"; } }
BepInEx/plugins/QOL/Zoom.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Unity.Netcode; 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("Zoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Zoom")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("CE105124-69D9-465A-B917-8A3F3B1E0303")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace Zoom; [BepInPlugin("Mhz.Zoom", "MHZoom", "1.0.0")] public class Plugin1 : BaseUnityPlugin { public class ZoomButton : LcInputActions { [InputAction("<Keyboard>/z", Name = "Zoom")] public InputAction ZoomKey { get; set; } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] private class ZoomStartPatch { private static void Prefix(PlayerControllerB __instance) { _original = __instance.gameplayCamera.fieldOfView; _offset = _original - 45f; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] private class ZoomUpdatePatch { private static void Prefix(PlayerControllerB __instance) { if ((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) { if (InputActionInstance.ZoomKey.WasPressedThisFrame()) { _anxia = true; } if (InputActionInstance.ZoomKey.WasReleasedThisFrame()) { _anxia = false; __instance.gameplayCamera.fieldOfView = _original; } } if (_anxia) { __instance.gameplayCamera.fieldOfView = _offset; } } } private Harmony _harmony; private static float _original; private static float _offset; private static bool _anxia; internal static ZoomButton InputActionInstance = new ZoomButton(); internal static ManualLogSource logSource; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown _anxia = false; _harmony = new Harmony("Mhz.Zoom"); _harmony.PatchAll(); logSource = ((BaseUnityPlugin)this).Logger; logSource.LogInfo((object)"Zoomok."); } }
BepInEx/plugins/Spray paint mods/BetterSprayPaint.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BetterSprayPaint")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("BetterSprayPaint")] [assembly: AssemblyTitle("BetterSprayPaint")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] 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 BetterSprayPaint { [BepInPlugin("taffyko.BetterSprayPaint", "BetterSprayPaint", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "taffyko.BetterSprayPaint"; public const string modName = "BetterSprayPaint"; public const string modVersion = "1.1.0"; private readonly Harmony harmony = new Harmony("taffyko.BetterSprayPaint"); public static ManualLogSource? log; private static bool? infiniteTank; private static bool? allowErasing; private static float? volume; public static bool InfiniteTank => infiniteTank ?? true; public static bool AllowErasing => allowErasing ?? true; public static float Volume => volume ?? 0.2f; private void Awake() { log = Logger.CreateLogSource("BetterSprayPaint"); log.LogInfo((object)"Loading taffyko.BetterSprayPaint"); if (bool.TryParse(((BaseUnityPlugin)this).Config.Bind<string>("General", "AllowErasing", (string)null, "(default: true) If true, holding tertiary action (default: E) while spraying allows you to erase. The host's setting applies to everyone in the lobby.").Value, out var result)) { allowErasing = result; } if (bool.TryParse(((BaseUnityPlugin)this).Config.Bind<string>("General", "InfiniteTank", (string)null, "(default: true) If true, the spray can has infinite uses. The host's setting applies to everyone in the lobby.").Value, out var result2)) { infiniteTank = result2; } if (float.TryParse(((BaseUnityPlugin)this).Config.Bind<string>("General", "Volume", (string)null, "(default: 0.2) Volume of spray paint sound effects.").Value, out var result3)) { volume = result3; } harmony.PatchAll(Assembly.GetExecutingAssembly()); } private void OnDestroy() { } } public class SprayPaintItemExtraBehaviour : MonoBehaviour { public void OnDestroy() { SprayPaintItem val = default(SprayPaintItem); ((Component)this).TryGetComponent<SprayPaintItem>(ref val); if ((Object)(object)val != (Object)null) { Patches.unload(val); } } } [HarmonyPatch] internal class Patches { public class SessionData { public bool handlerRegistered; public bool? allowErasing; public bool? infiniteTank; } public class CustomFields { public Material? sprayParticleMaterial; public Material? sprayEraseParticleMaterial; public int sprayPaintMask; public bool handlerRegistered; public SprayPaintItemExtraBehaviour? extraBehaviour; } private const string msgConfigAllowErasing = "taffyko.BetterSprayPaint.ConfigAllowErasing"; private const string msgConfigInfiniteTank = "taffyko.BetterSprayPaint.ConfigInfiniteTank"; public static SessionData? sessionData = null; public static InputAction? tertiaryUseAction; public static Dictionary<SprayPaintItem, CustomFields> fields = new Dictionary<SprayPaintItem, CustomFields>(); private static MethodInfo physicsRaycast = typeof(Physics).GetMethod("Raycast", new Type[5] { typeof(Ray), typeof(RaycastHit).MakeByRefType(), typeof(float), typeof(int), typeof(QueryTriggerInteraction) }); private static MethodInfo raycastSkipPlayer = typeof(Patches).GetMethod("RaycastSkipPlayer"); public static bool InfiniteTank => sessionData?.infiniteTank ?? Plugin.InfiniteTank; public static bool AllowErasing => sessionData?.allowErasing ?? Plugin.AllowErasing; [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "Update")] public static void PlayerUpdate(PlayerControllerB __instance) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00ed: 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) PlayerControllerB __instance2 = __instance; if (!IsLocalPlayer(__instance2)) { return; } sessionData = new SessionData(); if (((NetworkBehaviour)__instance2).NetworkManager.IsConnectedClient || ((NetworkBehaviour)__instance2).NetworkManager.IsServer) { CustomMessagingManager msgManager = ((NetworkBehaviour)__instance2).NetworkManager.CustomMessagingManager; if (!sessionData.handlerRegistered) { msgManager.RegisterNamedMessageHandler("taffyko.BetterSprayPaint.ConfigInfiniteTank", (HandleNamedMessageDelegate)delegate(ulong clientId, FastBufferReader reader) { //IL_004f: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance2).NetworkManager.IsServer) { FastBufferWriter val4 = default(FastBufferWriter); ((FastBufferWriter)(ref val4))..ctor(10, (Allocator)2, -1); bool infiniteTank = Plugin.InfiniteTank; ((FastBufferWriter)(ref val4)).WriteValue<bool>(ref infiniteTank, default(ForPrimitives)); msgManager.SendNamedMessage("taffyko.BetterSprayPaint.ConfigInfiniteTank", clientId, val4, (NetworkDelivery)3); } else { bool value2 = default(bool); ((FastBufferReader)(ref reader)).ReadValue<bool>(ref value2, default(ForPrimitives)); sessionData.infiniteTank = value2; } }); msgManager.RegisterNamedMessageHandler("taffyko.BetterSprayPaint.ConfigAllowErasing", (HandleNamedMessageDelegate)delegate(ulong clientId, FastBufferReader reader) { //IL_004f: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance2).NetworkManager.IsServer) { FastBufferWriter val3 = default(FastBufferWriter); ((FastBufferWriter)(ref val3))..ctor(10, (Allocator)2, -1); bool allowErasing = Plugin.AllowErasing; ((FastBufferWriter)(ref val3)).WriteValue<bool>(ref allowErasing, default(ForPrimitives)); msgManager.SendNamedMessage("taffyko.BetterSprayPaint.ConfigAllowErasing", clientId, val3, (NetworkDelivery)3); } else { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValue<bool>(ref value, default(ForPrimitives)); sessionData.allowErasing = value; } }); sessionData.handlerRegistered = true; } if (!sessionData.infiniteTank.HasValue) { if (!((NetworkBehaviour)__instance2).NetworkManager.IsServer) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(0, (Allocator)2, -1); msgManager.SendNamedMessage("taffyko.BetterSprayPaint.ConfigInfiniteTank", 0uL, val, (NetworkDelivery)3); } sessionData.infiniteTank = Plugin.InfiniteTank; } if (!sessionData.allowErasing.HasValue) { if (!((NetworkBehaviour)__instance2).NetworkManager.IsServer) { FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(0, (Allocator)2, -1); msgManager.SendNamedMessage("taffyko.BetterSprayPaint.ConfigAllowErasing", 0uL, val2, (NetworkDelivery)3); } sessionData.allowErasing = Plugin.AllowErasing; } } else { sessionData = null; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "OnDestroy")] public static void PlayerDestroy(PlayerControllerB __instance) { if (IsLocalPlayer(__instance)) { sessionData = null; } NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; CustomMessagingManager obj = ((networkManager != null) ? networkManager.CustomMessagingManager : null); if (obj != null) { obj.UnregisterNamedMessageHandler("taffyko.BetterSprayPaint.ConfigInfiniteTank"); } if (obj != null) { obj.UnregisterNamedMessageHandler("taffyko.BetterSprayPaint.ConfigAllowErasing"); } } public static bool IsLocalPlayer(PlayerControllerB player) { return (Object)(object)player == (Object)(object)StartOfRound.Instance?.localPlayerController; } [HarmonyPostfix] [HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")] public static void Update(SprayPaintItem __instance, ref float ___sprayCanTank, ref float ___sprayCanShakeMeter, ref AudioSource ___sprayAudio) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) reload(__instance); if (InfiniteTank) { ___sprayCanTank = 1f; } __instance.maxSprayPaintDecals = 4000; __instance.sprayIntervalSpeed = 0.01f; ___sprayAudio.volume = Plugin.Volume; if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null)) { return; } if (!IsLocalPlayer(((GrabbableObject)__instance).playerHeldBy)) { ___sprayCanShakeMeter = Math.Max(0.5f, ___sprayCanShakeMeter); } Animator playerBodyAnimator = ((GrabbableObject)__instance).playerHeldBy.playerBodyAnimator; AnimatorClipInfo[] currentAnimatorClipInfo = playerBodyAnimator.GetCurrentAnimatorClipInfo(2); for (int i = 0; i < currentAnimatorClipInfo.Length; i++) { AnimatorClipInfo val = currentAnimatorClipInfo[i]; if (((Object)((AnimatorClipInfo)(ref val)).clip).name == "ShakeItem") { AnimatorStateInfo currentAnimatorStateInfo = playerBodyAnimator.GetCurrentAnimatorStateInfo(2); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime > 0.1f) { playerBodyAnimator.Play("HoldOneHandedItem"); } } } } public static string msgErase(SprayPaintItem __instance) { return string.Format("{0}.Erase.{1}", "taffyko.BetterSprayPaint", ((NetworkBehaviour)__instance).NetworkObjectId); } public static string msgSpray(SprayPaintItem __instance) { return string.Format("{0}.Spray.{1}", "taffyko.BetterSprayPaint", ((NetworkBehaviour)__instance).NetworkObjectId); } public static void reload(SprayPaintItem __instance) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown SprayPaintItem __instance2 = __instance; if (!fields.ContainsKey(__instance2)) { fields[__instance2] = new CustomFields(); } CustomFields customFields = fields[__instance2]; if (tertiaryUseAction == null) { tertiaryUseAction = IngamePlayerSettings.Instance.playerInput.actions.FindAction("ItemTertiaryUse", false); } if ((Object)(object)customFields.extraBehaviour == (Object)null && !((Component)__instance2).TryGetComponent<SprayPaintItemExtraBehaviour>(ref customFields.extraBehaviour)) { customFields.extraBehaviour = ((Component)__instance2).gameObject.AddComponent<SprayPaintItemExtraBehaviour>(); } if (customFields.sprayPaintMask == 0) { customFields.sprayPaintMask = Traverse.Create((object)__instance2).Field("sprayPaintMask").GetValue<int>(); } if ((Object)(object)customFields.sprayParticleMaterial == (Object)null) { int value = Traverse.Create((object)__instance2).Field<int>("sprayCanMatsIndex").Value; customFields.sprayParticleMaterial = __instance2.particleMats[value]; } if ((Object)(object)customFields.sprayEraseParticleMaterial == (Object)null) { customFields.sprayEraseParticleMaterial = new Material(customFields.sprayParticleMaterial); customFields.sprayEraseParticleMaterial.color = new Color(0.5f, 0.5f, 0.5f, 1f); } if ((!((NetworkBehaviour)__instance2).NetworkManager.IsConnectedClient && !((NetworkBehaviour)__instance2).NetworkManager.IsServer) || customFields.handlerRegistered) { return; } CustomMessagingManager msgManager = ((NetworkBehaviour)__instance2).NetworkManager.CustomMessagingManager; msgManager.RegisterNamedMessageHandler(msgErase(__instance2), (HandleNamedMessageDelegate)delegate(ulong clientId, FastBufferReader reader) { //IL_0057: 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) if (AllowErasing) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); if (((NetworkBehaviour)__instance2).NetworkManager.IsServer && clientId != 0L) { FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(100, (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); msgManager.SendNamedMessageToAll(msgErase(__instance2), val2, (NetworkDelivery)3); } EraseSprayPaintAtPoint(__instance2, pos); } }); msgManager.RegisterNamedMessageHandler(msgSpray(__instance2), (HandleNamedMessageDelegate)delegate(ulong clientId, FastBufferReader reader) { //IL_0055: 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) Vector3 sprayPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayPos); Vector3 sprayRot = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref sprayRot); if (((NetworkBehaviour)__instance2).NetworkManager.IsServer && clientId != 0L) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(100, (Allocator)2, -1); ((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref sprayRot); msgManager.SendNamedMessageToAll(msgSpray(__instance2), val, (NetworkDelivery)3); } if ((Object)(object)((GrabbableObject)__instance2).playerHeldBy != (Object)null && !IsLocalPlayer(((GrabbableObject)__instance2).playerHeldBy)) { AddSprayPaintLocal(__instance2, sprayPos, sprayRot); } }); customFields.handlerRegistered = true; } public static void unload(SprayPaintItem __instance) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; CustomMessagingManager val = ((networkManager != null) ? networkManager.CustomMessagingManager : null); if (val != null) { val.UnregisterNamedMessageHandler(msgErase(__instance)); val.UnregisterNamedMessageHandler(msgSpray(__instance)); } fields.Remove(__instance); } public static void EraseSprayPaintAtPoint(SprayPaintItem __instance, Vector3 pos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject sprayPaintDecal in SprayPaintItem.sprayPaintDecals) { if ((Object)(object)sprayPaintDecal != (Object)null && Vector3.Distance(sprayPaintDecal.transform.position, pos) < 0.5f) { sprayPaintDecal.SetActive(false); } } } public static bool EraseSprayPaintLocal(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot, out RaycastHit sprayHit) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) CustomFields customFields = fields[__instance]; if (RaycastSkipPlayer(new Ray(sprayPos, sprayRot), out sprayHit, 6f, customFields.sprayPaintMask, (QueryTriggerInteraction)2, __instance)) { EraseSprayPaintAtPoint(__instance, ((RaycastHit)(ref sprayHit)).point); return true; } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SprayPaintItem), "TrySpraying")] public static bool TrySpraying(SprayPaintItem __instance, ref bool __result, ref RaycastHit ___sprayHit) { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00ec: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) CustomFields customFields = fields[__instance]; ShapeModule shape = __instance.sprayParticle.shape; MainModule main = __instance.sprayParticle.main; Vector3 position = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position; Vector3 forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward; if (AllowErasing && tertiaryUseAction != null && tertiaryUseAction.IsPressed()) { ((Renderer)((Component)__instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = customFields.sprayEraseParticleMaterial; ((ShapeModule)(ref shape)).angle = 5f; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(50f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.1f); if (EraseSprayPaintLocal(__instance, position, forward, out var sprayHit)) { __result = true; CustomMessagingManager customMessagingManager = ((NetworkBehaviour)__instance).NetworkManager.CustomMessagingManager; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(100, (Allocator)2, -1); Vector3 point = ((RaycastHit)(ref sprayHit)).point; ((FastBufferWriter)(ref val)).WriteValueSafe(ref point); if (((NetworkBehaviour)__instance).NetworkManager.IsServer) { customMessagingManager.SendNamedMessageToAll(msgErase(__instance), val, (NetworkDelivery)3); } else { customMessagingManager.SendNamedMessage(msgErase(__instance), 0uL, val, (NetworkDelivery)3); } } return false; } ((Renderer)((Component)__instance.sprayParticle).GetComponent<ParticleSystemRenderer>()).material = customFields.sprayParticleMaterial; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(100f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.05f); ((ShapeModule)(ref shape)).angle = 0f; if (AddSprayPaintLocal(__instance, position, forward)) { __result = true; CustomMessagingManager customMessagingManager2 = ((NetworkBehaviour)__instance).NetworkManager.CustomMessagingManager; FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(100, (Allocator)2, -1); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward); if (((NetworkBehaviour)__instance).NetworkManager.IsServer) { customMessagingManager2.SendNamedMessageToAll(msgSpray(__instance), val2, (NetworkDelivery)3); } else { customMessagingManager2.SendNamedMessage(msgSpray(__instance), 0uL, val2, (NetworkDelivery)3); } } return false; } public static bool RaycastSkipPlayer(Ray ray, out RaycastHit sprayHit, float _distance, int layerMask, QueryTriggerInteraction _queryTriggerInteraction, SprayPaintItem __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_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) Rigidbody val = ((GrabbableObject)__instance).playerHeldBy?.playerRigidbody; if ((Object)(object)val == (Object)null) { ManualLogSource? log = Plugin.log; if (log != null) { log.LogWarning((object)"Player rigidbody is null"); } } bool flag = false; RaycastHit val2 = default(RaycastHit); RaycastHit[] array = Physics.RaycastAll(ray, 6f, layerMask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (((Object)(object)val == (Object)null || (Object)(object)((RaycastHit)(ref val3)).rigidbody != (Object)(object)val) && !flag) { val2 = val3; flag = true; } } sprayHit = val2; return flag; } [HarmonyTranspiler] [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] private static IEnumerable<CodeInstruction> transpiler_AddSprayPaintLocal(IEnumerable<CodeInstruction> instructions) { bool foundMinNextDecalDistance = false; bool foundRaycastCall = false; foreach (CodeInstruction instruction in instructions) { if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f) { foundMinNextDecalDistance = true; yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f); } else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast) { foundRaycastCall = true; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)raycastSkipPlayer); } else { yield return instruction; } } } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(SprayPaintItem), "AddSprayPaintLocal")] public static bool _AddSprayPaintLocal(object instance, Vector3 sprayPos, Vector3 sprayRot) { Transpiler(null); return false; static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { bool foundMinNextDecalDistance = false; bool foundRaycastCall = false; foreach (CodeInstruction instruction in instructions) { if (!foundMinNextDecalDistance && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.175f) { foundMinNextDecalDistance = true; yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.001f); } else if (!foundRaycastCall && instruction.opcode == OpCodes.Call && instruction.operand == physicsRaycast) { foundRaycastCall = true; yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Call, (object)raycastSkipPlayer); } else { yield return instruction; } } } } public static bool AddSprayPaintLocal(SprayPaintItem instance, Vector3 sprayPos, Vector3 sprayRot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) bool num = _AddSprayPaintLocal(instance, sprayPos, sprayRot); if (num && SprayPaintItem.sprayPaintDecals.Count > SprayPaintItem.sprayPaintDecalsIndex) { GameObject obj = SprayPaintItem.sprayPaintDecals[SprayPaintItem.sprayPaintDecalsIndex]; RaycastHit value = Traverse.Create((object)instance).Field<RaycastHit>("sprayHit").Value; obj.transform.forward = -((RaycastHit)(ref value)).normal; ((Behaviour)obj.GetComponent<DecalProjector>()).enabled = true; } return num; } [HarmonyTranspiler] [HarmonyPatch(typeof(SprayPaintItem), "ItemInteractLeftRight")] private static IEnumerable<CodeInstruction> transpiler_ItemInteractLeftRight(IEnumerable<CodeInstruction> instructions) { bool foundShakeRestoreAmount = false; foreach (CodeInstruction instruction in instructions) { if (!foundShakeRestoreAmount && instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 0.15f) { foundShakeRestoreAmount = true; yield return new CodeInstruction(OpCodes.Ldc_R4, (object)0.3f); } else { yield return instruction; } } } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterSprayPaint"; public const string PLUGIN_NAME = "BetterSprayPaint"; public const string PLUGIN_VERSION = "1.1.0"; } }
BepInEx/plugins/Spray paint mods/NoShakeSprayPaint.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("NoShakeSprayPaint")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoShakeSprayPaint")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4e1cd9fe-e255-4259-a678-87c8c608c5b6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace NoShakeSprayPaint; [BepInPlugin("Sombre.NoShakeSprayPaint", "No Shake Spray Paint", "1.0.0")] public class NoShake : BaseUnityPlugin { private const string PLUGIN_GUID = "Sombre.NoShakeSprayPaint"; private const string PLUGIN_NAME = "No Shake Spray Paint"; private const string PLUGIN_VERSION = "1.0.0"; private readonly Harmony harmony = new Harmony("Sombre.NoShakeSprayPaint"); private static NoShake Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Sombre.NoShakeSprayPaint"); mls.LogInfo((object)"------No Shake Spray Paint done.------"); harmony.PatchAll(typeof(SprayPaintItemPatch)); } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void LateUpdatePatch(ref float ___sprayCanTank, ref float ___sprayCanShakeMeter) { ___sprayCanTank = 1f; ___sprayCanShakeMeter = 1f; } }
BepInEx/plugins/Verity-TooManySuits/TooManySuits.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreSuits; using TMPro; using TooManySuits.Helper; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TooManySuits")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TooManySuits")] [assembly: AssemblyTitle("TooManySuits")] [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 TooManySuits { [BepInPlugin("verity.TooManySuits", "Too Many Suits", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static ManualLogSource LogSource; public static ConfigEntry<string> NextButton; public static ConfigEntry<string> BackButton; public static ConfigEntry<float> TextScale; private void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown LogSource = ((BaseUnityPlugin)this).Logger; NextButton = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Next-Page-Keybind", "<Keyboard>/n", "Next page button."); BackButton = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Back-Page-Keybind", "<Keyboard>/b", "Back page button."); TextScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Text-Scale", 0.003f, "Size of the text above the suit rack."); GameObject val = new GameObject("TooManySuits"); val.AddComponent<PluginLoader>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); } } public class PluginLoader : MonoBehaviour { private class Hooks { public static bool SetUI; public static GameObject SuitPanel; public static void HookStartGame() { allSuits = (from suit in Resources.FindObjectsOfTypeAll<UnlockableSuit>() orderby suit.syncedSuitID.Value select suit).ToArray(); Object.Instantiate<GameObject>(suitSelectBundle.LoadAsset<GameObject>("SuitSelect")); SuitPanel = GameObject.Find("SuitPanel"); SuitPanel.SetActive(false); SetUI = true; } public static void HookDisconnected() { currentPage = 0; } } private readonly Harmony Harmony = new Harmony("TooManySuits"); private InputAction moveRightAction; private InputAction moveLeftAction; private static int currentPage; private int suitsPerPage = 13; private int suitsLength; private static UnlockableSuit[] allSuits; private static AssetBundle suitSelectBundle; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown Plugin.LogSource.LogInfo((object)"TooManySuits Mod Loaded."); moveRightAction = new InputAction((string)null, (InputActionType)0, Plugin.NextButton.Value, (string)null, (string)null, (string)null); moveRightAction.performed += MoveRightAction; moveRightAction.Enable(); moveLeftAction = new InputAction((string)null, (InputActionType)0, Plugin.BackButton.Value, (string)null, (string)null, (string)null); moveLeftAction.performed += MoveLeftAction; moveLeftAction.Enable(); MethodInfo method = typeof(StartOfRound).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(Hooks).GetMethod("HookStartGame"); Harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo method3 = typeof(GameNetworkManager).GetMethod("Disconnect"); MethodInfo method4 = typeof(Hooks).GetMethod("HookDisconnected"); Harmony.Patch((MethodBase)method3, (HarmonyMethod)null, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo method5 = typeof(PlayerControllerB).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method6 = typeof(LocalPlayer).GetMethod("PlayerControllerStart"); Harmony.Patch((MethodBase)method5, (HarmonyMethod)null, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); suitSelectBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "suitselect")); if (MoreSuitsMod.MakeSuitsFitOnRack) { suitsPerPage = 20; } } private void Update() { if (!((Object)(object)StartOfRound.Instance == (Object)null) && allSuits.Length != 0) { DisplaySuits(); } } private void DisplaySuits() { //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_015e: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) if (allSuits.Length == 0) { return; } int num = currentPage * suitsPerPage; int num2 = Mathf.Min(num + suitsPerPage, allSuits.Length); int num3 = 0; for (int i = 0; i < allSuits.Length; i++) { UnlockableSuit val = allSuits[i]; AutoParentToShip component = ((Component)val).gameObject.GetComponent<AutoParentToShip>(); if ((Object)(object)component == (Object)null) { continue; } bool flag = i >= num && i < num2; ((Component)val).gameObject.SetActive(flag); if (flag) { component.overrideOffset = true; if (MoreSuitsMod.MakeSuitsFitOnRack && suitsLength > 13) { float num4 = 0.18f; num4 /= (float)Math.Min(suitsLength, 20) / 12f; component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + StartOfRound.Instance.rightmostSuitPosition.forward * (num4 * (float)num3); component.rotationOffset = new Vector3(0f, 90f, 0f); } else { component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + StartOfRound.Instance.rightmostSuitPosition.forward * (0.18f * (float)num3); component.rotationOffset = new Vector3(0f, 90f, 0f); } num3++; } } suitsLength = allSuits.Length; if (!LocalPlayer.isActive()) { return; } if (LocalPlayer.localPlayer.isInHangarShipRoom) { ((TMP_Text)Hooks.SuitPanel.GetComponentInChildren<TextMeshProUGUI>()).text = $"Page {currentPage + 1}/{Mathf.CeilToInt((float)suitsLength / (float)suitsPerPage)}"; Hooks.SuitPanel.SetActive(true); return; } Hooks.SuitPanel.SetActive(false); if (Hooks.SetUI) { Hooks.SetUI = false; Hooks.SuitPanel.GetComponentInParent<Canvas>().renderMode = (RenderMode)2; Hooks.SuitPanel.GetComponentInParent<Canvas>().worldCamera = LocalPlayer.localPlayer.gameplayCamera; Transform transform = Hooks.SuitPanel.transform; Bounds bounds = StartOfRound.Instance.shipBounds.bounds; transform.position = ((Bounds)(ref bounds)).center - new Vector3(2.8992f, 0.7998f, 2f); Hooks.SuitPanel.transform.rotation = Quaternion.Euler(0f, 180f, 0f); Hooks.SuitPanel.transform.localScale = new Vector3(Plugin.TextScale.Value, Plugin.TextScale.Value, Plugin.TextScale.Value); Hooks.SuitPanel.SetActive(true); } } private void MoveRightAction(CallbackContext obj) { currentPage = Mathf.Min(currentPage + 1, Mathf.CeilToInt((float)suitsLength / (float)suitsPerPage) - 1); } private void MoveLeftAction(CallbackContext obj) { currentPage = Mathf.Max(currentPage - 1, 0); } } } namespace TooManySuits.Helper { public class LocalPlayer { public static PlayerControllerB localPlayer; public static bool isActive() { return (Object)(object)localPlayer != (Object)null; } public static void PlayerControllerStart(PlayerControllerB __instance) { if (NetworkManager.Singleton.LocalClientId == __instance.playerClientId) { localPlayer = __instance; } } } }
BepInEx/plugins/xconfigs/3rdPerson.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 BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using _3rdPerson.Helper; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("3rdPerson")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("3rdPerson")] [assembly: AssemblyTitle("3rdPerson")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace _3rdPerson { [BepInPlugin("verity.3rdperson", "3rd Person", "1.1.0")] public class Plugin : BaseUnityPlugin { public static readonly Harmony Harmony = new Harmony("verity.3rdperson"); public static ManualLogSource LogSource = null; public static ConfigEntry<string> KeybindEntry = null; public static ConfigEntry<string> OrbitKeybindEntry = null; public static ConfigEntry<float> OrbitSpeedEntry = null; public static ConfigEntry<float> Distance = null; public static ConfigEntry<float> RightOffset = null; public static ConfigEntry<float> UpOffset = null; public static ConfigEntry<bool> MoreCompanyCosmetics = null; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown GameObject val = new GameObject("3rdPerson"); val.AddComponent<PluginLoader>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); LogSource = ((BaseUnityPlugin)this).Logger; LogSource.LogInfo((object)"3rd Person Mod Loaded."); KeybindEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Camera Settings", "Keybind", "c", "The keybind used to toggle third person."); Distance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Distance", 2f, "Distance of the camera from the player."); RightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Right-Offset", 0.6f, "Offset of the camera to the right from the player."); UpOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Camera Settings", "Up-Offset", 0.1f, "Offset of the camera upwards from the player."); OrbitKeybindEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Orbit Settings", "Keybind", "<Mouse>/middleButton", "The keybind used to 'orbit' around the player."); OrbitSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Orbit Settings", "Orbit-Speed", 75f, "The speed/sensitivity of the orbiting."); MoreCompanyCosmetics = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Support", "MoreCompany-Cosmetic-Support", false, "Displays MoreCompany Cosmetics in third person, this can mess with first person visibility if you have glasses on."); } } public class PluginLoader : MonoBehaviour { private void Start() { LocalPlayer localPlayer = ((Component)this).gameObject.AddComponent<LocalPlayer>(); ((Object)localPlayer).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)localPlayer); Keybinding keybinding = ((Component)this).gameObject.AddComponent<Keybinding>(); ((Object)keybinding).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)keybinding); ThirdPersonCamera thirdPersonCamera = ((Component)this).gameObject.AddComponent<ThirdPersonCamera>(); ((Object)thirdPersonCamera).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)thirdPersonCamera); Hooks.Init(); } } } namespace _3rdPerson.Helper { public static class Hooks { private class HarmonyHooks { private static bool _previousState; public static void MenuOpenedHook() { _previousState = ThirdPersonCamera.ViewState; if (LocalPlayer.IsActive() && ThirdPersonCamera.ViewState) { LocalPlayer.GetController().quickMenuManager.isMenuOpen = false; ThirdPersonCamera.Toggle(); } } public static void MenuClosedHook() { if (LocalPlayer.IsActive() && _previousState) { LocalPlayer.GetController().inTerminalMenu = false; ThirdPersonCamera.Toggle(); } } public static void MoreCompanyHook() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) CosmeticApplication val = Object.FindObjectOfType<CosmeticApplication>(); if (CosmeticRegistry.locallySelectedCosmetics.Count <= 0 || val.spawnedCosmetics.Count > 0) { return; } foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { val.ApplyCosmetic(locallySelectedCosmetic, true); } foreach (CosmeticInstance spawnedCosmetic in val.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; SetAllChildrenLayer(((Component)spawnedCosmetic).transform, 29); } } private static void SetAllChildrenLayer(Transform transform, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((Component)transform).gameObject.layer = layer; foreach (Transform item in transform) { SetAllChildrenLayer(item, layer); } } public static bool PlayerInputHook() { if (ThirdPersonCamera.ViewState) { return !Keybinding.orbitAction.IsPressed(); } return true; } public static void KillPlayerHook() { if (ThirdPersonCamera.ViewState) { ThirdPersonCamera.Toggle(); } } } public static void Init() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown MethodInfo method = typeof(QuickMenuManager).GetMethod("OpenQuickMenu"); MethodInfo method2 = typeof(HarmonyHooks).GetMethod("MenuOpenedHook"); Plugin.Harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Open Menu Hooked."); MethodInfo method3 = typeof(QuickMenuManager).GetMethod("CloseQuickMenu"); MethodInfo method4 = typeof(HarmonyHooks).GetMethod("MenuClosedHook"); Plugin.Harmony.Patch((MethodBase)method3, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Close Menu Hooked."); MethodInfo method5 = typeof(Terminal).GetMethod("BeginUsingTerminal"); MethodInfo method6 = typeof(HarmonyHooks).GetMethod("MenuOpenedHook"); Plugin.Harmony.Patch((MethodBase)method5, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Open Terminal Hooked."); MethodInfo method7 = typeof(Terminal).GetMethod("QuitTerminal"); MethodInfo method8 = typeof(HarmonyHooks).GetMethod("MenuClosedHook"); Plugin.Harmony.Patch((MethodBase)method7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Close Terminal Hooked."); MethodInfo method9 = typeof(PlayerControllerB).GetMethod("PlayerLookInput", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method10 = typeof(HarmonyHooks).GetMethod("PlayerInputHook"); Plugin.Harmony.Patch((MethodBase)method9, new HarmonyMethod(method10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Player Look Input Hooked."); MethodInfo method11 = typeof(PlayerControllerB).GetMethod("KillPlayer"); MethodInfo method12 = typeof(HarmonyHooks).GetMethod("KillPlayerHook"); Plugin.Harmony.Patch((MethodBase)method11, new HarmonyMethod(method12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"Player Killed Hooked."); if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && Plugin.MoreCompanyCosmetics.Value) { MethodInfo method13 = typeof(HUDManager).GetMethod("AddPlayerChatMessageClientRpc", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method14 = typeof(HarmonyHooks).GetMethod("MoreCompanyHook"); Plugin.Harmony.Patch((MethodBase)method13, (HarmonyMethod)null, new HarmonyMethod(method14), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.LogSource.LogInfo((object)"MoreCompany Cosmetics Added."); } Plugin.LogSource.LogInfo((object)"Hooks Initialized."); } } public class Keybinding : MonoBehaviour { public static InputAction orbitAction; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown InputAction val = new InputAction((string)null, (InputActionType)0, "<Keyboard>/" + Plugin.KeybindEntry.Value, (string)null, (string)null, (string)null); val.performed += KeyPressed; val.Enable(); orbitAction = new InputAction("MouseLeftClick", (InputActionType)0, Plugin.OrbitKeybindEntry.Value ?? "", (string)null, (string)null, (string)null); orbitAction.Enable(); } private void KeyPressed(CallbackContext obj) { ThirdPersonCamera.Toggle(); } private void OnEnable() { Plugin.LogSource.LogInfo((object)("Keybinding Initialized, Current Keybind " + Plugin.KeybindEntry.Value + ".")); } } public class LocalPlayer : MonoBehaviour { private static PlayerControllerB? _playerController; public void OnEnable() { Plugin.LogSource.LogInfo((object)"Local Player Caching Initialized."); } private void Update() { if (GameNetworkManager.Instance != null) { _playerController = GameNetworkManager.Instance.localPlayerController; } } public static bool IsActive() { if ((Object)(object)_playerController != (Object)null) { return !_playerController.isPlayerDead; } return false; } public static PlayerControllerB GetController() { return _playerController; } } public class ThirdPersonCamera : MonoBehaviour { private static Camera _camera; public static bool ViewState; public static Camera GetCamera => _camera; private void Awake() { _camera = ((Component)this).gameObject.AddComponent<Camera>(); ((Object)_camera).hideFlags = (HideFlags)61; _camera.fieldOfView = 66f; _camera.nearClipPlane = 0.1f; _camera.cullingMask = 557520895; if (Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { _camera.cullingMask = 557520887; } ((Behaviour)_camera).enabled = false; Object.DontDestroyOnLoad((Object)(object)_camera); } private void OnEnable() { Plugin.LogSource.LogInfo((object)"Third Person Camera Initialized."); } private void Update() { if (!LocalPlayer.IsActive() || LocalPlayer.GetController().quickMenuManager.isMenuOpen || LocalPlayer.GetController().inTerminalMenu || LocalPlayer.GetController().isPlayerDead) { return; } if (Object.FindObjectsOfType<CentipedeAI>().Any((CentipedeAI centipede) => (Object)(object)centipede.clingingToPlayer != (Object)null && centipede.clingingToPlayer.playerClientId == NetworkManager.Singleton.LocalClientId)) { Plugin.LogSource.LogInfo((object)"Centipede On Player!"); if (ViewState) { Toggle(); } } else if (!Keybinding.orbitAction.IsPressed()) { ThirdPersonUpdate(); } else { ThirdPersonOrbitUpdate(); } } private void ThirdPersonUpdate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) Camera gameplayCamera = LocalPlayer.GetController().gameplayCamera; Vector3 val = ((Component)gameplayCamera).transform.forward * -1f; Vector3 val2 = ((Component)gameplayCamera).transform.TransformDirection(Vector3.right) * Plugin.RightOffset.Value; Vector3 val3 = Vector3.up * Plugin.UpOffset.Value; float value = Plugin.Distance.Value; ((Component)_camera).transform.position = ((Component)gameplayCamera).transform.position + val * value + val2 + val3; ((Component)_camera).transform.rotation = Quaternion.LookRotation(((Component)gameplayCamera).transform.forward); } private void ThirdPersonOrbitUpdate() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) MovementActions movement = LocalPlayer.GetController().playerActions.Movement; Vector2 val = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>() * (0.008f * (float)IngamePlayerSettings.Instance.settings.lookSensitivity); if (IngamePlayerSettings.Instance.settings.invertYAxis) { val.y *= -1f; } ((Component)_camera).transform.Rotate(Vector3.right, val.y * Plugin.OrbitSpeedEntry.Value * Time.deltaTime); ((Component)_camera).transform.RotateAround(((Component)LocalPlayer.GetController().gameplayCamera).transform.position, Vector3.up, val.x * Plugin.OrbitSpeedEntry.Value * Time.deltaTime); float value = Plugin.Distance.Value; ((Component)_camera).transform.position = ((Component)LocalPlayer.GetController().gameplayCamera).transform.position - ((Component)_camera).transform.forward * value; } public static void Toggle() { if (!LocalPlayer.IsActive() || LocalPlayer.GetController().isTypingChat || LocalPlayer.GetController().quickMenuManager.isMenuOpen || LocalPlayer.GetController().inTerminalMenu || LocalPlayer.GetController().isPlayerDead) { return; } ViewState = !ViewState; GameObject val = GameObject.Find("Systems/UI/Canvas/Panel/"); Canvas component = GameObject.Find("Systems/UI/Canvas/").GetComponent<Canvas>(); if (ViewState) { if (!Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { ((Renderer)LocalPlayer.GetController().thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; } val.SetActive(false); component.worldCamera = _camera; component.renderMode = (RenderMode)0; GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel/").SetActive(false); ((Renderer)LocalPlayer.GetController().thisPlayerModelArms).enabled = false; ((Behaviour)LocalPlayer.GetController().gameplayCamera).enabled = false; ((Behaviour)_camera).enabled = true; } else { if (!Chainloader.PluginInfos.ContainsKey("quackandcheese.mirrordecor")) { ((Renderer)LocalPlayer.GetController().thisPlayerModel).shadowCastingMode = (ShadowCastingMode)3; } val.SetActive(true); component.worldCamera = GameObject.Find("UICamera").GetComponent<Camera>(); component.renderMode = (RenderMode)1; GameObject.Find("Systems/Rendering/PlayerHUDHelmetModel/").SetActive(true); ((Renderer)LocalPlayer.GetController().thisPlayerModelArms).enabled = true; ((Behaviour)LocalPlayer.GetController().gameplayCamera).enabled = true; ((Behaviour)_camera).enabled = false; } } } }
BepInEx/plugins/xconfigs/BetterLadders.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BetterLadders; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("BetterLadders")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Configurable climbing speed, extension ladder time, and climbing with two-handed items")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0+515d4ea20921fc38b6d159ce5acd839699020398")] [assembly: AssemblyProduct("BetterLadders")] [assembly: AssemblyTitle("BetterLadders")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [Serializable] public class SyncedInstance<T> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } public static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(IntSize, (Allocator)2, -1); try { MessageManager.SendNamedMessage("BetterLadders_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); Plugin.Logger.LogInfo((object)"Requested sync from server"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { return; } Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SerializeToBytes(Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); MessageManager.SendNamedMessage("BetterLadders_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncInstance(data); Plugin.Logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } [HarmonyPostfix] [HarmonyPatch("PlayerControllerB", "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = SyncedInstance<Config>.OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("BetterLadders_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = SyncedInstance<Config>.OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("BetterLadders_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); SyncedInstance<Config>.RequestSync(); } [HarmonyPostfix] [HarmonyPatch("StartMatchLever", "PullLeverAnim")] private static void SetClientConfigWhenHostMissingMod() { if (!IsHost && !SyncedInstance<Config>.Synced && !SyncedInstance<Config>.Default.defaultsSet) { Plugin.Logger.LogInfo((object)"Config wasn't synced with host (likely doesn't have mod), setting vanilla config defaults"); SyncedInstance<Config>.Instance.SetVanillaDefaults(); } } } namespace BetterLadders { [Serializable] public class Config : SyncedInstance<Config> { public float climbSpeedMultiplier { get; internal set; } public float sprintingClimbSpeedMultiplier { get; internal set; } public bool allowTwoHanded { get; internal set; } public bool scaleAnimationSpeed { get; internal set; } public bool hideOneHanded { get; internal set; } public bool hideTwoHanded { get; internal set; } public float timeMultiplier { get; internal set; } public bool holdToPickup { get; internal set; } public float holdTime { get; internal set; } public bool defaultsSet { get; internal set; } public Config(ConfigFile cfg) { InitInstance(this); climbSpeedMultiplier = cfg.Bind<float>("General", "climbSpeedMultipler", 1f, "Ladder climb speed multiplier").Value; sprintingClimbSpeedMultiplier = cfg.Bind<float>("General", "sprintingClimbSpeedMultiplier", 1.5f, "Ladder climb speed multiplier while sprinting, stacks with climbSpeedMultiplier").Value; allowTwoHanded = cfg.Bind<bool>("General", "allowTwoHanded", true, "Whether to allow using ladders while carrying a two-handed object").Value; scaleAnimationSpeed = cfg.Bind<bool>("General", "scaleAnimationSpeed", true, "Whether to scale the speed of the climbing animation to the climbing speed").Value; hideOneHanded = cfg.Bind<bool>("General", "hideOneHanded", true, "Whether to hide one-handed items while climbing a ladder - false in vanilla").Value; hideTwoHanded = cfg.Bind<bool>("General", "hideTwoHanded", true, "Whether to hide two-handed items while climbing a ladder").Value; timeMultiplier = cfg.Bind<float>("Extension Ladders", "timeMultiplier", 0f, "Extension ladder time multiplier (0 for permanent) - lasts 20 seconds in vanilla").Value; holdToPickup = cfg.Bind<bool>("Extension Ladders", "holdToPickup", true, "Whether the interact key needs to be held to pick up an activated extension ladder").Value; holdTime = cfg.Bind<float>("Extension Ladders", "holdTime", 0.5f, "How long, in seconds, the interact key must be held if holdToPickup is true").Value; defaultsSet = false; } public void SetVanillaDefaults() { SyncedInstance<Config>.Instance.climbSpeedMultiplier = 1f; SyncedInstance<Config>.Instance.sprintingClimbSpeedMultiplier = 1f; SyncedInstance<Config>.Instance.allowTwoHanded = false; SyncedInstance<Config>.Instance.timeMultiplier = 1f; defaultsSet = true; } } [BepInPlugin("e3s1.BetterLadders", "BetterLadders", "1.3.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(ExtensionLadderItem))] public class ExtLadderUpdateTranspiler { [HarmonyPatch("Update")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); if (SyncedInstance<Config>.Instance.timeMultiplier > 0f) { for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && ((float)list[i].operand == 15f || (float)list[i].operand == 20f)) { float num = (float)list[i].operand * SyncedInstance<Config>.Instance.timeMultiplier; list[i] = new CodeInstruction(OpCodes.Ldc_R4, (object)num); } } } else if (SyncedInstance<Config>.Instance.timeMultiplier == 0f) { for (int j = 0; j < list.Count - 2; j++) { if (list[j].opcode == OpCodes.Ret && list[j + 2].opcode == OpCodes.Ldfld && list[j + 2].operand is FieldInfo fieldInfo && fieldInfo.DeclaringType == typeof(ExtensionLadderItem) && fieldInfo.Name == "ladderAnimationBegun" && fieldInfo.FieldType == typeof(bool) && list[j + 5].opcode == OpCodes.Ldarg_0) { list.Insert(j + 4, new CodeInstruction(OpCodes.Ret, (object)null)); } } } return list; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static bool canPickupLadder; [HarmonyPatch("BeginGrabObject")] [HarmonyPrefix] private static bool ControlExtLadderPickup(ref PlayerControllerB __instance) { if (!SyncedInstance<Config>.Default.holdToPickup) { return true; } if (LookingAtExtLadder(ref __instance, out var _, out var extLadderObj) && (Object)(object)extLadderObj != (Object)null && extLadderObj.ladderActivated) { if (canPickupLadder) { canPickupLadder = false; return true; } return false; } return true; } [HarmonyPatch("ClickHoldInteraction")] [HarmonyPrefix] private static bool ShowHoldInteractHUDTest(ref PlayerControllerB __instance) { if (!SyncedInstance<Config>.Default.holdToPickup) { return true; } if (Object.op_Implicit((Object)(object)__instance.hoveringOverTrigger)) { bool flag = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).IsPressed(); __instance.isHoldingInteract = flag; if (!flag) { __instance.StopHoldInteractionOnTrigger(); return false; } if ((Object)(object)__instance.hoveringOverTrigger == (Object)null || !__instance.hoveringOverTrigger.interactable) { __instance.StopHoldInteractionOnTrigger(); return false; } if ((Object)(object)__instance.hoveringOverTrigger == (Object)null || !((Component)__instance.hoveringOverTrigger).gameObject.activeInHierarchy || !__instance.hoveringOverTrigger.holdInteraction || __instance.hoveringOverTrigger.currentCooldownValue > 0f || (__instance.isHoldingObject && !__instance.hoveringOverTrigger.oneHandedItemAllowed) || (__instance.twoHanded && !__instance.hoveringOverTrigger.twoHandedItemAllowed)) { __instance.StopHoldInteractionOnTrigger(); return false; } if (__instance.isGrabbingObjectAnimation || __instance.isTypingChat || __instance.inSpecialInteractAnimation || __instance.throwingObject) { __instance.StopHoldInteractionOnTrigger(); return false; } if (!HUDManager.Instance.HoldInteractionFill(__instance.hoveringOverTrigger.timeToHold, __instance.hoveringOverTrigger.timeToHoldSpeedMultiplier)) { __instance.hoveringOverTrigger.HoldInteractNotFilled(); return false; } __instance.hoveringOverTrigger.Interact(__instance.thisPlayerBody); return false; } if (!IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).IsPressed()) { HUDManager.Instance.holdFillAmount = 0f; return false; } if (LookingAtExtLadder(ref __instance, out var _, out var extLadderObj) && (Object)(object)extLadderObj != (Object)null && extLadderObj.ladderActivated) { if (!HUDManager.Instance.HoldInteractionFill(SyncedInstance<Config>.Default.holdTime, 1f)) { return false; } canPickupLadder = true; __instance.BeginGrabObject(); } return false; } [HarmonyPatch("StopHoldInteractionOnTrigger")] [HarmonyPrefix] private static bool StopHoldInteractionOnTrigger(ref PlayerControllerB __instance) { if (!SyncedInstance<Config>.Default.holdToPickup) { return true; } if (LookingAtExtLadder(ref __instance, out var _, out var extLadderObj)) { if ((Object)(object)extLadderObj != (Object)null && extLadderObj.ladderActivated) { if (IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).IsPressed()) { return false; } HUDManager.Instance.holdFillAmount = 0f; } else { HUDManager.Instance.holdFillAmount = 0f; } } else { HUDManager.Instance.holdFillAmount = 0f; } if ((Object)(object)__instance.previousHoveringOverTrigger != (Object)null) { __instance.previousHoveringOverTrigger.StopInteraction(); } if ((Object)(object)__instance.hoveringOverTrigger != (Object)null) { __instance.hoveringOverTrigger.StopInteraction(); } return false; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void LadderClimbSpeedPatch(ref bool ___isSprinting, ref float ___climbSpeed, ref bool ___isClimbingLadder, ref PlayerControllerB __instance) { if (___isClimbingLadder) { float num = ((!___isSprinting) ? (4f * SyncedInstance<Config>.Instance.climbSpeedMultiplier) : (4f * SyncedInstance<Config>.Instance.climbSpeedMultiplier * SyncedInstance<Config>.Instance.sprintingClimbSpeedMultiplier)); float num2 = num / 4f; ___climbSpeed = num; if (SyncedInstance<Config>.Default.scaleAnimationSpeed && __instance.playerBodyAnimator.GetFloat("animationSpeed") != 0f) { __instance.playerBodyAnimator.SetFloat("animationSpeed", num2); } } } [HarmonyPatch("Interact_performed")] [HarmonyPrefix] private static void LadderTwoHandedAccessPatch(ref InteractTrigger ___hoveringOverTrigger, ref bool ___twoHanded) { if ((SyncedInstance<Config>.Instance.allowTwoHanded && (Object)(object)___hoveringOverTrigger != (Object)null && ___hoveringOverTrigger.isLadder) & ___twoHanded) { ___hoveringOverTrigger.twoHandedItemAllowed = true; ___hoveringOverTrigger.specialCharacterAnimation = false; } } [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] [HarmonyPostfix] private static void LadderHandsFullTipPatch(ref PlayerControllerB __instance, ref InteractTrigger ___hoveringOverTrigger, ref bool ___isHoldingInteract, ref bool ___twoHanded) { if (((SyncedInstance<Config>.Instance.allowTwoHanded && (Object)(object)___hoveringOverTrigger != (Object)null) & ___isHoldingInteract & ___twoHanded) && ___hoveringOverTrigger.isLadder) { ((TMP_Text)__instance.cursorTip).text = ___hoveringOverTrigger.hoverTip.Replace("[LMB]", "[E]"); } } [HarmonyPatch("SwitchToItemSlot")] [HarmonyPostfix] private static void LadderHeldItemVisibilityPatch(ref PlayerControllerB __instance) { LadderItemVisibility.Set(ref __instance.isClimbingLadder); } } [HarmonyPatch(typeof(InteractTrigger))] internal class InteractTriggerPatch { [HarmonyPatch("SetUsingLadderOnLocalClient")] [HarmonyPostfix] private static void LadderHeldItemVisibilityPatch(ref bool ___usingLadder) { LadderItemVisibility.Set(ref ___usingLadder); } } internal static class LadderItemVisibility { public static void Set(ref bool ___usingLadder) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isHoldingObject && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null && ((SyncedInstance<Config>.Instance.allowTwoHanded && SyncedInstance<Config>.Default.hideTwoHanded && localPlayerController.twoHanded) || (SyncedInstance<Config>.Default.hideOneHanded && !localPlayerController.twoHanded))) { localPlayerController.currentlyHeldObjectServer.EnableItemMeshes(!___usingLadder); } } } private readonly Harmony harmony = new Harmony("e3s1.BetterLadders"); public static Plugin Instance; public const string GUID = "e3s1.BetterLadders"; public const string NAME = "BetterLadders"; public const string VERSION = "1.3.0"; internal static ManualLogSource Logger { get; private set; } public static Config Config { get; internal set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); Logger.LogInfo((object)"BetterLadders loaded"); harmony.PatchAll(); } private static bool LookingAtExtLadder(ref PlayerControllerB __instance, out RaycastHit hit, out ExtensionLadderItem extLadderObj) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward); bool flag = Physics.Raycast(val, ref hit, __instance.grabDistance, __instance.interactableObjectsMask) && ((Component)((RaycastHit)(ref hit)).collider).gameObject.layer != 8; if (flag) { extLadderObj = ((Component)((RaycastHit)(ref hit)).collider).gameObject.GetComponent<ExtensionLadderItem>(); } else { extLadderObj = null; } return flag; } } public static class PluginInfo { public const string PLUGIN_GUID = "BetterLadders"; public const string PLUGIN_NAME = "BetterLadders"; public const string PLUGIN_VERSION = "1.3.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/xconfigs/BetterStamina.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BetterStamina.Config; using GameNetcodeStuff; using HarmonyLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterStamina")] [assembly: AssemblyDescription("Mod made by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterStamina")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1c42022e-b386-4342-baf0-67de1b7529e2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterStamina { [BepInPlugin("FlipMods.BetterStamina", "BetterStamina", "1.3.2")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("BetterStamina"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterStamina loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } public static void LogError(string message) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.BetterStamina"; public const string PLUGIN_NAME = "BetterStamina"; public const string PLUGIN_VERSION = "1.3.2"; } } namespace BetterStamina.Patches { [HarmonyPatch] public class PlayerPatcher { private static float currentSprintMeter; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] public static void UpdateStaminaPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void UpdateStaminaPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f); } else if (num > 0f) { __instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f); } } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] public static void LateUpdatePrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] public static void LateUpdateStaminaPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(currentSprintMeter + num * ConfigSync.instance.staminaConsumptionMultiplier, 0f); } else if (num > 0f) { __instance.sprintMeter = Mathf.Min(currentSprintMeter + num * ConfigSync.instance.staminaRegenMultiplier, 1f); } } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPrefix] public static void JumpPerformedPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { currentSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPostfix] public static void JumpPerformedPostfix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { float num = __instance.sprintMeter - currentSprintMeter; if (num < 0f) { __instance.sprintMeter = Mathf.Max(new float[1] { currentSprintMeter + num * ConfigSync.instance.jumpStaminaConsumptionMultiplier }); } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SpoofWeightValuesUpdate(IEnumerable<CodeInstruction> instructions) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public); MethodInfo method = typeof(PlayerPatcher).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field) { list[i] = new CodeInstruction(OpCodes.Call, (object)method); list.RemoveAt(i - 1); } } return list.AsEnumerable(); } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> SpoofWeightValuesLateUpdate(IEnumerable<CodeInstruction> instructions) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo field = typeof(PlayerControllerB).GetField("carryWeight", BindingFlags.Instance | BindingFlags.Public); MethodInfo method = typeof(PlayerPatcher).GetMethod("GetAdjustedWeight", BindingFlags.Static | BindingFlags.Public); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == field) { list[i] = new CodeInstruction(OpCodes.Call, (object)method); list.RemoveAt(i - 1); } } return list.AsEnumerable(); } public static float GetAdjustedWeight() { return Mathf.Max(((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null) ? (StartOfRound.Instance.localPlayerController.carryWeight * ConfigSync.instance.carryWeightPenaltyMultiplier) : 1f, 1f); } } } namespace BetterStamina.Config { [Serializable] public static class ConfigSettings { public static ConfigEntry<float> staminaRegenMultiplierConfig; public static ConfigEntry<float> staminaConsumptionMultiplierConfig; public static ConfigEntry<float> jumpStaminaConsumptionMultiplierConfig; public static ConfigEntry<float> carryWeightPenaltyMultiplierConfig; public static ConfigEntry<float> movementSpeedMultiplierConfig; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); staminaRegenMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaRegenMultiplier", 1.5f, "Multiplier for how fast your stamina regens."); staminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "StaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina drains while sprinting."); jumpStaminaConsumptionMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "JumpStaminaConsumptionMultiplier", 0.75f, "Multiplier for how much stamina jumping consumes."); carryWeightPenaltyMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "CarryWeightPenaltyMultiplier", 0.5f, "Multiplier for how much your speed/stamina consumption are affected by weight."); movementSpeedMultiplierConfig = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("BetterStamina", "MovementSpeedMultiplier", 1f, "Player movement speed multiplier."); } } [Serializable] [HarmonyPatch] public class ConfigSync { public static ConfigSync defaultConfig; public static ConfigSync instance; public static PlayerControllerB localPlayerController; public static bool isSynced = false; private static float defaultMovementSpeed = 4.6f; public float staminaRegenMultiplier = 1f; public float staminaConsumptionMultiplier = 1f; public float jumpStaminaConsumptionMultiplier = 1f; public float carryWeightPenaltyMultiplier = 1f; public float movementSpeedMultiplier = 1f; public static void BuildDefaultConfigSync() { instance = new ConfigSync(); } public static void BuildServerConfigSync() { if (defaultConfig == null) { defaultConfig = new ConfigSync(); defaultConfig.staminaRegenMultiplier = ConfigSettings.staminaRegenMultiplierConfig.Value; defaultConfig.staminaConsumptionMultiplier = ConfigSettings.staminaConsumptionMultiplierConfig.Value; defaultConfig.jumpStaminaConsumptionMultiplier = ConfigSettings.jumpStaminaConsumptionMultiplierConfig.Value; defaultConfig.carryWeightPenaltyMultiplier = ConfigSettings.carryWeightPenaltyMultiplierConfig.Value; defaultConfig.movementSpeedMultiplier = ConfigSettings.movementSpeedMultiplierConfig.Value; instance = defaultConfig; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void InitializeLocalPlayer(PlayerControllerB __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown localPlayerController = __instance; if (NetworkManager.Singleton.IsServer) { BuildServerConfigSync(); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnRequestConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSyncRequest)); OnLocalClientConfigSync(); } else { isSynced = false; BuildDefaultConfigSync(); NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BetterStamina-OnReceiveConfigSync", new HandleNamedMessageDelegate(OnReceiveConfigSync)); RequestConfigSync(); } } public static void RequestConfigSync() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsClient) { Plugin.Log("Sending config sync request to server."); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4, (Allocator)2, -1); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } else { Plugin.LogError("Failed to send config sync request."); } } public static void OnReceiveConfigSyncRequest(ulong clientId, FastBufferReader reader) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Plugin.Log("Receiving config sync request from client with id: " + clientId + ". Sending config sync to client."); byte[] array = SerializeConfigToByteArray(instance); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(array.Length + 4, (Allocator)2, -1); int num = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BetterStamina-OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } } public static void OnReceiveConfigSync(ulong clientId, FastBufferReader reader) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (((FastBufferReader)(ref reader)).TryBeginRead(4)) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Log("Receiving config sync from server."); byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); instance = DeserializeFromByteArray(data); OnLocalClientConfigSync(); } else { Plugin.LogError("Error receiving sync from server."); } } else { Plugin.LogError("Error receiving bytes length."); } } public static void OnLocalClientConfigSync() { localPlayerController.movementSpeed = defaultMovementSpeed * instance.movementSpeedMultiplier; isSynced = true; } public static byte[] SerializeConfigToByteArray(ConfigSync config) { BinaryFormatter binaryFormatter = new BinaryFormatter(); MemoryStream memoryStream = new MemoryStream(); binaryFormatter.Serialize(memoryStream, config); return memoryStream.ToArray(); } public static ConfigSync DeserializeFromByteArray(byte[] data) { MemoryStream serializationStream = new MemoryStream(data); BinaryFormatter binaryFormatter = new BinaryFormatter(); return (ConfigSync)binaryFormatter.Deserialize(serializationStream); } } }
BepInEx/plugins/xconfigs/CoilHeadStare.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TDP.CoilHeadStare.Patch; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CoilHeadStare")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CoilHeadStare")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9d96f0c2-6393-4d02-99d7-34538a0dad5c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace TDP.CoilHeadStare { [BepInPlugin("TDP.CoilHeadStare", "CoilHeadStare", "1.0.3")] public class ModBase : BaseUnityPlugin { private const string modGUID = "TDP.CoilHeadStare"; private const string modName = "CoilHeadStare"; private const string modVersion = "1.0.3"; private Harmony harmony; internal static ModBase instance; internal ManualLogSource mls; public static ConfigEntry<float> config_timeUntilStare; public static ConfigEntry<float> config_maxStareDistance; public static ConfigEntry<float> config_turnHeadSpeed; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } else { Object.Destroy((Object)(object)this); } ConfigFile(); harmony = new Harmony("TDP.CoilHeadStare"); harmony.PatchAll(typeof(CoilHeadPatch)); mls = Logger.CreateLogSource("TDP.CoilHeadStare"); mls.LogInfo((object)"CoilHeadStare 1.0.3 loaded."); } private void ConfigFile() { config_timeUntilStare = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Time Until Stare", 8f, "Time between moving and looking at closest player (in seconds)"); config_maxStareDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Max Stare Distance", 6f, "Coilhead will only stare at players closer than this (for reference: coilhead's height is ca. 4)"); config_turnHeadSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("CoilHeadStare", "Head Turn Speed", 0.3f, "The speed at which the head turns towards the player"); Stare.timeUntilStare = config_timeUntilStare.Value; Stare.maxStareDistance = config_maxStareDistance.Value; Stare.turnHeadSpeed = config_turnHeadSpeed.Value; } private void ConfigureDoorControls() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("HangarDoorButtonPanel"); GameObject val2 = new GameObject("PlacementCollider"); val2.transform.SetParent(val.transform, false); BoxCollider val3 = val2.AddComponent<BoxCollider>(); val3.size = new Vector3(0.881444f, 0.147624f, 0.7243316f); val3.center = new Vector3(0.2525222f, 0.06033165f, -0.06168448f); PlaceableShipObject val4 = val2.AddComponent<PlaceableShipObject>(); val4.unlockableID = 1212; val4.parentObject = val.AddComponent<AutoParentToShip>(); val4.mainMesh = val.GetComponent<MeshFilter>(); val4.mainTransform = val.transform; val4.placeObjectCollider = (Collider)(object)val3; val4.yOffset = 0f; val4.AllowPlacementOnWalls = true; val2.AddComponent<AudioSource>(); } } } namespace TDP.CoilHeadStare.Patch { internal class CoilHeadPatch { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] private static void StartPostFix(EnemyAI __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (__instance is SpringManAI) { Debug.Log((object)"CoilHead found. Adding stare script."); Stare stare = ((Component)__instance).gameObject.AddComponent<Stare>(); stare.Initialize((SpringManAI)__instance); } } } public class Stare : MonoBehaviour { private SpringManAI coilHeadInstance; public static float timeUntilStare; public static float maxStareDistance; public static float turnHeadSpeed; private Transform head; private float timeSinceMoving; private bool isTurningHead; private PlayerControllerB stareTarget; public void Initialize(SpringManAI instance) { Debug.Log((object)"Initializing Stare on Coilhead."); coilHeadInstance = instance; head = ((Component)coilHeadInstance).transform.GetChild(0).GetChild(2).GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(2) .GetChild(0) .GetChild(0) .GetChild(1); if (((Object)head).name != "springBone.002_end") { Debug.LogError((object)"CoilHeadStare could not find head transform. Destroying script."); Object.Destroy((Object)(object)this); } } private void Update() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coilHeadInstance == (Object)null) { return; } if ((Object)(object)head == (Object)null) { Debug.LogError((object)"CoilHeadStare head transform missing. Destroying script."); Object.Destroy((Object)(object)this); return; } if (!isTurningHead) { stareTarget = ((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false); } if (!((Object)(object)stareTarget == (Object)null)) { Vector3 val = ((Component)stareTarget.gameplayCamera).transform.position - head.position; float num = Vector3.Distance(head.position, ((Component)((EnemyAI)coilHeadInstance).GetClosestPlayer(false, false, false)).transform.position); if ((double)((EnemyAI)coilHeadInstance).creatureAnimator.GetFloat("walkSpeed") > 0.01 || num > maxStareDistance || Vector3.Angle(head.forward, val) < 5f) { timeSinceMoving = 0f; } else { timeSinceMoving += Time.deltaTime; } if (timeSinceMoving > timeUntilStare) { isTurningHead = true; } else { isTurningHead = false; } if (isTurningHead) { head.forward = Vector3.RotateTowards(head.forward, val, turnHeadSpeed * Time.deltaTime, 0f); } } } } }
BepInEx/plugins/xconfigs/Crippledxsupport.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 BepInEx; using BepInEx.Configuration; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FasterItemDropship")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("Mod made by flipf17")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FasterItemDropship")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a5a250fd-b706-48b9-9be9-da360fd939dc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace FasterItemDropship { public static class ConfigSettings { public static ConfigEntry<int> dropshipDeliveryTime; public static ConfigEntry<int> dropshipMaxStayDuration; public static ConfigEntry<int> dropshipLeaveAfterSecondsOpenDoors; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); dropshipDeliveryTime = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "DeliveryTime", 10, "How long it takes (in seconds) for the item dropship to arrive."); dropshipMaxStayDuration = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "MaxLandDuration", 40, "The max duration (in seconds) the item dropship will stay."); dropshipLeaveAfterSecondsOpenDoors = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("FasterItemDropship", "LeaveAfterSecondsOpenDoors", 3, "How long (in seconds) the item dropship will stay for after opening its doors."); } } [BepInPlugin("FlipMods.FasterItemDropship", "FasterItemDropship", "1.2.1")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown instance = this; ConfigSettings.BindConfigSettings(); _harmony = new Harmony("FasterItemDropship"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"FasterItemDropship loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.FasterItemDropship"; public const string PLUGIN_NAME = "FasterItemDropship"; public const string PLUGIN_VERSION = "1.2.1"; } } namespace FasterItemDropship.Patches { [HarmonyPatch] internal class FasterItemDropshipPatcher { private static Terminal terminalScript; private static StartOfRound playersManager; private static List<int> itemsToDeliver; private static List<int> orderedItemsFromTerminal; [HarmonyPatch(typeof(ItemDropship), "Start")] [HarmonyPrefix] public static void InitializeDropship(ItemDropship __instance) { playersManager = Object.FindObjectOfType<StartOfRound>(); terminalScript = Object.FindObjectOfType<Terminal>(); itemsToDeliver = (List<int>)Traverse.Create((object)__instance).Field("itemsToDeliver").GetValue(); } [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPrefix] public static void InitializeTerminal(Terminal __instance) { orderedItemsFromTerminal = __instance.orderedItemsFromTerminal; } [HarmonyPatch(typeof(ItemDropship), "Update")] [HarmonyPrefix] public static void DropshipUpdate(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer && !__instance.deliveringOrder && terminalScript.orderedItemsFromTerminal.Count > 0 && !playersManager.shipHasLanded) { __instance.shipTimer += Time.deltaTime; } } [HarmonyPatch(typeof(ItemDropship), "Update")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4) { if ((float)list[i].operand == 20f) { list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value; } else if ((float)list[i].operand == 40f) { list[i].operand = (float)(ConfigSettings.dropshipMaxStayDuration.Value + ConfigSettings.dropshipDeliveryTime.Value); } else if ((float)list[i].operand == 30f) { list[i].operand = (float)ConfigSettings.dropshipMaxStayDuration.Value; break; } } } return list.AsEnumerable(); } [HarmonyPatch(typeof(ItemDropship), "OpenShipDoorsOnServer")] [HarmonyPostfix] public static void OnOpenShipDoors(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer) { __instance.shipTimer = Mathf.Max(__instance.shipTimer, (float)(ConfigSettings.dropshipMaxStayDuration.Value - ConfigSettings.dropshipLeaveAfterSecondsOpenDoors.Value)); } } [HarmonyPatch(typeof(ItemDropship), "ShipLandedAnimationEvent")] [HarmonyPrefix] public static void AddLateItemsServer(ItemDropship __instance) { if (((NetworkBehaviour)__instance).IsServer && !__instance.shipLanded && !__instance.shipDoorsOpened) { while (orderedItemsFromTerminal.Count > 0 && itemsToDeliver.Count < 12) { itemsToDeliver.Add(orderedItemsFromTerminal[0]); orderedItemsFromTerminal.RemoveAt(0); } } } } }
BepInEx/plugins/xconfigs/men.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 Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("EmoteWhileInMotion")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")] [assembly: AssemblyProduct("EmoteWhileInMotion")] [assembly: AssemblyTitle("EmoteWhileInMotion")] [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 EmoteWhileInMotion { [BepInPlugin("EmoteWhileInMotion", "EmoteWhileInMotion", "1.0.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("EmoteWhileInMotion"); private static Plugin Instance; public static ManualLogSource Logger; public static ConfigEntry<bool> EmoteWhileJumping; public static ConfigEntry<bool> EmoteWhileWalking; public static ConfigEntry<bool> EmoteWhileCrouching; public static ConfigEntry<bool> EmoteWhileGrabbingObject; public static ConfigEntry<bool> EmoteWhileTyping; public static ConfigEntry<string> DisableKey; public static bool DisableKeyPressed; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin EmoteWhileInMotion is loaded!"); EmoteWhileJumping = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmoteWhileJumping", true, "Whether or not to allow emotes while jumping."); EmoteWhileWalking = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmoteWhileWalking", true, "Whether or not to allow emotes while walking."); EmoteWhileCrouching = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmoteWhileCrouching", false, "Whether or not to allow emotes while crouching."); EmoteWhileGrabbingObject = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmoteWhileGrabbingObject", true, "Whether or not to allow emotes while grabbing an object."); EmoteWhileTyping = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmoteWhileTyping", true, "Whether or not to allow emotes while typing in chat."); DisableKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "DisableKey", "0", "The key to hold to disable emotes."); harmony.PatchAll(Assembly.GetExecutingAssembly()); } } public static class PluginInfo { public const string PLUGIN_GUID = "EmoteWhileInMotion"; public const string PLUGIN_NAME = "EmoteWhileInMotion"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace EmoteWhileInMotion.Patches { [HarmonyPatch] internal class PlayerControllerBPatch { [HarmonyPatch(typeof(PlayerControllerB), "CheckConditionsForEmote")] [HarmonyPostfix] private static void CheckConditionsForEmotePostfix(PlayerControllerB __instance, ref bool __result) { if (__instance.inSpecialInteractAnimation || __instance.isPlayerDead) { __result = false; } if (Plugin.EmoteWhileJumping.Value && __instance.isJumping) { __result = true; } if (Plugin.EmoteWhileWalking.Value && __instance.isWalking) { __result = true; } if (Plugin.EmoteWhileCrouching.Value && __instance.isCrouching) { __result = true; } if (Plugin.EmoteWhileGrabbingObject.Value && __instance.isGrabbingObjectAnimation) { __result = true; } if (Plugin.EmoteWhileTyping.Value && __instance.isTypingChat) { __result = true; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void UpdatePrefix(PlayerControllerB __instance) { if (__instance.isPlayerControlled && ((NetworkBehaviour)__instance).IsOwner) { if (InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[Plugin.DisableKey.Value], 0f) && !Plugin.DisableKeyPressed) { Plugin.DisableKeyPressed = true; __instance.performingEmote = false; __instance.StopPerformingEmoteServerRpc(); __instance.timeSinceStartingEmote = 0f; } else if (!InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[Plugin.DisableKey.Value], 0f)) { Plugin.DisableKeyPressed = false; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/xconfigs/MoreBlood.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using MoreBlood.Config; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreBlood")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreBlood")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d1f1321d-30a3-4600-9bf8-1e69fe1abf8c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreBlood { [BepInPlugin("FlipMods.MoreBlood", "MoreBlood", "1.0.2")] public class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony _harmony; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown instance = this; _harmony = new Harmony("MoreBlood"); ConfigSettings.BindConfigSettings(); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreBlood loaded"); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.MoreBlood"; public const string PLUGIN_NAME = "MoreBlood"; public const string PLUGIN_VERSION = "1.0.2"; } } namespace MoreBlood.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class MoreBloodPatcher { private static int bloodCount; [HarmonyPatch("DropBlood")] [HarmonyPostfix] public static void MoreBlood(PlayerControllerB __instance, Vector3 direction = default(Vector3), bool leaveBlood = true, bool leaveFootprint = false) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) bloodCount++; if (bloodCount < ConfigSettings.numBloodPools.Value) { __instance.DropBlood(direction, leaveBlood, leaveFootprint); } else { bloodCount = 0; } } [HarmonyPatch("RandomizeBloodRotationAndScale")] [HarmonyPostfix] public static void RandomizeBloodScale(ref Transform blood, PlayerControllerB __instance) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Transform obj = blood; obj.localScale *= ConfigSettings.bloodScale.Value; blood.position += new Vector3((float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value, 0.55f, (float)Random.Range(-1, 1) * ConfigSettings.bloodScale.Value); } } } namespace MoreBlood.Config { public static class ConfigSettings { public static ConfigEntry<float> bloodScale; public static ConfigEntry<int> numBloodPools; public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); bloodScale = ((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("MoreBlood", "BloodScale", 4f, "The size of the blood pools"); numBloodPools = ((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("MoreBlood", "NumberOfBloodPools", 4, "Max number of blood pools spread around the blood source."); } } }
BepInEx/plugins/xconfigs/No fall damage.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using NoFallDamage.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NoFallDamage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoFallDamage")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3a7ea2ee-2b5b-477c-9e57-1b026ffeecd5")] [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 NoFallDamage { [BepInPlugin("jaceob.NoFallDamage", "No Fall Damage", "1.0.0")] public class NoFallDamageClass : BaseUnityPlugin { private const string modGUID = "jaceob.NoFallDamage"; private const string modName = "No Fall Damage"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("jaceob.NoFallDamage"); private static NoFallDamageClass instance; internal ManualLogSource logSource; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } logSource = Logger.CreateLogSource("jaceob.NoFallDamage"); logSource.LogInfo((object)"No Fall Damage mod started!"); harmony.PatchAll(typeof(NoFallDamageClass)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } } namespace NoFallDamage.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void noFallDamagePatch(ref bool ___takingFallDamage) { ___takingFallDamage = false; } } }
BepInEx/plugins/xconfigs/NoFriendlyFire.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 GameNetcodeStuff; 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.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("NoFriendlyFire")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Disables the ability for teammates to damage each-other.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3dd114ce725e4bf8b6c1674e7a23d5326e84fcd7")] [assembly: AssemblyProduct("NoFriendlyFire")] [assembly: AssemblyTitle("NoFriendlyFire")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoFriendlyFire { [BepInPlugin("NoFriendlyFire", "NoFriendlyFire", "1.0.0")] public class NoFriendlyFire : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("NoFriendlyFire"); public static ManualLogSource LoggerInstance { get; private set; } private void Awake() { LoggerInstance = ((BaseUnityPlugin)this).Logger; LoggerInstance.LogInfo((object)"Plugin NoFriendlyFire loaded successfully."); _harmony.PatchAll(); } } public static class PluginInfo { public const string PLUGIN_GUID = "NoFriendlyFire"; public const string PLUGIN_NAME = "NoFriendlyFire"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace NoFriendlyFire.Patches { [HarmonyPatch] internal class NoFriendlyFireDamagePatch { [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayerFromOtherClientServerRpc")] [HarmonyPrefix] public static void DamagePlayerFromOtherClientServerRpc(ref int damageAmount, Vector3 hitDirection, int playerWhoHit) { NoFriendlyFire.LoggerInstance.LogDebug((object)$"Player{playerWhoHit} attempted to friendly fire, setting damage amount to 0."); damageAmount = 0; } } }
BepInEx/plugins/xconfigs/QuotaFixer.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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("QuotaFixer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("QuotaFixer")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QuotaFixer")] [assembly: AssemblyTitle("QuotaFixer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace QuotaFixer; [BepInPlugin("viviko.QuotaFixer", "QuotaFixer", "1.0.0")] public class QuotaFixer : BaseUnityPlugin { [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPrefix] [HarmonyPatch("SetNewProfitQuota")] private static bool SetNewProfitQuotaPatch(TimeOfDay __instance) { return __instance.daysUntilDeadline <= 0; } } private const string modGUID = "viviko.QuotaFixer"; private const string modName = "QuotaFixer"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("viviko.QuotaFixer"); private static QuotaFixer Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("QuotaFixer"); harmony.PatchAll(); mls.LogInfo((object)"Plugin QuotaFixer is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "QuotaFixer"; public const string PLUGIN_NAME = "QuotaFixer"; public const string PLUGIN_VERSION = "1.0.0"; }
BepInEx/plugins/xconfigs/QuotaSettings.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 QuotaSetting.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Funny")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Funny")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8ddda834-48b6-4333-baab-9779753a355c")] [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 QuotaSetting { [BepInPlugin("Fred.QuotaSettings", "QuotaSettings", "1.0.5")] public class ModBase : BaseUnityPlugin { private const string modGUID = "Fred.QuotaSettings"; private const string modName = "QuotaSettings"; private const string modVersion = "1.0.5"; private readonly Harmony harmony = new Harmony("Fred.QuotaSettings"); internal static ModBase Instance; internal ConfigurationController ConfigManager; internal ManualLogSource mls = Logger.CreateLogSource("Fred.QuotaSettings"); public static int startingCredits; public static int startingQuota; public static int quotaDeadline; public static int baseQuotaIncrease; public static int quotaCurveMultiplier; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } ConfigManager = new ConfigurationController(((BaseUnityPlugin)this).Config); startingCredits = ConfigManager.StartingCredits; startingQuota = ConfigManager.StartingQuota; quotaDeadline = ConfigManager.QuotaDeadline; baseQuotaIncrease = ConfigManager.BaseQuotaIncrease; quotaCurveMultiplier = ConfigManager.QuotaCurveMultiplier; Instance.mls.LogInfo((object)"Quota Settings is active!"); harmony.PatchAll(typeof(ModBase)); harmony.PatchAll(typeof(TimeOfDayPatch)); } } internal class ConfigurationController { private ConfigEntry<int> StartingCreditsCfg; private ConfigEntry<int> StartingQuotaCfg; private ConfigEntry<int> QuotaDeadlineCfg; private ConfigEntry<int> BaseQuotaIncreaseCfg; private ConfigEntry<int> QuotaCurveMultiplierCfg; internal int StartingCredits { get { if (StartingCreditsCfg.Value < 0) { StartingCreditsCfg.Value = (int)((ConfigEntryBase)StartingCreditsCfg).DefaultValue; } return StartingCreditsCfg.Value; } set { StartingCreditsCfg.Value = value; } } internal int StartingQuota { get { if (StartingQuotaCfg.Value < 0) { StartingQuotaCfg.Value = (int)((ConfigEntryBase)StartingQuotaCfg).DefaultValue; } return StartingQuotaCfg.Value; } set { StartingQuotaCfg.Value = value; } } internal int QuotaDeadline { get { if (QuotaDeadlineCfg.Value < 0) { QuotaDeadlineCfg.Value = (int)((ConfigEntryBase)QuotaDeadlineCfg).DefaultValue; } return QuotaDeadlineCfg.Value; } set { QuotaDeadlineCfg.Value = value; } } internal int BaseQuotaIncrease { get { if (BaseQuotaIncreaseCfg.Value < 0) { BaseQuotaIncreaseCfg.Value = (int)((ConfigEntryBase)BaseQuotaIncreaseCfg).DefaultValue; } return BaseQuotaIncreaseCfg.Value; } set { BaseQuotaIncreaseCfg.Value = value; } } internal int QuotaCurveMultiplier { get { if (QuotaCurveMultiplierCfg.Value < 0) { QuotaCurveMultiplierCfg.Value = (int)((ConfigEntryBase)QuotaCurveMultiplierCfg).DefaultValue; } return QuotaCurveMultiplierCfg.Value; } set { QuotaCurveMultiplierCfg.Value = value; } } public ConfigurationController(ConfigFile Config) { StartingCreditsCfg = Config.Bind<int>("General", "Starting Credits", 60, "The amount of credits you start with."); StartingQuotaCfg = Config.Bind<int>("General", "Starting Quota", 130, "The first quota you need to reach."); BaseQuotaIncreaseCfg = Config.Bind<int>("General", "Base Quota Increase", 200, "When you reach quota this is the base amount it goes up."); QuotaDeadlineCfg = Config.Bind<int>("General", "Starting Deadline", 3, "How many days you have until you are forced to sell or..."); QuotaCurveMultiplierCfg = Config.Bind<int>("General", "Curve Multiplier", 1, "The higher the number, the larger the quota."); } } } namespace QuotaSetting.Patches { [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(ref TimeOfDay __instance) { __instance.quotaVariables.startingCredits = ModBase.startingCredits; __instance.quotaVariables.startingQuota = ModBase.startingQuota; __instance.quotaVariables.deadlineDaysAmount = ModBase.quotaDeadline; __instance.quotaVariables.baseIncrease = ModBase.baseQuotaIncrease; } } }
BepInEx/plugins/xconfigs/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.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; 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: AssemblyTitle("RouteRandom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RouteRandom")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("335007c9-7068-4df7-85b3-b406e9795203")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace RouteRandom { [BepInPlugin("stormytuna.RouteRandom", "Route Random", "1.2.1")] public class RouteRandomBase : BaseUnityPlugin { public const string ModGUID = "stormytuna.RouteRandom"; public const string ModName = "Route Random"; public const string ModVersion = "1.2.1"; public static ManualLogSource Log = Logger.CreateLogSource("stormytuna.RouteRandom"); public static RouteRandomBase Instance; 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() { if (Instance == null) { Instance = this; } Log.LogInfo((object)"Route Random 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 class CompatibleNounComparer : EqualityComparer<CompatibleNoun> { public override bool Equals(CompatibleNoun x, CompatibleNoun y) { bool flag = ((Object)x.result).name.Equals(((Object)y.result).name, StringComparison.InvariantCultureIgnoreCase); RouteRandomBase.Log.LogInfo((object)$"Comparing {((Object)x.result).name} against {((Object)y.result).name} - result: {flag}"); return flag; } public override int GetHashCode(CompatibleNoun obj) { return ((object)obj.result).GetHashCode(); } } public static TerminalPatch Instance; private static readonly TerminalNode noSuitablePlanetsNode = new TerminalNode { name = "NoSuitablePlanets", displayText = "\nNo suitable planets found.\nConsider route random.\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.", clearPreviousText = true }; private static TerminalKeyword routeKeyword; private static TerminalKeyword randomKeyword; private static TerminalKeyword randomFilterWeatherKeyword; private static CompatibleNoun routeRandomCompatibleNoun; private static CompatibleNoun routeRandomFilterWeatherCompatibleNoun; private static TerminalNode routeRendNodeFree; private static TerminalNode routeDineNodeFree; private static TerminalNode routeTitanNodeFree; 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_003e: Expected O, but got Unknown //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_004e: 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_006a: Expected O, but got Unknown //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_007a: 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_0080: 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_0098: Expected O, but got Unknown //IL_009d: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00d0: Expected O, but got Unknown try { routeKeyword = __instance.GetKeyword("Route"); randomKeyword = new TerminalKeyword { word = "random", name = "Random", defaultVerb = routeKeyword }; randomFilterWeatherKeyword = new TerminalKeyword { word = "randomfilterweather", name = "RandomFilterWeather", defaultVerb = routeKeyword }; routeRandomCompatibleNoun = new CompatibleNoun { noun = randomKeyword, result = new TerminalNode { name = "routeRandom", buyRerouteToMoon = -1 } }; routeRandomFilterWeatherCompatibleNoun = new CompatibleNoun { noun = randomFilterWeatherKeyword, result = new TerminalNode { name = "routeRandomFilterWeather", buyRerouteToMoon = -1 } }; TerminalNode result = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "85route").result; routeRendNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result, "85routefree"); TerminalNode result2 = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "7route").result; routeDineNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result2, "7routefree"); TerminalNode result3 = routeKeyword.compatibleNouns.First((CompatibleNoun cn) => ((Object)cn.result).name == "8route").result; routeTitanNodeFree = TerminalHelper.MakeRouteMoonNodeFree(result3, "8routefree"); 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 { RouteRandomBase.Log.LogError((object)"Failed to add Terminal keywords and compatible nouns!"); } } [HarmonyPostfix] [HarmonyPatch("ParsePlayerSentence")] public static TerminalNode RouteToRandomPlanet(TerminalNode __result, Terminal __instance) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Object)__result).name == "routeRandom"; bool flag2 = ((Object)__result).name == "routeRandomFilterWeather"; if (flag || flag2) { List<CompatibleNoun> list = routeKeyword.compatibleNouns.Where((CompatibleNoun noun) => noun.ResultIsRealMoon() && noun.ResultIsAffordable()).Distinct(new CompatibleNounComparer()).ToList(); RouteRandomBase.Log.LogInfo((object)$"Num available moons: {list.Count}"); if (flag2) { foreach (CompatibleNoun item in list.ToList()) { LevelWeatherType weatherType = RoutePlanetNameToWeatherType(((Object)item.result).name, __instance.moonsCatalogueList); if (!WeatherIsAllowed(weatherType)) { list.Remove(item); } } RouteRandomBase.Log.LogInfo((object)$"Num available moons after filtering weather: {list.Count}"); } if (RouteRandomBase.ConfigDifferentPlanetEachTime.Value) { list.RemoveAll((CompatibleNoun rpn) => rpn.result.GetNodeAfterConfirmation().NodeRoutesToCurrentOrbitedMoon()); RouteRandomBase.Log.LogInfo((object)$"Num available moons after filtering orbited moon: {list.Count}"); } if (list.Count <= 0) { RouteRandomBase.Log.LogInfo((object)"Couldn't find a planet with suitable weather!"); return noSuitablePlanetsNode; } TerminalNode val = rand.NextFromCollection(list).result; RouteRandomBase.Log.LogInfo((object)("Chosen node: " + ((Object)val).name)); if (RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value) { val = TryGetFreeNodeForCostlyPlanetNode(val); RouteRandomBase.Log.LogInfo((object)"Making node free!"); } if (RouteRandomBase.ConfigHidePlanet.Value) { RouteRandomBase.Log.LogInfo((object)"Hiding stuffs >:3"); TerminalNode nodeAfterConfirmation = val.GetNodeAfterConfirmation(); hidePlanetHackNode.buyRerouteToMoon = nodeAfterConfirmation.buyRerouteToMoon; hidePlanetHackNode.itemCost = ((!RouteRandomBase.ConfigRemoveCostOfCostlyPlanets.Value) ? nodeAfterConfirmation.itemCost : 0); return hidePlanetHackNode; } return RouteRandomBase.ConfigSkipConfirmation.Value ? val.GetNodeAfterConfirmation() : val; } return __result; } private static bool WeatherIsAllowed(LevelWeatherType weatherType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown return (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, }; } private static LevelWeatherType RoutePlanetNameToWeatherType(string routePlanetName, SelectableLevel[] moonCatalogue) { //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) return (LevelWeatherType)(routePlanetName switch { "41route" => moonCatalogue[0].currentWeather, "220route" => moonCatalogue[1].currentWeather, "56route" => moonCatalogue[2].currentWeather, "21route" => moonCatalogue[3].currentWeather, "61route" => moonCatalogue[4].currentWeather, "85route" => moonCatalogue[5].currentWeather, "7route" => moonCatalogue[6].currentWeather, "8route" => moonCatalogue[7].currentWeather, _ => -1, }); } private static TerminalNode TryGetFreeNodeForCostlyPlanetNode(TerminalNode node) { return (TerminalNode)(((Object)node).name switch { "85route" => routeRendNodeFree, "7route" => routeDineNodeFree, "8route" => routeTitanNodeFree, _ => node, }); } } } namespace RouteRandom.Helpers { public static class RandomHelper { public static TSource NextFromCollection<TSource>(this Random rand, IList<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 TerminalNode MakeRouteMoonNodeFree(TerminalNode routeMoonNode, string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_003e: 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_0052: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown TerminalNode result = routeMoonNode.terminalOptions[1].result; TerminalNode result2 = new TerminalNode { name = ((Object)result).name + "Free", buyRerouteToMoon = result.buyRerouteToMoon, clearPreviousText = true, displayText = result.displayText, itemCost = 0 }; TerminalNode val = new TerminalNode(); ((Object)val).name = name; val.buyRerouteToMoon = -2; val.clearPreviousText = true; val.displayPlanetInfo = routeMoonNode.displayPlanetInfo; val.displayText = routeMoonNode.displayText; val.itemCost = 0; val.overrideOptions = true; val.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { routeMoonNode.terminalOptions[0], new CompatibleNoun { noun = new TerminalKeyword { name = "Confirm", isVerb = true }, result = result2 } }; return val; } } }
BepInEx/plugins/xconfigs/SellInShip.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("SellInShip")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("SellInShip")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("SellInShip")] [assembly: AssemblyTitle("SellInShip")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] namespace SellInShip { [BepInPlugin("viviko.SellInShip", "SellInShip", "1.0.1")] public class SellInShip : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPostfix] [HarmonyPatch("ThrowObjectServerRpc")] private static void ThrowObjectServerRpcPatch(ref NetworkObjectReference grabbedObject, bool droppedInElevator, bool droppedInShipRoom) { NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null)) { GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>(); if (!(component.__getTypeName() == "GiftBoxItem") && (Object)(object)component.playerHeldBy == (Object)null && component.itemProperties.isScrap && component.scrapValue > 0 && droppedInShipRoom) { HUDManager.Instance.DisplayGlobalNotification(component.itemProperties.itemName + " sold for " + component.scrapValue + " scrap"); Terminal terminalScript = HUDManager.Instance.terminalScript; terminalScript.groupCredits += component.scrapValue; EndOfGameStats gameStats = StartOfRound.Instance.gameStats; gameStats.scrapValueCollected += component.scrapValue; TimeOfDay instance = TimeOfDay.Instance; instance.quotaFulfilled += component.scrapValue; TimeOfDay.Instance.UpdateProfitQuotaCurrentTime(); ((Component)component).gameObject.GetComponent<NetworkObject>().Despawn(true); } } } } private const string modGUID = "viviko.SellInShip"; private const string modName = "SellInShip"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("viviko.SellInShip"); private static SellInShip Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("viviko.SellInShip"); harmony.PatchAll(); mls.LogInfo((object)"Plugin SellInShip is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "SellInShip"; public const string PLUGIN_NAME = "SellInShip"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/xconfigs/spawnCrippled.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 HarmonyLib; using NicholaScott.BepInEx.Utils.Configuration; using NicholaScott.BepInEx.Utils.Instancing; using NicholaScott.BepInEx.Utils.Patching; 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("NicholaScott.LethalCompany.SpawnableItems")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NicholaScott.LethalCompany.SpawnableItems")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6A25689C-CA4B-4FB5-98D4-300354668DC9")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace NicholaScott.LethalCompany.SpawnableItems; [BepInDependency("NicholaScott.BepInEx.Utils", "1.2.1")] [BepInPlugin("NicholaScott.LethalCompany.SpawnableStoreItems", "Spawnable Store Items", "0.1.2")] public class SpawnableStoreItems : BaseUnityPlugin { public struct Configuration { [ConfigEntryDefinition(Category = "General", Description = "Maximum number of items that can spawn inside the factory.")] public int MaxItemsSpawningInside; [ConfigEntryDefinition(Category = "WIP/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Binoculars; [ConfigEntryDefinition(Category = "WIP/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Mapper; [ConfigEntryDefinition(Name = "ShotgunShell", Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Ammo; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int WalkieTalkie; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Flashlight; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Shovel; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int LockPicker; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int ProFlashlight; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int StunGrenade; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Boombox; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int ExtensionLadder; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int RadarBooster; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int SprayPaint; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int TZPInhalant; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int ZapGun; [ConfigEntryDefinition(Category = "General/RelativeRarities", Description = "The rarity relative to all other entries. Set to 0 to disable this item")] public int Jetpack; } private const string GenRelCategory = "General/RelativeRarities"; private const string WipRelCategory = "WIP/RelativeRarities"; private const string GenDescription = "The rarity relative to all other entries. Set to 0 to disable this item"; private void Awake() { Singleton<SpawnableStoreItems>.Instance = this; Singleton<SpawnableStoreItems, Configuration>.Configuration = Extensions.BindStruct<Configuration>(((BaseUnityPlugin)this).Config, new Configuration { MaxItemsSpawningInside = 30, Binoculars = 0, Mapper = 0, Ammo = 5, WalkieTalkie = 0, Flashlight = 15, Shovel = 0, LockPicker = 0, ProFlashlight = 0, StunGrenade = 0, Boombox = 1, ExtensionLadder = 5, RadarBooster = 0, SprayPaint = 20, TZPInhalant = 1, ZapGun = 0, Jetpack = 0 }); Extensions.PatchAttribute<Production>(Assembly.GetExecutingAssembly(), ((BaseUnityPlugin)this).Info.Metadata.GUID, (Action<object>)((BaseUnityPlugin)this).Logger.LogInfo); } } [Production] public static class SpawnPatcher { private static Dictionary<string, CachedItem<int>> cachedConfigRarities = new Dictionary<string, CachedItem<int>>(); private static SpawnableItemWithRarity ItemQualifies(Item item) { //IL_008b: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown Type cfgType = typeof(SpawnableStoreItems.Configuration); SpawnableStoreItems.Configuration cfg = Singleton<SpawnableStoreItems, SpawnableStoreItems.Configuration>.Configuration; string cleanItemName = item.itemName.Replace("-", "").Replace(" ", "").ToLower(); if (!cachedConfigRarities.ContainsKey(cleanItemName)) { cachedConfigRarities.Add(cleanItemName, new CachedItem<int>((InstanceLocator<int>)delegate { FieldInfo[] source = (from it in cfgType.GetFields() where it.Name.ToLower() == cleanItemName select it).ToArray(); return source.Any() ? ((int)source.First().GetValue(cfg)) : 0; }, (ItemNotNull<int>)null)); } SpawnableItemWithRarity val = new SpawnableItemWithRarity { rarity = CachedItem<int>.op_Implicit(cachedConfigRarities[cleanItemName]), spawnableItem = item }; Singleton<SpawnableStoreItems>.Logger.LogInfo((object)$"[{val.rarity}] {item.itemName}"); return val; } private static int GetRandomWeightedIndex(Random random, int[] weights) { float num = weights.Where((int t) => t >= 0).Sum(); if (num <= 0f) { return random.Next(0, weights.Length); } float num2 = (float)random.NextDouble(); float num3 = 0f; for (int i = 0; i < weights.Length; i++) { if (weights[i] > 0) { num3 += (float)weights[i] / num; if (num3 >= num2) { return i; } } } return random.Next(0, weights.Length); } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] public static void SpawnStoreItemsInsideFactory(RoundManager __instance) { //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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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) SpawnableItemWithRarity[] array = StartOfRound.Instance.allItemsList.itemsList.Where((Item item) => !item.isScrap && Object.op_Implicit((Object)(object)item.spawnPrefab)).Select(ItemQualifies).ToArray(); int[] weights = array.Select((SpawnableItemWithRarity f) => f.rarity).ToArray(); List<RandomScrapSpawn> list = (from s in Object.FindObjectsOfType<RandomScrapSpawn>() where !s.spawnUsed select s).ToList(); Random random = new Random(StartOfRound.Instance.randomMapSeed - 7); int num = random.Next(Singleton<SpawnableStoreItems, SpawnableStoreItems.Configuration>.Configuration.MaxItemsSpawningInside / 2, Singleton<SpawnableStoreItems, SpawnableStoreItems.Configuration>.Configuration.MaxItemsSpawningInside); for (int i = 0; i < num; i++) { if (list.Count <= 0) { break; } int index = random.Next(0, list.Count); RandomScrapSpawn val = list[index]; Vector3 val2 = ((Component)val).transform.position; if (val.spawnedItemsCopyPosition) { list.RemoveAt(index); } else { val2 = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)val).transform.position, val.itemSpawnRange, RoundManager.Instance.navHit); } int randomWeightedIndex = GetRandomWeightedIndex(random, weights); GameObject val3 = Object.Instantiate<GameObject>(array[randomWeightedIndex].spawnableItem.spawnPrefab, val2 + Vector3.up * 0.5f, Quaternion.identity, StartOfRound.Instance.propsContainer); val3.GetComponent<GrabbableObject>().fallTime = 0f; val3.GetComponent<NetworkObject>().Spawn(false); } } }
BepInEx/plugins/xconfigs/UnlockOCrippled.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("UnlockOnStart")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Discord Rich Presence support in the game.")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1+f1c01e20fe6f86529d4ec16f64ffd52eaba29b35")] [assembly: AssemblyProduct("UnlockOnStart")] [assembly: AssemblyTitle("UnlockOnStart")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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 UnlockOnStart { public class ConfigManager { public static ConfigManager Instance { get; private set; } public static ConfigEntry<bool> Teleporter { get; private set; } public static ConfigEntry<bool> InverseTeleporter { get; private set; } public static ConfigEntry<bool> LoudHorn { get; private set; } public static ConfigEntry<bool> SignalTranslator { get; private set; } public static ConfigEntry<int> Flashlights { get; private set; } public static ConfigEntry<int> ProFlashlights { get; private set; } public static ConfigEntry<int> WalkieTalkies { get; private set; } public static ConfigEntry<int> LockPickers { get; private set; } public static ConfigEntry<int> ExtensionLadders { get; private set; } public static ConfigEntry<int> RadarBoosters { get; private set; } public static ConfigEntry<int> SprayPaints { get; private set; } public static ConfigEntry<int> Jetpacks { get; private set; } public static ConfigEntry<int> Inhalants { get; private set; } public static ConfigEntry<int> Shovels { get; private set; } public static ConfigEntry<int> StunGrenades { get; private set; } public static ConfigEntry<int> ZapGuns { get; private set; } public static ConfigEntry<int> Shotgun { get; private set; } public static ConfigEntry<int> ShotgunShells { get; private set; } public static ConfigEntry<bool> CozyLights { get; private set; } public static ConfigEntry<bool> Television { get; private set; } public static ConfigEntry<bool> Toilet { get; private set; } public static ConfigEntry<bool> Shower { get; private set; } public static ConfigEntry<bool> RecordPlayer { get; private set; } public static ConfigEntry<bool> Table { get; private set; } public static ConfigEntry<bool> RomanticTable { get; private set; } public static ConfigEntry<bool> JackOLantern { get; private set; } public static ConfigEntry<bool> WelcomeMat { get; private set; } public static ConfigEntry<bool> Goldfish { get; private set; } public static ConfigEntry<bool> PlushiePajama { get; private set; } public static ConfigEntry<bool> Suits { get; private set; } public static ConfigEntry<bool> Debug { get; private set; } public static void Init(ConfigFile config) { Instance = new ConfigManager(config); } private ConfigManager(ConfigFile config) { Teleporter = config.Bind<bool>("Teleporters", "Teleporter", false, "Unlock the teleporter on new save."); InverseTeleporter = config.Bind<bool>("Teleporters", "Inverse Teleporter", false, "Unlock the inverse teleporter on new save."); LoudHorn = config.Bind<bool>("Ship upgrades", "Loud Horn", false, "Unlock the loud horn on new save."); SignalTranslator = config.Bind<bool>("Ship upgrades", "Signal Translator", false, "Unlock the signal translator on new save."); Flashlights = config.Bind<int>("Flashlights", "Flashlight", 0, "How many flashlights to unlock on new save."); ProFlashlights = config.Bind<int>("Flashlights", "Pro-flashlight", 0, "How many pro-flashlights to unlock on new save."); WalkieTalkies = config.Bind<int>("Tools", "Walkie-Talkie", 0, "How many walkie-talkies to unlock on new save."); LockPickers = config.Bind<int>("Tools", "Lockpicker", 0, "How many lockpickers to unlock on new save."); ExtensionLadders = config.Bind<int>("Tools", "Extension Ladder", 0, "How many extension ladders to unlock on new save."); RadarBoosters = config.Bind<int>("Tools", "Radar Booster", 0, "How many radar boosters to unlock on new save."); SprayPaints = config.Bind<int>("Tools", "Spray Paint", 0, "How many spray paints to unlock on new save."); Jetpacks = config.Bind<int>("Tools", "Jetpack", 0, "How many jetpacks to unlock on new save."); Inhalants = config.Bind<int>("Consumables", "TZP-Inhalant", 0, "How many inhalants to unlock on new save."); Shovels = config.Bind<int>("Weapons", "Shovel", 0, "How many shovels to unlock on new save."); StunGrenades = config.Bind<int>("Weapons", "Stun Grenade", 0, "How many stun grenades to unlock on new save."); ZapGuns = config.Bind<int>("Weapons", "Zap Gun", 0, "How many zap guns to unlock on new save."); Shotgun = config.Bind<int>("Weapons", "Shotgun", 0, "How many shotguns to unlock on new save."); ShotgunShells = config.Bind<int>("Weapons", "Shotgun Shells", 0, "How many shotgun shells to unlock on new save."); CozyLights = config.Bind<bool>("Decorations", "Cozy Lights", false, "Unlock the cozy lights on new save."); Television = config.Bind<bool>("Decorations", "Television", false, "Unlock the television on new save."); Toilet = config.Bind<bool>("Decorations", "Toilet", false, "Unlock the toilet on new save."); Shower = config.Bind<bool>("Decorations", "Shower", false, "Unlock the shower on new save."); RecordPlayer = config.Bind<bool>("Decorations", "Record Player", false, "Unlock the record player on new save."); Table = config.Bind<bool>("Decorations", "Table", false, "Unlock the table on new save."); RomanticTable = config.Bind<bool>("Decorations", "Romantic Table", false, "Unlock the romantic table on new save."); JackOLantern = config.Bind<bool>("Decorations", "Jack-O-Lantern", false, "Unlock the jack-o-lantern on new save."); WelcomeMat = config.Bind<bool>("Decorations", "Welcome Mat", false, "Unlock the welcome mat on new save."); Goldfish = config.Bind<bool>("Decorations", "Goldfish", false, "Unlock the goldfish on new save."); PlushiePajama = config.Bind<bool>("Decorations", "Plushie Pajama", false, "Unlock the plushie pajama on new save."); Suits = config.Bind<bool>("Suits", "Suits", false, "Unlock all suits on new save."); Debug = config.Bind<bool>("Debug", "Debugging", true, "Enable debug logging."); } } [HarmonyPatch(typeof(StartOfRound))] internal class NewSaveStartPatch { [HarmonyPatch("LoadShipGrabbableItems")] [HarmonyPrefix] internal static void LoadUnlockablesFromConfig() { if (StartOfRound.Instance.gameStats.daysSpent == 0 && !StartOfRound.Instance.isChallengeFile) { Plugin.logger.LogInfo((object)"New save detected, loading unlockables from config."); if (!GameNetworkManager.Instance.isHostingGame) { return; } List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables; foreach (UnlockableItem item in unlockables) { string unlockableName = item.unlockableName; int unlockableID = unlockables.IndexOf(item); checkInDictionary(Unlockables.ShipUpgradesDictionary, unlockableID, unlockableName); checkInDictionary(Unlockables.SuitDictionary, unlockableID, unlockableName); checkInDictionary(Unlockables.DecorationDictionary, unlockableID, unlockableName); } SpawnItemsFromConfig(); } else { Plugin.logger.LogInfo((object)"Not a new save, not loading unlockables from config."); } } internal static void SpawnItemsFromConfig() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList; foreach (Item item in itemsList) { string itemName = item.itemName; int num = itemsList.IndexOf(item); if (Unlockables.ItemsDictionary.ContainsKey(itemName)) { if (Unlockables.ItemsDictionary[itemName] == 0) { continue; } Plugin.logger.LogInfo((object)$"Unlocking {itemName} * {Unlockables.ItemsDictionary[itemName]}."); for (int i = 0; i < Unlockables.ItemsDictionary[itemName]; i++) { Vector3 position = StartOfRound.Instance.playerSpawnPositions[1].position; position.x += Random.Range(-0.7f, 0.7f); position.z += Random.Range(2f, 2f); position.y += 0.5f; GrabbableObject component = Object.Instantiate<GameObject>(item.spawnPrefab, position, Quaternion.identity, StartOfRound.Instance.elevatorTransform).GetComponent<GrabbableObject>(); component.fallTime = 1f; component.hasHitGround = false; component.scrapPersistedThroughRounds = true; component.isInElevator = true; component.isInShipRoom = true; try { Plugin.logger.LogDebug((object)$"Spawning {itemName} at {position}."); ((NetworkBehaviour)component).NetworkObject.Spawn(false); } catch (Exception arg) { Plugin.logger.LogError((object)$"Could not spawn {itemName}: {arg}"); } } } else if (ConfigManager.Debug.Value) { Plugin.logger.LogDebug((object)("Unlockable |" + itemName + "| not found in config.")); } } } private static void checkInDictionary(Dictionary<string, bool> dictionary, int unlockableID, string itemName) { if (dictionary.ContainsKey(itemName) && dictionary[itemName]) { Plugin.logger.LogInfo((object)("Unlocking " + itemName + ".")); unlockShipItem(StartOfRound.Instance, unlockableID, itemName); } } private static void unlockShipItem(StartOfRound instance, int unlockableID, string name) { try { if (ConfigManager.Debug.Value) { Plugin.logger.LogInfo((object)("Attempting to unlock " + name)); } MethodInfo method = ((object)instance).GetType().GetMethod("UnlockShipObject", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(instance, new object[1] { unlockableID }); } catch (NullReferenceException arg) { Plugin.logger.LogError((object)$"Could not invoke UnlockShipObject method: {arg}"); } } } [BepInPlugin("UnlockOnStart", "UnlockOnStart", "0.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource logger; private readonly Harmony harmony = new Harmony("UnlockOnStart"); private void Awake() { ConfigManager.Init(((BaseUnityPlugin)this).Config); logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin UnlockOnStart is loaded!"); } } public class Unlockables { public static Dictionary<string, bool> ShipUpgradesDictionary = new Dictionary<string, bool> { { "Teleporter", ConfigManager.Teleporter.Value }, { "Inverse Teleporter", ConfigManager.InverseTeleporter.Value }, { "Loud horn", ConfigManager.LoudHorn.Value }, { "Signal translator", ConfigManager.SignalTranslator.Value } }; public static Dictionary<string, bool> SuitDictionary = new Dictionary<string, bool> { { "Green suit", ConfigManager.Suits.Value }, { "Hazard suit", ConfigManager.Suits.Value }, { "Pajama suit", ConfigManager.Suits.Value } }; public static Dictionary<string, bool> DecorationDictionary = new Dictionary<string, bool> { { "Cozy lights", ConfigManager.CozyLights.Value }, { "Television", ConfigManager.Television.Value }, { "Toilet", ConfigManager.Toilet.Value }, { "Shower", ConfigManager.Shower.Value }, { "Record player", ConfigManager.RecordPlayer.Value }, { "Table", ConfigManager.Table.Value }, { "Romantic table", ConfigManager.RomanticTable.Value }, { "JackOLantern", ConfigManager.JackOLantern.Value }, { "Welcome mat", ConfigManager.WelcomeMat.Value }, { "Goldfish", ConfigManager.Goldfish.Value }, { "Plushie pajama", ConfigManager.PlushiePajama.Value } }; public static Dictionary<string, int> ItemsDictionary = new Dictionary<string, int> { { "Flashlight", ConfigManager.Flashlights.Value }, { "Pro-flashlight", ConfigManager.ProFlashlights.Value }, { "Walkie-talkie", ConfigManager.WalkieTalkies.Value }, { "Lockpicker", ConfigManager.LockPickers.Value }, { "Extension ladder", ConfigManager.ExtensionLadders.Value }, { "Radar-booster", ConfigManager.RadarBoosters.Value }, { "Spray paint", ConfigManager.SprayPaints.Value }, { "Shovel", ConfigManager.Shovels.Value }, { "Stun grenade", ConfigManager.StunGrenades.Value }, { "Zap gun", ConfigManager.ZapGuns.Value }, { "Shotgun", ConfigManager.Shotgun.Value }, { "Shotgun shells", ConfigManager.ShotgunShells.Value }, { "Jetpack", ConfigManager.Jetpacks.Value }, { "TZP-Inhalant", ConfigManager.Inhalants.Value } }; } public static class PluginInfo { public const string PLUGIN_GUID = "UnlockOnStart"; public const string PLUGIN_NAME = "UnlockOnStart"; public const string PLUGIN_VERSION = "0.0.1"; } }
BepInEx/plugins/xconfigs/Whoosh.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); } } }