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 MultiMod v1.1.4
MultiMod.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using TMPro; 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("MultiMod")] [assembly: AssemblyDescription("MultiMod is a collection of different QoL modifications to enhance gameplay.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MultiMod")] [assembly: AssemblyCopyright("Copyright © dsrdakota 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(true)] [assembly: Guid("3bc2e3f2-4d6a-47c0-a9a0-8ce0bc007429")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.1.4.0")] namespace MultiMod; internal class InputDebug : LcInputActions { [InputAction(/*Could not decode attribute arguments.*/)] public InputAction ExplodeKey { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction TeleportToShipKey { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction TeleportToMainKey { get; set; } } internal class InputToggles { } [HarmonyPatch(typeof(DepositItemsDeskPatch))] internal class DepositItemsDeskPatch { private static DepositItemsDesk desk; [HarmonyPrefix] [HarmonyPatch(typeof(DepositItemsDeskPatch), "Start")] private static void OnStart(DepositItemsDesk __instance) { desk = __instance; } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(DepositItemsDeskPatch), "PlaceItemOnCounter")] private static void PlaceItemOnCounter(PlayerControllerB playerWhoTriggered) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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) if (((Component)desk.deskObjectsContainer).GetComponentsInChildren<GrabbableObject>().Length < 64 && !desk.inGrabbingObjectsAnimation && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)playerWhoTriggered == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Vector3 val = RoundManager.RandomPointInBounds(((Collider)desk.triggerCollider).bounds); Bounds bounds = ((Collider)desk.triggerCollider).bounds; val.y = ((Bounds)(ref bounds)).min.y; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2)) { val = ((RaycastHit)(ref val2)).point; } val.y += playerWhoTriggered.currentlyHeldObjectServer.itemProperties.verticalOffset; val = ((Component)desk.deskObjectsContainer).transform.InverseTransformPoint(val); desk.AddObjectToDeskServerRpc(NetworkObjectReference.op_Implicit(((Component)playerWhoTriggered.currentlyHeldObjectServer).gameObject.GetComponent<NetworkObject>())); playerWhoTriggered.DiscardHeldObject(true, desk.deskObjectsContainer, val, false); Debug.Log((object)"discard held object called from deposit items desk"); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { public static int currentGameVersion; [HarmonyPatch("Awake")] public static void Prefix(GameNetworkManager __instance) { currentGameVersion = __instance.gameVersionNum; } } [HarmonyPatch(typeof(PlayerControllerBPatch))] internal class PlayerControllerBPatch { private static bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; private static bool isServer = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsServer; [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "Start")] private static void OnStart(PlayerControllerB __instance) { isHost = ((NetworkBehaviour)__instance).IsHost; isServer = ((NetworkBehaviour)__instance).IsServer; if (((NetworkBehaviour)__instance).IsServer) { HUDManager.Instance.DisplayTip("MultiMod", "We are the server", false, false, "LC_Tip1"); } if (((NetworkBehaviour)__instance).IsHost) { HUDManager.Instance.DisplayTip("MultiMod", "We are the host", false, false, "LC_Tip1"); } MultiModPlugin.log.LogInfo((object)"Running OnStart"); if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { MultiModPlugin.__localPlayer = __instance; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdatePatch(ref float ___sprintMultiplier, ref float ___sprintMeter, ref bool ___isSprinting) { PlayerControllerB val = Object.FindObjectOfType<PlayerControllerB>(); if (!isHost) { if (MultiModPlugin.InfiniteStaminaEnabledConfig.Value) { ___sprintMeter = 1f; } if (___isSprinting) { ___sprintMultiplier = ((MultiModPlugin.SprintSpeedConfig.Value > 50) ? 5 : MultiModPlugin.SprintSpeedConfig.Value); } else { ___sprintMultiplier = ((MultiModPlugin.SprintSpeedConfig.Value > 20) ? 2 : MultiModPlugin.WalkSpeedConfig.Value); } } else { if (MultiModPlugin.InfiniteStaminaEnabledConfig.Value) { ___sprintMeter = 1f; } if (___isSprinting) { ___sprintMultiplier = ((!MultiModPlugin.HostDisablePlayerCheatsConfig.Value) ? (MultiModPlugin.SprintSpeedConfig.Value / 10) : ((MultiModPlugin.SprintSpeedConfig.Value > 50) ? 5 : MultiModPlugin.SprintSpeedConfig.Value)); } else { ___sprintMultiplier = ((!MultiModPlugin.HostDisablePlayerCheatsConfig.Value) ? (MultiModPlugin.WalkSpeedConfig.Value / 10) : ((MultiModPlugin.SprintSpeedConfig.Value > 20) ? 2 : MultiModPlugin.WalkSpeedConfig.Value)); } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdateJumpClimbWeightPatch(PlayerControllerB __instance) { //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { MultiModPlugin.__localPlayer = __instance; } if (MultiModPlugin.ClimbSpeedEnabledConfig.Value) { __instance.climbSpeed = MultiModPlugin.ClimbSpeedMultiplierConfig.Value / 10; } else { __instance.climbSpeed = 4f; } if (MultiModPlugin.ThrowPowerConfig.Value > -1) { __instance.throwPower = ((!MultiModPlugin.HostDisablePlayerCheatsConfig.Value) ? (MultiModPlugin.ThrowPowerConfig.Value / 10) : ((MultiModPlugin.ThrowPowerConfig.Value > 200) ? 20 : (MultiModPlugin.ThrowPowerConfig.Value / 10))); } else { __instance.throwPower = 17f; } if (MultiModPlugin.WeightMultiplierConfig.Value > -1) { __instance.carryWeight = ((!MultiModPlugin.HostDisablePlayerCheatsConfig.Value) ? (MultiModPlugin.WeightMultiplierConfig.Value / 10) : ((MultiModPlugin.WeightMultiplierConfig.Value > 150) ? 15 : (MultiModPlugin.WeightMultiplierConfig.Value / 10))); } else { __instance.carryWeight = 1f; } if (MultiModPlugin.JumpPowerConfig.Value > -1) { __instance.jumpForce = ((!MultiModPlugin.HostDisablePlayerCheatsConfig.Value) ? (MultiModPlugin.JumpPowerConfig.Value / 10) : ((MultiModPlugin.JumpPowerConfig.Value > 200) ? 20 : (MultiModPlugin.JumpPowerConfig.Value / 10))); } else { __instance.jumpForce = 5f; } Vector3 oldPlayerPosition = __instance.oldPlayerPosition; oldPlayerPosition += new Vector3(10f, 10f, 10f); bool inShipPhase = RoundManager.Instance.playersManager.inShipPhase; if (__instance.isSinking) { __instance.TeleportPlayer(oldPlayerPosition, false, 0f, false, true); __instance.isSinking = false; __instance.UpdateSpecialAnimationValue(true, (short)0, 0f, false); } if (__instance.isUnderwater) { __instance.TeleportPlayer(oldPlayerPosition, false, 0f, false, true); __instance.isUnderwater = false; __instance.UpdateSpecialAnimationValue(true, (short)0, 0f, false); } if (MultiModPlugin.InfiniteHealthEnabledConfig.Value && !MultiModPlugin.HostDisablePlayerCheatsConfig.Value) { __instance.health = int.MaxValue; } else { __instance.health = __instance.health; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void UpdateHealthPatch(ref float ___health) { if (MultiModPlugin.InfiniteHealthEnabledConfig.Value && !MultiModPlugin.HostDisablePlayerCheatsConfig.Value) { ___health = 2.1474836E+09f; } else { ___health = ___health; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] public static void ConnectClientToPlayerObject(PlayerControllerB __instance) { MultiModPlugin.log.LogInfo((object)"Running ConnectClientToPlayerObject"); if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { MultiModPlugin.__localPlayer = __instance; MultiModPlugin.__terminal = Object.FindObjectOfType<Terminal>(); MultiModPlugin.__startOfRound = StartOfRound.Instance; MultiModPlugin.log.LogInfo((object)"updated all values"); } else { MultiModPlugin.log.LogInfo((object)"not ready for some reason"); } } } [HarmonyPatch(typeof(StartOfRoundPatch))] internal class StartOfRoundPatch { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] public static void StartPatch(ref StartOfRound ___instance) { MultiModPlugin.__startOfRound = ___instance; ___instance.maxShipItemCapacity = ((MultiModPlugin.MaxItemsInShipConfig.Value > 200) ? 200 : MultiModPlugin.MaxItemsInShipConfig.Value); MultiModPlugin.UpdateAllRandomSeeds(); } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] public static void InvinciblePatch(ref bool ___allowLocalPlayerDeath) { ___allowLocalPlayerDeath = !MultiModPlugin.InfiniteHealthEnabledConfig.Value; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(Terminal __instance, ref int ___groupCredits) { bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; MultiModPlugin.__terminal = __instance; if (!isHost) { return; } MultiModPlugin.log.LogInfo((object)"Terminal Start Event Running"); MultiModPlugin.log.LogInfo((object)(TimeOfDay.Instance.daysUntilDeadline == TimeOfDay.Instance.quotaVariables.deadlineDaysAmount)); MultiModPlugin.log.LogInfo((object)(TimeOfDay.Instance.profitQuota == TimeOfDay.Instance.quotaVariables.startingQuota)); MultiModPlugin.log.LogInfo((object)((Object)RoundManager.Instance.currentLevel).name.ToLower()); if (!MultiModPlugin.EnableCreditsModConfig.Value) { return; } if (MultiModPlugin.InfiniteCreditsConfig.Value) { __instance.groupCredits = int.MaxValue; } else if (MultiModPlugin.ConsecutiveCreditsConfig.Value) { if (!(((Object)RoundManager.Instance.currentLevel).name.ToLower() == "gordion") && !(RoundManager.Instance.currentLevel.PlanetName.ToLower() == "71 gordion") && RoundManager.Instance.currentLevel.levelID != 79) { __instance.groupCredits = (__instance.groupCredits += MultiModPlugin.CreditsToGiveConfig.Value); } } else { __instance.groupCredits = MultiModPlugin.CreditsToGiveConfig.Value; } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch() { } } [HarmonyPatch(typeof(TimeOfDayPatch))] internal class TimeOfDayPatch { [HarmonyPatch(typeof(TimeOfDay), "Awake")] [HarmonyPostfix] private static void AwakePatch(ref TimeOfDay __instance) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; int value = MultiModPlugin.DeadlineConfig.Value; if (isHost) { __instance.quotaVariables.deadlineDaysAmount = value; __instance.quotaVariables.startingCredits = MultiModPlugin.StartingCreditsConfig.Value; __instance.quotaVariables.randomizerMultiplier = MultiModPlugin.QuotaMultiplierConfig.Value / 10; if (MultiModPlugin.InfiniteDeadlineConfig.Value) { __instance.timeUntilDeadline = (int)(__instance.totalTime * (float)__instance.quotaVariables.deadlineDaysAmount); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n INFINITE"; } else { __instance.daysUntilDeadline = __instance.quotaVariables.deadlineDaysAmount; ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n " + __instance.daysUntilDeadline + "/" + __instance.quotaVariables.deadlineDaysAmount; } } } [HarmonyPatch(typeof(TimeOfDay), "Update")] [HarmonyPostfix] private static void UpdatePatch(ref TimeOfDay __instance) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; int value = MultiModPlugin.DeadlineConfig.Value; if (isHost) { __instance.quotaVariables.deadlineDaysAmount = value; __instance.quotaVariables.startingCredits = MultiModPlugin.StartingCreditsConfig.Value; __instance.quotaVariables.randomizerMultiplier = MultiModPlugin.QuotaMultiplierConfig.Value / 10; if (MultiModPlugin.InfiniteDeadlineConfig.Value) { __instance.timeUntilDeadline = (int)(__instance.totalTime * (float)__instance.quotaVariables.deadlineDaysAmount); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n INFINITE"; } else { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n " + __instance.daysUntilDeadline + "/" + __instance.quotaVariables.deadlineDaysAmount; } } } [HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void SetNewProfitQuotaPatch(ref TimeOfDay __instance) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; bool isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; int timesFulfilledQuota = TimeOfDay.Instance.timesFulfilledQuota; if (isHost) { __instance.quotaVariables.deadlineDaysAmount = MultiModPlugin.DeadlineConfig.Value; __instance.quotaVariables.randomizerMultiplier = MultiModPlugin.QuotaMultiplierConfig.Value / 10; TimeOfDay obj = __instance; obj.timesFulfilledQuota++; int num = __instance.quotaFulfilled - __instance.profitQuota; float num2 = Mathf.Clamp(1f + (float)__instance.timesFulfilledQuota * ((float)__instance.timesFulfilledQuota / __instance.quotaVariables.increaseSteepness), 0f, 10000f); num2 = __instance.quotaVariables.baseIncrease * num2 * (__instance.quotaVariables.randomizerCurve.Evaluate(Random.Range(0f, 1f)) * __instance.quotaVariables.randomizerMultiplier + 1f); __instance.profitQuota = (int)Mathf.Clamp((float)__instance.profitQuota + num2, 0f, 1E+09f); __instance.quotaFulfilled = 0; if (MultiModPlugin.InfiniteDeadlineConfig.Value) { __instance.timeUntilDeadline = (int)(__instance.totalTime * (float)__instance.quotaVariables.deadlineDaysAmount); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n INFINITE"; } else { __instance.timeUntilDeadline = __instance.totalTime * (float)__instance.quotaVariables.deadlineDaysAmount + 1f; ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n " + __instance.daysUntilDeadline + "/" + __instance.quotaVariables.deadlineDaysAmount; } int num3 = (int)Math.Ceiling((decimal)(num / 5 + 15 * __instance.daysUntilDeadline) * (decimal)MultiModPlugin.BonusCreditsMultiplierConfig.Value); __instance.SyncNewProfitQuotaClientRpc(__instance.profitQuota, num3, __instance.timesFulfilledQuota); } } [HarmonyPatch(typeof(TimeOfDay), "UpdateProfitQuotaCurrentTime")] [HarmonyPostfix] private static void UpdateProfitQuotaCurrentTimePatch(ref TimeOfDay __instance) { __instance.quotaVariables.deadlineDaysAmount = MultiModPlugin.DeadlineConfig.Value; __instance.quotaVariables.randomizerMultiplier = MultiModPlugin.QuotaMultiplierConfig.Value / 10; if (MultiModPlugin.InfiniteDeadlineConfig.Value) { __instance.timeUntilDeadline = (int)(__instance.totalTime * (float)__instance.quotaVariables.deadlineDaysAmount); ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n INFINITE"; } else { ((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n " + __instance.daysUntilDeadline + "/" + __instance.quotaVariables.deadlineDaysAmount; } } [HarmonyPatch(typeof(TimeOfDay), "SetBuyingRateForDay")] [HarmonyPostfix] public static void SetBuyingRateForDayPatch() { StartOfRound.Instance.companyBuyingRate = MultiModPlugin.BuyingRateConfig.Value / 10; } [HarmonyPatch(typeof(TimeOfDay), "OnDayChanged")] [HarmonyPostfix] public static void OnDayChangedPatch() { if (!((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } Terminal val = Object.FindObjectOfType<Terminal>(); MultiModPlugin.log.LogInfo((object)"OnDayChanged Event Running"); MultiModPlugin.log.LogInfo((object)(TimeOfDay.Instance.daysUntilDeadline == TimeOfDay.Instance.quotaVariables.deadlineDaysAmount)); MultiModPlugin.log.LogInfo((object)(TimeOfDay.Instance.profitQuota == TimeOfDay.Instance.quotaVariables.startingQuota)); MultiModPlugin.log.LogInfo((object)((Object)RoundManager.Instance.currentLevel).name.ToLower()); if (!MultiModPlugin.EnableCreditsModConfig.Value) { return; } if (MultiModPlugin.InfiniteCreditsConfig.Value) { val.groupCredits = int.MaxValue; } else if (MultiModPlugin.ConsecutiveCreditsConfig.Value) { if (!(((Object)RoundManager.Instance.currentLevel).name.ToLower() == "gordion") && !(RoundManager.Instance.currentLevel.PlanetName.ToLower() == "71 gordion") && RoundManager.Instance.currentLevel.levelID != 79) { val.groupCredits = (val.groupCredits += MultiModPlugin.CreditsToGiveConfig.Value); } } else { val.groupCredits = MultiModPlugin.CreditsToGiveConfig.Value; } } } public enum CustomSeedsType { UseGameDefault, UseModdedSeeds, UsedFixedSeeds } [BepInPlugin("com.dsrdakota.mods", "Multi Mod", "1.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MultiModPlugin : BaseUnityPlugin { internal static InputDebug InpDbg; internal static InputToggles InpTogg; public static ManualLogSource log; public static ConfigEntry<bool> HostDisablePlayerCheatsConfig; public static ConfigEntry<bool> EnableCreditsModConfig; public static ConfigEntry<int> StartingCreditsConfig; public static ConfigEntry<int> CreditsToGiveConfig; public static ConfigEntry<bool> ConsecutiveCreditsConfig; public static ConfigEntry<bool> InfiniteCreditsConfig; public static ConfigEntry<int> BonusCreditsMultiplierConfig; public static ConfigEntry<int> BuyingRateConfig; public static ConfigEntry<int> QuotaMultiplierConfig; public static ConfigEntry<bool> InfiniteDeadlineConfig; public static ConfigEntry<int> DeadlineConfig; public static ConfigEntry<float> ScrapAmountMultiplierConfig; public static ConfigEntry<float> ScrapValueMultiplierConfig; public static ConfigEntry<int> MaxItemsInShipConfig; public static ConfigEntry<CustomSeedsType> CustomSeedsTypeConfig; public static ConfigEntry<int> LevelRandomConfig; public static ConfigEntry<int> EnemySpawnRandomConfig; public static ConfigEntry<int> EnemyOutsideRandomConfig; public static ConfigEntry<int> AnomalyRandomConfig; public static ConfigEntry<int> MapRandomConfig; public static ConfigEntry<int> BreakerBoxRandomConfig; public static ConfigEntry<int> ChallengeMoonRandomConfig; public static ConfigEntry<int> ScrapValueRandomConfig; public static ConfigEntry<bool> InfiniteHealthEnabledConfig; public static ConfigEntry<bool> InfiniteStaminaEnabledConfig; public static ConfigEntry<int> SprintSpeedConfig; public static ConfigEntry<int> WalkSpeedConfig; public static ConfigEntry<int> ThrowPowerConfig; public static ConfigEntry<int> JumpPowerConfig; public static ConfigEntry<bool> ClimbSpeedEnabledConfig; public static ConfigEntry<int> ClimbSpeedMultiplierConfig; public static ConfigEntry<int> WeightMultiplierConfig; public static Random BaseRandomizer; public static Random ScrapValueRandomizer; public static Random MapSeedRandomizer; public static Random LevelSeedRandomizer; public static Random EnemySpawnRandomizer; public static Random OutsideEnemySpawnRandomizer; public static Random AnomalyRandomizer; public static Random BreakerBoxRandomizer; public static Random ChallengeMoonSeedRandomizer; public static PlayerControllerB __localPlayer; public static Terminal __terminal; public static StartOfRound __startOfRound; private void Awake() { //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Expected O, but got Unknown BaseRandomizer = new Random(); HostDisablePlayerCheatsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Host", "!TODO Disable some player cheats", true, "!TODO This allows all players to play fairly. Set to true: sprint speed capped at 50, walk speed capped at 20, jump capped at 250 and NO invicibility."); QuotaMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Quota Multiplier", 10, "Multiplier to use after each quota met."); InfiniteDeadlineConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Host", "Infinite Deadline", false, "Make the deadline infinite."); DeadlineConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Days to Deadline", 3, "Days left to deadline. (Deadline is only infinite when Infinite Deadline is enable)."); MaxItemsInShipConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Set maximum number of items allowed in the ship. (Will cap at 240)", 80, (ConfigDescription)null); ScrapValueMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Host", "Scrap Value Multiplier", 1f, "Multiplier for the value of scrap spawned."); ScrapAmountMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Host", "Scrap Amount Multiplier", 1.05f, "Multiplier for the amount of scrap spawned."); StartingCreditsConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Starting Credits", 450, "Credits to start with."); EnableCreditsModConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Host", "Enable Credits Modifications", true, "This will enable or disable all credits modifications in the following below."); InfiniteCreditsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Host", "Infinite Credits", false, "Infinitely have credits."); CreditsToGiveConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Credits To Give", 210, "Start the game with this amount of credits."); ConsecutiveCreditsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Host", "Give Credits Consecutively", false, "Consecutively give credits after every round with the Credits config."); BonusCreditsMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Bonus Credits Multiplier", 10, "Bonus multiplier to use when getting an over-quota bonus."); BuyingRateConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Host", "Company Buying Rate", 10, "Sets the default company buying rate."); CustomSeedsTypeConfig = ((BaseUnityPlugin)this).Config.Bind<CustomSeedsType>("Random Seeds", "Custom Random Seeds", CustomSeedsType.UseGameDefault, "Seed randomization will be controlled by the mod, fixed by the mod or game default."); CustomSeedsTypeConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {CustomSeedsTypeConfig.Value}"); UpdateAllRandomSeeds(); }; ScrapValueRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Scrap Random Seed", 16542, "Random seed for the scrap spawned."); ScrapValueRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {ScrapValueRandomConfig.Value}"); UpdateAllRandomSeeds(); }; MapRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Map Random Seed", 52782, "Random seed for the map itself (shown upon landing)."); MapRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {MapRandomConfig.Value}"); UpdateAllRandomSeeds(); }; LevelRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Level Random Seed", 878277, "Random seed for the level (Mansion/Facility?)."); LevelRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {LevelRandomConfig.Value}"); UpdateAllRandomSeeds(); }; EnemySpawnRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Enemy Random Seed", 57447010, "Random seed for the enemies spawned in general."); EnemySpawnRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {CustomSeedsTypeConfig.Value}"); UpdateAllRandomSeeds(); }; EnemyOutsideRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Enemies Outside Random Seed", 478755, "Random seed for the enemies spawned outside."); EnemyOutsideRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {EnemyOutsideRandomConfig.Value}"); UpdateAllRandomSeeds(); }; BreakerBoxRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Breaker Box Random Seed", 757522, "Random seed for the breaker box spawned."); BreakerBoxRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {BreakerBoxRandomConfig.Value}"); UpdateAllRandomSeeds(); }; AnomalyRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Anomaly Random Seed", 754447, "Random seed for the any anomalies."); CustomSeedsTypeConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {CustomSeedsTypeConfig.Value}"); UpdateAllRandomSeeds(); }; ChallengeMoonRandomConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Random Seeds", "Challenge Moon Random Seed", 880088, "Random seed specific to the Challenge Moon."); ChallengeMoonRandomConfig.SettingChanged += delegate { log.LogInfo((object)$"Slider value changed to {ChallengeMoonRandomConfig.Value}"); UpdateAllRandomSeeds(); }; InfiniteHealthEnabledConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Infinte Health", false, "Whether or not you have infinite health."); InfiniteStaminaEnabledConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Infinte Stamina", false, "Whether or not you have infinite stamina."); WalkSpeedConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Walk Speed", 10, "Change default walk speed."); SprintSpeedConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Sprint Speed", 20, "Change default sprint speed."); ThrowPowerConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Throw Power", 170, "Change default throwing power."); JumpPowerConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Jump Power", 150, "Change default jump power."); ClimbSpeedEnabledConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Climb Speed Enabled", false, "Change default climb speed for climbing ladders."); ClimbSpeedMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Climb Speed", 40, "Change default climb speed for ladders."); WeightMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Player", "Weight", 10, "Change the default weight multiplier. Useful only when carrying heavy items and not recommended below 0.5 (Def: 1.0)"); log = ((BaseUnityPlugin)this).Logger; InpDbg = new InputDebug(); InpTogg = new InputToggles(); SetupKeybindCallbacks(); Harmony val = new Harmony("com.dsrdakota.mods.multimod"); val.PatchAll(typeof(MultiModPlugin)); val.PatchAll(typeof(RoundManagerPatch)); val.PatchAll(typeof(PlayerControllerBPatch)); val.PatchAll(typeof(TimeOfDayPatch)); val.PatchAll(typeof(TerminalPatch)); val.PatchAll(typeof(GameNetworkManagerPatch)); val.PatchAll(typeof(DepositItemsDeskPatch)); } private void SetupKeybindCallbacks() { InpDbg.ExplodeKey.performed += OnExplodeKeyPressed; InpDbg.TeleportToMainKey.performed += OnTeleportToMainKeyPressed; InpDbg.TeleportToShipKey.performed += OnTeleportToShipKeyPressed; } private void OnExplodeKeyPressed(CallbackContext ctx) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 log.LogInfo((object)"Running OnExplodeKeyPressed"); if (__startOfRound.inShipPhase || !__startOfRound.shipHasLanded || (int)((CallbackContext)(ref ctx)).phase != 3 || !((CallbackContext)(ref ctx)).performed) { return; } log.LogInfo((object)("ishost: " + ((NetworkBehaviour)RoundManager.Instance).IsHost)); log.LogInfo((object)("isserver: " + ((NetworkBehaviour)RoundManager.Instance).IsServer)); log.LogInfo((object)("isclient: " + ((NetworkBehaviour)RoundManager.Instance).IsClient)); log.LogInfo((object)("islocalplayer: " + ((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer)); if (((NetworkBehaviour)RoundManager.Instance).IsClient || ((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer) { if (Object.op_Implicit((Object)(object)__localPlayer)) { log.LogMessage((object)"Attempting tooooo killllllll"); CoroutineHelper.Start(RunTheKill()); } else { log.LogWarning((object)"Haven't gotten local player object yet."); } } } private static IEnumerator RunTheKill() { Vector3 PositionLastFrame = ((Component)__localPlayer.gameplayCamera).transform.position; yield return null; Vector3 PositionCurrentFrame = ((Component)__localPlayer.gameplayCamera).transform.position; Vector3 RagdollVelocity = (PositionCurrentFrame - PositionLastFrame) * 46f; RagdollVelocity.y *= 25f / 46f; log.LogMessage((object)"Running killllllll"); RoundManager.Instance.PlayAudibleNoise(__localPlayer.serverPlayerPosition, 25f, 0.75f, 1, true, 0); __localPlayer.KillPlayer(RagdollVelocity, true, (CauseOfDeath)3, 0, default(Vector3)); } private void OnTeleportToShipKeyPressed(CallbackContext ctx) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0173: 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_017f: Unknown result type (might be due to invalid IL or missing references) log.LogInfo((object)"Running OnTeleportToShipKeyPressed"); if (__startOfRound.inShipPhase || !__startOfRound.shipHasLanded || (int)((CallbackContext)(ref ctx)).phase != 3 || !((CallbackContext)(ref ctx)).performed) { return; } log.LogInfo((object)("ishost: " + ((NetworkBehaviour)RoundManager.Instance).IsHost)); log.LogInfo((object)("isserver: " + ((NetworkBehaviour)RoundManager.Instance).IsServer)); log.LogInfo((object)("isclient: " + ((NetworkBehaviour)RoundManager.Instance).IsClient)); log.LogInfo((object)("islocalplayer: " + ((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer)); if (!((NetworkBehaviour)RoundManager.Instance).IsClient && !((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer) { return; } if (Object.op_Implicit((Object)(object)__localPlayer)) { if (!__localPlayer.isPlayerDead && (((NetworkBehaviour)RoundManager.Instance).IsClient || ((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer)) { Vector3 position = StartOfRound.Instance.outsideShipSpawnPosition.position; __localPlayer.TeleportPlayer(position, false, 0f, false, true); } } else { log.LogWarning((object)"Haven't gotten local player object yet."); } } private void OnTeleportToMainKeyPressed(CallbackContext ctx) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) log.LogInfo((object)"Running OnTeleportToMainKeyPressed"); if (__startOfRound.inShipPhase || !__startOfRound.shipHasLanded || (int)((CallbackContext)(ref ctx)).phase != 3 || !((CallbackContext)(ref ctx)).performed || ((Object)RoundManager.Instance.currentLevel).name.ToLower() == "gordion" || RoundManager.Instance.currentLevel.PlanetName.ToLower() == "71 gordion" || RoundManager.Instance.currentLevel.levelID == 79) { return; } log.LogInfo((object)("ishost: " + ((NetworkBehaviour)RoundManager.Instance).IsHost)); log.LogInfo((object)("isserver: " + ((NetworkBehaviour)RoundManager.Instance).IsServer)); log.LogInfo((object)("isclient: " + ((NetworkBehaviour)RoundManager.Instance).IsClient)); log.LogInfo((object)("islocalplayer: " + ((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer)); if (!((NetworkBehaviour)RoundManager.Instance).IsClient && !((NetworkBehaviour)RoundManager.Instance).IsLocalPlayer) { return; } if (Object.op_Implicit((Object)(object)__localPlayer)) { if (!__localPlayer.isPlayerDead) { log.LogInfo((object)"Getting main entrance pos and teleporting player ..."); Vector3 val = RoundManager.FindMainEntrancePosition(true, !__localPlayer.isInsideFactory); Vector3 position = ((Component)RoundManager.FindMainEntranceScript(!__localPlayer.isInsideFactory)).transform.position; log.LogInfo((object)("is pos null: " + false)); log.LogInfo((object)(val.x + ", " + val.y + ", " + val.z)); log.LogInfo((object)("is pos2 null: " + false)); log.LogInfo((object)(position.x + ", " + position.y + ", " + position.z)); __localPlayer.TeleportPlayer(val, false, 0f, false, true); } } else { log.LogWarning((object)"Haven't gotten local player object yet."); } } public static void UpdateAllRandomSeeds() { switch (CustomSeedsTypeConfig.Value) { case CustomSeedsType.UsedFixedSeeds: ScrapValueRandomizer = new Random(ScrapValueRandomConfig.Value); MapSeedRandomizer = new Random(MapRandomConfig.Value); LevelSeedRandomizer = new Random(LevelRandomConfig.Value); EnemySpawnRandomizer = new Random(EnemySpawnRandomConfig.Value); OutsideEnemySpawnRandomizer = new Random(EnemyOutsideRandomConfig.Value); AnomalyRandomizer = new Random(AnomalyRandomConfig.Value); BreakerBoxRandomizer = new Random(BreakerBoxRandomConfig.Value); ChallengeMoonSeedRandomizer = new Random(ChallengeMoonRandomConfig.Value); if (StartOfRound.Instance.isChallengeFile) { RoundManager.Instance.ChallengeMoonRandom = new Random(ChallengeMoonRandomConfig.Value); } StartOfRound.Instance.overrideRandomSeed = ((CustomSeedsTypeConfig.Value != 0) ? true : false); StartOfRound.Instance.overrideSeedNumber = ((CustomSeedsTypeConfig.Value != 0) ? MapSeedRandomizer.Next(13458240, int.MaxValue) : StartOfRound.Instance.randomMapSeed); RoundManager.Instance.ScrapValuesRandom = ScrapValueRandomizer; RoundManager.Instance.LevelRandom = LevelSeedRandomizer; RoundManager.Instance.EnemySpawnRandom = EnemySpawnRandomizer; RoundManager.Instance.OutsideEnemySpawnRandom = EnemySpawnRandomizer; RoundManager.Instance.AnomalyRandom = AnomalyRandomizer; RoundManager.Instance.BreakerBoxRandom = BreakerBoxRandomizer; break; case CustomSeedsType.UseModdedSeeds: ScrapValueRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); MapSeedRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); LevelSeedRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); EnemySpawnRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); OutsideEnemySpawnRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); AnomalyRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); BreakerBoxRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); ChallengeMoonSeedRandomizer = new Random(BaseRandomizer.Next(707, 77345663)); if (StartOfRound.Instance.isChallengeFile) { RoundManager.Instance.ChallengeMoonRandom = new Random(BaseRandomizer.Next(707, 77345663)); } StartOfRound.Instance.overrideRandomSeed = ((CustomSeedsTypeConfig.Value != 0) ? true : false); StartOfRound.Instance.overrideSeedNumber = ((CustomSeedsTypeConfig.Value != 0) ? MapSeedRandomizer.Next(13458240, int.MaxValue) : StartOfRound.Instance.randomMapSeed); RoundManager.Instance.ScrapValuesRandom = ScrapValueRandomizer; RoundManager.Instance.LevelRandom = LevelSeedRandomizer; RoundManager.Instance.EnemySpawnRandom = EnemySpawnRandomizer; RoundManager.Instance.OutsideEnemySpawnRandom = EnemySpawnRandomizer; RoundManager.Instance.AnomalyRandom = AnomalyRandomizer; RoundManager.Instance.BreakerBoxRandom = BreakerBoxRandomizer; break; case CustomSeedsType.UseGameDefault: break; } } } [HarmonyPatch(typeof(RoundManagerPatch))] public static class RoundManagerPatch { [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] public static void SpawnScrapInLevelPrefix(RoundManager __instance) { __instance.scrapValueMultiplier = MultiModPlugin.ScrapValueMultiplierConfig.Value; __instance.scrapAmountMultiplier = MultiModPlugin.ScrapAmountMultiplierConfig.Value; MultiModPlugin.UpdateAllRandomSeeds(); __instance.playersManager.shipDoorsEnabled = true; } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] public static void GenerateNewLevelClientRpc(ref RoundManager __instance) { __instance.scrapValueMultiplier = MultiModPlugin.ScrapValueMultiplierConfig.Value; __instance.scrapAmountMultiplier = MultiModPlugin.ScrapAmountMultiplierConfig.Value; MultiModPlugin.UpdateAllRandomSeeds(); } [HarmonyPatch("GenerateNewLevelClientRpc")] [HarmonyPostfix] public static void GenerateNewLevelClientRpcPostfix(int randomSeed, int levelID) { MultiModPlugin.UpdateAllRandomSeeds(); } }