Decompiled source of Wateridge v1.1.4
LethalExpansion.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Adapters; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalExpansion.Extenders; using LethalExpansion.Patches; using LethalExpansion.Patches.Monsters; using LethalExpansion.Utils; using LethalExpansion.Utils.HUD; using LethalSDK.Component; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using TMPro; using Unity.AI.Navigation; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; 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("LethalExpansion")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalExpansion")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f80eb3fd-9563-4f80-9fc7-3fcce1655c13")] [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")] public class AutoScrollText : MonoBehaviour { public TextMeshProUGUI textMeshPro; public float scrollSpeed = 15f; private Vector2 startPosition; private float textHeight; private bool startScrolling = false; private bool isWaitingToReset = false; private float displayHeight; private float fontSize; private void Start() { textMeshPro = ((Component)this).GetComponent<TextMeshProUGUI>(); InitializeScrolling(); } private void InitializeScrolling() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textMeshPro != (Object)null) { startPosition = ((TMP_Text)textMeshPro).rectTransform.anchoredPosition; textHeight = ((TMP_Text)textMeshPro).preferredHeight; displayHeight = ((TMP_Text)textMeshPro).rectTransform.sizeDelta.y; fontSize = ((TMP_Text)textMeshPro).fontSize; } ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private IEnumerator WaitBeforeScrolling(float waitTime) { yield return (object)new WaitForSeconds(waitTime); startScrolling = true; } private IEnumerator WaitBeforeResetting(float waitTime) { isWaitingToReset = true; yield return (object)new WaitForSeconds(waitTime); ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; isWaitingToReset = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private void Update() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textMeshPro != (Object)null && startScrolling && !isWaitingToReset) { RectTransform rectTransform = ((TMP_Text)textMeshPro).rectTransform; rectTransform.anchoredPosition += new Vector2(0f, scrollSpeed * Time.deltaTime); if (((TMP_Text)textMeshPro).rectTransform.anchoredPosition.y >= startPosition.y + textHeight - displayHeight - fontSize) { startScrolling = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeResetting(5f)); } } } public void ResetScrolling() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)textMeshPro != (Object)null) { ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; } isWaitingToReset = false; InitializeScrolling(); } } public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private string description; private string netinfo; public static RectTransform ModSettingsToolTipPanel; public static TMP_Text ModSettingsToolTipPanelDescription; public static TMP_Text ModSettingsToolTipPanelNetInfo; public int index; private float delay = 0.5f; private bool isPointerOver = false; public void OnPointerEnter(PointerEventData eventData) { isPointerOver = true; ((MonoBehaviour)this).StartCoroutine(ShowTooltipAfterDelay()); } public void OnPointerExit(PointerEventData eventData) { isPointerOver = false; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(false); } private IEnumerator ShowTooltipAfterDelay() { yield return (object)new WaitForSeconds(delay); if (isPointerOver) { ModSettingsToolTipPanel.anchoredPosition = new Vector2(-30f, ((Component)this).GetComponent<RectTransform>().anchoredPosition.y + -80f); description = ConfigManager.Instance.FindDescription(index); (bool, bool) info = ConfigManager.Instance.FindNetInfo(index); netinfo = "Network synchronization: " + (info.Item1 ? "Yes" : "No") + "\nMod required by clients: " + (info.Item2 ? "No" : "Yes"); ModSettingsToolTipPanelDescription.text = description; ModSettingsToolTipPanelNetInfo.text = netinfo; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(true); } } } public class ConfigItem { public string Key { get; set; } public Type type { get; set; } public object Value { get; set; } public object DefaultValue { get; set; } public string Tab { get; set; } public string Description { get; set; } public object MinValue { get; set; } public object MaxValue { get; set; } public bool Sync { get; set; } public bool Hidden { get; set; } public bool Optional { get; set; } public bool RequireRestart { get; set; } public ConfigItem(string key, object defaultValue, string tab, string description, object minValue = null, object maxValue = null, bool sync = true, bool optional = false, bool hidden = false, bool requireRestart = false) { Key = key; DefaultValue = defaultValue; type = defaultValue.GetType(); Tab = tab; Description = description; if (minValue != null && maxValue != null) { if (minValue.GetType() == type && maxValue.GetType() == type) { MinValue = minValue; MaxValue = maxValue; } } else { MinValue = null; MaxValue = null; } Sync = sync; Optional = optional; Hidden = hidden; Value = DefaultValue; RequireRestart = requireRestart; } } namespace LethalExpansion { [BepInPlugin("LethalExpansion", "LethalExpansion", "1.3.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalExpansion : BaseUnityPlugin { private enum compatibility { unknown, perfect, good, medium, bad, critical, incompatible } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<PluginInfo, bool> <>9__32_1; public static UnityAction <>9__32_0; public static Func<PluginInfo, bool> <>9__32_2; public static Func<AudioMixerGroup, bool> <>9__33_1; public static Func<GameObject, bool> <>9__33_2; public static Func<AudioMixerGroup, bool> <>9__33_3; public static Func<AudioMixerGroup, bool> <>9__33_4; public static Func<AudioMixerGroup, bool> <>9__33_5; public static Func<GlobalPropSettings, bool> <>9__33_0; public static Func<PluginInfo, bool> <>9__36_2; public static Func<PluginInfo, bool> <>9__36_0; public static Func<PluginInfo, bool> <>9__36_1; internal bool <OnSceneLoaded>b__32_1(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } internal void <OnSceneLoaded>b__32_0() { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); } internal bool <OnSceneLoaded>b__32_2(PluginInfo p) { return p.Metadata.GUID == "BiggerLobby"; } internal bool <LoadCustomMoon>b__33_1(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__33_2(GameObject o) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene scene = o.scene; return ((Scene)(ref scene)).name != "InitSceneLaunchOptions"; } internal bool <LoadCustomMoon>b__33_3(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__33_4(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__33_5(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__33_0(GlobalPropSettings p) { return p.ID == 1231; } internal bool <waitForSession>b__36_2(PluginInfo p) { return p.Metadata.GUID == "BrutalCompanyPlus"; } internal bool <waitForSession>b__36_0(PluginInfo p) { return p.Metadata.GUID == "LethalAdjustments"; } internal bool <waitForSession>b__36_1(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } } private const string PluginGUID = "LethalExpansion"; private const string PluginName = "LethalExpansion"; private const string VersionString = "1.3.8"; public static readonly Version ModVersion = new Version("1.3.8"); private readonly Version[] CompatibleModVersions = new Version[1] { new Version(1, 3, 8) }; private readonly Dictionary<string, compatibility> CompatibleMods = new Dictionary<string, compatibility> { { "com.sinai.unityexplorer", compatibility.medium }, { "HDLethalCompany", compatibility.good }, { "LC_API", compatibility.good }, { "me.swipez.melonloader.morecompany", compatibility.unknown }, { "BrutalCompanyPlus", compatibility.unknown }, { "MoonOfTheDay", compatibility.good }, { "Television_Controller", compatibility.bad }, { "beeisyou.LandmineFix", compatibility.perfect }, { "LethalAdjustments", compatibility.good }, { "CoomfyDungeon", compatibility.bad }, { "BiggerLobby", compatibility.critical } }; private List<PluginInfo> loadedPlugins = new List<PluginInfo>(); public static readonly int[] CompatibleGameVersions = new int[1] { 45 }; public static bool sessionWaiting = true; public static bool hostDataWaiting = true; public static bool ishost = false; public static bool alreadypatched = false; public static bool weathersReadyToShare = false; public static bool isInGame = false; public static int delayedLevelChange = -1; public static string lastKickReason = string.Empty; private static readonly Harmony Harmony = new Harmony("LethalExpansion"); public static ManualLogSource Log = new ManualLogSource("LethalExpansion"); public static ConfigFile config; public static NetworkManager networkManager; public GameObject SpaceLight; public GameObject terrainfixer; public static Transform currentWaterSurface; private int width = 256; private int height = 256; private int depth = 20; private float scale = 20f; private void Awake() { //IL_0c97: Unknown result type (might be due to invalid IL or missing references) //IL_0c9d: Expected O, but got Unknown //IL_0ce6: Unknown result type (might be due to invalid IL or missing references) //IL_0cf3: Expected O, but got Unknown //IL_0cf8: Unknown result type (might be due to invalid IL or missing references) //IL_0d05: Expected O, but got Unknown //IL_0d6c: Unknown result type (might be due to invalid IL or missing references) //IL_0d79: Expected O, but got Unknown //IL_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Expected O, but got Unknown //IL_0dab: Unknown result type (might be due to invalid IL or missing references) //IL_0db0: Unknown result type (might be due to invalid IL or missing references) //IL_0dbc: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.8 is loading..."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Getting other plugins list"); loadedPlugins = GetLoadedPlugins(); foreach (PluginInfo loadedPlugin in loadedPlugins) { if (!(loadedPlugin.Metadata.GUID != "LethalExpansion")) { continue; } if (CompatibleMods.ContainsKey(loadedPlugin.Metadata.GUID)) { switch (CompatibleMods[loadedPlugin.Metadata.GUID]) { case compatibility.unknown: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.perfect: Console.BackgroundColor = ConsoleColor.Blue; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.good: Console.BackgroundColor = ConsoleColor.Green; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.medium: Console.BackgroundColor = ConsoleColor.Yellow; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.bad: Console.BackgroundColor = ConsoleColor.Red; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogError((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.critical: Console.BackgroundColor = ConsoleColor.DarkRed; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogFatal((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.incompatible: Console.BackgroundColor = ConsoleColor.Magenta; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogFatal((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; default: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } else { Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {compatibility.unknown}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } } config = ((BaseUnityPlugin)this).Config; ConfigManager.Instance.AddItem(new ConfigItem("GlobalTimeSpeedMultiplier", 1.4f, "Time", "Change the global time speed", 0.1f, 3f)); ConfigManager.Instance.AddItem(new ConfigItem("LengthOfHours", 60, "Time", "Change amount of seconds in one hour", 1, 300)); ConfigManager.Instance.AddItem(new ConfigItem("NumberOfHours", 18, "Time", "Max lenght of an Expedition in hours. (Begin at 6 AM | 18 = Midnight)", 6, 20)); ConfigManager.Instance.AddItem(new ConfigItem("DeadlineDaysAmount", 3, "Expeditions", "Change amount of days for the Quota.", 1, 9)); ConfigManager.Instance.AddItem(new ConfigItem("StartingCredits", 60, "Expeditions", "Change amount of starting Credit.", 0, 1000)); ConfigManager.Instance.AddItem(new ConfigItem("MoonsRoutePricesMultiplier", 1f, "Moons", "Change the Cost of the Moon Routes.", 0f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("StartingQuota", 130, "Expeditions", "Change the starting Quota.", 0, 1000, sync: true, optional: true)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapAmountMultiplier", 1f, "Dungeons", "Change the amount of Scraps in dungeons.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapValueMultiplier", 0.4f, "Dungeons", "Change the value of Scraps.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("MapSizeMultiplier", 1.5f, "Dungeons", "Change the size of the Dungeons. (Can crash when under 1.0)", 0.8f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("PreventMineToExplodeWithItems", false, "Dungeons", "Prevent Landmines to explode by dropping items on them")); ConfigManager.Instance.AddItem(new ConfigItem("MineActivationWeight", 0.15f, "Dungeons", "Set the minimal weight to prevent Landmine's explosion (0.15 = 16 lb, Player = 2.0)", 0.01f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("WeightUnit", 0, "HUD", "Change the carried Weight unit : 0 = Pounds (lb), 1 = Kilograms (kg) and 2 = Both", 0, 2, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ConvertPoundsToKilograms", true, "HUD", "Convert Pounds into Kilograms (16 lb = 7 kg) (Only effective if WeightUnit = 1)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("PreventScrapWipeWhenAllPlayersDie", false, "Expeditions", "Prevent the Scraps Wipe when all players die.")); ConfigManager.Instance.AddItem(new ConfigItem("24HoursClock", false, "HUD", "Display a 24h clock instead of 12h.", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ClockAlwaysVisible", false, "HUD", "Display clock while inside of the Ship.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadline", false, "Expeditions", "Automatically increase the Deadline depending of the required quota.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadlineStage", 300, "Expeditions", "Increase the quota deadline of one day each time the quota exceeds this value.", 100, 3000)); ConfigManager.Instance.AddItem(new ConfigItem("LoadModules", true, "Modules", "Load SDK Modules that add new content to the game. Disable it to play with Vanilla players. (RESTART REQUIRED)", null, null, sync: false, optional: false, hidden: false, requireRestart: true)); ConfigManager.Instance.AddItem(new ConfigItem("MaxItemsInShip", 45, "Expeditions", "Change the Items cap can be kept in the ship.", 10, 500)); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonWeatherInCatalogue", true, "HUD", "Display the current weather of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonRankInCatalogue", false, "HUD", "Display the rank of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonPriceInCatalogue", false, "HUD", "Display the route price of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("QuotaIncreaseSteepness", 16, "Expeditions", "Change the Quota Increase Steepness. (Highter = less steep exponential increase)", 0, 32)); ConfigManager.Instance.AddItem(new ConfigItem("QuotaBaseIncrease", 100, "Expeditions", "Change the Quota Base Increase.", 0, 300)); ConfigManager.Instance.AddItem(new ConfigItem("KickPlayerWithoutMod", false, "Lobby", "Kick the players without Lethal Expansion installer. (Will be kicked anyway if LoadModules is True)")); ConfigManager.Instance.AddItem(new ConfigItem("BrutalCompanyPlusCompatibility", false, "Compatibility", "Leave Brutal Company Plus control the Quota settings.")); ConfigManager.Instance.AddItem(new ConfigItem("LethalAdjustmentsCompatibility", false, "Compatibility", "Leave Lethal Adjustments control the Dungeon settings.")); ConfigManager.Instance.AddItem(new ConfigItem("CoomfyDungeonCompatibility", false, "Compatibility", "Let Coomfy Dungeons control the Dungeon size & scrap settings.")); ConfigManager.Instance.AddItem(new ConfigItem("SettingsDebug", false, "Debug", "Show an output of every settings in the Console. (The Console must listen Info messages)", null, null, sync: false)); ConfigManager.Instance.ReadConfig(); ((BaseUnityPlugin)this).Config.SettingChanged += ConfigSettingChanged; AssetBundlesManager.Instance.LoadAllAssetBundles(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; Harmony.PatchAll(typeof(GameNetworkManager_Patch)); Harmony.PatchAll(typeof(Terminal_Patch)); Harmony.PatchAll(typeof(MenuManager_Patch)); Harmony.PatchAll(typeof(GrabbableObject_Patch)); Harmony.PatchAll(typeof(RoundManager_Patch)); Harmony.PatchAll(typeof(TimeOfDay_Patch)); Harmony.PatchAll(typeof(HUDManager_Patch)); Harmony.PatchAll(typeof(StartOfRound_Patch)); Harmony.PatchAll(typeof(EntranceTeleport_Patch)); Harmony.PatchAll(typeof(Landmine_Patch)); Harmony.PatchAll(typeof(AudioReverbTrigger_Patch)); Harmony.PatchAll(typeof(InteractTrigger_Patch)); Harmony.PatchAll(typeof(RuntimeDungeon)); Harmony val = new Harmony("LethalExpansion"); MethodInfo methodInfo = AccessTools.Method(typeof(BaboonBirdAI), "GrabScrap", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugAI), "GrabItem", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterGrabItem", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo4 = AccessTools.Method(typeof(HoarderBugAI), "DropItem", (Type[])null, (Type[])null); MethodInfo methodInfo5 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterDropItem_Patch", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(HoarderBugAI), "KillEnemy", (Type[])null, (Type[])null); MethodInfo methodInfo7 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "KillEnemy_Patch", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(methodInfo5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(methodInfo7), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; HDRenderPipelineAsset val2 = (HDRenderPipelineAsset)(object)((currentRenderPipeline is HDRenderPipelineAsset) ? currentRenderPipeline : null); if ((Object)(object)val2 != (Object)null) { RenderPipelineSettings currentPlatformRenderPipelineSettings = val2.currentPlatformRenderPipelineSettings; currentPlatformRenderPipelineSettings.supportWater = true; val2.currentPlatformRenderPipelineSettings = currentPlatformRenderPipelineSettings; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Water support applied to the HDRenderPipelineAsset."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"HDRenderPipelineAsset not found."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.8 is loaded."); } private List<PluginInfo> GetLoadedPlugins() { return Chainloader.PluginInfos.Values.ToList(); } private float[,] GenerateHeights() { float[,] array = new float[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { array[i, j] = CalculateHeight(i, j); } } return array; } private float CalculateHeight(int x, int y) { float num = (float)x / (float)width * scale; float num2 = (float)y / (float)height * scale; return Mathf.PerlinNoise(num, num2); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading scene: " + ((Scene)(ref scene)).name)); if (((Scene)(ref scene)).name == "InitScene") { networkManager = GameObject.Find("NetworkManager").GetComponent<NetworkManager>(); } if (((Scene)(ref scene)).name == "MainMenu") { sessionWaiting = true; hostDataWaiting = true; ishost = false; alreadypatched = false; delayedLevelChange = -1; isInGame = false; AssetGather.Instance.AddAudioMixer(GameObject.Find("Canvas/MenuManager").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); SettingsMenu.Instance.InitSettingsMenu(); if (lastKickReason != null && lastKickReason.Length > 0) { PopupManager.Instance.InstantiatePopup(scene, "Kicked from Lobby", "You have been kicked\r\nReason: " + lastKickReason, "Ok", "Ignore"); } if (!ConfigManager.Instance.FindEntryValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")) { PopupManager instance = PopupManager.Instance; Scene sceneFocus = scene; object obj = <>c.<>9__32_0; if (obj == null) { UnityAction val = delegate { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); }; <>c.<>9__32_0 = val; obj = (object)val; } instance.InstantiatePopup(sceneFocus, "CoomfyDungeon mod found", "Warning: CoomfyDungeon is incompatible with LethalExpansion, Would you like to enable the compatibility mode? Otherwise dungeon generation Desync may occurs!", "Yes", "No", (UnityAction)obj, null, 20, 18); } if (loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BiggerLobby")) { PopupManager.Instance.InstantiatePopup(scene, "BiggerLobby mod found", "Warning: BiggerLobby is incompatible with LethalExpansion, host/client synchronization will break and dungeon generation Desync may occurs!", "Ok", "Ignore", null, null, 20, 18); } } if (((Scene)(ref scene)).name == "CompanyBuilding") { SpaceLight.SetActive(false); terrainfixer.SetActive(false); } if (((Scene)(ref scene)).name == "SampleSceneRelay") { SpaceLight = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/SpaceLight.prefab")); SceneManager.MoveGameObjectToScene(SpaceLight, scene); Mesh mesh = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Meshes/MonitorWall.fbx").GetComponent<MeshFilter>().mesh; GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube"); val2.GetComponent<MeshFilter>().mesh = mesh; MeshRenderer component = val2.GetComponent<MeshRenderer>(); GameObject val3 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding")); Object.Destroy((Object)(object)val3.GetComponent<FloodWeather>()); ((Object)val3).name = "WaterSurface"; val3.transform.position = Vector3.zero; ((Component)val3.transform.Find("Water")).GetComponent<MeshFilter>().sharedMesh = null; SpawnPrefab.Instance.waterSurface = val3; ((Renderer)component).materials = (Material[])(object)new Material[9] { ((Renderer)component).materials[0], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[2] }; ((Component)StartOfRound.Instance.screenLevelDescription).gameObject.AddComponent<AutoScrollText>(); AssetGather.Instance.AddAudioMixer(GameObject.Find("Systems/Audios/DiageticBackground").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); terrainfixer = new GameObject(); ((Object)terrainfixer).name = "terrainfixer"; terrainfixer.transform.position = new Vector3(0f, -500f, 0f); Terrain val4 = terrainfixer.AddComponent<Terrain>(); TerrainData val5 = new TerrainData(); val5.heightmapResolution = width + 1; val5.size = new Vector3((float)width, (float)depth, (float)height); val5.SetHeights(0, 0, GenerateHeights()); val4.terrainData = val5; Terminal_Patch.ResetFireExitAmounts(); Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume)); for (int i = 0; i < array.Length; i++) { Object obj2 = array[i]; if ((Object)(object)((Volume)((obj2 is Volume) ? obj2 : null)).sharedProfile == (Object)null) { Object obj3 = array[i]; ((Volume)((obj3 is Volume) ? obj3 : null)).sharedProfile = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<VolumeProfile>("Assets/Mods/LethalExpansion/Sky and Fog Global Volume Profile.asset"); } } waitForSession().GetAwaiter(); isInGame = true; } if (((Scene)(ref scene)).name.StartsWith("Level")) { SpaceLight.SetActive(false); terrainfixer.SetActive(false); if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item.Key); Log.LogInfo(item.Value); Log.LogInfo(item.DefaultValue); Log.LogInfo((object)item.Sync); } } } if (!(((Scene)(ref scene)).name == "InitSceneLaunchOptions") || !isInGame) { return; } SpaceLight.SetActive(false); terrainfixer.SetActive(false); GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val6 in rootGameObjects) { val6.SetActive(false); } if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item2 in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item2.Key); Log.LogInfo(item2.Value); Log.LogInfo(item2.DefaultValue); Log.LogInfo((object)item2.Sync); } } LoadCustomMoon(scene).GetAwaiter(); } private async Task LoadCustomMoon(Scene scene) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) await Task.Delay(400); try { if ((Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab != (Object)null && (Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform != (Object)null) { CheckAndRemoveIllegalComponents(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform); GameObject mainPrefab = Object.Instantiate<GameObject>(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab); currentWaterSurface = mainPrefab.transform.Find("Environment/Water"); if ((Object)(object)mainPrefab != (Object)null) { SceneManager.MoveGameObjectToScene(mainPrefab, scene); Transform DiageticBackground = mainPrefab.transform.Find("Systems/Audio/DiageticBackground"); if ((Object)(object)DiageticBackground != (Object)null) { ((Component)DiageticBackground).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Terrain[] Terrains = mainPrefab.GetComponentsInChildren<Terrain>(); if (Terrains != null && Terrains.Length != 0) { Terrain[] array = Terrains; foreach (Terrain terrain in array) { terrain.drawInstanced = true; } } } } string[] _tmp = new string[5] { "MapPropsContainer", "OutsideAINode", "SpawnDenialPoint", "ItemShipLandingNode", "OutsideLevelNavMesh" }; string[] array2 = _tmp; foreach (string s in array2) { if ((Object)(object)GameObject.FindGameObjectWithTag(s) == (Object)null || GameObject.FindGameObjectsWithTag(s).Any(delegate(GameObject o) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene scene2 = o.scene; return ((Scene)(ref scene2)).name != "InitSceneLaunchOptions"; })) { GameObject obj = new GameObject(); ((Object)obj).name = s; obj.tag = s; obj.transform.position = new Vector3(0f, -200f, 0f); SceneManager.MoveGameObjectToScene(obj, scene); } } await Task.Delay(200); GameObject DropShip = GameObject.Find("ItemShipAnimContainer"); if ((Object)(object)DropShip != (Object)null) { Transform ItemShip = DropShip.transform.Find("ItemShip"); if ((Object)(object)ItemShip != (Object)null) { ((Component)ItemShip).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicClose = DropShip.transform.Find("ItemShip/Music"); if ((Object)(object)ItemShipMusicClose != (Object)null) { ((Component)ItemShipMusicClose).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicFar = DropShip.transform.Find("ItemShip/Music/Music (1)"); if ((Object)(object)ItemShipMusicFar != (Object)null) { ((Component)ItemShipMusicFar).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } } await Task.Delay(200); RuntimeDungeon runtimeDungeon = Object.FindObjectOfType<RuntimeDungeon>(false); if ((Object)(object)runtimeDungeon == (Object)null) { GameObject dungeonGenerator = new GameObject(); ((Object)dungeonGenerator).name = "DungeonGenerator"; dungeonGenerator.tag = "DungeonGenerator"; dungeonGenerator.transform.position = new Vector3(0f, -200f, 0f); runtimeDungeon = dungeonGenerator.AddComponent<RuntimeDungeon>(); runtimeDungeon.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; runtimeDungeon.Generator.LengthMultiplier = 0.8f; runtimeDungeon.Generator.PauseBetweenRooms = 0.2f; runtimeDungeon.GenerateOnStart = false; runtimeDungeon.Root = dungeonGenerator; runtimeDungeon.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter dungeonNavMesh = dungeonGenerator.AddComponent<UnityNavMeshAdapter>(); dungeonNavMesh.BakeMode = (RuntimeNavMeshBakeMode)3; dungeonNavMesh.LayerMask = LayerMask.op_Implicit(35072); SceneManager.MoveGameObjectToScene(dungeonGenerator, scene); } else if ((Object)(object)runtimeDungeon.Generator.DungeonFlow == (Object)null) { runtimeDungeon.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; } runtimeDungeon.Generator.DungeonFlow.GlobalProps.First((GlobalPropSettings p) => p.ID == 1231).Count = new IntRange(RoundManager.Instance.currentLevel.GetFireExitAmountOverwrite(), RoundManager.Instance.currentLevel.GetFireExitAmountOverwrite()); GameObject OutOfBounds = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)OutOfBounds).name = "OutOfBounds"; OutOfBounds.layer = 13; OutOfBounds.transform.position = new Vector3(0f, -300f, 0f); OutOfBounds.transform.localScale = new Vector3(1000f, 5f, 1000f); BoxCollider boxCollider = OutOfBounds.GetComponent<BoxCollider>(); ((Collider)boxCollider).isTrigger = true; OutOfBounds.AddComponent<OutOfBoundsTrigger>(); Rigidbody rigidbody = OutOfBounds.AddComponent<Rigidbody>(); rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.collisionDetectionMode = (CollisionDetectionMode)1; SceneManager.MoveGameObjectToScene(OutOfBounds, scene); await Task.Delay(200); } catch (Exception ex2) { Exception ex = ex2; Log.LogError((object)ex); } } private void CheckAndRemoveIllegalComponents(Transform root) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown try { Component[] components = ((Component)root).GetComponents<Component>(); Component[] array = components; foreach (Component component in array) { if (!ComponentWhitelists.moonPrefabWhitelist.Any((Type whitelistType) => ((object)component).GetType() == whitelistType)) { Log.LogWarning((object)("Removed illegal " + ((object)component).GetType().Name + " component.")); Object.Destroy((Object)(object)component); } } foreach (Transform item in root) { Transform root2 = item; CheckAndRemoveIllegalComponents(root2); } } catch (Exception ex) { Log.LogError((object)ex.Message); } } private void OnSceneUnloaded(Scene scene) { if (((Scene)(ref scene)).name.Length > 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Unloading scene: " + ((Scene)(ref scene)).name)); } if (((Scene)(ref scene)).name.StartsWith("Level") || ((Scene)(ref scene)).name == "CompanyBuilding" || (((Scene)(ref scene)).name == "InitSceneLaunchOptions" && isInGame)) { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(true); } if ((Object)(object)currentWaterSurface != (Object)null) { currentWaterSurface = null; } Terminal_Patch.ResetFireExitAmounts(); } } private async Task waitForSession() { while (sessionWaiting) { await Task.Delay(1000); } if (!ishost) { while (!sessionWaiting && hostDataWaiting) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "hostconfig", string.Empty, 0L); await Task.Delay(3000); } } else { for (int i = 0; i < ConfigManager.Instance.GetAll().Count; i++) { if (ConfigManager.Instance.MustBeSync(i)) { ConfigManager.Instance.SetItemValue(i, ConfigManager.Instance.FindEntryValue(i)); } } } TimeOfDay.Instance.globalTimeSpeedMultiplier = ConfigManager.Instance.FindItemValue<float>("GlobalTimeSpeedMultiplier"); TimeOfDay.Instance.lengthOfHours = ConfigManager.Instance.FindItemValue<int>("LengthOfHours"); TimeOfDay.Instance.numberOfHours = ConfigManager.Instance.FindItemValue<int>("NumberOfHours"); if (!ConfigManager.Instance.FindItemValue<bool>("BrutalCompanyPlusCompatibility") || !loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BrutalCompanyPlus")) { TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = ConfigManager.Instance.FindItemValue<int>("DeadlineDaysAmount"); TimeOfDay.Instance.quotaVariables.startingQuota = ConfigManager.Instance.FindItemValue<int>("StartingQuota"); TimeOfDay.Instance.quotaVariables.startingCredits = ConfigManager.Instance.FindItemValue<int>("StartingCredits"); TimeOfDay.Instance.quotaVariables.baseIncrease = ConfigManager.Instance.FindItemValue<int>("QuotaBaseIncrease"); TimeOfDay.Instance.quotaVariables.increaseSteepness = ConfigManager.Instance.FindItemValue<int>("QuotaIncreaseSteepness"); } bool hasLethalAdjustmentCompat = ConfigManager.Instance.FindItemValue<bool>("LethalAdjustmentsCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "LethalAdjustments"); bool ignoreScrapAmountAndMapSize = hasLethalAdjustmentCompat || (ConfigManager.Instance.FindItemValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")); if (!hasLethalAdjustmentCompat) { RoundManager.Instance.scrapValueMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapValueMultiplier"); } if (!ignoreScrapAmountAndMapSize) { RoundManager.Instance.scrapAmountMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapAmountMultiplier"); RoundManager.Instance.mapSizeMultiplier = ConfigManager.Instance.FindItemValue<float>("MapSizeMultiplier"); } StartOfRound.Instance.maxShipItemCapacity = ConfigManager.Instance.FindItemValue<int>("MaxItemsInShip"); if (!alreadypatched) { Terminal_Patch.MainPatch(GameObject.Find("TerminalScript").GetComponent<Terminal>()); alreadypatched = true; } } private void ConfigSettingChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (val != null) { Log.LogInfo((object)$"{val.ChangedSetting.Definition.Key} Changed to {val.ChangedSetting.BoxedValue}"); } } } } namespace LethalExpansion.Utils { public class AssetBundlesManager { private static AssetBundlesManager _instance; public AssetBundle mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LethalExpansion.dll", "lethalexpansion.lem")); public Dictionary<string, (AssetBundle, ModManifest)> assetBundles = new Dictionary<string, (AssetBundle, ModManifest)>(); public readonly string[] forcedNative = new string[2] { "templatemod", "oldseaport" }; public DirectoryInfo modPath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location); public DirectoryInfo modDirectory; public DirectoryInfo pluginsDirectory; public static AssetBundlesManager Instance { get { if (_instance == null) { _instance = new AssetBundlesManager(); } return _instance; } } public (AssetBundle, ModManifest) Load(string name) { return assetBundles[name.ToLower()]; } public void LoadAllAssetBundles() { modDirectory = modPath.Parent; pluginsDirectory = modDirectory; while (pluginsDirectory != null && pluginsDirectory.Name != "plugins") { pluginsDirectory = pluginsDirectory.Parent; } if (pluginsDirectory != null) { LethalExpansion.Log.LogInfo((object)("Plugins folder found: " + pluginsDirectory.FullName)); LethalExpansion.Log.LogInfo((object)("Mod path is: " + modDirectory.FullName)); if (modDirectory.FullName == pluginsDirectory.FullName) { LethalExpansion.Log.LogWarning((object)("LethalExpansion is Rooting the Plugins folder, this is not recommended. " + modDirectory.FullName)); } string[] files = Directory.GetFiles(pluginsDirectory.FullName, "*.lem", SearchOption.AllDirectories); foreach (string file in files) { LoadBundle(file); } } else { LethalExpansion.Log.LogWarning((object)"Mod is not in a plugins folder."); } } public void LoadBundle(string file) { if (forcedNative.Contains<string>(Path.GetFileNameWithoutExtension(file)) && !file.Contains(modDirectory.FullName)) { LethalExpansion.Log.LogWarning((object)("Illegal use of reserved Asset Bundle name: " + Path.GetFileNameWithoutExtension(file) + " at: " + file + ".")); } else { if (!(Path.GetFileName(file) != "lethalexpansion.lem")) { return; } if (!assetBundles.ContainsKey(Path.GetFileNameWithoutExtension(file))) { Stopwatch stopwatch = new Stopwatch(); AssetBundle val = null; try { stopwatch.Start(); val = AssetBundle.LoadFromFile(file); stopwatch.Stop(); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); } if ((Object)(object)val != (Object)null) { string text = "Assets/Mods/" + Path.GetFileNameWithoutExtension(file) + "/ModManifest.asset"; ModManifest modManifest = val.LoadAsset<ModManifest>(text); if ((Object)(object)modManifest != (Object)null) { if (!assetBundles.Any((KeyValuePair<string, (AssetBundle, ModManifest)> b) => b.Value.Item2.modName == modManifest.modName)) { LethalExpansion.Log.LogInfo((object)string.Format("Module found: {0} v{1} Loaded in {2}ms", modManifest.modName, (modManifest.GetVersion() != null) ? ((object)modManifest.GetVersion()).ToString() : "0.0.0.0", stopwatch.ElapsedMilliseconds)); if (modManifest.GetVersion() == null || ((object)modManifest.GetVersion()).ToString() == "0.0.0.0") { LethalExpansion.Log.LogWarning((object)("Module " + modManifest.modName + " have no version number, this is unsafe!")); } assetBundles.Add(Path.GetFileNameWithoutExtension(file).ToLower(), (val, modManifest)); } else { LethalExpansion.Log.LogWarning((object)("Another mod with same name is already loaded: " + modManifest.modName)); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle have no ModManifest: " + Path.GetFileName(file))); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("File is not an AssetBundle: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle with same name already loaded: " + Path.GetFileName(file))); } } } public bool BundleLoaded(string bundleName) { return assetBundles.ContainsKey(bundleName.ToLower()); } public bool BundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (!assetBundles.ContainsKey(text.ToLower())) { return false; } } return true; } public bool IncompatibleBundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (assetBundles.ContainsKey(text.ToLower())) { return true; } } return false; } } public class AssetGather { private static AssetGather _instance; public Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public Dictionary<string, GameObject> planetPrefabs = new Dictionary<string, GameObject>(); public Dictionary<string, GameObject> mapObjects = new Dictionary<string, GameObject>(); public Dictionary<string, SpawnableOutsideObject> outsideObjects = new Dictionary<string, SpawnableOutsideObject>(); public Dictionary<string, Item> scraps = new Dictionary<string, Item>(); public Dictionary<string, LevelAmbienceLibrary> levelAmbiances = new Dictionary<string, LevelAmbienceLibrary>(); public Dictionary<string, EnemyType> enemies = new Dictionary<string, EnemyType>(); public Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); public static AssetGather Instance { get { if (_instance == null) { _instance = new AssetGather(); } return _instance; } } public void GetList() { LethalExpansion.Log.LogInfo((object)"Audio Clips"); foreach (KeyValuePair<string, AudioClip> audioClip in audioClips) { LethalExpansion.Log.LogInfo((object)audioClip.Key); } LethalExpansion.Log.LogInfo((object)"Audio Mixers"); foreach (KeyValuePair<string, (AudioMixer, AudioMixerGroup[])> audioMixer in audioMixers) { LethalExpansion.Log.LogInfo((object)audioMixer.Key); } LethalExpansion.Log.LogInfo((object)"Planet Prefabs"); foreach (KeyValuePair<string, GameObject> planetPrefab in planetPrefabs) { LethalExpansion.Log.LogInfo((object)planetPrefab.Key); } LethalExpansion.Log.LogInfo((object)"Map Objects"); foreach (KeyValuePair<string, GameObject> mapObject in mapObjects) { LethalExpansion.Log.LogInfo((object)mapObject.Key); } LethalExpansion.Log.LogInfo((object)"Outside Objects"); foreach (KeyValuePair<string, SpawnableOutsideObject> outsideObject in outsideObjects) { LethalExpansion.Log.LogInfo((object)outsideObject.Key); } LethalExpansion.Log.LogInfo((object)"Scraps"); foreach (KeyValuePair<string, Item> scrap in scraps) { LethalExpansion.Log.LogInfo((object)scrap.Key); } LethalExpansion.Log.LogInfo((object)"Level Ambiances"); foreach (KeyValuePair<string, LevelAmbienceLibrary> levelAmbiance in levelAmbiances) { LethalExpansion.Log.LogInfo((object)levelAmbiance.Key); } LethalExpansion.Log.LogInfo((object)"Enemies"); foreach (KeyValuePair<string, EnemyType> enemy in enemies) { LethalExpansion.Log.LogInfo((object)enemy.Key); } LethalExpansion.Log.LogInfo((object)"Sprites"); foreach (KeyValuePair<string, Sprite> sprite in sprites) { LethalExpansion.Log.LogInfo((object)sprite.Key); } } public void AddAudioClip(AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(((Object)clip).name) && !audioClips.ContainsValue(clip)) { audioClips.Add(((Object)clip).name, clip); } } public void AddAudioClip(string name, AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(name) && !audioClips.ContainsValue(clip)) { audioClips.Add(name, clip); } } public void AddAudioMixer(AudioMixer mixer) { if (!((Object)(object)mixer != (Object)null) || audioMixers.ContainsKey(((Object)mixer).name)) { return; } List<AudioMixerGroup> list = new List<AudioMixerGroup>(); AudioMixerGroup[] array = mixer.FindMatchingGroups(string.Empty); foreach (AudioMixerGroup val in array) { if ((Object)(object)val != (Object)null && !list.Contains(val)) { list.Add(val); } } audioMixers.Add(((Object)mixer).name, (mixer, list.ToArray())); } public void AddPlanetPrefabs(GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(((Object)prefab).name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(((Object)prefab).name, prefab); } } public void AddPlanetPrefabs(string name, GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(name, prefab); } } public void AddMapObjects(GameObject mapObject) { if ((Object)(object)mapObject != (Object)null && !mapObjects.ContainsKey(((Object)mapObject).name) && !mapObjects.ContainsValue(mapObject)) { mapObjects.Add(((Object)mapObject).name, mapObject); } } public void AddOutsideObject(SpawnableOutsideObject outsideObject) { if ((Object)(object)outsideObject != (Object)null && !outsideObjects.ContainsKey(((Object)outsideObject).name) && !outsideObjects.ContainsValue(outsideObject)) { outsideObjects.Add(((Object)outsideObject).name, outsideObject); } } public void AddScrap(Item scrap) { if ((Object)(object)scrap != (Object)null && !scraps.ContainsKey(((Object)scrap).name) && !scraps.ContainsValue(scrap)) { scraps.Add(((Object)scrap).name, scrap); } } public void AddLevelAmbiances(LevelAmbienceLibrary levelAmbiance) { if ((Object)(object)levelAmbiance != (Object)null && !levelAmbiances.ContainsKey(((Object)levelAmbiance).name) && !levelAmbiances.ContainsValue(levelAmbiance)) { levelAmbiances.Add(((Object)levelAmbiance).name, levelAmbiance); } } public void AddEnemies(EnemyType enemie) { if ((Object)(object)enemie != (Object)null && !enemies.ContainsKey(((Object)enemie).name) && !enemies.ContainsValue(enemie)) { enemies.Add(((Object)enemie).name, enemie); } } public void AddSprites(Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(((Object)sprite).name) && !sprites.ContainsValue(sprite)) { sprites.Add(((Object)sprite).name, sprite); } } public void AddSprites(string name, Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(name) && !sprites.ContainsValue(sprite)) { sprites.Add(name, sprite); } } } public class ChatMessageProcessor { public static bool ProcessMessage(string message) { if (Regex.IsMatch(message, "^\\[sync\\].*\\[sync\\]$")) { try { string value = Regex.Match(message, "^\\[sync\\](.*)\\[sync\\]$").Groups[1].Value; string[] array = value.Split(new char[1] { '|' }); if (array.Length == 3) { NetworkPacketManager.packetType packetType = (NetworkPacketManager.packetType)int.Parse(array[0]); string[] array2 = array[1].Split(new char[1] { '>' }); ulong num = ulong.Parse(array2[0]); long num2 = long.Parse(array2[1]); string[] array3 = array[2].Split(new char[1] { '=' }); string header = array3[0]; string packet = array3[1]; if (num2 == -1 || num2 == (long)((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId) { if (num != 0) { NetworkPacketManager.Instance.CancelTimeout((long)num); } LethalExpansion.Log.LogInfo((object)message); switch (packetType) { case NetworkPacketManager.packetType.request: ProcessRequest(num, header, packet); break; case NetworkPacketManager.packetType.data: ProcessData(num, header, packet); break; case NetworkPacketManager.packetType.other: LethalExpansion.Log.LogInfo((object)"Unsupported type."); break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized type."); break; } } } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); return false; } } return false; } private static void ProcessRequest(ulong sender, string header, string packet) { try { switch (header) { case "clientinfo": { if (LethalExpansion.ishost || sender != 0) { break; } string text2 = LethalExpansion.ModVersion.ToString() + "-"; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text2 = text2 + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } text2 = text2.Remove(text2.Length - 1); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "clientinfo", text2, 0L); break; } case "hostconfig": if (LethalExpansion.ishost && sender != 0) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "clientinfo", string.Empty, (long)sender); } break; case "hostweathers": if (LethalExpansion.ishost && sender != 0L && LethalExpansion.weathersReadyToShare) { string text = string.Empty; int[] currentWeathers = StartOfRound_Patch.currentWeathers; foreach (int num in currentWeathers) { text = text + num + "&"; } text = text.Remove(text.Length - 1); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostweathers", text, (long)sender, waitForAnswer: false); } break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized command."); break; } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); } } private static void ProcessData(ulong sender, string header, string packet) { //IL_04f6: Unknown result type (might be due to invalid IL or missing references) try { switch (header) { case "clientinfo": { if (!LethalExpansion.ishost || sender == 0) { break; } string[] array = ((!Enumerable.Contains(packet, '-')) ? new string[1] { packet } : packet.Split(new char[1] { '-' })); string text = string.Empty; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text = text + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } if (text.Length > 0) { text = text.Remove(text.Length - 1); } if (array[0] != LethalExpansion.ModVersion.ToString()) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong version."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong version.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } if (array.Length > 1 && array[1] != text) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong bundles."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong bundles.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } string text2 = string.Empty; foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { switch (item.type.Name) { case "Int32": text2 = text2 + "i" + ((int)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Single": text2 = text2 + "f" + ((float)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Boolean": text2 = text2 + "b" + (bool)item.Value; break; case "String": text2 = text2 + "s" + item; break; } text2 += "&"; } text2 = text2.Remove(text2.Length - 1); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostconfig", text2, (long)sender); break; } case "hostconfig": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array2 = packet.Split(new char[1] { '&' }); LethalExpansion.Log.LogInfo((object)("Received host config: " + packet)); for (int i = 0; i < array2.Length; i++) { if (i < ConfigManager.Instance.GetCount() && ConfigManager.Instance.MustBeSync(i)) { ConfigManager.Instance.SetItemValue(i, array2[i].Substring(1), array2[i][0]); } } LethalExpansion.hostDataWaiting = false; LethalExpansion.Log.LogInfo((object)"Updated config"); break; } case "hostweathers": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array3 = packet.Split(new char[1] { '&' }); LethalExpansion.Log.LogInfo((object)("Received host weathers: " + packet)); StartOfRound_Patch.currentWeathers = new int[array3.Length]; for (int j = 0; j < array3.Length; j++) { int result = 0; if (int.TryParse(array3[j], out result)) { StartOfRound_Patch.currentWeathers[j] = result; StartOfRound.Instance.levels[j].currentWeather = (LevelWeatherType)result; } } break; } case "kickreason": if (!LethalExpansion.ishost && sender == 0) { LethalExpansion.lastKickReason = packet; } break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized property."); break; } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); } } } public class ComponentWhitelists { public static List<Type> moonPrefabWhitelist = new List<Type> { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkinnedMeshRenderer), typeof(MeshCollider), typeof(BoxCollider), typeof(SphereCollider), typeof(CapsuleCollider), typeof(SphereCollider), typeof(TerrainCollider), typeof(WheelCollider), typeof(ArticulationBody), typeof(ConstantForce), typeof(ConfigurableJoint), typeof(FixedJoint), typeof(HingeJoint), typeof(Cloth), typeof(Rigidbody), typeof(NetworkObject), typeof(NetworkRigidbody), typeof(NetworkTransform), typeof(NetworkAnimator), typeof(Animator), typeof(Animation), typeof(Terrain), typeof(Tree), typeof(WindZone), typeof(DecalProjector), typeof(LODGroup), typeof(Light), typeof(HDAdditionalLightData), typeof(LightProbeGroup), typeof(LightProbeProxyVolume), typeof(LocalVolumetricFog), typeof(OcclusionArea), typeof(OcclusionPortal), typeof(ReflectionProbe), typeof(PlanarReflectionProbe), typeof(HDAdditionalReflectionData), typeof(Skybox), typeof(SortingGroup), typeof(SpriteRenderer), typeof(Volume), typeof(AudioSource), typeof(AudioReverbZone), typeof(AudioReverbFilter), typeof(AudioChorusFilter), typeof(AudioDistortionFilter), typeof(AudioEchoFilter), typeof(AudioHighPassFilter), typeof(AudioLowPassFilter), typeof(AudioListener), typeof(LensFlare), typeof(TrailRenderer), typeof(LineRenderer), typeof(ParticleSystem), typeof(ParticleSystemRenderer), typeof(ParticleSystemForceField), typeof(Projector), typeof(VideoPlayer), typeof(NavMeshSurface), typeof(NavMeshModifier), typeof(NavMeshModifierVolume), typeof(NavMeshLink), typeof(NavMeshObstacle), typeof(OffMeshLink), typeof(SI_AudioReverbPresets), typeof(SI_AudioReverbTrigger), typeof(SI_DungeonGenerator), typeof(SI_MatchLocalPlayerPosition), typeof(SI_AnimatedSun), typeof(SI_EntranceTeleport), typeof(SI_ScanNode), typeof(SI_DoorLock), typeof(SI_WaterSurface), typeof(SI_Ladder), typeof(SI_ItemDropship), typeof(SI_NetworkPrefabInstancier), typeof(SI_InteractTrigger), typeof(SI_DamagePlayer), typeof(SI_SoundYDistance), typeof(SI_AudioOutputInterface), typeof(PlayerShip) }; public static List<Type> scrapWhitelist = new List<Type> { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkinnedMeshRenderer), typeof(MeshCollider), typeof(BoxCollider), typeof(SphereCollider), typeof(CapsuleCollider), typeof(SphereCollider), typeof(TerrainCollider), typeof(WheelCollider), typeof(ArticulationBody), typeof(ConstantForce), typeof(ConfigurableJoint), typeof(FixedJoint), typeof(HingeJoint), typeof(Cloth), typeof(Rigidbody), typeof(NetworkObject), typeof(NetworkRigidbody), typeof(NetworkTransform), typeof(NetworkAnimator), typeof(Animator), typeof(Animation), typeof(DecalProjector), typeof(LODGroup), typeof(Light), typeof(HDAdditionalLightData), typeof(LightProbeGroup), typeof(LightProbeProxyVolume), typeof(LocalVolumetricFog), typeof(OcclusionArea), typeof(OcclusionPortal), typeof(ReflectionProbe), typeof(PlanarReflectionProbe), typeof(HDAdditionalReflectionData), typeof(SortingGroup), typeof(SpriteRenderer), typeof(AudioSource), typeof(AudioReverbZone), typeof(AudioReverbFilter), typeof(AudioChorusFilter), typeof(AudioDistortionFilter), typeof(AudioEchoFilter), typeof(AudioHighPassFilter), typeof(AudioLowPassFilter), typeof(AudioListener), typeof(LensFlare), typeof(TrailRenderer), typeof(LineRenderer), typeof(ParticleSystem), typeof(ParticleSystemRenderer), typeof(ParticleSystemForceField), typeof(VideoPlayer) }; } public class ConfigManager { private static ConfigManager _instance; private List<ConfigItem> items = new List<ConfigItem>(); private List<ConfigEntryBase> entries = new List<ConfigEntryBase>(); public static ConfigManager Instance { get { if (_instance == null) { _instance = new ConfigManager(); } return _instance; } } public void AddItem(ConfigItem item) { try { items.Add(item); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public void ReadConfig() { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown items = (from item in items orderby item.Tab, item.Key select item).ToList(); try { for (int i = 0; i < items.Count; i++) { if (!items[i].Hidden) { string description = items[i].Description; description = description + "\nNetwork synchronization: " + (items[i].Sync ? "Yes" : "No"); description = description + "\nMod required by clients: " + (items[i].Optional ? "No" : "Yes"); switch (items[i].type.Name) { case "Int32": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<int>(items[i].Tab, items[i].Key, (int)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>((int)items[i].MinValue, (int)items[i].MaxValue), Array.Empty<object>()))); break; case "Single": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<float>(items[i].Tab, items[i].Key, (float)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>((float)items[i].MinValue, (float)items[i].MaxValue), Array.Empty<object>()))); break; case "Boolean": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<bool>(items[i].Tab, items[i].Key, (bool)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; case "String": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<string>(items[i].Tab, items[i].Key, (string)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; } if (!items[i].Sync) { items[i].Value = entries.Last().BoxedValue; } } else { entries.Add(null); } } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public object FindItemValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindItemValue(int index) { try { return items[index].Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(string key) { try { return entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(int index) { try { return entries[index].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool RequireRestart(string key) { try { return items.First((ConfigItem item) => item.Key == key).RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool RequireRestart(int index) { try { return items[index].RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public string FindDescription(string key) { try { return items.First((ConfigItem item) => item.Key == key).Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public string FindDescription(int index) { try { return items[index].Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public (bool, bool) FindNetInfo(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); return (configItem.Sync, configItem.Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public (bool, bool) FindNetInfo(int index) { try { return (items[index].Sync, items[index].Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public object FindDefaultValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindDefaultValue(int index) { try { return items[index].DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool MustBeSync(string key) { try { return items.First((ConfigItem item) => item.Key == key).Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool MustBeSync(int index) { try { return items[index].Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool SetItemValue(string key, object value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!items.First((ConfigItem item) => item.Key == key).RequireRestart) { try { configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(string key, object value) { try { entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue(int index, string value, char type) { if (!items[index].RequireRestart) { try { switch (type) { case 'i': items[index].Value = int.Parse(value, CultureInfo.InvariantCulture); break; case 'f': items[index].Value = float.Parse(value, CultureInfo.InvariantCulture); break; case 'b': items[index].Value = bool.Parse(value); break; case 's': items[index].Value = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(int index, string value, char type) { try { switch (type) { case 'i': entries[index].BoxedValue = int.Parse(value); break; case 'f': entries[index].BoxedValue = float.Parse(value); break; case 'b': entries[index].BoxedValue = bool.Parse(value); break; case 's': entries[index].BoxedValue = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (object, int) FindValueAndIndex(string key) { try { return (items.First((ConfigItem item) => item.Key == key).Value, items.FindIndex((ConfigItem item) => item.Key == key)); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (null, -1); } } public int FindIndex(string key) { try { return items.FindIndex((ConfigItem item) => item.Key == key); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public T FindItemValue<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindItemValue<T>(int index) { try { ConfigItem configItem = items[index]; if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(string key) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(int index) { try { ConfigEntryBase val = entries[index]; if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool SetItemValue<T>(string key, T value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!configItem.RequireRestart) { try { if (configItem == null || !(configItem.Value is T)) { LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(string key, T value) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { val.BoxedValue = value; return true; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue<T>(int index, T value) { if (!items[index].RequireRestart) { try { items[index].Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(int index, T value) { try { entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (T, int) FindValueAndIndex<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return ((T)configItem.Value, items.FindIndex((ConfigItem item) => item.Key == key)); } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (default(T), -1); } } public List<ConfigItem> GetAll() { try { return items; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public int GetCount() { try { return items.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public int GetEntriesCount() { try { return entries.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public object ReadConfigValue(string key) { try { return entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public T ReadConfigValue<T>(string key) { try { return (T)entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool WriteConfigValue(string key, object value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool WriteConfigValue<T>(string key, T value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } } public static class ModUtils { public static T[] RemoveElementFromArray<T>(T[] originalArray, int indexToRemove) { if (indexToRemove < 0 || indexToRemove >= originalArray.Length) { throw new ArgumentOutOfRangeException("indexToRemove"); } T[] array = new T[originalArray.Length - 1]; int i = 0; int num = 0; for (; i < originalArray.Length; i++) { if (i != indexToRemove) { array[num] = originalArray[i]; num++; } } return array; } } public class NetworkPacketManager { public enum packetType { request = 0, data = 1, other = -1 } private static NetworkPacketManager _instance; private ConcurrentDictionary<long, CancellationTokenSource> timeoutDictionary = new ConcurrentDictionary<long, CancellationTokenSource>(); public static NetworkPacketManager Instance { get { if (_instance == null) { _instance = new NetworkPacketManager(); } return _instance; } } private NetworkPacketManager() { } public void sendPacket(packetType type, string header, string packet, long destination = -1L, bool waitForAnswer = true) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{destination}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(destination); } } public void sendPacket(packetType type, string header, string packet, long[] destinations, bool waitForAnswer = true) { for (int i = 0; i < destinations.Length; i++) { int num = (int)destinations[i]; if (num != -1) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{num}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(num); } } } } public void StartTimeout(long id) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); if (!timeoutDictionary.TryAdd(id, cancellationTokenSource)) { return; } Task.Run(async delegate { try { await PacketTimeout(id, cancellationTokenSource.Token); } catch (OperationCanceledException) { } finally { timeoutDictionary.TryRemove(id, out var _); } }); } public void CancelTimeout(long id) { if (timeoutDictionary.TryRemove(id, out var value)) { value.Cancel(); } } private async Task PacketTimeout(long id, CancellationToken token) { await Task.Delay(5000, token); if (token.IsCancellationRequested) { } } } public class PopupManager { private static PopupManager _instance; private List<PopupObject> popups = new List<PopupObject>(); public static PopupManager Instance { get { if (_instance == null) { _instance = new PopupManager(); } return _instance; } } private PopupManager() { } public void InstantiatePopup(Scene sceneFocus, string title = "Popup", string content = "", string button1 = "Ok", string button2 = "Cancel", UnityAction button1Action = null, UnityAction button2Action = null, int titlesize = 24, int contentsize = 24, int button1size = 24, int button2size = 24) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009e: 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_0145: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown if (!((Scene)(ref sceneFocus)).isLoaded) { return; } GameObject[] rootGameObjects = ((Scene)(ref sceneFocus)).GetRootGameObjects(); Canvas val = null; GameObject[] array = rootGameObjects; foreach (GameObject val2 in array) { val = val2.GetComponentInChildren<Canvas>(); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null || ((Component)val).gameObject.scene != sceneFocus) { GameObject val3 = new GameObject(); ((Object)val3).name = "Canvas"; val = val3.AddComponent<Canvas>(); SceneManager.MoveGameObjectToScene(((Component)val).gameObject, sceneFocus); } GameObject _tmp = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/HUD/Popup.prefab"), ((Component)val).transform); if ((Object)(object)_tmp != (Object)null) { ((Component)_tmp.transform.Find("DragAndDropSurface")).gameObject.AddComponent<SettingMenu_DragAndDrop>().rectTransform = _tmp.GetComponent<RectTransform>(); ((UnityEvent)((Component)_tmp.transform.Find("CloseButton")).gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { Object.Destroy((Object)(object)_tmp); }); if (button1Action != null) { ((UnityEvent)((Component)_tmp.transform.Find("Button1")).gameObject.GetComponent<Button>().onClick).AddListener(button1Action); } if (button2Action != null) { ((UnityEvent)((Component)_tmp.transform.Find("Button2")).gameObject.GetComponent<Button>().onClick).AddListener(button2Action); } ((UnityEvent)((Component)_tmp.transform.Find("Button1")).gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { Object.Destroy((Object)(object)_tmp); }); ((UnityEvent)((Component)_tmp.transform.Find("Button2")).gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { Object.Destroy((Object)(object)_tmp); }); PopupObject popupObject = new PopupObject(_tmp, ((Component)_tmp.transform.Find("Title")).GetComponent<TMP_Text>(), ((Component)_tmp.transform.Find("Panel/MainContent")).GetComponent<TMP_Text>(), ((Component)_tmp.transform.Find("Button1/Text")).GetComponent<TMP_Text>(), ((Component)_tmp.transform.Find("Button2/Text")).GetComponent<TMP_Text>()); popupObject.title.text = title; popupObject.title.fontSize = titlesize; popupObject.content.text = content; popupObject.content.fontSize = contentsize; popupObject.button1.text = button1; popupObject.button1.fontSize = button1size; popupObject.button2.text = button2; popupObject.button2.fontSize = button2size; popups.Add(popupObject); } } } public class PopupObject { public GameObject baseObject; public TMP_Text title; public TMP_Text content; public TMP_Text button1; public TMP_Text button2; public PopupObject(GameObject baseObject, TMP_Text title, TMP_Text content, TMP_Text button1, TMP_Text button2) { this.baseObject = baseObject; this.title = title; this.content = content; this.button1 = button1; this.button2 = button2; } } public class VersionChecker { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__1_0; internal void <CompareVersions>b__1_0() { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalExpansion/"); } } public static async Task CheckVersion() { HttpClient httpClient = new HttpClient(); try { CompareVersions(await httpClient.GetStringAsync("https://raw.githubusercontent.com/HolographicWings/LethalExpansion/main/last.txt")); } catch (HttpRequestException val) { HttpRequestException val2 = val; HttpRequestException ex = val2; LethalExpansion.Log.LogError((object)((Exception)(object)ex).Message); } finally { ((IDisposable)httpClient)?.Dispose(); } } private static void CompareVersions(string onlineVersion) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if (!(LethalExpansion.ModVersion < Version.Parse(onlineVersion))) { return; } PopupManager instance = PopupManager.Instance; Scene sceneByName = SceneManager.GetSceneByName("MainMenu"); string content = "Lethal Expansion is not up to date " + onlineVersion; object obj = <>c.<>9__1_0; if (obj == null) { UnityAction val = delegate { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalExpansion/"); }; <>c.<>9__1_0 = val; obj = (object)val; } instance.InstantiatePopup(sceneByName, "Update", content, "Update", "Ignore", (UnityAction)obj); } } } namespace LethalExpansion.Utils.HUD { public class SettingMenu_DragAndDrop : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { public UnityEvent onBeginDragEvent; public UnityEvent onDragEvent; public UnityEvent onEndDragEvent; public RectTransform rectTransform; private Canvas canvas; private void Awake() { if ((Object)(object)rectTransform == (Object)null) { rectTransform = ((Component)this).GetComponent<RectTransform>(); } canvas = Object.FindFirstObjectByType<Canvas>(); } public void OnBeginDrag(PointerEventData eventData) { if (onBeginDragEvent != null) { onBeginDragEvent.Invoke(); } } public void OnDrag(PointerEventData eventData) { //IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (eventData != null && (Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = ClampToWindow(rectTransform.anchoredPosition + eventData.delta / canvas.scaleFactor); if (onDragEvent != null) { onDragEvent.Invoke(); } } } public void OnEndDrag(PointerEventData eventData) { if (onEndDragEvent != null) { onEndDragEvent.Invoke(); } } private Vector2 ClampToWindow(Vector2 position) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[4]; float num = -260f; float num2 = 260f; float num3 = -60f; float num4 = 50f; float num5 = Mathf.Clamp(position.x, num, num2); float num6 = Mathf.Clamp(position.y, num3, num4); return new Vector2(num5, num6); } } public class SettingsMenu { private static SettingsMenu _instance; private bool initialized = false; private List<HUDSettingEntry> entries = new List<HUDSettingEntry>(); public static SettingsMenu Instance { get { if (_instance == null) { _instance = new SettingsMenu(); } return _instance; } } private SettingsMenu() { } public void InitSettingsMenu() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_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_0183: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Expected O, but got Unknown //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Expected O, but got Unknown //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Expected O, but got Unknown //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Expected O, but got Unknown //IL_0965: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Expected O, but got Unknown entries = new List<HUDSettingEntry>(); GameObject val = GameObject.Find("Canvas/MenuContainer"); if ((Object)(object)val == (Object)null) { LethalExpansion.Log.LogError((object)"MenuContainer not found in the scene!"); return; } RectTransform component = ((Component)val.transform.Find("MainButtons/HostButton")).GetComponent<RectTransform>(); component.anchoredPosition += new Vector2(0f, 38.5f); RectTransform component2 = ((Component)val.transform.Find("MainButtons/JoinACrew")).GetComponent<RectTransform>(); component2.anchoredPosition += new Vector2(0f, 38.5f); RectTransform component3 = ((Component)val.transform.Find("MainButtons/StartLAN")).GetComponent<RectTransform>(); component3.anchoredPosition += new Vector2(0f, 38.5f); GameObject gameObject = ((Component)val.transform.Find("MainButtons/SettingsButton")).gameObject; RectTransform component4 = gameObject.GetComponent<RectTransform>(); component4.anchoredPosition += new Vector2(0f, 38.5f); GameObject val2 = Object.Instantiate<GameObject>(gameObject, val.transform); val2.transform.SetParent(val.transform.Find("MainButtons")); ((Object)val2).name = "ModSettingsButton"; ((Component)val2.transform.Find("Text (TMP)")).GetComponent<TMP_Text>().text = "> Mod Settings"; val2.GetComponent<RectTransform>().anchoredPosition = gameObject.GetComponent<RectTransform>().anchoredPosition - new Vector2(0f, 38.5f); GameObject ModSettingsPanel = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/HUD/Settings/ModSettings.prefab")); GameObject val3 = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/HUD/Settings/SettingEntry.prefab"); GameObject val4 = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/HUD/Settings/SettingCategory.prefab"); ModSettingsPanel.transform.SetParent(val.transform); ModSettingsPanel.transform.localPosition = Vector3.zero; ModSettingsPanel.transform.localScale = Vector3.one; Button component5 = val2.GetComponent<Button>(); component5.onClick = new ButtonClickedEvent(); ((UnityEvent)component5.onClick).AddListener((UnityAction)delegate { ModSettingsPanel.SetActive(true); GetSettings(); }); SettingMenu_DragAndDrop settingMenu_DragAndDrop = ((Component)ModSettingsPanel.transform.Find("DragAndDropSurface")).gameObject.AddComponent<SettingMenu_DragAndDrop>(); settingMenu_DragAndDrop.rectTransform = ModSettingsPanel.GetComponent<RectTransform>(); Button component6 = ((Component)ModSettingsPanel.transform.Find("CloseButton")).GetComponent<Button>(); Button component7 = ((Component)ModSettingsPanel.transform.Find("ApplyButton")).GetComponent<Button>(); Button component8 = ((Component)ModSettingsPanel.transform.Find("CancelButton")).GetComponent<Button>(); ((UnityEvent)component6.onClick).AddListener((UnityAction)delegate { ModSettingsPanel.SetActive(false); }); ((UnityEvent)component7.onClick).AddListener((UnityAction)delegate { ApplySettings(); ModSettingsPanel.SetActive(false); }); ((UnityEvent)component8.onClick).AddListener((UnityAction)delegate { ModSettingsPanel.SetActive(false); }); GameObject gameObject2 = ((Component)ModSettingsPanel.transform.Find("Scroll View/Viewport/ModSettingsContent")).gameObject; Button component9 = ((Component)gameObject2.transform.Find("AllDefaultButton")).GetComponent<Button>(); ((UnityEvent)component9.onClick).AddListener((UnityAction)delegate { ResetAllSettings(); }); RectTransform component10 = gameObject2.GetComponent<RectTransform>(); GameObject gameObject3 = ((Component)gameObject2.transform.Find("TooltipPanel")).gameObject; TooltipHandler.ModSettingsToolTipPanel = gameObject3.GetComponent<RectTransform>(); TooltipHandler.ModSettingsToolTipPanelDescription = ((Component)gameObject3.transform.Find("Description")).GetComponent<TMP_Text>(); TooltipHandler.ModSettingsToolTipPanelNetInfo = ((Component)gameObject3.transform.Find("NetInfo")).GetComponent<TMP_Text>(); int num = -15; string text = string.Empty; foreach
LethalSDK.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using DunGen; using DunGen.Adapters; using GameNetcodeStuff; using LethalSDK.Component; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using Unity.Netcode; using UnityEditor; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; 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("LethalSDK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalSDK")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4d234a4d-c807-438a-b717-4c6d77706054")] [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")] public class AssetModificationProcessor : AssetPostprocessor { private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string assetPath in importedAssets) { ProcessAsset(assetPath); } foreach (string assetPath2 in movedAssets) { ProcessAsset(assetPath2); } } private static void ProcessAsset(string assetPath) { if (assetPath.Contains("NavMesh-Environment")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? (SelectionLogger.name + "NavMesh") : "New NavMesh"); } if (assetPath.Contains("New Terrain")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? SelectionLogger.name : "New Terrain"); } if (assetPath.ToLower().StartsWith("assets/mods/") && assetPath.Split(new char[1] { '/' }).Length > 3 && !assetPath.ToLower().EndsWith(".unity") && !assetPath.ToLower().Contains("/scenes")) { AssetImporter atPath = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath != (Object)null) { string text2 = (atPath.assetBundleName = ExtractBundleNameFromPath(assetPath)); atPath.assetBundleVariant = "lem"; Debug.Log((object)(assetPath + " asset moved to " + text2 + " asset bundle.")); } if (assetPath != "Assets/Mods/" + assetPath.ToLower().Replace("assets/mods/", string.Empty).RemoveNonAlphanumeric(4)) { AssetDatabase.MoveAsset(assetPath, "Assets/Mods/" + assetPath.ToLower().Replace("assets/mods/", string.Empty).RemoveNonAlphanumeric(4)); } } else { AssetImporter atPath2 = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath2 != (Object)null) { atPath2.assetBundleName = null; Debug.Log((object)(assetPath + " asset removed from asset bundle.")); } } } public static string ExtractBundleNameFromPath(string path) { string[] array = path.Split(new char[1] { '/' }); if (array.Length > 3) { return array[2].ToLower(); } return ""; } } [InitializeOnLoad] public class SelectionLogger { public static string name; static SelectionLogger() { Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged)); } private static void OnSelectionChanged() { if ((Object)(object)Selection.activeGameObject != (Object)null) { name = ((Object)GetRootParent(Selection.activeGameObject)).name; } else { name = string.Empty; } } public static GameObject GetRootParent(GameObject obj) { if ((Object)(object)obj != (Object)null && (Object)(object)obj.transform.parent != (Object)null) { return GetRootParent(((Component)obj.transform.parent).gameObject); } return obj; } } [InitializeOnLoad] public class AssetBundleVariantAssigner { static AssetBundleVariantAssigner() { AssignVariantToAssetBundles(); } [InitializeOnLoadMethod] private static void AssignVariantToAssetBundles() { string[] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames(); string[] array = allAssetBundleNames; foreach (string text in array) { if (!text.Contains(".")) { string[] assetPathsFromAssetBundle = AssetDatabase.GetAssetPathsFromAssetBundle(text); string[] array2 = assetPathsFromAssetBundle; foreach (string text2 in array2) { AssetImporter.GetAtPath(text2).SetAssetBundleNameAndVariant(text, "lem"); } Debug.Log((object)("File extention added to AssetBundle: " + text)); } } AssetDatabase.SaveAssets(); string text3 = "Assets/AssetBundles"; if (!Directory.Exists(text3)) { Debug.LogError((object)("Le dossier n'existe pas : " + text3)); return; } string[] files = Directory.GetFiles(text3); string[] array3 = files; foreach (string text4 in array3) { if (Path.GetExtension(text4) == "" && Path.GetFileName(text4) != "AssetBundles") { string path = text4 + ".meta"; string text5 = text4 + ".manifest"; string path2 = text5 + ".meta"; File.Delete(text4); if (File.Exists(path)) { File.Delete(path); } if (File.Exists(text5)) { File.Delete(text5); } if (File.Exists(path2)) { File.Delete(path2); } Debug.Log((object)("Fichier supprimé : " + text4)); } } AssetDatabase.Refresh(); } } public class CubemapTextureBuilder : EditorWindow { private Texture2D[] textures = (Texture2D[])(object)new Texture2D[6]; private string[] labels = new string[6] { "Right", "Left", "Top", "Bottom", "Front", "Back" }; private TextureFormat[] HDRFormats; private Vector2Int[] placementRects; [MenuItem("LethalSDK/Cubemap Builder", false, 100)] public static void OpenWindow() { EditorWindow.GetWindow<CubemapTextureBuilder>(); } private Texture2D UpscaleTexture(Texture2D original, int targetWidth, int targetHeight) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(targetWidth, targetHeight)); Graphics.Blit((Texture)(object)original, val); Texture2D val2 = new Texture2D(targetWidth, targetHeight); val2.ReadPixels(new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), 0, 0); val2.Apply(); RenderTexture.ReleaseTemporary(val); return val2; } private void OnGUI() { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown for (int i = 0; i < 6; i++) { ref Texture2D reference = ref textures[i]; Object obj = EditorGUILayout.ObjectField(labels[i], (Object)(object)textures[i], typeof(Texture2D), false, Array.Empty<GUILayoutOption>()); reference = (Texture2D)(object)((obj is Texture2D) ? obj : null); } if (!GUILayout.Button("Build Cubemap", Array.Empty<GUILayoutOption>())) { return; } if (textures.Any((Texture2D t) => (Object)(object)t == (Object)null)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok"); return; } int size = ((Texture)textures[0]).width; if (textures.Any((Texture2D t) => ((Texture)t).width != size || ((Texture)t).height != size)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok"); return; } bool flag = HDRFormats.Any((TextureFormat f) => f == textures[0].format); string[] array = textures.Select((Texture2D t) => AssetDatabase.GetAssetPath((Object)(object)t)).ToArray(); string text = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(array[0]), "Cubemap", flag ? "exr" : "png"); if (!string.IsNullOrEmpty(text)) { bool[] array2 = textures.Select((Texture2D t) => ((Texture)t).isReadable).ToArray(); TextureImporter[] array3 = array.Select(delegate(string p) { AssetImporter atPath2 = AssetImporter.GetAtPath(p); return (TextureImporter)(object)((atPath2 is TextureImporter) ? atPath2 : null); }).ToArray(); TextureImporter[] array4 = array3; foreach (TextureImporter val in array4) { val.isReadable = true; } AssetDatabase.Refresh(); string[] array5 = array; foreach (string text2 in array5) { AssetDatabase.ImportAsset(text2); } Texture2D val2 = new Texture2D(size * 4, size * 3, (TextureFormat)(flag ? 20 : 4), false); for (int l = 0; l < 6; l++) { val2.SetPixels(((Vector2Int)(ref placementRects[l])).x * size, ((Vector2Int)(ref placementRects[l])).y * size, size, size, textures[l].GetPixels(0)); } val2.Apply(false); byte[] bytes = (flag ? ImageConversion.EncodeToEXR(val2) : ImageConversion.EncodeToPNG(val2)); File.WriteAllBytes(text, bytes); Object.Destroy((Object)(object)val2); for (int m = 0; m < 6; m++) { array3[m].isReadable = array2[m]; } text = text.Remove(0, Application.dataPath.Length - 6); AssetDatabase.ImportAsset(text); AssetImporter atPath = AssetImporter.GetAtPath(text); TextureImporter val3 = (TextureImporter)(object)((atPath is TextureImporter) ? atPath : null); val3.textureShape = (TextureImporterShape)2; val3.sRGBTexture = false; val3.generateCubemap = (TextureImporterGenerateCubemap)5; string[] array6 = array; foreach (string text3 in array6) { AssetDatabase.ImportAsset(text3); } AssetDatabase.ImportAsset(text); AssetDatabase.Refresh(); } } public CubemapTextureBuilder() { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) TextureFormat[] array = new TextureFormat[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); HDRFormats = (TextureFormat[])(object)array; placementRects = (Vector2Int[])(object)new Vector2Int[6] { new Vector2Int(2, 1), new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(1, 0), new Vector2Int(1, 1), new Vector2Int(3, 1) }; ((EditorWindow)this)..ctor(); } } public class PlayerShip : MonoBehaviour { public readonly Vector3 shipPosition = new Vector3(-17.5f, 5.75f, -16.55f); private void Start() { Object.Destroy((Object)(object)this); } } [CustomEditor(typeof(PlayerShip))] public class PlayerShipEditor : Editor { public override void OnInspectorGUI() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) ((Editor)this).OnInspectorGUI(); PlayerShip playerShip = (PlayerShip)(object)((Editor)this).target; if (((Component)playerShip).transform.position != playerShip.shipPosition) { ((Component)playerShip).transform.position = playerShip.shipPosition; } } } namespace LethalSDK.ScriptableObjects { [CreateAssetMenu(fileName = "AssetBank", menuName = "LethalSDK/Asset Bank")] public class AssetBank : ScriptableObject { [Header("Audio Clips")] [SerializeField] private AudioClipInfoPair[] _audioClips = new AudioClipInfoPair[0]; [SerializeField] private PlanetPrefabInfoPair[] _planetPrefabs = new PlanetPrefabInfoPair[0]; [SerializeField] private PrefabInfoPair[] _networkPrefabs = new PrefabInfoPair[0]; [HideInInspector] public string serializedAudioClips; [HideInInspector] public string serializedPlanetPrefabs; [HideInInspector] public string serializedNetworkPrefabs; private void OnValidate() { for (int i = 0; i < _audioClips.Length; i++) { _audioClips[i].AudioClipName = _audioClips[i].AudioClipName.RemoveNonAlphanumeric(1); _audioClips[i].AudioClipPath = _audioClips[i].AudioClipPath.RemoveNonAlphanumeric(4); } for (int j = 0; j < _planetPrefabs.Length; j++) { _planetPrefabs[j].PlanetPrefabName = _planetPrefabs[j].PlanetPrefabName.RemoveNonAlphanumeric(1); _planetPrefabs[j].PlanetPrefabPath = _planetPrefabs[j].PlanetPrefabPath.RemoveNonAlphanumeric(4); } for (int k = 0; k < _networkPrefabs.Length; k++) { _networkPrefabs[k].PrefabName = _networkPrefabs[k].PrefabName.RemoveNonAlphanumeric(1); _networkPrefabs[k].PrefabPath = _networkPrefabs[k].PrefabPath.RemoveNonAlphanumeric(4); } serializedAudioClips = string.Join(";", _audioClips.Select((AudioClipInfoPair p) => ((p.AudioClipName.Length != 0) ? p.AudioClipName : (((Object)(object)p.AudioClip != (Object)null) ? ((Object)p.AudioClip).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.AudioClip))); serializedPlanetPrefabs = string.Join(";", _planetPrefabs.Select((PlanetPrefabInfoPair p) => ((p.PlanetPrefabName.Length != 0) ? p.PlanetPrefabName : (((Object)(object)p.PlanetPrefab != (Object)null) ? ((Object)p.PlanetPrefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.PlanetPrefab))); serializedNetworkPrefabs = string.Join(";", _networkPrefabs.Select((PrefabInfoPair p) => ((p.PrefabName.Length != 0) ? p.PrefabName : (((Object)(object)p.Prefab != (Object)null) ? ((Object)p.Prefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.Prefab))); } public AudioClipInfoPair[] AudioClips() { if (serializedAudioClips != null) { return (from s in serializedAudioClips.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new AudioClipInfoPair(split[0], split[1])).ToArray(); } return new AudioClipInfoPair[0]; } public bool HaveAudioClip(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().Any((AudioClipInfoPair a) => a.AudioClipName == audioClipName); } return false; } public string AudioClipPath(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().First((AudioClipInfoPair c) => c.AudioClipName == audioClipName).AudioClipPath; } return string.Empty; } public Dictionary<string, string> AudioClipsDictionary() { if (serializedAudioClips != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); AudioClipInfoPair[] audioClips = _audioClips; for (int i = 0; i < audioClips.Length; i++) { AudioClipInfoPair audioClipInfoPair = audioClips[i]; dictionary.Add(audioClipInfoPair.AudioClipName, audioClipInfoPair.AudioClipPath); } return dictionary; } return new Dictionary<string, string>(); } public PlanetPrefabInfoPair[] PlanetPrefabs() { if (serializedPlanetPrefabs != null) { return (from s in serializedPlanetPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PlanetPrefabInfoPair(split[0], split[1])).ToArray(); } return new PlanetPrefabInfoPair[0]; } public bool HavePlanetPrefabs(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().Any((PlanetPrefabInfoPair a) => a.PlanetPrefabName == planetPrefabName); } return false; } public string PlanetPrefabsPath(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().First((PlanetPrefabInfoPair c) => c.PlanetPrefabName == planetPrefabName).PlanetPrefabPath; } return string.Empty; } public Dictionary<string, string> PlanetPrefabsDictionary() { if (serializedPlanetPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PlanetPrefabInfoPair[] planetPrefabs = _planetPrefabs; for (int i = 0; i < planetPrefabs.Length; i++) { PlanetPrefabInfoPair planetPrefabInfoPair = planetPrefabs[i]; dictionary.Add(planetPrefabInfoPair.PlanetPrefabName, planetPrefabInfoPair.PlanetPrefabPath); } return dictionary; } return new Dictionary<string, string>(); } public PrefabInfoPair[] NetworkPrefabs() { if (serializedNetworkPrefabs != null) { return (from s in serializedNetworkPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PrefabInfoPair(split[0], split[1])).ToArray(); } return new PrefabInfoPair[0]; } public bool HaveNetworkPrefabs(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().Any((PrefabInfoPair a) => a.PrefabName == networkPrefabName); } return false; } public string NetworkPrefabsPath(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().First((PrefabInfoPair c) => c.PrefabName == networkPrefabName).PrefabPath; } return string.Empty; } public Dictionary<string, string> NetworkPrefabsDictionary() { if (serializedNetworkPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PrefabInfoPair[] networkPrefabs = _networkPrefabs; for (int i = 0; i < networkPrefabs.Length; i++) { PrefabInfoPair prefabInfoPair = networkPrefabs[i]; dictionary.Add(prefabInfoPair.PrefabName, prefabInfoPair.PrefabPath); } return dictionary; } return new Dictionary<string, string>(); } } [CreateAssetMenu(fileName = "ModManifest", menuName = "LethalSDK/Mod Manifest")] public class ModManifest : ScriptableObject { public string modName = "New Mod"; [Space] [SerializeField] private SerializableVersion version = new SerializableVersion(0, 0, 0, 0); [HideInInspector] public string serializedVersion; [Space] public string author = "Author"; [Space] [TextArea(5, 15)] public string description = "Mod Description"; [Space] [Header("Content")] public Scrap[] scraps = new Scrap[0]; public Moon[] moons = new Moon[0]; [Space] public AssetBank assetBank; private void OnValidate() { serializedVersion = version.ToString(); } public SerializableVersion GetVersion() { int[] array = ((serializedVersion != null) ? serializedVersion.Split(new char[1] { '.' }).Select(int.Parse).ToArray() : new int[4]); return new SerializableVersion(array[0], array[1], array[2], array[3]); } } [CreateAssetMenu(fileName = "New Moon", menuName = "LethalSDK/Moon")] public class Moon : ScriptableObject { public string MoonName = "NewMoon"; public string[] RequiredBundles; public string[] IncompatibleBundles; public bool IsEnabled = true; public bool IsHidden = false; public bool IsLocked = false; [Header("Info")] public string OrbitPrefabName = "Moon1"; public bool SpawnEnemiesAndScrap = true; public string PlanetName = "New Moon"; public GameObject MainPrefab; [TextArea(5, 15)] public string PlanetDescription; public VideoClip PlanetVideo; public string RiskLevel = "X"; [Range(0f, 16f)] public float TimeToArrive = 1f; [Header("Time")] [Range(0.1f, 5f)] public float DaySpeedMultiplier = 1f; public bool PlanetHasTime = true; [SerializeField] private RandomWeatherPair[] _RandomWeatherTypes = new RandomWeatherPair[6] { new RandomWeatherPair(LevelWeatherType.None, 0, 0), new RandomWeatherPair(LevelWeatherType.Rainy, 0, 0), new RandomWeatherPair(LevelWeatherType.Stormy, 1, 0), new RandomWeatherPair(LevelWeatherType.Foggy, 1, 0), new RandomWeatherPair(LevelWeatherType.Flooded, -4, 5), new RandomWeatherPair(LevelWeatherType.Eclipsed, 1, 0) }; public bool OverwriteWeather = false; public LevelWeatherType OverwriteWeatherType = LevelWeatherType.None; [Header("Route")] public string RouteWord = "newmoon"; public int RoutePrice; public string BoughtComment = "Please enjoy your flight."; [Header("Dungeon")] [Range(1f, 5f)] public float FactorySizeMultiplier = 1f; public int FireExitsAmountOverwrite = 1; [SerializeField] private DungeonFlowPair[] _DungeonFlowTypes = new DungeonFlowPair[2] { new DungeonFlowPair(0, 300), new DungeonFlowPair(1, 1) }; [SerializeField] private SpawnableScrapPair[] _SpawnableScrap = new SpawnableScrapPair[19] { new SpawnableScrapPair("Cog1", 80), new SpawnableScrapPair("EnginePart1", 90), new SpawnableScrapPair("FishTestProp", 12), new SpawnableScrapPair("MetalSheet", 88), new SpawnableScrapPair("FlashLaserPointer", 4), new SpawnableScrapPair("BigBolt", 80), new SpawnableScrapPair("BottleBin", 19), new SpawnableScrapPair("Ring", 3), new SpawnableScrapPair("SteeringWheel", 32), new SpawnableScrapPair("MoldPan", 5), new SpawnableScrapPair("EggBeater", 10), new SpawnableScrapPair("PickleJar", 10), new SpawnableScrapPair("DustPan", 32), new SpawnableScrapPair("Airhorn", 3), new SpawnableScrapPair("ClownHorn", 3), new SpawnableScrapPair("CashRegister", 3), new SpawnableScrapPair("Candy", 2), new SpawnableScrapPair("GoldBar", 1), new SpawnableScrapPair("YieldSign", 6) }; [Range(0f, 100f)] public int MinScrap = 8; [Range(0f, 100f)] public int MaxScrap = 12; public string LevelAmbienceClips = "Level1TypeAmbience"; [Range(0f, 30f)] public int MaxEnemyPowerCount = 4; [SerializeField] private SpawnableEnemiesPair[] _Enemies = new SpawnableEnemiesPair[8] { new SpawnableEnemiesPair("Centipede", 51), new SpawnableEnemiesPair("SandSpider", 58), new SpawnableEnemiesPair("HoarderBug", 28), new SpawnableEnemiesPair("Flowerman", 13), new SpawnableEnemiesPair("Crawler", 16), new SpawnableEnemiesPair("Blob", 31), new SpawnableEnemiesPair("DressGirl", 1), new SpawnableEnemiesPair("Puffer", 28) }; public AnimationCurve EnemySpawnChanceThroughoutDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0015411376953125,\"value\":-3.0,\"inSlope\":19.556997299194337,\"outSlope\":19.556997299194337,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.12297855317592621},{\"serializedVersion\":\"3\",\"time\":0.4575331211090088,\"value\":4.796203136444092,\"inSlope\":24.479534149169923,\"outSlope\":24.479534149169923,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.396077424287796,\"outWeight\":0.35472238063812258},{\"serializedVersion\":\"3\",\"time\":0.7593884468078613,\"value\":4.973001480102539,\"inSlope\":2.6163148880004885,\"outSlope\":2.6163148880004885,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2901076376438141,\"outWeight\":0.5360636115074158},{\"serializedVersion\":\"3\",\"time\":1.0,\"value\":15.0,\"inSlope\":35.604026794433597,\"outSlope\":35.604026794433597,\"tangentMode\":0,\"weightedMode\":1,\"inWeight\":0.04912583902478218,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float SpawnProbabilityRange = 4f; [Header("Outside")] [SerializeField] private SpawnableMapObjectPair[] _SpawnableMapObjects = new SpawnableMapObjectPair[2] { new SpawnableMapObjectPair("Landmine", spawnFacingAwayFromWall: false, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-0.003082275390625,\"value\":0.0,\"inSlope\":0.23179344832897187,\"outSlope\":0.23179344832897187,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27936428785324099},{\"serializedVersion\":\"3\",\"time\":0.8171924352645874,\"value\":1.7483322620391846,\"inSlope\":7.064207077026367,\"outSlope\":7.064207077026367,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2631833553314209,\"outWeight\":0.6898177862167358},{\"serializedVersion\":\"3\",\"time\":1.0002186298370362,\"value\":11.760997772216797,\"inSlope\":968.80810546875,\"outSlope\":968.80810546875,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.029036391526460649,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableMapObjectPair("TurretContainer", spawnFacingAwayFromWall: true, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.354617178440094,\"outSlope\":0.354617178440094,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9190289974212647,\"value\":1.0005745887756348,\"inSlope\":Infinity,\"outSlope\":1.7338485717773438,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.6534967422485352},{\"serializedVersion\":\"3\",\"time\":1.0038425922393799,\"value\":7.198680877685547,\"inSlope\":529.4945068359375,\"outSlope\":529.4945068359375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.14589552581310273,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [SerializeField] private SpawnableOutsideObjectPair[] _SpawnableOutsideObjects = new SpawnableOutsideObjectPair[7] { new SpawnableOutsideObjectPair("LargeRock1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7571572661399841,\"value\":0.6448163986206055,\"inSlope\":2.974250078201294,\"outSlope\":2.974250078201294,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995536804199219,\"value\":5.883961200714111,\"inSlope\":65.30631256103516,\"outSlope\":65.30631256103516,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.12097536772489548,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock2", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7562879920005798,\"value\":1.2308543920516968,\"inSlope\":5.111926555633545,\"outSlope\":5.111926555633545,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.21955738961696626},{\"serializedVersion\":\"3\",\"time\":1.0010795593261719,\"value\":7.59307336807251,\"inSlope\":92.0470199584961,\"outSlope\":92.0470199584961,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.05033162236213684,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock3", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9964686632156372,\"value\":2.0009398460388185,\"inSlope\":6.82940673828125,\"outSlope\":6.82940673828125,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06891261041164398,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock4", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9635604619979858,\"value\":2.153383493423462,\"inSlope\":6.251225471496582,\"outSlope\":6.251225471496582,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.07428120821714401,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995394349098206,\"value\":5.0,\"inSlope\":15.746581077575684,\"outSlope\":15.746581077575684,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06317413598299027,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("TreeLeafless1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.776531994342804,\"value\":6.162014007568359,\"inSlope\":30.075166702270509,\"outSlope\":30.075166702270509,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.5323987007141113},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":38.093849182128909,\"inSlope\":1448.839111328125,\"outSlope\":1448.839111328125,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0620061457157135,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("SmallGreyRocks1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.802714467048645,\"value\":1.5478605031967164,\"inSlope\":9.096116065979004,\"outSlope\":9.096116065979004,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.58766108751297},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":14.584033966064454,\"inSlope\":1244.9173583984375,\"outSlope\":1244.9173583984375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.054620321840047839,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("GiantPumpkin", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.8832725882530212,\"value\":0.5284063816070557,\"inSlope\":3.2962090969085695,\"outSlope\":29.38977813720703,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.19772815704345704,\"outWeight\":0.8989489078521729},{\"serializedVersion\":\"3\",\"time\":0.972209095954895,\"value\":6.7684478759765629,\"inSlope\":140.27394104003907,\"outSlope\":140.27394104003907,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.39466607570648196,\"outWeight\":0.47049039602279665},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":23.0,\"inSlope\":579.3037109375,\"outSlope\":14.8782377243042,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.648808479309082,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [Range(0f, 30f)] public int MaxOutsideEnemyPowerCount = 8; [Range(0f, 30f)] public int MaxDaytimeEnemyPowerCount = 5; [SerializeField] private SpawnableEnemiesPair[] _OutsideEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("MouthDog", 75), new SpawnableEnemiesPair("ForestGiant", 0), new SpawnableEnemiesPair("SandWorm", 56) }; [SerializeField] private SpawnableEnemiesPair[] _DaytimeEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("RedLocustBees", 22), new SpawnableEnemiesPair("Doublewing", 74), new SpawnableEnemiesPair("DocileLocustBees", 52) }; public AnimationCurve OutsideEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-7.736962288618088e-7,\"value\":-2.996999979019165,\"inSlope\":Infinity,\"outSlope\":0.5040292143821716,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.08937685936689377},{\"serializedVersion\":\"3\",\"time\":0.7105481624603272,\"value\":-0.6555822491645813,\"inSlope\":9.172262191772461,\"outSlope\":9.172262191772461,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.3333333432674408,\"outWeight\":0.7196550369262695},{\"serializedVersion\":\"3\",\"time\":1.0052626132965088,\"value\":5.359400749206543,\"inSlope\":216.42247009277345,\"outSlope\":11.374387741088868,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.044637180864810947,\"outWeight\":0.48315444588661196}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); public AnimationCurve DaytimeEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":2.2706568241119386,\"inSlope\":-7.500085353851318,\"outSlope\":-7.500085353851318,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.20650266110897065},{\"serializedVersion\":\"3\",\"time\":0.38507816195487978,\"value\":-0.0064108967781066898,\"inSlope\":-2.7670974731445314,\"outSlope\":-2.7670974731445314,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.28388944268226626,\"outWeight\":0.30659767985343935},{\"serializedVersion\":\"3\",\"time\":0.6767024993896484,\"value\":-7.021658420562744,\"inSlope\":-27.286888122558595,\"outSlope\":-27.286888122558595,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.10391546785831452,\"outWeight\":0.12503522634506226},{\"serializedVersion\":\"3\",\"time\":0.9998173117637634,\"value\":-14.818100929260254,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float DaytimeEnemiesProbabilityRange = 5f; public bool LevelIncludesSnowFootprints = false; [HideInInspector] public string serializedRandomWeatherTypes; [HideInInspector] public string serializedDungeonFlowTypes; [HideInInspector] public string serializedSpawnableScrap; [HideInInspector] public string serializedEnemies; [HideInInspector] public string serializedOutsideEnemies; [HideInInspector] public string serializedDaytimeEnemies; [HideInInspector] public string serializedSpawnableMapObjects; [HideInInspector] public string serializedSpawnableOutsideObjects; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); MoonName = MoonName.RemoveNonAlphanumeric(1); OrbitPrefabName = OrbitPrefabName.RemoveNonAlphanumeric(1); RiskLevel = RiskLevel.RemoveNonAlphanumeric(); RouteWord = RouteWord.RemoveNonAlphanumeric(2); BoughtComment = BoughtComment.RemoveNonAlphanumeric(); LevelAmbienceClips = LevelAmbienceClips.RemoveNonAlphanumeric(1); TimeToArrive = Mathf.Clamp(TimeToArrive, 0f, 16f); DaySpeedMultiplier = Mathf.Clamp(DaySpeedMultiplier, 0.1f, 5f); RoutePrice = Mathf.Clamp(RoutePrice, 0, int.MaxValue); FactorySizeMultiplier = Mathf.Clamp(FactorySizeMultiplier, 1f, 5f); FireExitsAmountOverwrite = Mathf.Clamp(FireExitsAmountOverwrite, 0, 20); MinScrap = Mathf.Clamp(MinScrap, 0, MaxScrap); MaxScrap = Mathf.Clamp(MaxScrap, MinScrap, 100); MaxEnemyPowerCount = Mathf.Clamp(MaxEnemyPowerCount, 0, 30); MaxOutsideEnemyPowerCount = Mathf.Clamp(MaxOutsideEnemyPowerCount, 0, 30); MaxDaytimeEnemyPowerCount = Mathf.Clamp(MaxDaytimeEnemyPowerCount, 0, 30); SpawnProbabilityRange = Mathf.Clamp(SpawnProbabilityRange, 0f, 30f); DaytimeEnemiesProbabilityRange = Mathf.Clamp(DaytimeEnemiesProbabilityRange, 0f, 30f); for (int i = 0; i < _SpawnableScrap.Length; i++) { _SpawnableScrap[i].ObjectName = _SpawnableScrap[i].ObjectName.RemoveNonAlphanumeric(1); } for (int j = 0; j < _Enemies.Length; j++) { _Enemies[j].EnemyName = _Enemies[j].EnemyName.RemoveNonAlphanumeric(1); } for (int k = 0; k < _SpawnableMapObjects.Length; k++) { _SpawnableMapObjects[k].ObjectName = _SpawnableMapObjects[k].ObjectName.RemoveNonAlphanumeric(1); } for (int l = 0; l < _SpawnableOutsideObjects.Length; l++) { _SpawnableOutsideObjects[l].ObjectName = _SpawnableOutsideObjects[l].ObjectName.RemoveNonAlphanumeric(1); } for (int m = 0; m < _OutsideEnemies.Length; m++) { _OutsideEnemies[m].EnemyName = _OutsideEnemies[m].EnemyName.RemoveNonAlphanumeric(1); } for (int n = 0; n < _DaytimeEnemies.Length; n++) { _DaytimeEnemies[n].EnemyName = _DaytimeEnemies[n].EnemyName.RemoveNonAlphanumeric(1); } serializedRandomWeatherTypes = string.Join(";", _RandomWeatherTypes.Select((RandomWeatherPair p) => $"{(int)p.Weather},{p.WeatherVariable1},{p.WeatherVariable2}")); serializedDungeonFlowTypes = string.Join(";", _DungeonFlowTypes.Select((DungeonFlowPair p) => $"{p.ID},{p.Rarity}")); serializedSpawnableScrap = string.Join(";", _SpawnableScrap.Select((SpawnableScrapPair p) => $"{p.ObjectName},{p.SpawnWeight}")); serializedEnemies = string.Join(";", _Enemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedOutsideEnemies = string.Join(";", _OutsideEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedDaytimeEnemies = string.Join(";", _DaytimeEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedSpawnableMapObjects = string.Join(";", _SpawnableMapObjects.Select((SpawnableMapObjectPair p) => $"{p.ObjectName}|{p.SpawnFacingAwayFromWall}|{CurveContainer.SerializeCurve(p.SpawnRate)}")); serializedSpawnableOutsideObjects = string.Join(";", _SpawnableOutsideObjects.Select((SpawnableOutsideObjectPair p) => p.ObjectName + "|" + CurveContainer.SerializeCurve(p.SpawnRate))); } public RandomWeatherPair[] RandomWeatherTypes() { return (from s in serializedRandomWeatherTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 3 select new RandomWeatherPair((LevelWeatherType)int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]))).ToArray(); } public DungeonFlowPair[] DungeonFlowTypes() { return (from s in serializedDungeonFlowTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new DungeonFlowPair(int.Parse(split[0]), int.Parse(split[1]))).ToArray(); } public SpawnableScrapPair[] SpawnableScrap() { return (from s in serializedSpawnableScrap.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableScrapPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] Enemies() { return (from s in serializedEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] OutsideEnemies() { return (from s in serializedOutsideEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] DaytimeEnemies() { return (from s in serializedDaytimeEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableMapObjectPair[] SpawnableMapObjects() { return (from s in serializedSpawnableMapObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 3 select new SpawnableMapObjectPair(split[0], bool.Parse(split[1]), CurveContainer.DeserializeCurve(split[2]))).ToArray(); } public SpawnableOutsideObjectPair[] SpawnableOutsideObjects() { return (from s in serializedSpawnableOutsideObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 2 select new SpawnableOutsideObjectPair(split[0], CurveContainer.DeserializeCurve(split[1]))).ToArray(); } } [CreateAssetMenu(fileName = "New Scrap", menuName = "LethalSDK/Scrap")] public class Scrap : ScriptableObject { public string[] RequiredBundles; public string[] IncompatibleBundles; [Header("Base")] public string itemName = string.Empty; public int minValue = 0; public int maxValue = 0; public bool twoHanded = false; public bool twoHandedAnimation = false; public bool requiresBattery = false; public bool isConductiveMetal = false; public int weight = 0; public GameObject prefab; [Header("Sounds")] public string grabSFX = string.Empty; public string dropSFX = string.Empty; [Header("Offsets")] public float verticalOffset = 0f; public Vector3 restingRotation = Vector3.zero; public Vector3 positionOffset = Vector3.zero; public Vector3 rotationOffset = Vector3.zero; [Header("Variants")] public Mesh[] meshVariants = (Mesh[])(object)new Mesh[0]; public Material[] materialVariants = (Material[])(object)new Material[0]; [Header("Spawn rate")] public bool useGlobalSpawnWeight = true; [Range(0f, 100f)] public int globalSpawnWeight = 10; [SerializeField] private ScrapSpawnChancePerScene[] _perPlanetSpawnWeight = new ScrapSpawnChancePerScene[8] { new ScrapSpawnChancePerScene("41 Experimentation", 10), new ScrapSpawnChancePerScene("220 Assurance", 10), new ScrapSpawnChancePerScene("56 Vow", 10), new ScrapSpawnChancePerScene("21 Offense", 10), new ScrapSpawnChancePerScene("61 March", 10), new ScrapSpawnChancePerScene("85 Rend", 10), new ScrapSpawnChancePerScene("7 Dine", 10), new ScrapSpawnChancePerScene("8 Titan", 10) }; [HideInInspector] public string serializedData; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); itemName = itemName.RemoveNonAlphanumeric(1); grabSFX = grabSFX.RemoveNonAlphanumeric(1); dropSFX = dropSFX.RemoveNonAlphanumeric(1); for (int i = 0; i < _perPlanetSpawnWeight.Length; i++) { _perPlanetSpawnWeight[i].SceneName = _perPlanetSpawnWeight[i].SceneName.RemoveNonAlphanumeric(1); } serializedData = string.Join(";", _perPlanetSpawnWeight.Select((ScrapSpawnChancePerScene p) => $"{p.SceneName},{p.SpawnWeight}")); } public ScrapSpawnChancePerScene[] perPlanetSpawnWeight() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new ScrapSpawnChancePerScene(split[0], int.Parse(split[1]))).ToArray(); } } } namespace LethalSDK.Utils { public static class AssetGatherDialog { public static Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public static Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public static Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); } [Serializable] public class SerializableVersion { public int Major = 1; public int Minor = 0; public int Build = 0; public int Revision = 0; public SerializableVersion(int major, int minor, int build, int revision) { Major = major; Minor = minor; Build = build; Revision = revision; } public Version ToVersion() { return new Version(Major, Minor, Build, Revision); } public override string ToString() { return $"{Major}.{Minor}.{Build}.{Revision}"; } } [Serializable] public class CurveContainer { public AnimationCurve curve; public static string SerializeCurve(AnimationCurve curve) { CurveContainer curveContainer = new CurveContainer { curve = curve }; return JsonUtility.ToJson((object)curveContainer); } public static AnimationCurve DeserializeCurve(string json) { CurveContainer curveContainer = JsonUtility.FromJson<CurveContainer>(json); return curveContainer.curve; } } [Serializable] public struct StringIntPair { public string _string; public int _int; public StringIntPair(string _string, int _int) { this._string = _string.RemoveNonAlphanumeric(1); this._int = Mathf.Clamp(_int, 0, 100); } } [Serializable] public struct StringStringPair { public string _string1; public string _string2; public StringStringPair(string _string1, string _string2) { this._string1 = _string1.RemoveNonAlphanumeric(1); this._string2 = _string2.RemoveNonAlphanumeric(1); } } [Serializable] public struct IntIntPair { public int _int1; public int _int2; public IntIntPair(int _int1, int _int2) { this._int1 = _int1; this._int2 = _int2; } } [Serializable] public struct DungeonFlowPair { public int ID; [Range(0f, 300f)] public int Rarity; public DungeonFlowPair(int id, int rarity) { ID = id; Rarity = Mathf.Clamp(rarity, 0, 300); } } [Serializable] public struct SpawnableScrapPair { public string ObjectName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableScrapPair(string objectName, int spawnWeight) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct SpawnableMapObjectPair { public string ObjectName; public bool SpawnFacingAwayFromWall; public AnimationCurve SpawnRate; public SpawnableMapObjectPair(string objectName, bool spawnFacingAwayFromWall, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnFacingAwayFromWall = spawnFacingAwayFromWall; SpawnRate = spawnRate; } } [Serializable] public struct SpawnableOutsideObjectPair { public string ObjectName; public AnimationCurve SpawnRate; public SpawnableOutsideObjectPair(string objectName, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnRate = spawnRate; } } [Serializable] public struct SpawnableEnemiesPair { public string EnemyName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableEnemiesPair(string enemyName, int spawnWeight) { EnemyName = enemyName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapSpawnChancePerScene { public string SceneName; [Range(0f, 100f)] public int SpawnWeight; public ScrapSpawnChancePerScene(string sceneName, int spawnWeight) { SceneName = sceneName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapInfoPair { public string ScrapPath; public Scrap Scrap; public ScrapInfoPair(string scrapPath, Scrap scrap) { ScrapPath = scrapPath.RemoveNonAlphanumeric(4); Scrap = scrap; } } [Serializable] public struct AudioClipInfoPair { public string AudioClipName; [HideInInspector] public string AudioClipPath; [SerializeField] public AudioClip AudioClip; public AudioClipInfoPair(string audioClipName, string audioClipPath) { AudioClipName = audioClipName.RemoveNonAlphanumeric(1); AudioClipPath = audioClipPath.RemoveNonAlphanumeric(4); AudioClip = null; } } [Serializable] public struct PlanetPrefabInfoPair { public string PlanetPrefabName; [HideInInspector] public string PlanetPrefabPath; [SerializeField] public GameObject PlanetPrefab; public PlanetPrefabInfoPair(string planetPrefabName, string planetPrefabPath) { PlanetPrefabName = planetPrefabName.RemoveNonAlphanumeric(1); PlanetPrefabPath = planetPrefabPath.RemoveNonAlphanumeric(4); PlanetPrefab = null; } } [Serializable] public struct PrefabInfoPair { public string PrefabName; [HideInInspector] public string PrefabPath; [SerializeField] public GameObject Prefab; public PrefabInfoPair(string prefabName, string prefabPath) { PrefabName = prefabName.RemoveNonAlphanumeric(1); PrefabPath = prefabPath.RemoveNonAlphanumeric(4); Prefab = null; } } [Serializable] public struct RandomWeatherPair { public LevelWeatherType Weather; [Tooltip("Thunder Frequency, Flooding speed or minimum initial enemies in eclipses")] public int WeatherVariable1; [Tooltip("Flooding offset when Weather is Flooded")] public int WeatherVariable2; public RandomWeatherPair(LevelWeatherType weather, int weatherVariable1, int weatherVariable2) { Weather = weather; WeatherVariable1 = weatherVariable1; WeatherVariable2 = weatherVariable2; } } public enum LevelWeatherType { None = -1, DustClouds, Rainy, Stormy, Foggy, Flooded, Eclipsed } public class SpawnPrefab { private static SpawnPrefab _instance; public GameObject waterSurface; public static SpawnPrefab Instance { get { if (_instance == null) { _instance = new SpawnPrefab(); } return _instance; } } } public static class TypeExtensions { public enum removeType { Normal, Serializable, Keyword, Path, SerializablePath } public static readonly Dictionary<removeType, string> regexes = new Dictionary<removeType, string> { { removeType.Normal, "[^a-zA-Z0-9 ,.!?_-]" }, { removeType.Serializable, "[^a-zA-Z0-9 .!_-]" }, { removeType.Keyword, "[^a-zA-Z0-9._-]" }, { removeType.Path, "[^a-zA-Z0-9 ,.!_/-]" }, { removeType.SerializablePath, "[^a-zA-Z0-9 .!_/-]" } }; public static string RemoveNonAlphanumeric(this string input) { if (input != null) { return Regex.Replace(input, regexes[removeType.Normal], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType.Normal], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, removeType removeType = removeType.Normal) { if (input != null) { return Regex.Replace(input, regexes[removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, removeType removeType = removeType.Normal) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, int removeType = 0) { if (input != null) { return Regex.Replace(input, regexes[(removeType)removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, int removeType = 0) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[(removeType)removeType], string.Empty); } return input; } return new string[0]; } } } namespace LethalSDK.Editor { internal class CopyrightsWindow : EditorWindow { private Vector2 scrollPosition; private readonly Dictionary<string, string> assetAuthorList = new Dictionary<string, string> { { "Drop Ship assets, Sun cycle animations, ScrapItem sprite, ScavengerSuit Textures/Arms Mesh and MonitorWall mesh", "Zeekerss" }, { "SDK Scripts, Sun Texture, CrossButton Sprite (Inspired of vanilla), OldSeaPort planet prefab texture", "HolographicWings" }, { "Old Sea Port asset package", "VIVID Arts" }, { "Survival Game Tools asset package", "cookiepopworks.com" } }; [MenuItem("LethalSDK/Copyrights", false, 999)] public static void ShowWindow() { EditorWindow.GetWindow<CopyrightsWindow>("Copyrights"); } private void OnGUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("List of Copyrights", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(5f); foreach (KeyValuePair<string, string> assetAuthor in assetAuthorList) { GUILayout.Label("Asset: " + assetAuthor.Key + " - By: " + assetAuthor.Value, EditorStyles.wordWrappedLabel, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(2f); } EditorGUILayout.Space(5f); GUILayout.Label("This SDK do not embed any Vanilla script.", Array.Empty<GUILayoutOption>()); GUILayout.EndScrollView(); } } public class EditorChecker : Editor { public override void OnInspectorGUI() { ((Editor)this).DrawDefaultInspector(); } } [CustomEditor(typeof(ModManifest))] public class ModManifestEditor : EditorChecker { public override void OnInspectorGUI() { ModManifest modManifest = (ModManifest)(object)((Editor)this).target; if (modManifest.serializedVersion == "0.0.0.0") { EditorGUILayout.HelpBox("Please define a version to your mod and don't forget to increment it at each update.", (MessageType)2); } if (modManifest.modName == null || modManifest.modName.Length == 0) { EditorGUILayout.HelpBox("Your mod need a name.", (MessageType)3); } IEnumerable<string> enumerable = from e in modManifest.scraps.Where((Scrap e) => (Object)(object)e != (Object)null).ToList() group e by e.itemName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Scraps. Duplicated Scraps are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in modManifest.moons.Where((Moon e) => (Object)(object)e != (Object)null).ToList() group e by e.MoonName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Moons. Duplicated Moons are: " + text2, (MessageType)2); } string text3 = string.Empty; Scrap[] scraps = modManifest.scraps; foreach (Scrap scrap in scraps) { if ((Object)(object)scrap != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)scrap).name + ","; } } Moon[] moons = modManifest.moons; foreach (Moon moon in moons) { if ((Object)(object)moon != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)moon).name + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register a Scrap or a Moon from another mod folder. " + text3, (MessageType)2); } if ((Object)(object)modManifest.assetBank != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest.assetBank)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { EditorGUILayout.HelpBox("You try to register an AssetBank from another mod folder.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(AssetBank))] public class AssetBankEditor : EditorChecker { public override void OnInspectorGUI() { AssetBank assetBank = (AssetBank)(object)((Editor)this).target; IEnumerable<string> enumerable = from e in (from e in assetBank.AudioClips() where e.AudioClipName != null && e.AudioClipName.Length > 0 select e).ToList() group e by e.AudioClipName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Audio Clip. Duplicated Clips are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in (from e in assetBank.PlanetPrefabs() where e.PlanetPrefabName != null && e.PlanetPrefabName.Length > 0 select e).ToList() group e by e.PlanetPrefabName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Planet Prefabs. Duplicated Planet Prefabs are: " + text2, (MessageType)2); } string text3 = string.Empty; AudioClipInfoPair[] array = assetBank.AudioClips(); for (int i = 0; i < array.Length; i++) { AudioClipInfoPair audioClipInfoPair = array[i]; if (audioClipInfoPair.AudioClipName != null && audioClipInfoPair.AudioClipName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(audioClipInfoPair.AudioClipPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + audioClipInfoPair.AudioClipName + ","; } } PlanetPrefabInfoPair[] array2 = assetBank.PlanetPrefabs(); for (int j = 0; j < array2.Length; j++) { PlanetPrefabInfoPair planetPrefabInfoPair = array2[j]; if (planetPrefabInfoPair.PlanetPrefabName != null && planetPrefabInfoPair.PlanetPrefabName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(planetPrefabInfoPair.PlanetPrefabPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + planetPrefabInfoPair.PlanetPrefabName + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register an Audio Clip or a Planet Prefab from another mod folder. " + text3, (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DungeonGenerator))] public class SI_DungeonGeneratorEditor : EditorChecker { public override void OnInspectorGUI() { SI_DungeonGenerator sI_DungeonGenerator = (SI_DungeonGenerator)(object)((Editor)this).target; string assetPath = AssetDatabase.GetAssetPath((Object)(object)sI_DungeonGenerator.DungeonRoot); if (assetPath != null && assetPath.Length > 0) { EditorGUILayout.HelpBox("Dungeon Root must be in the scene.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_ScanNode))] public class SI_ScanNodeEditor : EditorChecker { public override void OnInspectorGUI() { SI_ScanNode sI_ScanNode = (SI_ScanNode)(object)((Editor)this).target; if (sI_ScanNode.MinRange > sI_ScanNode.MaxRange) { EditorGUILayout.HelpBox("Min Range must be smaller than Max Ranger.", (MessageType)3); } if (sI_ScanNode.CreatureScanID < -1) { EditorGUILayout.HelpBox("Creature Scan ID can't be less than -1.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_AnimatedSun))] public class SI_AnimatedSunEditor : EditorChecker { public override void OnInspectorGUI() { SI_AnimatedSun sI_AnimatedSun = (SI_AnimatedSun)(object)((Editor)this).target; if ((Object)(object)sI_AnimatedSun.directLight == (Object)null || (Object)(object)sI_AnimatedSun.indirectLight == (Object)null) { EditorGUILayout.HelpBox("A direct and an indirect light must be defined.", (MessageType)2); } if ((Object)(object)((Component)sI_AnimatedSun.directLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform || (Object)(object)((Component)sI_AnimatedSun.indirectLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform) { EditorGUILayout.HelpBox("Direct and an indirect light must be a child of the AnimatedSun in the hierarchy.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_EntranceTeleport))] public class SI_EntranceTeleportEditor : EditorChecker { public override void OnInspectorGUI() { SI_EntranceTeleport sI_EntranceTeleport = (SI_EntranceTeleport)(object)((Editor)this).target; IEnumerable<int> enumerable = from e in Object.FindObjectsOfType<SI_EntranceTeleport>().ToList() group e by e.EntranceID into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (int item in enumerable) { text += $"{item},"; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("Two entrances or more have same Entrance ID. Duplicated entrances are: " + text, (MessageType)2); } if ((Object)(object)sI_EntranceTeleport.EntrancePoint == (Object)null) { EditorGUILayout.HelpBox("An entrance point must be defined.", (MessageType)3); } if (sI_EntranceTeleport.AudioReverbPreset < 0) { EditorGUILayout.HelpBox("Audio Reverb Preset can't be negative.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Scrap))] public class ScrapEditor : EditorChecker { public override void OnInspectorGUI() { Scrap scrap = (Scrap)(object)((Editor)this).target; if ((Object)(object)scrap.prefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Prefab to your Scrap.", (MessageType)1); } else { if ((Object)(object)scrap.prefab.GetComponent<NetworkObject>() == (Object)null) { EditorGUILayout.HelpBox("The Prefab must have a NetworkObject.", (MessageType)3); } if ((Object)(object)scrap.prefab.transform.Find("ScanNode") == (Object)null) { EditorGUILayout.HelpBox("The Prefab don't have a ScanNode.", (MessageType)2); } if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap.prefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap))) { EditorGUILayout.HelpBox("The Prefab must come from the same mod folder as your Scrap.", (MessageType)2); } } if (scrap.itemName == null || scrap.itemName.Length == 0) { EditorGUILayout.HelpBox("Your scrap must have a Name.", (MessageType)3); } if (!scrap.useGlobalSpawnWeight && !scrap.perPlanetSpawnWeight().Any((ScrapSpawnChancePerScene w) => w.SceneName != null && w.SceneName.Length > 0)) { EditorGUILayout.HelpBox("Your scrap use Per Planet Spawn Weight but no planet are defined.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Moon))] public class MoonEditor : EditorChecker { public override void OnInspectorGUI() { Moon moon = (Moon)(object)((Editor)this).target; if (moon.MoonName == null || moon.MoonName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Name.", (MessageType)3); } if (moon.PlanetName == null || moon.PlanetName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Planet Name.", (MessageType)3); } if (moon.RouteWord == null || moon.RouteWord.Length < 3) { EditorGUILayout.HelpBox("Your moon route word must be at least 3 characters long.", (MessageType)3); } if ((Object)(object)moon.MainPrefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Main Prefab to your Scrap.", (MessageType)1); } else if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon.MainPrefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon))) { EditorGUILayout.HelpBox("The Main Prefab must come from the same mod folder as your Moon.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DoorLock))] public class SI_DoorLockEditor : EditorChecker { public override void OnInspectorGUI() { SI_DoorLock sI_DoorLock = (SI_DoorLock)(object)((Editor)this).target; EditorGUILayout.HelpBox("DoorLock is not implemented yet.", (MessageType)1); base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_Ladder))] public class SI_LadderEditor : EditorChecker { public override void OnInspectorGUI() { SI_Ladder sI_Ladder = (SI_Ladder)(object)((Editor)this).target; EditorGUILayout.HelpBox("Ladder is experimental.", (MessageType)1); base.OnInspectorGUI(); } } internal class OldAssetsRemover { private static readonly List<string> assetPaths = new List<string> { "Assets/LethalCompanyAssets", "Assets/Mods/LethalExpansion/Audio", "Assets/Mods/LethalExpansion/AudioMixerController", "Assets/Mods/LethalExpansion/Materials/Default.mat", "Assets/Mods/LethalExpansion/Prefabs/Settings", "Assets/Mods/LethalExpansion/Prefabs/EntranceTeleportA.prefab", "Assets/Mods/LethalExpansion/Prefabs/Prefabs.zip", "Assets/Mods/LethalExpansion/Scenes/ItemPlaceTest", "Assets/Mods/LethalExpansion/Sprites/HandIcon.png", "Assets/Mods/LethalExpansion/Sprites/HandIconPoint.png", "Assets/Mods/LethalExpansion/Sprites/HandLadderIcon.png", "Assets/Mods/TemplateMod/Moons/NavMesh-Environment.asset", "Assets/Mods/TemplateMod/Moons/OldSeaPort.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile 1.asset", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunCompanyLevel.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeB.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBStormy.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeC.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCStormy.anim", "Assets/Mods/LethalExpansion/Skybox", "Assets/Mods/LethalExpansion/Sprites/XButton.png", "Assets/Mods/LethalExpansion/Textures/sunTexture1.png", "Assets/Mods/OldSeaPort/Materials/Maple_bark_1.mat", "Assets/Mods/OldSeaPort/Materials/maple_leaves.mat", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/OldSeaPort/EffectExamples/Shared/Scripts", "Assets/Mods/OldSeaPort/scenes", "Assets/Mods/OldSeaPort/prefabs/Plane (12).prefab", "Assets/Mods/LethalExpansion/Meshes/labyrinth.fbx" }; [InitializeOnLoadMethod] public static void CheckOldAssets() { foreach (string assetPath in assetPaths) { if (AssetDatabase.IsValidFolder(assetPath)) { DeleteFolder(assetPath); } else if ((Object)(object)AssetDatabase.LoadAssetAtPath<GameObject>(assetPath) != (Object)null) { DeleteAsset(assetPath); } } } private static void DeleteFolder(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted folder at: " + path)); } else { Debug.LogError((object)("Failed to delete folder at: " + path)); } } private static void DeleteAsset(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted asset at: " + path)); } else { Debug.LogError((object)("Failed to delete asset at: " + path)); } } } public class VersionChecker : Editor { [InitializeOnLoadMethod] public static void CheckVersion() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown UnityWebRequest www = UnityWebRequest.Get("https://raw.githubusercontent.com/HolographicWings/LethalSDK-Unity-Project/main/last.txt"); UnityWebRequestAsyncOperation operation = www.SendWebRequest(); CallbackFunction callback = null; callback = (CallbackFunction)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (((AsyncOperation)operation).isDone) { EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); OnRequestComplete(www); } }; EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); } private static void OnRequestComplete(UnityWebRequest www) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)www.result == 2 || (int)www.result == 3) { Debug.LogError((object)("Error when getting last version number: " + www.error)); } else { CompareVersions(www.downloadHandler.text); } } private static void CompareVersions(string onlineVersion) { if (Version.Parse(PlayerSettings.bundleVersion) < Version.Parse(onlineVersion) && EditorUtility.DisplayDialogComplex("Warning", "The SDK is not up to date: " + onlineVersion, "Update", "Ignore", "") == 0) { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalSDK/"); } } } internal class LethalSDKCategory : EditorWindow { [MenuItem("LethalSDK/Lethal SDK v1.3.0", false, 0)] public static void ShowWindow() { } } public class Lethal_AssetBundleBuilderWindow : EditorWindow { private enum compressionOption { NormalCompression, FastCompression, Uncompressed } private static string assetBundleDirectoryKey = "LethalSDK_AssetBundleBuilderWindow_assetBundleDirectory"; private static string compressionModeKey = "LethalSDK_AssetBundleBuilderWindow_compressionMode"; private static string _64BitsModeKey = "LethalSDK_AssetBundleBuilderWindow_64BitsMode"; private string assetBundleDirectory = string.Empty; private compressionOption compressionMode = compressionOption.NormalCompression; private bool _64BitsMode; [MenuItem("LethalSDK/AssetBundle Builder", false, 100)] public static void ShowWindow() { //IL_0017: 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) Lethal_AssetBundleBuilderWindow window = EditorWindow.GetWindow<Lethal_AssetBundleBuilderWindow>("AssetBundle Builder"); ((EditorWindow)window).minSize = new Vector2(295f, 133f); ((EditorWindow)window).maxSize = new Vector2(295f, 133f); window.LoadPreferences(); } private void OnGUI() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown GUILayout.Label("Base Settings", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Output Path", "The directory where the asset bundles will be saved."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(84f) }); assetBundleDirectory = EditorGUILayout.TextField(assetBundleDirectory, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.Label("Options", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Compression Mode", "Select the compression option for the asset bundle. Faster the compression is, faster the assets will load and less CPU it will use, but the Bundle will be bigger."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) }); compressionMode = (compressionOption)(object)EditorGUILayout.EnumPopup((Enum)compressionMode, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("64 Bits Asset Bundle (Not recommended)", "Better performances but incompatible with 32 bits computers."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) }); _64BitsMode = EditorGUILayout.Toggle(_64BitsMode, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Build AssetBundles", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) })) { BuildAssetBundles(); } if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) })) { ClearPreferences(); } GUILayout.EndHorizontal(); } private void ClearPreferences() { EditorPrefs.DeleteKey(assetBundleDirectoryKey); EditorPrefs.DeleteKey(compressionModeKey); EditorPrefs.DeleteKey(_64BitsModeKey); LoadPreferences(); } private void BuildAssetBundles() { //IL_0022: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) if (!Directory.Exists(assetBundleDirectory)) { Directory.CreateDirectory(assetBundleDirectory); } BuildAssetBundleOptions val = (BuildAssetBundleOptions)0; val = (BuildAssetBundleOptions)(compressionMode switch { compressionOption.NormalCompression => 0, compressionOption.FastCompression => 256, compressionOption.Uncompressed => 1, _ => 0, }); BuildTarget val2 = (BuildTarget)(_64BitsMode ? 19 : 5); try { if (assetBundleDirectory != null || assetBundleDirectory.Length != 0) { AssetBundleManifest val3 = BuildPipeline.BuildAssetBundles(assetBundleDirectory, val, val2); if ((Object)(object)val3 != (Object)null) { Debug.Log((object)"AssetBundles built successfully."); } else { Debug.LogError((object)"Cannot build AssetBundles."); } } else { Debug.LogError((object)"AssetBundles path cannot be blank."); } } catch (Exception ex) { Debug.LogError((object)ex.Message); } } private void OnLostFocus() { SavePreferences(); } private void OnDisable() { SavePreferences(); } private void LoadPreferences() { assetBundleDirectory = EditorPrefs.GetString(assetBundleDirectoryKey, "Assets/AssetBundles"); compressionMode = (compressionOption)EditorPrefs.GetInt(compressionModeKey, 0); _64BitsMode = EditorPrefs.GetBool(_64BitsModeKey, false); } private void SavePreferences() { EditorPrefs.SetString(assetBundleDirectoryKey, assetBundleDirectory); EditorPrefs.SetInt(compressionModeKey, (int)compressionMode); EditorPrefs.SetBool(_64BitsModeKey, _64BitsMode); } } } namespace LethalSDK.Component { [AddComponentMenu("LethalSDK/DamagePlayer")] public class SI_DamagePlayer : MonoBehaviour { public bool kill = false; public bool dontSpawnBody = false; public SI_CauseOfDeath causeOfDeath = SI_CauseOfDeath.Gravity; public int damages = 25; public int numberIterations = 1; public int iterationCooldown = 1000; public int warmupCooldown = 0; public UnityEvent postEvent = new UnityEvent(); public void Trigger(object player) { if (kill) { ((MonoBehaviour)this).StartCoroutine(Kill(player)); } else { ((MonoBehaviour)this).StartCoroutine(Damage(player)); } } public IEnumerator Kill(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).KillPlayer(Vector3.zero, !dontSpawnBody, (CauseOfDeath)causeOfDeath, 0); postEvent.Invoke(); } public IEnumerator Damage(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); int iteration = 0; while (iteration < numberIterations || numberIterations == -1) { ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).DamagePlayer(damages, true, true, (CauseOfDeath)causeOfDeath, 0, false, Vector3.zero); postEvent.Invoke(); iteration++; yield return (object)new WaitForSeconds((float)iterationCooldown / 1000f); } } public void StopCounter(object player) { ((MonoBehaviour)this).StopAllCoroutines(); } } [AddComponentMenu("LethalSDK/SoundYDistance")] public class SI_SoundYDistance : MonoBehaviour { public AudioSource audioSource; public int maxDistance = 50; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } } public void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null) { audioSource.volume = 1f - Mathf.Abs(((Component)this).transform.position.y - ((Component)RoundManager.Instance.playersManager.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[((NetworkBehaviour)StartOfRound.Instance).NetworkManager.LocalClientId]].gameplayCamera).transform.position.y) / (float)maxDistance; } } } [AddComponentMenu("LethalSDK/AudioOutputInterface")] public class SI_AudioOutputInterface : MonoBehaviour { public AudioSource audioSource; public string mixerName = "Diagetic"; public string mixerGroupName = "Master"; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } if (mixerName != null && mixerName.Length > 0 && mixerGroupName != null && mixerGroupName.Length > 0) { audioSource.outputAudioMixerGroup = AssetGatherDialog.audioMixers[mixerName].Item2.First((AudioMixerGroup g) => ((Object)g).name == mixerGroupName); } Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/NetworkPrefabInstancier")] public class SI_NetworkPrefabInstancier : MonoBehaviour { public GameObject prefab; public GameObject instance; public void Awake() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null && component.NetworkManager.IsHost) { instance = Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent); instance.GetComponent<NetworkObject>().Spawn(false); } } ((Component)this).gameObject.SetActive(false); } public void OnDestroy() { if ((Object)(object)instance != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null && component.NetworkManager.IsHost) { instance.GetComponent<NetworkObject>().Despawn(true); Object.Destroy((Object)(object)instance); } } } } public class ScriptImporter : MonoBehaviour { public virtual void Awake() { Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/MatchLocalPlayerPosition")] public class SI_MatchLocalPlayerPosition : ScriptImporter { public override void Awake() { ((Component)this).gameObject.AddComponent<MatchLocalPlayerPosition>(); base.Awake(); } } [AddComponentMenu("LethalSDK/AnimatedSun")] public class SI_AnimatedSun : ScriptImporter { public Light indirectLight; public Light directLight; public override void Awake() { animatedSun val = ((Component)this).gameObject.AddComponent<animatedSun>(); val.indirectLight = indirectLight; val.directLight = directLight; base.Awake(); } } [AddComponentMenu("LethalSDK/ScanNode")] public class SI_ScanNode : ScriptImporter { public int MaxRange; public int MinRange; public bool RequiresLineOfSight; public string HeaderText; public string SubText; public int ScrapValue; public int CreatureScanID; public NodeType NodeType; public override void Awake() { ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>(); val.minRange = MinRange; val.maxRange = MaxRange; val.requiresLineOfSight = RequiresLineOfSight; val.headerText = HeaderText; val.subText = SubText; val.scrapValue = ScrapValue; val.creatureScanID = CreatureScanID; val.nodeType = (int)NodeType; base.Awake(); } } public enum NodeType { Information = 0, Danger = 0, Ressource = 0 } [AddComponentMenu("LethalSDK/AudioReverbPresets")] public class SI_AudioReverbPresets : ScriptImporter { public GameObject[] presets; public override void Awake() { } public void Update() { int num = 0; GameObject[] array = presets; foreach (GameObject val in array) { if ((Object)(object)val.GetComponent<SI_AudioReverbTrigger>() != (Object)null) { num++; } } if (num != 0) { return; } List<AudioReverbTrigger> list = new List<AudioReverbTrigger>(); GameObject[] array2 = presets; foreach (GameObject val2 in array2) { if ((Object)(object)val2.GetComponent<AudioReverbTrigger>() != (Object)null) { list.Add(val2.GetComponent<AudioReverbTrigger>()); } } AudioReverbPresets val3 = ((Component)this).gameObject.AddComponent<AudioReverbPresets>(); val3.audioPresets = list.ToArray(); Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/AudioReverbTrigger")] public class SI_AudioReverbTrigger : ScriptImporter { [Header("Reverb Preset")] public bool ChangeDryLevel = false; [Range(-10000f, 0f)] public float DryLevel = 0f; public bool ChangeHighFreq = false; [Range(-10000f, 0f)] public float HighFreq = -270f; public bool ChangeLowFreq = false; [Range(-10000f, 0f)] public float LowFreq = -244f; public bool ChangeDecayTime = false; [Range(0f, 35f)] public float DecayTime = 1.4f; public bool ChangeRoom = false; [Range(-10000f, 0f)] public float Room = -600f; [Header("MISC")] public bool ElevatorTriggerForProps = false; public bool SetInElevatorTrigger = false; public bool IsShipRoom = false; public bool ToggleLocalFog = false; public float FogEnabledAmount = 10f; [Header("Weather and effects")] public bool SetInsideAtmosphere = false; public bool InsideLighting = false; public int WeatherEffect = -1; public bool EffectEnabled = true; public bool DisableAllWeather = false; public bool EnableCurrentLevelWeather = true; public override void Awake() { AudioReverbTrigger val = ((Component)this).gameObject.AddComponent<AudioReverbTrigger>(); ReverbPreset val2 = ScriptableObject.CreateInstance<ReverbPreset>(); val2.changeDryLevel = ChangeDryLevel; val2.dryLevel = DryLevel; val2.changeHighFreq = ChangeHighFreq; val2.highFreq = HighFreq; val2.changeLowFreq = ChangeLowFreq; val2.lowFreq = LowFreq; val2.changeDecayTime = ChangeDecayTime; val2.decayTime = DecayTime; val2.changeRoom = ChangeRoom; val2.room = Room; val.reverbPreset = val2; val.usePreset = -1; val.audioChanges = (switchToAudio[])(object)new switchToAudio[0]; val.elevatorTriggerForProps = ElevatorTriggerForProps; val.setInElevatorTrigger = SetInElevatorTrigger; val.isShipRoom = IsShipRoom; val.toggleLocalFog = ToggleLocalFog; val.fogEnabledAmount = FogEnabledAmount; val.setInsideAtmosphere = SetInsideAtmosphere; val.insideLighting = InsideLighting; val.weatherEffect = WeatherEffect; val.effectEnabled = EffectEnabled; val.disableAllWeather = DisableAllWeather; val.enableCurrentLevelWeather = EnableCurrentLevelWeather; base.Awake(); } } [AddComponentMenu("LethalSDK/DungeonGenerator")] public class SI_DungeonGenerator : ScriptImporter { public GameObject DungeonRoot; public override void Awake() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).tag != "DungeonGenerator") { ((Component)this).tag = "DungeonGenerator"; } RuntimeDungeon val = ((Component)this).gameObject.AddComponent<RuntimeDungeon>(); val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; val.Generator.LengthMultiplier = 0.8f; val.Generator.PauseBetweenRooms = 0.2f; val.GenerateOnStart = false; if ((Object)(object)DungeonRoot != (Object)null) { _ = DungeonRoot.scene; if (false) { DungeonRoot = new GameObject(); ((Object)DungeonRoot).name = "DungeonRoot"; DungeonRoot.transform.position = new Vector3(0f, -200f, 0f); } } val.Root = DungeonRoot; val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter val2 = ((Component)this).gameObject.AddComponent<UnityNavMeshAdapter>(); val2.BakeMode = (RuntimeNavMeshBakeMode)3; val2.LayerMask = LayerMask.op_Implicit(35072); base.Awake(); } } [AddComponentMenu("LethalSDK/EntranceTeleport")] public class SI_EntranceTeleport : ScriptImporter { public int EntranceID = 0; public Transform EntrancePoint; public int AudioReverbPreset = -1; public AudioClip[] DoorAudios = (AudioClip[])(object)new AudioClip[0]; public override void Awake() { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown AudioSource val = ((Component)this).gameObject.AddComponent<AudioSource>(); val.outputAudioMixerGroup = AssetGatherDialog.audioMixers["Diagetic"].Item2.First((AudioMixerGroup g) => ((Object)g).name == "Master"); val.playOnAwake = false; val.spatialBlend = 1f; EntranceTeleport entranceTeleport = ((Component)this).gameObject.AddComponent<EntranceTeleport>(); entranceTeleport.isEntranceToBuilding = true; entranceTeleport.entrancePoint = EntrancePoint; entranceTeleport.entranceId = EntranceID; entranceTeleport.audioReverbPreset = AudioReverbPreset; entranceTeleport.entrancePointAudio = val; entranceTeleport.doorAudios = DoorAudios; InteractTrigger val2 = ((Component)this).gameObject.AddComponent<InteractTrigger>(); val2.hoverIcon = (AssetGatherDialog.sprites.ContainsKey("HandIcon") ? AssetGatherDialog.sprites["HandIcon"] : AssetGatherDialog.sprites.First().Value); val2.hoverTip = "Enter : [LMB]"; val2.disabledHoverTip = string.Empty; val2.holdTip = string.Empty; val2.animationString = string.Empty; val2.interactable = true; val2.oneHandedItemAllowed = true; val2.twoHandedItemAllowed = true; val2.holdInteraction = true; val2.timeToHold = 1.5f; val2.timeToHoldSpeedMultiplier = 1f; val2.holdingInteractEvent = new InteractEventFloat(); val2.onInteract = new InteractEvent(); val2.onInteractEarly = new InteractEvent(); val2.onStopInteract = new InteractEvent(); val2.onCancelAnimation = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)val2.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate { entranceTeleport.TeleportPlayer(); }); base.Awake(); } } [AddComponentMenu("LethalSDK/DoorLock")] public class SI_DoorLock : ScriptImporter { public override void Awake() { base.Awake(); } } [AddComponentMenu("LethalSDK/WaterSurface")] public class SI_WaterSurface : ScriptImporter { private GameObject obj; public int soundMaxDistance = 50; public override void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) obj = Object.Instantiate<GameObject>(SpawnPrefab.Instance.waterSurface); SceneManager.MoveGameObjectToScene(obj, ((Component)this).gameObject.scene); obj.transform.parent = ((Component)this).transform; obj.transform.localPosition = Vector3.zero; Transform val = obj.transform.Find("Water"); ((Component)val).GetComponent<MeshFilter>().sharedMesh = ((Component)this).GetComponent<MeshFilter>().sharedMesh; val.position = ((Component)this).transform.position; val.rotation = ((Component)this).transform.rotation; val.localScale = ((Component)this).transform.localScale; SI_SoundYDistance sI_SoundYDistance = ((Component)val).gameObject.AddComponent<SI_SoundYDistance>(); sI_SoundYDistance.audioSource = ((Component)obj.transform.Find("WaterAudio")).GetComponent<AudioSource>(); sI_SoundYDistance.maxDistance = soundMaxDistance; obj.SetActive(true); base.Awake(); } } [AddComponentMenu("LethalSDK/Ladder")] public class SI_Ladder : ScriptImporter { public Transform BottomPosition; public Transform TopPosition; public Transform HorizontalPosition; public Transform PlayerNodePosition; public bool UseRaycastToGetTopPosition = false; public override void Awake() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown InteractTrigger val = ((Component)this).gameObject.AddComponent<InteractTrigger>(); val.hoverIcon = (AssetGatherDialog.sprites.ContainsKey("HandLadderIcon") ? AssetGatherDialog.sprites["HandLadderIcon"] : AssetGatherDialog.sprites.First().Value); val.hoverTip = "Climb : [LMB]"; val.disabledHoverTip = string.Empty; val.holdTip = string.Empty; val.animationString = string.Empty; val.specialCharacterAnimation = true; val.animationWaitTime = 0.5f; val.animationString = "SA_PullLever"; val.isLadder = true; val.lockPlayerPosition = true; val.playerPositionNode = BottomPosition; val.bottomOfLadderPosition = BottomPosition; val.bottomOfLadderPosition = BottomPosition; val.topOfLadderPosition = TopPosition; val.ladderHorizontalPosition = HorizontalPosition; val.ladderPlayerPositionNode = PlayerNodePosition; val.useRaycastToGetTopPosition = UseRaycastToGetTopPosition; val.holdingInteractEvent = new InteractEventFloat(); val.onCancelAnimation = new InteractEvent(); val.onInteract = new InteractEvent(); val.onInteractEarly = new InteractEvent(); val.onStopInteract = new InteractEvent(); base.Awake(); } } [AddComponentMenu("LethalSDK/ItemDropship")] public class SI_ItemDropship : ScriptImporter { public Animator ShipAnimator; public Transform[] ItemSpawnPositions; public GameObject OpenTriggerObject; public GameObject KillTriggerObject; public AudioClip ShipThrusterCloseSound; public AudioClip ShipLandSound; public AudioClip ShipOpenDoorsSound; public override void Awake() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown ItemDropship ItemDropship = ((Component)this).gameObject.AddComponent<ItemDropship>(); ItemDropship.shipAnimator = ShipAnimator; ItemDropship.itemSpawnPositions = ItemSpawnPositions; PlayAudioAnimationEvent val = ((Component)this).gameObject.AddComponent<PlayAudioAnimationEvent>(); val.audioToPlay = ((Component)this).GetComponent<AudioSource>(); val.audioClip = ShipLandSound; val.audioClip2 = ShipOpenDoorsSound; InteractTrigger val2 = OpenTriggerObject.AddComponent<InteractTrigger>(); val2.hoverIcon = (AssetGatherDialog.sprites.ContainsKey("HandIcon") ? AssetGatherDialog.sprites["HandIcon"] : AssetGatherDialog.sprites.First().Value); val2.hoverTip = "Open : [LMB]"; val2.disabledHoverTip = string.Empty; val2.holdTip = string.Empty; val2.animationString = string.Empty; val2.twoHandedItemAllowed = true; val2.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)val2.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate { ItemDropship.TryOpeningShip(); }); ItemDropship.triggerScript = val2; if ((Object)(object)((Component)ItemDropship).transform.Find("Music") != (Object)null) { ((Component)((Component)ItemDropship).transform.Find("Music")).gameObject.AddComponent<OccludeAudio>(); if ((Object)(object)((Component)this).transform.Find("ThrusterContainer/Thruster") != (Object)null) { facePlayerOnAxis val3 = ((Component)((Component)this).transform.Find("ThrusterContainer/Thruster")).gameObject.AddComponent<facePlayerOnAxis>(); val3.turnAxis = ((Component)this).transform.Find("ThrusterContainer/flameAxis"); } } KillLocalPlayer KillLocalPlayerScript = KillTriggerObject.AddComponent<KillLocalPlayer>(); InteractTrigger val4 = KillTriggerObject.AddComponent<InteractTrigger>(); val4.hoverTip = string.Empty; val4.disabledHoverTip = string.Empty; val4.holdTip = string.Empty; val4.animationString = string.Empty; val4.touchTrigger = true; val4.triggerOnce = true; val4.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)val4.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate(PlayerControllerB player) { KillLocalPlayerScript.KillPlayer(player); }); base.Awake(); } } [AddComponentMenu("LethalSDK/InteractTrigger")] public class SI_InteractTrigger : ScriptImporter { [Header("Aesthetics")] public string hoverIcon = "HandIcon"; public string hoverTip = "Interact"; public string disabledHoverIcon = string.Empty; public string disabledHoverTip = string.Empty; [Header("Interaction")] public bool interactable = true; public bool oneHandedItemAllowed = true; public bool twoHandedItemAllowed = false; public bool holdInteraction = false; public float timeToHold = 0.5f; public float timeToHoldSpeedMultiplier = 1f; public string holdTip = string.Empty; public UnityEvent<float> holdingInteractEvent = new UnityEvent<float>(); public bool touchTrigger = false; public bool triggerOnce = false; [Header("Misc")] public bool interactCooldown = true; public float cooldownTime = 1f; public bool disableTriggerMesh = true; public bool RandomChanceTrigger = false; public int randomChancePercentage = 0; [Header("Events")] public UnityEvent<object> onInteract = new UnityEvent<object>(); public UnityEvent<object> onInteractEarly = new UnityEvent<object>(); public UnityEvent<object> onStopInteract = new UnityEvent<object>(); public UnityEvent<object> onCancelAnimation = new UnityEvent<object>(); [Header("Special Animation")] public bool specialCharacterAnimation = false; public bool stopAnimationManually = false; public string stopAnimationString = "SA_stopAnimation"; public bool hidePlayerItem = false; public bool isPlayingSpecialAnimation = false; public float animationWaitTime = 2f; public string animationString = string.Empty; public bool lockPlayerPosition = false; public Transform playerPositionNode; [Header("Ladders")] public bool isLadder = false; public Transform topOfLadderPosition; public bool useRaycastToGetTopPosition = false; public Transform bottomOfLadderPosition; public Transform ladderHorizontalPosition; public Transform ladderPlayerPositionNode; public override void Awake() { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown InteractTrigger val = ((Component)this).gameObject.AddComponent<InteractTrigger>(); if (hoverIcon != null && hoverIcon.Length > 0) { val.hoverIcon = null; } else { val.hoverIcon = (AssetGatherDialog.sprites.ContainsKey(hoverIcon) ? AssetGatherDialog.sprites[hoverIcon] : AssetGatherDialog.sprites.First().Value); } val.hoverTip = hoverTip; if (disabledHoverIcon != null && disabledHoverIcon.Length > 0) { val.disabledHoverIcon = null; } else { val.disabledHoverIcon = (AssetGatherDialog.sprites.ContainsKey(disabledHoverIcon) ? AssetGatherDia