Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SnowyHolidayDropship v1.1.4
SnowyHolidayDropship.dll
Decompiled a year agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SnowyHolidayDropship")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Brings back the holiday dropship on snowy moons.")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4+a822ac66f33636b0d0a3a5c0fd88d3f1db24dd1c")] [assembly: AssemblyProduct("SnowyHolidayDropship")] [assembly: AssemblyTitle("SnowyHolidayDropship")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SnowyHolidayDropship { internal static class DropshipDecorator { private static ItemDropship shipScript; private static AudioClip music; private static AudioClip musicFar; private static AudioClip musicJolly; private static AudioClip musicFarJolly; private static AudioClip musicOld; private static AudioClip musicFarOld; private static Mesh ship; private static Mesh shipJolly; private static GameObject star; private static GameObject shipObject; private static MeshFilter shipComponent; private static AudioSource musicComponent; private static AudioSource musicFarComponent; private static Random rand = new Random(); private static bool initialized; private static bool landed; private static bool seeded; private static GameObject artificeBlizzard; internal static void Init(ItemDropship itemDropship) { initialized = false; shipScript = itemDropship; try { Transform transform = ((Component)shipScript).transform; star = ((Component)transform.Find("Star")).gameObject; shipObject = ((Component)transform.Find("ItemShip")).gameObject; shipComponent = shipObject.GetComponent<MeshFilter>(); Transform obj = transform.Find("Music"); musicComponent = ((Component)obj).GetComponent<AudioSource>(); musicFarComponent = ((Component)obj.Find("Music (1)")).GetComponent<AudioSource>(); Plugin.Logger.LogInfo((object)"Successfully cached all dropship object references"); if ((Object)(object)music == (Object)null || (Object)(object)musicFar == (Object)null || (Object)(object)ship == (Object)null || (Object)(object)musicJolly == (Object)null || (Object)(object)musicFarJolly == (Object)null || (Object)(object)shipJolly == (Object)null || (Object)(object)musicOld == (Object)null || (Object)(object)musicFarOld == (Object)null) { AssetBundle obj2 = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "snowyholidaydropship")); music = obj2.LoadAsset<AudioClip>("IcecreamTruckV2"); musicFar = obj2.LoadAsset<AudioClip>("IcecreamTruckFar"); musicJolly = obj2.LoadAsset<AudioClip>("IcecreamTruckV2Christmas"); musicFarJolly = obj2.LoadAsset<AudioClip>("IcecreamTruckV2ChristmasFar"); musicOld = obj2.LoadAsset<AudioClip>("IcecreamTruck"); musicFarOld = obj2.LoadAsset<AudioClip>("IcecreamTruckFar_0"); ship = obj2.LoadAsset<Mesh>("MainShipPart"); shipJolly = obj2.LoadAsset<Mesh>("MainShipPart_0"); obj2.Unload(false); Plugin.Logger.LogInfo((object)"Successfully cached all asset bundle references"); } if (((Object)StartOfRound.Instance.currentLevel).name == "ArtificeLevel" && Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.artificeblizzard")) { artificeBlizzard = GameObject.Find("/Systems/Audio/BlizzardAmbience"); if ((Object)(object)artificeBlizzard != (Object)null) { Plugin.Logger.LogInfo((object)"Artifice Blizzard compatibility success"); } } if ((Object)(object)star != (Object)null) { star.SetActive(false); } initialized = true; landed = false; seeded = false; } catch (Exception ex) { Plugin.Logger.LogError((object)"Failed to capture references to all the dropship objects - are you playing on a modded moon?"); Plugin.Logger.LogError((object)"Please send the information below to the developer, and mention what moon this error occurred on"); Plugin.Logger.LogError((object)ex); } } internal static void RedecorateDropship(bool vehicle = false) { if (!initialized || landed) { return; } landed = true; if (!seeded) { rand = new Random(StartOfRound.Instance.randomMapSeed); Plugin.Logger.LogInfo((object)$"RNG initialized (Seed: {StartOfRound.Instance.randomMapSeed})"); seeded = true; } Plugin.Logger.LogInfo((object)"Roll chance for holiday"); bool flag = RandomChance(IsSnowLevel() ? ((double)Plugin.configSnowyChance.Value) : ((double)Plugin.configNormalChance.Value)); Plugin.Logger.LogInfo((object)"Roll chance for old music"); bool flag2 = RandomChance(Plugin.configLegacyChance.Value); if (vehicle) { shipComponent.mesh = ship; star.SetActive(false); Plugin.Logger.LogInfo((object)"Dropship: Normal (delivering vehicle)"); return; } if (flag) { shipComponent.mesh = shipJolly; musicComponent.clip = musicJolly; musicFarComponent.clip = musicFarJolly; star.SetActive(true); Plugin.Logger.LogInfo((object)"Dropship: Holiday"); return; } shipComponent.mesh = ship; if (flag2) { musicComponent.clip = musicOld; musicFarComponent.clip = musicFarOld; Plugin.Logger.LogInfo((object)"Dropship: Normal (old music)"); } else { musicComponent.clip = music; musicFarComponent.clip = musicFar; Plugin.Logger.LogInfo((object)"Dropship: Normal"); } star.SetActive(false); } internal static void DropshipLeave() { landed = false; if (initialized && star.activeSelf) { ((MonoBehaviour)shipScript).StartCoroutine(DisableStarInSky()); } } internal static IEnumerator DisableStarInSky() { float start = Time.time; Plugin.Logger.LogInfo((object)"Holiday: Upon reaching orbit, disable star"); while (shipObject.activeSelf) { yield return null; } star.SetActive(false); Plugin.Logger.LogInfo((object)$"Holiday: Star disabled after {Time.time - start}s"); } private static bool RandomChance(double chance) { double num = rand.NextDouble(); Plugin.Logger.LogInfo((object)$"RNG: {num} < {chance}"); if (!(chance >= 1.0)) { if (chance > 0.0) { return num < chance; } return false; } return true; } private static bool IsSnowLevel() { if (StartOfRound.Instance.currentLevel.levelIncludesSnowFootprints) { if (!((Object)(object)artificeBlizzard == (Object)null)) { return artificeBlizzard.activeSelf; } return true; } return false; } } internal static class LobbyCompatibility { internal static void Init() { PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.snowyholidaydropship", Version.Parse("1.1.4"), (CompatibilityLevel)0, (VersionStrictness)0); } } [BepInPlugin("butterystancakes.lethalcompany.snowyholidaydropship", "Snowy Holiday Dropship", "1.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.snowyholidaydropship"; internal const string PLUGIN_NAME = "Snowy Holiday Dropship"; internal const string PLUGIN_VERSION = "1.1.4"; internal static ManualLogSource Logger; private const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility"; public static ConfigEntry<float> configSnowyChance; public static ConfigEntry<float> configNormalChance; public static ConfigEntry<float> configLegacyChance; private void Awake() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected"); LobbyCompatibility.Init(); } AcceptableValueRange<float> val = new AcceptableValueRange<float>(0f, 1f); string text = " (0 = never, 1 = guaranteed, or anything in between - 0.5 = 50% chance)"; configSnowyChance = ((BaseUnityPlugin)this).Config.Bind<float>("Random", "SnowyChance", 1f, new ConfigDescription("The percentage chance for the dropship to be holiday-themed on snowy moons." + text, (AcceptableValueBase)(object)val, Array.Empty<object>())); configNormalChance = ((BaseUnityPlugin)this).Config.Bind<float>("Random", "NormalChance", 0f, new ConfigDescription("The percentage chance for the dropship to be holiday-themed on normal moons." + text, (AcceptableValueBase)(object)val, Array.Empty<object>())); configLegacyChance = ((BaseUnityPlugin)this).Config.Bind<float>("Random", "LegacyChance", 0f, new ConfigDescription("The percentage chance for the normal dropship to use the old music, showcased in an early teaser video." + text, (AcceptableValueBase)(object)val, Array.Empty<object>())); new Harmony("butterystancakes.lethalcompany.snowyholidaydropship").PatchAll(); Logger.LogInfo((object)"Snowy Holiday Dropship v1.1.4 loaded"); } } public static class PluginInfo { public const string PLUGIN_GUID = "SnowyHolidayDropship"; public const string PLUGIN_NAME = "SnowyHolidayDropship"; public const string PLUGIN_VERSION = "1.1.4"; } } namespace SnowyHolidayDropship.Patches { [HarmonyPatch] internal class SnowyHolidayDropshipPatches { [HarmonyPatch(typeof(ItemDropship), "Start")] [HarmonyPostfix] public static void ItemDropshipPostStart(ItemDropship __instance) { DropshipDecorator.Init(__instance); } [HarmonyPatch(typeof(ItemDropship), "LandShipClientRpc")] [HarmonyPostfix] public static void PostLandShipClientRpc() { DropshipDecorator.RedecorateDropship(); } [HarmonyPatch(typeof(ItemDropship), "ShipLeave")] [HarmonyPatch(typeof(ItemDropship), "FinishDeliveringVehicleClientRpc")] [HarmonyPostfix] public static void ItemDropshipPostShipLeave() { DropshipDecorator.DropshipLeave(); } [HarmonyPatch(typeof(ItemDropship), "DeliverVehicleClientRpc")] [HarmonyPostfix] public static void PostDeliverVehicleClientRpc() { DropshipDecorator.RedecorateDropship(vehicle: true); } } }