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 EclipseEditionModpack SERVER test v0.0.1
EclipseTitle.dll
Decompiled 2 years agousing System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; using VerboseCompany.Properties; [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("VerboseCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VerboseCompany")] [assembly: AssemblyTitle("VerboseCompany")] [assembly: AssemblyVersion("1.0.0.0")] namespace VerboseCompany { [BepInPlugin("dev.parax.lethalcompany.verbosecompany", "Verbose Company", "1.0.0")] public class Main : BaseUnityPlugin { private const string ModId = "dev.parax.lethalcompany.verbosecompany"; private const string ModName = "Verbose Company"; private const string Version = "1.0.0"; public static AssetBundle verboseCompanyAssets; public static Texture2D titleFontAsset; private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown verboseCompanyAssets = AssetBundle.LoadFromMemory(Resources.verbosecompanyassets); verboseCompanyAssets.LoadAllAssets(); titleFontAsset = verboseCompanyAssets.LoadAsset<Texture2D>("filsonfontasset"); Harmony val = new Harmony("dev.parax.lethalcompany.verbosecompany"); val.PatchAll(); } } [HarmonyPatch(typeof(MenuManager))] public class TitleText_MenuManagerPatch { public static string[] LethalSyn = new string[15] { "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company", "Lethal Company" }; public static string[] CompanySyn = new string[14] { "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition", "Eclipse Edition" }; public static GameObject TitleObj; public static TextMeshProUGUI TitleObjText; [HarmonyPatch("Start")] [HarmonyPrefix] private static void Start() { //IL_0083: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01e3: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, LethalSyn.Length); int num2 = Random.Range(0, CompanySyn.Length); TitleObj = Object.Instantiate<GameObject>(GameObject.Find("Canvas/MenuContainer/MainButtons/HostButton")); ((Object)TitleObj.transform).name = "TitleObj"; TitleObj.transform.SetParent(GameObject.Find("Canvas/MenuContainer").transform); TitleObj.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); TitleObj.transform.localScale = new Vector3(1f, 1f, 1f); TitleObj.transform.localPosition = new Vector3(0f, 140f, 0f); Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Image))); Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Button))); Object.Destroy((Object)(object)TitleObj.GetComponent(typeof(Animator))); Object.Destroy((Object)(object)TitleObj.transform.GetChild(0)); Component component = GameObject.Find("Canvas/MenuContainer/TitleObj/Text (TMP)").GetComponent(typeof(TextMeshProUGUI)); TitleObjText = (TextMeshProUGUI)(object)((component is TextMeshProUGUI) ? component : null); ((TMP_Text)TitleObjText).text = LethalSyn[num].ToUpper() + "\n" + CompanySyn[num2].ToUpper(); ((TMP_Text)TitleObjText).faceColor = Color32.op_Implicit(new Color(1f, 0f, 0f)); ((TMP_Text)TitleObjText).fontSize = 90f; Component component2 = ((Component)TitleObjText).GetComponent(typeof(RectTransform)); RectTransform val = (RectTransform)(object)((component2 is RectTransform) ? component2 : null); val.sizeDelta = new Vector2(1000f, 100f); ((TMP_Text)TitleObjText).alignment = (TextAlignmentOptions)4098; ((TMP_Text)TitleObjText).verticalAlignment = (VerticalAlignmentOptions)256; ((TMP_Text)TitleObjText).lineSpacing = -52f; ((TMP_Text)TitleObjText).characterSpacing = -12f; GameObject.Find("Canvas/MenuContainer/MainButtons/HeaderImage").SetActive(false); } [HarmonyPatch("Update")] [HarmonyPrefix] private static void Update() { TitleObj.SetActive(GameObject.Find("Canvas/MenuContainer/MainButtons").activeSelf); } } } namespace VerboseCompany.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("VerboseCompany.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] verbosecompanyassets { get { object @object = ResourceManager.GetObject("verbosecompanyassets", resourceCulture); return (byte[])@object; } } internal Resources() { } } }
TVLoader.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.Logging; using HarmonyLib; using TVLoader.Utils; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TVLoader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TVLoader")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e59845a7-f2f7-4416-9a61-ca1939ce6e2d")] [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 TVLoader { [BepInPlugin("rattenbonkers.TVLoader", "TVLoader", "1.0.3")] public class TVLoaderPlugin : BaseUnityPlugin { private const string MyGUID = "rattenbonkers.TVLoader"; private const string PluginName = "TVLoader"; private const string VersionString = "1.0.3"; private static readonly Harmony Harmony = new Harmony("rattenbonkers.TVLoader"); public static ManualLogSource Log = new ManualLogSource("TVLoader"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); VideoManager.Load(); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("PluginName: {0}, VersionString: {1} is loaded. Video Count: ${2}", "TVLoader", "1.0.3", VideoManager.Videos.Count)); } } } namespace TVLoader.Utils { internal static class VideoManager { public static List<string> Videos = new List<string>(); public static void Load() { string[] directories = Directory.GetDirectories(Paths.PluginPath); foreach (string text in directories) { string path = Path.Combine(Paths.PluginPath, text, "Television Videos"); if (Directory.Exists(path)) { string[] files = Directory.GetFiles(path, "*.mp4"); Videos.AddRange(files); TVLoaderPlugin.Log.LogInfo((object)$"{text} has {files.Length} videos."); } } string path2 = Path.Combine(Paths.PluginPath, "Television Videos"); if (!Directory.Exists(path2)) { Directory.CreateDirectory(path2); } string[] files2 = Directory.GetFiles(path2, "*.mp4"); Videos.AddRange(files2); TVLoaderPlugin.Log.LogInfo((object)$"Global has {files2.Length} videos."); TVLoaderPlugin.Log.LogInfo((object)$"Loaded {Videos.Count} total."); } } } namespace TVLoader.Patches { [HarmonyPatch(typeof(TVScript))] internal class TVScriptPatches { private static FieldInfo currentClipProperty = typeof(TVScript).GetField("currentClip", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo currentTimeProperty = typeof(TVScript).GetField("currentClipTime", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo wasLastFrameProp = typeof(TVScript).GetField("wasTvOnLastFrame", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo timeSinceTurningOffTVProp = typeof(TVScript).GetField("timeSinceTurningOffTV", BindingFlags.Instance | BindingFlags.NonPublic); private static MethodInfo setMatProperty = typeof(TVScript).GetMethod("SetTVScreenMaterial", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch(typeof(TVScript), "Update")] [HarmonyPrefix] public static bool Update(TVScript __instance) { return false; } [HarmonyPatch(typeof(TVScript), "TurnTVOnOff")] [HarmonyPrefix] public static bool TurnTVOnOff(TVScript __instance, bool on) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 if (VideoManager.Videos.Count == 0) { return false; } if ((int)__instance.video.source != 1) { __instance.video.clip = null; __instance.tvSFX.clip = null; } __instance.tvOn = on; if (on) { PlayNextVideo(__instance); __instance.tvSFX.PlayOneShot(__instance.switchTVOn); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOn, 1f); } else { __instance.video.Stop(); __instance.tvSFX.PlayOneShot(__instance.switchTVOff); WalkieTalkie.TransmitOneShotAudio(__instance.tvSFX, __instance.switchTVOff, 1f); } setMatProperty.Invoke(__instance, new object[1] { on }); return false; } [HarmonyPatch(typeof(TVScript), "TVFinishedClip")] [HarmonyPrefix] public static bool TVFinishedClip(TVScript __instance, VideoPlayer source) { PlayNextVideo(__instance); return false; } private static void PlayNextVideo(TVScript instance) { if (VideoManager.Videos.Count != 0) { TVLoaderPlugin.Log.LogInfo((object)"Playing next video..."); int num = (int)currentClipProperty.GetValue(instance); num = (num + 1) % VideoManager.Videos.Count; TVLoaderPlugin.Log.LogInfo((object)$"currentClip: {num} - {VideoManager.Videos[num]}"); currentTimeProperty.SetValue(instance, 0f); currentClipProperty.SetValue(instance, num); instance.tvSFX.time = 0f; instance.video.url = "file://" + VideoManager.Videos[num]; instance.video.source = (VideoSource)1; instance.video.controlledAudioTrackCount = 1; instance.video.audioOutputMode = (VideoAudioOutputMode)1; instance.video.SetTargetAudioSource((ushort)0, instance.tvSFX); instance.video.Play(); instance.SyncTVServerRpc(); } } } }
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; } } }
LethalCompanyScalingMaster.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using LC_API.ServerAPI; using LethalCompanyModV2.Component; using LethalCompanyScalingMaster; using LethalCompanyScalingMaster.Component; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [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("LethalCompanyScalingMaster")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod for variable and configurable scaling based on the amount of players in game. Fully customaizable and compatible with biggelobbies and only the host needs it.")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0")] [assembly: AssemblyProduct("LethalCompanyScalingMaster")] [assembly: AssemblyTitle("LethalCompanyScalingMaster")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class NetworkManagerPatch { } namespace LethalCompanyModV2.Patches { [HarmonyPatch(typeof(TimeOfDay))] [HarmonyPatch("SetNewProfitQuota")] internal class QuotaPatch { private static bool Prefix() { TimeOfDay instance = TimeOfDay.Instance; Debug.Log((object)"SetNewProfitQuotaPatch"); instance.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.profitQuota = (int)Mathf.Clamp((float)instance.profitQuota + num2, 0f, 1E+09f); instance.quotaFulfilled = 0; _ = instance.totalTime; _ = instance.quotaVariables.deadlineDaysAmount; int num3 = num / 5 + 15 * instance.daysUntilDeadline; Debug.Log((object)"Syncing new profit quota!"); TimeOfDay.Instance.SyncNewProfitQuotaClientRpc(instance.profitQuota, num3, instance.timesFulfilledQuota); return false; } } } namespace LethalCompanyModV2.Component { public class ControlManager : MonoBehaviour { private bool _isMenuOpen; private GUIManager _guiManager; private bool isInitialized; public void Awake() { Debug.LogWarning((object)"Control Manager Started"); _guiManager = new GUIManager(); } public void Update() { if (!isInitialized && !isInitialized && (Object)(object)StartOfRound.Instance != (Object)null && Plugin.GetConnectedPlayers() == 1 && StartOfRound.Instance.fullyLoadedPlayers.Count > 0) { Debug.Log((object)("Fully loaded players count: " + StartOfRound.Instance.fullyLoadedPlayers.Count)); ((MonoBehaviour)this).Invoke("InitializeFunctions", 2f); isInitialized = true; } if (Keyboard.current.ctrlKey.isPressed && ((ButtonControl)Keyboard.current.mKey).wasPressedThisFrame && Plugin.Host) { Debug.Log((object)"Ctrl key held down and 'm' key pressed - Triggering Method2"); Debug.Log((object)("Plugin Host: " + Plugin.Host)); ToggleMenu(); } } private void InitializeFunctions() { ToggleMenu(); Plugin.SaveValues(); } private void ToggleMenu() { if (Plugin.Host) { _isMenuOpen = !_isMenuOpen; if (_isMenuOpen) { Debug.Log((object)"Opening Menu..."); Cursor.lockState = (CursorLockMode)1; Cursor.visible = true; } else { Debug.Log((object)"Closing Menu..."); Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } } private void OnGUI() { if (_isMenuOpen) { _guiManager.OnGUI(); } } } public class GUIManager { public static TimeOfDay _tod; private bool _initialized; public static string _playerCountQuotaModifier; public static string _baseQuota; public static string _baseIncreaseInput; public static float _quotaIncreaseSteepness; public static int _deathPenalty; public static string _daysUntilDeadlineInput; private bool _enableAutoUpdatedScaling = true; private string _perPlayerCredits = "15"; public static int _totalStartingCredits; private GUIStyle _currentStyle; private GUIStyle _textFieldStyle; private GUIStyle _titleLabelStyle; private GUIStyle _headerLabelStyle; private bool _showSideMenu; public void OnGUI() { //IL_0022: 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_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) if (!_initialized) { Init(); } GUILayout.BeginArea(new Rect(10f, 35f, 500f, 600f)); GUI.Box(new Rect(0f, 0f, 520f, 600f), "", _currentStyle); GUILayout.Label("LC - Better Quota Scaler - Eclipse edition", _headerLabelStyle, Array.Empty<GUILayoutOption>()); GUILayout.Label("(CTRL + M TO TOGGLE)", Array.Empty<GUILayoutOption>()); GUILayout.Label("Quota Settings", _titleLabelStyle, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Starting Quota", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); GUILayout.Label("=", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label("Base Quota", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.Label("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label("(", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label("Player Count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.Label("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label("Player Count Modifier", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) }); GUILayout.Label(")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (float.TryParse(_baseQuota, out var result) && float.TryParse(_playerCountQuotaModifier, out var result2)) { GUILayout.Label(((int)(result + (float)Plugin.GetConnectedPlayers() * result2)).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); } GUILayout.Label("=", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); _baseQuota = FilterNumericInput(GUILayout.TextField(_baseQuota, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })); GUILayout.Label("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label("(", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.Label(Plugin.GetConnectedPlayers().ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.Label("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); _playerCountQuotaModifier = FilterNumericInput(GUILayout.TextField(_playerCountQuotaModifier, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(125f) })); GUILayout.Label(")", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) }); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (float.TryParse(_baseQuota, out var result3) && float.TryParse(_playerCountQuotaModifier, out var result4)) { GUILayout.Label("Starting Profit Quota = " + (int)(result3 + (float)Plugin.GetConnectedPlayers() * result4), Array.Empty<GUILayoutOption>()); } GUILayout.Width(400f); GUILayout.Label("Quota increase steepness: " + _quotaIncreaseSteepness, Array.Empty<GUILayoutOption>()); _quotaIncreaseSteepness = Mathf.Round(GUILayout.HorizontalSlider(_quotaIncreaseSteepness, 0f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }) * 2f) / 2f; GUILayout.Label("Quota increase base increase value: " + _tod.quotaVariables.baseIncrease, Array.Empty<GUILayoutOption>()); _baseIncreaseInput = FilterNumericInput(GUILayout.TextField(_baseIncreaseInput, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) })); GUILayout.Label("Deadline settings", _titleLabelStyle, Array.Empty<GUILayoutOption>()); GUILayout.Label("Deadline: " + _tod.daysUntilDeadline, Array.Empty<GUILayoutOption>()); _daysUntilDeadlineInput = FilterNumericInput(GUILayout.TextField(_daysUntilDeadlineInput, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) })); GUILayout.Label("Death Penalty Settings", _titleLabelStyle, Array.Empty<GUILayoutOption>()); _deathPenalty = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_deathPenalty / 100f, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }) * 100f); string text = _deathPenalty + "%"; GUILayout.Label("Death Penalty: " + text, Array.Empty<GUILayoutOption>()); GUILayout.Label("Per Player Death Penalty: " + text, Array.Empty<GUILayoutOption>()); GUILayout.Label("Max percentage of money you can lose is " + (_deathPenalty * Plugin.GetConnectedPlayers()).ToString("0.00") + "%", Array.Empty<GUILayoutOption>()); GUILayout.Label("Credit/Funds settings", _titleLabelStyle, Array.Empty<GUILayoutOption>()); GUILayout.Label("Per Player Starting Credits: " + _perPlayerCredits, Array.Empty<GUILayoutOption>()); _perPlayerCredits = FilterNumericInput(GUILayout.TextField(_perPlayerCredits, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) })); if (float.TryParse(_perPlayerCredits, out var result5)) { _totalStartingCredits = (int)((float)Plugin.GetConnectedPlayers() * result5); GUILayout.Label("Total Starting credits with these settings " + _totalStartingCredits, Array.Empty<GUILayoutOption>()); } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUI.backgroundColor = (_enableAutoUpdatedScaling ? Color.green : Color.red); if (GUILayout.Button("Auto Update on player join: " + (_enableAutoUpdatedScaling ? "Enabled" : "Disabled"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) })) { _enableAutoUpdatedScaling = !_enableAutoUpdatedScaling; Plugin.AutoUpdateQuota = _enableAutoUpdatedScaling; } GUI.backgroundColor = Color.white; if (GUILayout.Button("Save values", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) })) { Plugin.SaveValues(); } GUILayout.EndHorizontal(); if (GUILayout.Button("Show Calculated Values", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(500f) })) { _showSideMenu = !_showSideMenu; } GUILayout.EndArea(); if (_showSideMenu) { GUILayout.BeginArea(new Rect(560f, 10f, 200f, 550f)); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); GUILayout.Label("Quotas for the next rounds", _titleLabelStyle, Array.Empty<GUILayoutOption>()); for (int i = 1; i <= 10; i++) { int num = CalculateQuotaForRound(i); GUILayout.Label("Round " + i + ": " + num, Array.Empty<GUILayoutOption>()); } GUILayout.EndVertical(); GUILayout.EndArea(); } } private string FilterNumericInput(string input) { if (string.IsNullOrWhiteSpace(input)) { return "0"; } string text = new string(Enumerable.ToArray(Enumerable.Where(input, (char c) => char.IsDigit(c) || c == '.'))); if (string.IsNullOrWhiteSpace(text)) { return "0"; } return text; } private int CalculateQuotaForRound(int round) { QuotaSettings quotaVariables = _tod.quotaVariables; int num = quotaVariables.startingQuota; if (round == 1) { return num; } for (int i = 1; i < round; i++) { float num2 = Mathf.Clamp(1f + (float)i * ((float)i / quotaVariables.increaseSteepness), 0f, 10000f); num2 = quotaVariables.baseIncrease * num2; num = (int)Mathf.Clamp((float)num + num2, 0f, 1E+09f); } return num; } public void Init() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown _tod = TimeOfDay.Instance; Plugin.DeathPenalty = 80 / Plugin.GetConnectedPlayers(); _deathPenalty = 80 / Plugin.GetConnectedPlayers(); if (_currentStyle == null) { _currentStyle = new GUIStyle(GUI.skin.box); _currentStyle.normal.background = MakeTex(2, 2, new Color(0.2f, 0f, 0f, 1f)); _currentStyle.normal.textColor = new Color(1f, 1f, 1f, 1f); } if (_textFieldStyle == null) { _textFieldStyle = new GUIStyle(GUI.skin.textField); } if (_titleLabelStyle == null) { _titleLabelStyle = new GUIStyle(GUI.skin.label); _titleLabelStyle.fontSize = 15; _titleLabelStyle.alignment = (TextAnchor)3; } if (_headerLabelStyle == null) { _headerLabelStyle = new GUIStyle(GUI.skin.label); _headerLabelStyle.fontSize = 24; _headerLabelStyle.alignment = (TextAnchor)4; } _initialized = true; } private Texture2D MakeTex(int width, int height, Color col) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } static GUIManager() { _playerCountQuotaModifier = "20"; _baseQuota = "200"; _baseIncreaseInput = "100"; _quotaIncreaseSteepness = 10f; _deathPenalty = 20; _daysUntilDeadlineInput = "3"; _totalStartingCredits = 0; } } } namespace LethalCompanyScalingMaster { [BepInPlugin("LethalCompanyScalingMaster", "LethalCompanyScalingMaster", "1.4.0")] public class Plugin : BaseUnityPlugin { private static bool _loaded; public static int DeadlineAmount; public static int groupCredits; public static bool AutoUpdateQuota = true; private Harmony _harmony; public static bool Host { get; set; } public static int DeathPenalty { get; set; } private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalCompanyScalingMaster is starting up..."); _harmony = new Harmony("LethalCompanyScalingMaster"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalCompanyScalingMaster has loaded!"); } private void Start() { Initialize(); } private void OnDestroy() { Initialize(); } private void Initialize() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!_loaded) { GameObject val = new GameObject("DontDestroy"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<ControlManager>(); val.AddComponent<BroadcastingComponent>(); ModdedServer.SetServerModdedOnly(); _loaded = true; } } public static int GetConnectedPlayers() { return StartOfRound.Instance.connectedPlayersAmount + 1; } public static void OnPlayerJoin() { if (AutoUpdateQuota) { SaveValues(); } } public static void SaveValues() { if (float.TryParse(GUIManager._baseQuota, out var result) && float.TryParse(GUIManager._playerCountQuotaModifier, out var result2)) { int num = (int)(result + (float)GetConnectedPlayers() * result2); GUIManager._tod.quotaVariables.startingQuota = num; GUIManager._tod.profitQuota = num; } if (float.TryParse(GUIManager._baseIncreaseInput, out var result3)) { GUIManager._tod.quotaVariables.baseIncrease = result3; } if (int.TryParse(GUIManager._daysUntilDeadlineInput, out var result4)) { DeadlineAmount = result4; GUIManager._tod.quotaVariables.deadlineDaysAmount = result4; } GUIManager._tod.quotaVariables.increaseSteepness = GUIManager._quotaIncreaseSteepness; groupCredits = GUIManager._totalStartingCredits; DeathPenalty = GUIManager._deathPenalty; BroadcastingComponent.BroadcastDeathPenalty(DeathPenalty); UpdateAndSyncValues(); } public static void UpdateAndSyncValues() { TimeOfDay instance = TimeOfDay.Instance; Debug.Log((object)("Updating Profit Quota's " + GetConnectedPlayers())); if (((NetworkBehaviour)instance).IsServer) { Terminal val = Object.FindObjectOfType<Terminal>(); if (!((NetworkBehaviour)val).IsServer) { Debug.Log((object)"This terminal instance is not a server!!!"); } else { Debug.Log((object)"This terminal instance is a server"); val.SyncGroupCreditsClientRpc(groupCredits, val.numberOfItemsInDropship); } instance.SyncNewProfitQuotaClientRpc(instance.profitQuota, 0, instance.timesFulfilledQuota); instance.SyncTimeClientRpc(instance.globalTime, (int)((float)DeadlineAmount * instance.totalTime)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalCompanyScalingMaster"; public const string PLUGIN_NAME = "LethalCompanyScalingMaster"; public const string PLUGIN_VERSION = "1.4.0"; } } namespace LethalCompanyScalingMaster.Patches { [HarmonyPatch(typeof(HUDManager))] [HarmonyPatch("ApplyPenalty")] internal class DeathPenaltyPatch { private static bool Prefix(ref int playersDead, ref int bodiesInsured) { float num = (float)Plugin.DeathPenalty / 100f; Terminal val = Object.FindObjectOfType<Terminal>(); int groupCredits = val.groupCredits; bodiesInsured = Mathf.Max(bodiesInsured, 0); for (int i = 0; i < playersDead - bodiesInsured; i++) { val.groupCredits -= (int)((double)groupCredits * (double)num); } for (int j = 0; j < bodiesInsured; j++) { val.groupCredits -= (int)((double)groupCredits * ((double)num / 2.5)); } if (val.groupCredits < 0) { val.groupCredits = 0; } Debug.Log((object)("Death penalty is:" + num)); ((TMP_Text)HUDManager.Instance.statsUIElements.penaltyAddition).text = $"{playersDead} casualties: -{(float)((double)num * 100.0 * (double)(playersDead - bodiesInsured))}%\n({bodiesInsured} bodies recovered)"; ((TMP_Text)HUDManager.Instance.statsUIElements.penaltyTotal).text = $"DUE: ${groupCredits - val.groupCredits}"; Debug.Log((object)$"New group credits after penalty: {val.groupCredits}"); return false; } } [HarmonyPatch(typeof(HUDManager), "Start")] public static class HUDManagerStartPatch { [HarmonyPrefix] public static void ApplyStartPrefix() { Debug.Log((object)"APPLYING HUDMANAGER PREFIX"); } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("OnPlayerConnectedClientRpc")] public class OnPlayerConnectedClientRpcPatch { [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] private static void Postfix(ulong clientId, int connectedPlayers, int profitQuota) { Plugin.OnPlayerJoin(); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void AwakePostFix() { Debug.Log((object)"Starting the patch: Postfix for OnPlayerConnectedClientRpc()"); Plugin.Host = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; Debug.Log((object)("Plugin host has been set to: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)); } } } namespace LethalCompanyScalingMaster.Component { public class BroadcastingComponent : MonoBehaviour { private static BroadcastingComponent _instance; public static BroadcastingComponent Instance { get { //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_0027: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("(BroadcastingComponent.cs)BroadcastingComponent"); _instance = val.AddComponent<BroadcastingComponent>(); Object.DontDestroyOnLoad((Object)val); } return _instance; } } public static void BroadcastDeathPenalty(int penalty) { Debug.Log((object)("(BroadcastingComponent.cs) Broadcasting new dp value: " + penalty)); Networking.Broadcast(penalty, "death_penalty"); } private void OnEnable() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Debug.Log((object)"(BroadcastingComponent.cs)Broadcasting: Subscribed"); Networking.GetInt = (GotIntEventDelegate)Delegate.Combine((Delegate?)(object)Networking.GetInt, (Delegate?)new GotIntEventDelegate(OnGotInt)); } private void OnDisable() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Debug.Log((object)"(BroadcastingComponent.cs)Broadcasting: Unsubscribed"); Networking.GetInt = (GotIntEventDelegate)Delegate.Remove((Delegate?)(object)Networking.GetInt, (Delegate?)new GotIntEventDelegate(OnGotInt)); } private void OnGotInt(int data, string signature) { if (signature.Equals("death_penalty")) { Debug.Log((object)("(BroadcastingComponent.cs) Got an int for (" + signature + ") with data: " + data)); UpdateDeathPenalty(data); } } private void UpdateDeathPenalty(int deathPenalty) { Plugin.DeathPenalty = deathPenalty; GUIManager._deathPenalty = deathPenalty; } private void Awake() { if ((Object)(object)_instance == (Object)null) { _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Debug.Log((object)"Destroying the Broadcasting component"); Object.Destroy((Object)(object)((Component)this).gameObject); } } } }