Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HalloweenTheme v1.2.0
com.github.zehsteam.HalloweenTheme.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using com.github.zehsteam.HalloweenTheme.Data; using com.github.zehsteam.HalloweenTheme.Dependencies; using com.github.zehsteam.HalloweenTheme.MonoBehaviours; using com.github.zehsteam.HalloweenTheme.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.zehsteam.HalloweenTheme")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Reskin mod for vanilla moons, enemies, scrap, and equipment to make them more spooky. (11 moons, 1 enemy, 37 scrap, 2 equipment)")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+93c2dfe0e047f5b124fb992bea25533204622dd2")] [assembly: AssemblyProduct("HalloweenTheme")] [assembly: AssemblyTitle("com.github.zehsteam.HalloweenTheme")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace com.github.zehsteam.HalloweenTheme { internal static class ConfigHelper { public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>()))); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { if (acceptableValues == null) { LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart); } else { LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart); } } return configEntry; } public static void AddButton(string section, string name, string description, string buttonText, Action callback) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton(section, name, description, buttonText, callback); } } } internal class ConfigManager { public ConfigEntry<bool> ExtendedLogging { get; private set; } public ConfigManager() { BindConfigs(); } private void BindConfigs() { ConfigHelper.SkipAutoGen(); ExtendedLogging = ConfigHelper.Bind("General", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging."); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal static class Content { public static HalloweenAssets HalloweenAssets { get; private set; } public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { AssetBundle val = LoadAssetBundle("halloweentheme_assets"); if (!((Object)(object)val == (Object)null)) { HalloweenAssets = LoadAssetFromAssetBundle<HalloweenAssets>(val, "HalloweenAssets"); Plugin.Logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } } private static AssetBundle LoadAssetBundle(string fileName) { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, fileName); return AssetBundle.LoadFromFile(text); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to load AssetBundle \"{fileName}\". {arg}"); } return null; } private static T LoadAssetFromAssetBundle<T>(AssetBundle assetBundle, string name) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Plugin.Logger.LogError((object)"Failed to load asset from AssetBundle. Name is null or whitespace."); return default(T); } if ((Object)(object)assetBundle == (Object)null) { Plugin.Logger.LogError((object)("Failed to load asset \"" + name + "\" from AssetBundle. AssetBundle is null.")); return default(T); } T val = assetBundle.LoadAsset<T>(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)("Failed to load asset \"" + name + "\" from AssetBundle. Asset is null.")); return default(T); } return val; } } internal static class ItemHelper { public static Item GetItemByName(string itemName) { foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName.Equals(itemName)) { return items; } } return null; } public static void SetItemProperties(string itemName, ItemProperties itemProperties) { Item itemByName = GetItemByName(itemName); if ((Object)(object)itemByName == (Object)null) { Plugin.Logger.LogError((object)("Failed to set item properties for \"" + itemName + "\". Could not find item.")); } else { SetItemProperties(itemByName, itemProperties); } } public static void SetItemProperties(Item item, ItemProperties itemProperties) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { Plugin.Logger.LogError((object)"Failed to set item properties. Item is null."); return; } if (itemProperties == null) { Plugin.Logger.LogError((object)("Failed to set item properties for \"" + item.itemName + "\". ItemProperties is null.")); return; } if ((Object)(object)itemProperties.GrabSFX != (Object)null) { item.grabSFX = itemProperties.GrabSFX; } if ((Object)(object)itemProperties.DropSFX != (Object)null) { item.dropSFX = itemProperties.DropSFX; } if ((Object)(object)itemProperties.PocketSFX != (Object)null) { item.pocketSFX = itemProperties.PocketSFX; } if ((Object)(object)itemProperties.ThrowSFX != (Object)null) { item.throwSFX = itemProperties.ThrowSFX; } item.verticalOffset = itemProperties.VerticalOffset; item.floorYOffset = itemProperties.FloorYOffset; item.allowDroppingAheadOfPlayer = itemProperties.AllowDroppingAheadOfPlayer; item.restingRotation = itemProperties.RestingRotation; item.rotationOffset = itemProperties.RotationOffset; item.positionOffset = itemProperties.PositionOffset; Plugin.Instance.LogInfoExtended("Set item properties for \"" + item.itemName + "\"."); } } internal static class LevelHelper { private static bool _spawnedHalloweenLevelPrefab; public static string PlanetName => StartOfRound.Instance.currentLevel.PlanetName; public static LevelWeatherType CurrentWeather => StartOfRound.Instance.currentLevel.currentWeather; public static int RandomMapSeed => StartOfRound.Instance.randomMapSeed; public static void Reset() { _spawnedHalloweenLevelPrefab = false; } public static void OnLevelLoaded() { if (!_spawnedHalloweenLevelPrefab) { _spawnedHalloweenLevelPrefab = true; SpawnHalloweenLevelPrefab(); } } private static void SpawnHalloweenLevelPrefab() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) MoonReskinData moonReskinData = Content.HalloweenAssets.GetMoonReskinData(PlanetName); if (moonReskinData != null && moonReskinData.ConfigData.Enabled.Value) { GameObject val = GameObject.Find("Environment"); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"Failed to spawn halloween level prefab. Environment GameObject could not be found."); return; } GameObject val2 = Object.Instantiate<GameObject>(moonReskinData.Prefab, val.transform); val2.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); Plugin.Instance.LogInfoExtended("Spawned halloween level prefab \"" + ((Object)moonReskinData.Prefab).name + "\"."); } } public static EntranceTeleport GetEntranceTeleport(int entranceId, bool isEntranceToBuilding = true) { EntranceTeleport[] array = Object.FindObjectsByType<EntranceTeleport>((FindObjectsSortMode)0); foreach (EntranceTeleport val in array) { if ((!isEntranceToBuilding || val.isEntranceToBuilding) && val.entranceId == entranceId) { return val; } } return null; } } internal static class PlayerUtils { public static PlayerControllerB GetLocalPlayerScript() { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return null; } return GameNetworkManager.Instance.localPlayerController; } public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)playerScript == (Object)(object)GetLocalPlayerScript(); } } [BepInPlugin("com.github.zehsteam.HalloweenTheme", "HalloweenTheme", "1.2.0")] internal class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.github.zehsteam.HalloweenTheme"); internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static ConfigManager ConfigManager { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = Logger.CreateLogSource("com.github.zehsteam.HalloweenTheme"); Logger.LogInfo((object)"HalloweenTheme has awoken!"); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(FlashlightItemPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); ConfigManager = new ConfigManager(); Content.Load(); Content.HalloweenAssets.Initialize(); } public void OnLevelLoaded() { LevelHelper.OnLevelLoaded(); } public void OnShipHasLeft() { LevelHelper.Reset(); } public void OnLocalDisconnect() { LevelHelper.Reset(); } public void LogInfoExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { Logger.LogInfo(data); } } } internal static class Utils { public static bool RandomPercent(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f < percent; } public static bool RandomPercent(float percent, Random random) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return random.NextDouble() * 100.0 < (double)percent; } public static void DisableGameObject(string name) { GameObject val = GameObject.Find(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Failed to disable GameObject \"" + name + "\". GameObject could not be found.")); } else { val.SetActive(false); } } public static void HideGameObject(string name, bool disableColliders = true) { GameObject val = GameObject.Find(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Failed to hide GameObject \"" + name + "\". GameObject could not be found.")); } else { HideGameObject(val, disableColliders); } } public static void HideGameObject(GameObject gameObject, bool disableColliders = true) { if ((Object)(object)gameObject == (Object)null) { Plugin.Logger.LogWarning((object)"Failed to hide GameObject. GameObject could not be found."); return; } Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); foreach (Renderer renderer in componentsInChildren) { DisableRenderer(renderer); } if (disableColliders) { DisableColliders(gameObject); } } public static void DisableColliders(string name) { GameObject val = GameObject.Find(name); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Failed to disable colliders on GameObject \"" + name + "\". GameObject could not be found.")); } else { DisableColliders(val); } } public static void DisableColliders(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { Plugin.Logger.LogWarning((object)"Failed to disable colliders on GameObject. GameObject is null."); return; } Collider[] componentsInChildren = gameObject.GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { if (!IgnoreCollider(val)) { val.enabled = false; } } } public static bool IgnoreCollider(Collider collider) { if (collider.isTrigger) { return true; } if (((Component)collider).gameObject.CompareTag("InteractTrigger")) { return true; } if (((Component)collider).gameObject.layer == LayerMask.GetMask(new string[1] { "InteractableObject" })) { return true; } if (((Component)collider).gameObject.layer == LayerMask.GetMask(new string[1] { "Trigger" })) { return true; } return false; } public static void DisableRenderer(Renderer renderer) { if (!((Object)(object)renderer == (Object)null)) { renderer.enabled = false; } } public static void EnableRenderer(Renderer renderer) { if (!((Object)(object)renderer == (Object)null)) { renderer.enabled = true; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.HalloweenTheme"; public const string PLUGIN_NAME = "HalloweenTheme"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace com.github.zehsteam.HalloweenTheme.Patches { [HarmonyPatch(typeof(EnemyAI))] internal static class EnemyAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref EnemyAI __instance) { SetEnemyReskin(__instance); } private static void SetEnemyReskin(EnemyAI enemyAI) { if (!((Object)(object)enemyAI == (Object)null) && !((Object)(object)enemyAI.enemyType == (Object)null) && Content.HalloweenAssets.TryGetEnemyReskinData(enemyAI.enemyType.enemyName, out var enemyReskinData) && enemyReskinData.ConfigData.Enabled.Value) { Object.Instantiate<GameObject>(enemyReskinData.Prefab, ((Component)enemyAI).transform); } } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] private static bool ItemActivatePatch(ref FlashlightItem __instance, bool used) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) FlashlightReskin componentInChildren = ((Component)__instance).GetComponentInChildren<FlashlightReskin>(); if ((Object)(object)componentInChildren == (Object)null) { return true; } AudioClip val = (used ? componentInChildren.TurnOnSFX : componentInChildren.TurnOffSFX); if ((Object)(object)val == (Object)null) { return true; } if (__instance.flashlightInterferenceLevel < 2) { __instance.SwitchFlashlight(used); } __instance.flashlightAudio.PlayOneShot(val); RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 7f, 0.4f, 0, ((GrabbableObject)__instance).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); return false; } [HarmonyPatch("EquipItem")] [HarmonyPostfix] private static void EquipItemPatch(ref FlashlightItem __instance) { if (!((NetworkBehaviour)__instance).IsOwner && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && ((GrabbableObject)__instance).isBeingUsed) { FlashlightReskin componentInChildren = ((Component)__instance).GetComponentInChildren<FlashlightReskin>(); if (!((Object)(object)componentInChildren == (Object)null) && componentInChildren.IsTorch) { ((GrabbableObject)__instance).playerHeldBy.ChangeHelmetLight(__instance.flashlightTypeID, false); ((Behaviour)__instance.flashlightBulb).enabled = true; } } } [HarmonyPatch("SwitchFlashlight")] [HarmonyPostfix] private static void SwitchFlashlightPatch(ref FlashlightItem __instance, bool on) { FlashlightReskin componentInChildren = ((Component)__instance).GetComponentInChildren<FlashlightReskin>(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.SwitchFlashlight(on); if (!((NetworkBehaviour)__instance).IsOwner && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((GrabbableObject)__instance).isPocketed && componentInChildren.IsTorch) { ((GrabbableObject)__instance).playerHeldBy.ChangeHelmetLight(__instance.flashlightTypeID, false); ((Behaviour)__instance.flashlightBulb).enabled = on; } } } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref GrabbableObject __instance) { if (!((Object)(object)__instance.itemProperties == (Object)null) && Content.HalloweenAssets.TryGetItemReskinData(__instance.itemProperties.itemName, out var itemReskinData) && itemReskinData.ConfigData.Enabled.Value) { Object.Instantiate<GameObject>(itemReskinData.Prefab, ((Component)__instance).transform); } } [HarmonyPatch("EnableItemMeshes")] [HarmonyPostfix] private static void EnableItemMeshesPatch(ref GrabbableObject __instance) { ItemReskin componentInChildren = ((Component)__instance).GetComponentInChildren<ItemReskin>(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.HideOriginalModel(); } } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPatch() { Plugin.Instance.OnLevelLoaded(); } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { private static bool _initializedCustomAssets; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { InitializeCustomAssets(); } private static void InitializeCustomAssets() { if (!_initializedCustomAssets) { _initializedCustomAssets = true; ReplaceSpawnableOutsideObjects(); ApplyItemReskinData(); } } private static void ReplaceSpawnableOutsideObjects() { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel selectableLevel in levels) { ReplaceSpawnableOutsideObjectsForLevel(selectableLevel); } } private static void ReplaceSpawnableOutsideObjectsForLevel(SelectableLevel selectableLevel) { List<SpawnableOutsideObjectWithRarity> list = Content.HalloweenAssets.DefaultSpawnableOutsideObjects; if (Content.HalloweenAssets.TryGetMoonReskinData(LevelHelper.PlanetName, out var moonReskinData)) { list = moonReskinData.SpawnableOutsideObjects; } foreach (SpawnableOutsideObjectWithRarity item in list) { bool flag = false; for (int i = 0; i < selectableLevel.spawnableOutsideObjects.Length; i++) { if (((Object)selectableLevel.spawnableOutsideObjects[i].spawnableObject).name == ((Object)item.spawnableObject).name) { flag = true; selectableLevel.spawnableOutsideObjects[i] = item; break; } } if (!flag) { CollectionExtensions.AddItem<SpawnableOutsideObjectWithRarity>((IEnumerable<SpawnableOutsideObjectWithRarity>)selectableLevel.spawnableOutsideObjects, item); Plugin.Instance.LogInfoExtended("Added missing SpawnableOutsideObject \"" + ((Object)item.spawnableObject).name + "\" to level \"" + selectableLevel.PlanetName + "\"."); } } Plugin.Instance.LogInfoExtended("Replaced SpawnableOutsideObjects for level \"" + selectableLevel.PlanetName + "\"."); } private static void ApplyItemReskinData() { foreach (ItemReskinData itemReskinData in Content.HalloweenAssets.ItemReskinDataList) { if ((Object)(object)itemReskinData.Prefab == (Object)null || !itemReskinData.ConfigData.Enabled.Value) { continue; } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (!(items.itemName != itemReskinData.ItemName)) { ItemReskin component = itemReskinData.Prefab.GetComponent<ItemReskin>(); if (!((Object)(object)component == (Object)null) && component.ItemProperties != null && component.ItemProperties.Enabled) { ItemHelper.SetItemProperties(items, component.ItemProperties.ToItemProperties()); } } } } } [HarmonyPatch("ShipHasLeft")] [HarmonyPostfix] private static void ShipHasLeftPatch() { Plugin.Instance.OnShipHasLeft(); } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPostfix] private static void OnLocalDisconnectPatch() { Plugin.Instance.OnLocalDisconnect(); } } } namespace com.github.zehsteam.HalloweenTheme.MonoBehaviours { public class AnimatedItemReskin : ItemReskin { [Space(20f)] [Header("Animated")] [Space(5f)] public Animator Animator; public override void LateStart() { base.LateStart(); SetAnimator(); } private void SetAnimator() { if (!((Object)(object)base.GrabbableObject == (Object)null) && !((Object)(object)Animator == (Object)null)) { GrabbableObject grabbableObject = base.GrabbableObject; AnimatedItem val = (AnimatedItem)(object)((grabbableObject is AnimatedItem) ? grabbableObject : null); if (!((Object)(object)val == (Object)null)) { val.itemAnimator = Animator; } } } } public class CustomEntranceTeleport : MonoBehaviour { public bool IsEntranceToBuilding = true; public int EntranceId; public Transform EntrancePoint; private void Start() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) EntranceTeleport entranceTeleport = LevelHelper.GetEntranceTeleport(EntranceId, IsEntranceToBuilding); if ((Object)(object)entranceTeleport == (Object)null) { Plugin.Logger.LogError((object)$"Failed to set custom entrance teleport. EntranceTeleport is null. (EntranceId: {EntranceId}, IsEntranceToBuilding: {IsEntranceToBuilding})"); return; } ((Component)entranceTeleport).transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); ((Component)entranceTeleport).transform.localScale = ((Component)this).transform.localScale; entranceTeleport.entrancePoint.SetPositionAndRotation(EntrancePoint.position, EntrancePoint.rotation); Utils.HideGameObject(((Component)this).gameObject); Plugin.Instance.LogInfoExtended($"Successfully set custom entrance teleport. (EntranceId: {EntranceId}, IsEntranceToBuilding: {IsEntranceToBuilding})"); } } public class FlashlightReskin : ItemReskin { [Space(20f)] [Header("Flashlight")] [Space(5f)] public Light Light; public AudioClip TurnOnSFX; public AudioClip TurnOffSFX; public bool IsTorch; public float FlickerSpeed = 1.5f; public float IntensityMultiplier = 0.4f; public AudioSource TorchBurnAudio; private Coroutine _playTorchBurnAudioAfterDelayCoroutine; public FlashlightItem FlashlightItem { get; private set; } public float InitialLightIntensity { get; private set; } public override void Start() { base.Start(); if (!((Object)(object)Light == (Object)null)) { InitialLightIntensity = Light.intensity; ((Behaviour)Light).enabled = false; } } public override void LateStart() { base.LateStart(); if (!((Object)(object)base.GrabbableObject == (Object)null)) { GrabbableObject grabbableObject = base.GrabbableObject; FlashlightItem = (FlashlightItem)(object)((grabbableObject is FlashlightItem) ? grabbableObject : null); if (!((Object)(object)FlashlightItem == (Object)null)) { SetLight(); } } } private void Update() { if (!((Object)(object)FlashlightItem == (Object)null) && !((Object)(object)Light == (Object)null) && IsTorch) { Torch_Update(); } } private void Torch_Update() { if ((Object)(object)TorchBurnAudio != (Object)null) { TorchBurnAudio.mute = ((GrabbableObject)FlashlightItem).isPocketed; } if (((GrabbableObject)FlashlightItem).isBeingUsed) { float num = Mathf.PerlinNoise(Time.time * FlickerSpeed, 0f); Light.intensity = Mathf.Lerp(InitialLightIntensity * (1f - IntensityMultiplier), InitialLightIntensity * (1f + IntensityMultiplier), num); } } private void SetLight() { if (!((Object)(object)FlashlightItem == (Object)null) && !((Object)(object)Light == (Object)null)) { FlashlightItem.initialIntensity = InitialLightIntensity; if ((Object)(object)FlashlightItem.flashlightBulb != (Object)null) { ((Behaviour)FlashlightItem.flashlightBulb).enabled = false; } if ((Object)(object)FlashlightItem.flashlightBulbGlow != (Object)null) { ((Component)FlashlightItem.flashlightBulbGlow).gameObject.SetActive(false); } FlashlightItem.flashlightBulb = Light; } } public void SwitchFlashlight(bool on) { if (!((Object)(object)TorchBurnAudio == (Object)null) && IsTorch) { if (_playTorchBurnAudioAfterDelayCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_playTorchBurnAudioAfterDelayCoroutine); } if (on) { _playTorchBurnAudioAfterDelayCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayTorchBurnAudioAfterDelay(0.8f)); } else { TorchBurnAudio.Stop(); } } } private IEnumerator PlayTorchBurnAudioAfterDelay(float time) { yield return (object)new WaitForSeconds(time); TorchBurnAudio.Play(); } } public class ItemReskin : MonoBehaviour { [Header("Transform")] [Space(5f)] public Vector3 Position; public Vector3 Rotation; public Vector3 Scale = Vector3.one; [Space(10f)] public ItemReskinScanNodeProperties ScanNodeProperties; [Space(10f)] public ItemReskinItemProperties ItemProperties; [Space(10f)] public ItemReskinBoxColliderProperties MainBoxColliderProperties; [Space(10f)] public ItemReskinTransformProperties ScanNodeTransformProperties; [Space(10f)] public ItemReskinBoxColliderProperties ScanNodeBoxColliderProperties; public GrabbableObject GrabbableObject { get; private set; } public virtual void Start() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) if ((Object)(object)((Component)this).transform.parent == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } GrabbableObject grabbableObject = default(GrabbableObject); if (!((Component)((Component)this).transform.parent).TryGetComponent<GrabbableObject>(ref grabbableObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } GrabbableObject = grabbableObject; ((Component)this).transform.SetLocalPositionAndRotation(Position, Quaternion.Euler(Rotation)); ((Component)this).transform.localScale = Scale; ((MonoBehaviour)this).StartCoroutine(LateStartCoroutine()); } private IEnumerator LateStartCoroutine() { yield return null; LateStart(); } public virtual void LateStart() { HideOriginalModel(); SetItemProperties(); SetScanNodeProperties(); SetMainBoxColliderProperties(); SetScanNodeTransformProperties(); SetScanNodeBoxColliderProperties(); } public void HideOriginalModel() { if ((Object)(object)GrabbableObject == (Object)null) { return; } Renderer[] components = ((Component)GrabbableObject).GetComponents<Renderer>(); foreach (Renderer renderer in components) { Utils.DisableRenderer(renderer); } for (int j = 0; j < ((Component)GrabbableObject).transform.childCount; j++) { if (!((Object)(object)((Component)GrabbableObject).transform.GetChild(j) == (Object)(object)((Component)this).transform)) { Renderer[] componentsInChildren = ((Component)((Component)GrabbableObject).transform.GetChild(j)).GetComponentsInChildren<Renderer>(); foreach (Renderer renderer2 in componentsInChildren) { Utils.DisableRenderer(renderer2); } } } } private void SetItemProperties() { if (!((Object)(object)GrabbableObject == (Object)null) && ItemProperties != null && ItemProperties.Enabled) { ItemHelper.SetItemProperties(GrabbableObject.itemProperties, ItemProperties.ToItemProperties()); } } private void SetScanNodeProperties() { if (!((Object)(object)GrabbableObject == (Object)null) && ScanNodeProperties != null && !string.IsNullOrWhiteSpace(ScanNodeProperties.HeaderText)) { ScanNodeProperties componentInChildren = ((Component)GrabbableObject).GetComponentInChildren<ScanNodeProperties>(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.headerText = ScanNodeProperties.HeaderText; } } } private void SetMainBoxColliderProperties() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GrabbableObject == (Object)null) && MainBoxColliderProperties != null && MainBoxColliderProperties.Enabled) { BoxCollider component = ((Component)GrabbableObject).GetComponent<BoxCollider>(); if (!((Object)(object)component == (Object)null)) { component.center = MainBoxColliderProperties.Center; component.size = MainBoxColliderProperties.Size; } } } private void SetScanNodeTransformProperties() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) if (!((Object)(object)GrabbableObject == (Object)null) && ScanNodeTransformProperties != null && ScanNodeTransformProperties.Enabled) { ScanNodeProperties componentInChildren = ((Component)GrabbableObject).GetComponentInChildren<ScanNodeProperties>(); if (!((Object)(object)componentInChildren == (Object)null)) { ((Component)componentInChildren).transform.SetLocalPositionAndRotation(ScanNodeTransformProperties.Position, Quaternion.Euler(ScanNodeTransformProperties.Rotation)); ((Component)componentInChildren).transform.localScale = ScanNodeTransformProperties.Scale; } } } private void SetScanNodeBoxColliderProperties() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GrabbableObject == (Object)null || ScanNodeBoxColliderProperties == null || !ScanNodeBoxColliderProperties.Enabled) { return; } ScanNodeProperties componentInChildren = ((Component)GrabbableObject).GetComponentInChildren<ScanNodeProperties>(); if (!((Object)(object)componentInChildren == (Object)null)) { BoxCollider component = ((Component)componentInChildren).GetComponent<BoxCollider>(); if (!((Object)(object)component == (Object)null)) { component.center = ScanNodeBoxColliderProperties.Center; component.size = ScanNodeBoxColliderProperties.Size; } } } } [Serializable] public class ItemReskinScanNodeProperties { public string HeaderText; } [Serializable] public class ItemReskinItemProperties { public bool Enabled; [Space(10f)] public AudioClip GrabSFX; public AudioClip DropSFX; public AudioClip PocketSFX; public AudioClip ThrowSFX; public float VerticalOffset; public int FloorYOffset; public bool AllowDroppingAheadOfPlayer = true; public Vector3 RestingRotation; public Vector3 RotationOffset; public Vector3 PositionOffset; public ItemProperties ToItemProperties() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) return new ItemProperties(GrabSFX, DropSFX, PocketSFX, ThrowSFX, VerticalOffset, FloorYOffset, AllowDroppingAheadOfPlayer, RestingRotation, RotationOffset, PositionOffset); } } [Serializable] public class ItemReskinBoxColliderProperties { public bool Enabled; [Space(10f)] public Vector3 Center; public Vector3 Size = Vector3.one; } [Serializable] public class ItemReskinTransformProperties { public bool Enabled; [Space(10f)] public Vector3 Position; public Vector3 Rotation; public Vector3 Scale = Vector3.one; } public class LampReskin : ItemReskin { [Space(20f)] [Header("Lamp")] [Space(5f)] public Color Color; [Space(10f)] public ItemReskinTransformProperties LightTransformProperties; public override void LateStart() { base.LateStart(); SetLightColor(); SetLightTransformProperties(); } private void SetLightColor() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.GrabbableObject == (Object)null)) { Light componentInChildren = ((Component)base.GrabbableObject).GetComponentInChildren<Light>(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.color = Color; } } } private void SetLightTransformProperties() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) if (!((Object)(object)base.GrabbableObject == (Object)null) && LightTransformProperties != null && LightTransformProperties.Enabled) { Light componentInChildren = ((Component)base.GrabbableObject).GetComponentInChildren<Light>(); if (!((Object)(object)componentInChildren == (Object)null)) { ((Component)componentInChildren).transform.SetLocalPositionAndRotation(LightTransformProperties.Position, Quaternion.Euler(LightTransformProperties.Rotation)); ((Component)componentInChildren).transform.localScale = LightTransformProperties.Scale; } } } } public class LevelManager : MonoBehaviour { public NavMeshData NavMeshData; public GameObject BrightDayPrefab; public string[] ObjectsToDisable = Array.Empty<string>(); private void Start() { DisableObjects(); SetNavMeshData(); SetBrightDay(); } private void SetNavMeshData() { if (!((Object)(object)NavMeshData == (Object)null)) { NavMeshSurface navMeshSurface = GetNavMeshSurface(); if ((Object)(object)navMeshSurface == (Object)null) { Plugin.Logger.LogError((object)"Failed to set NavMeshData. NavMeshSurface is null."); return; } navMeshSurface.navMeshData = NavMeshData; navMeshSurface.BuildNavMesh(); Plugin.Instance.LogInfoExtended("Successfully set NavMeshData."); } } private void DisableObjects() { if (ObjectsToDisable.Length != 0) { string[] objectsToDisable = ObjectsToDisable; foreach (string name in objectsToDisable) { Utils.DisableGameObject(name); } } } private void SetBrightDay() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)BrightDayPrefab == (Object)null) { return; } MoonReskinData moonReskinData = Content.HalloweenAssets.GetMoonReskinData(LevelHelper.PlanetName); if (moonReskinData == null || moonReskinData.DisableWeatherOverride || !moonReskinData.ConfigData.OverrideWeather.Value || (int)LevelHelper.CurrentWeather == 3 || !Utils.RandomPercent(moonReskinData.ConfigData.OverrideWeatherChance.Value, new Random(LevelHelper.RandomMapSeed + 234))) { return; } GameObject val = GameObject.Find("Environment/Lighting"); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"Failed to set bright day prefab. Lighting GameObject could not be found."); return; } GameObject gameObject = ((Component)val.transform.Find("BrightDay")).gameObject; if ((Object)(object)gameObject == (Object)null) { Plugin.Logger.LogError((object)"Failed to set bright day prefab. BrightDay GameObject could not be found."); return; } gameObject.SetActive(false); GameObject val2 = Object.Instantiate<GameObject>(BrightDayPrefab, val.transform); val2.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); ((Object)val2).name = ((Object)val2).name.Replace("Clone", "").Trim(); ((Object)gameObject).name = ((Object)gameObject).name + " (Old)"; Plugin.Instance.LogInfoExtended("Set BrightDay from prefab."); } private static NavMeshSurface GetNavMeshSurface() { try { return GameObject.Find("Environment").GetComponentInChildren<NavMeshSurface>(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to get NavMeshSurface.\n\n{arg}"); } return null; } } public class SmartLight : MonoBehaviour { public Light Light; public bool DisableAfterMaxDistance = true; public float MaxDistance = 60f; private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Light == (Object)null) && DisableAfterMaxDistance) { PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript(); if (!((Object)(object)localPlayerScript == (Object)null)) { ((Behaviour)Light).enabled = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerScript).transform.position) <= MaxDistance; } } } } public class TulipSnakeReskin : MonoBehaviour { public GameObject ModelObject; public Vector3 Position; public Vector3 Rotation; public ParticleSystem ParticleSystem; private bool _isDead; public FlowerSnakeEnemy FlowerSnakeEnemy { get; private set; } private void Start() { //IL_005b: 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)((Component)this).transform.parent == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } FlowerSnakeEnemy flowerSnakeEnemy = default(FlowerSnakeEnemy); if (!((Component)((Component)this).transform.parent).TryGetComponent<FlowerSnakeEnemy>(ref flowerSnakeEnemy)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } FlowerSnakeEnemy = flowerSnakeEnemy; ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); HideOriginalModel(); SetModelParent(); } private void HideOriginalModel() { if (!((Object)(object)FlowerSnakeEnemy == (Object)null) && !((Object)(object)ModelObject == (Object)null)) { SkinnedMeshRenderer[] componentsInChildren = ((Component)FlowerSnakeEnemy).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { ((Renderer)val).enabled = false; } } } private void SetModelParent() { //IL_0086: 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_0091: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)FlowerSnakeEnemy == (Object)null || (Object)(object)ModelObject == (Object)null) { return; } try { Transform parent = ((Component)FlowerSnakeEnemy).transform.Find("FlowerLizardModel").Find("AnimContainer").Find("Armature") .Find("Belly") .Find("LowerChest"); ModelObject.transform.SetParent(parent); ModelObject.transform.SetLocalPositionAndRotation(Position, Quaternion.Euler(Rotation)); Plugin.Instance.LogInfoExtended("Set model parent."); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to set model parent. {arg}"); } } private void Update() { if (!((Object)(object)FlowerSnakeEnemy == (Object)null) && ((EnemyAI)FlowerSnakeEnemy).isEnemyDead && !_isDead) { _isDead = true; OnDeath(); } } private void OnDeath() { if (!((Object)(object)ParticleSystem == (Object)null)) { ParticleSystem.Stop(); } } } } namespace com.github.zehsteam.HalloweenTheme.Dependencies { internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SkipAutoGen() { LethalConfigManager.SkipAutoGen(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig<T>(ConfigEntry<T> configEntry, bool requiresRestart = false) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (!(configEntry is ConfigEntry<string> val)) { if (!(configEntry is ConfigEntry<bool> val2)) { if (!(configEntry is ConfigEntry<float> val3)) { if (!(configEntry is ConfigEntry<int> val4)) { throw new NotSupportedException($"Unsupported type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigSlider<T>(ConfigEntry<T> configEntry, bool requiresRestart = false) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!(configEntry is ConfigEntry<float> val)) { if (!(configEntry is ConfigEntry<int> val2)) { throw new NotSupportedException($"Slider not supported for type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddButton(string section, string name, string description, string buttonText, Action callback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { callback?.Invoke(); })); } } } namespace com.github.zehsteam.HalloweenTheme.Data { [Serializable] public class EnemyReskinConfigData { public EnemyReskinConfigDataDefault DefaultValues { get; private set; } public ConfigEntry<bool> Enabled { get; private set; } public EnemyReskinData EnemyReskinData { get; private set; } public EnemyReskinConfigData() { DefaultValues = new EnemyReskinConfigDataDefault(); } public EnemyReskinConfigData(EnemyReskinConfigDataDefault defaultValues) { DefaultValues = defaultValues; } public void BindConfigs(EnemyReskinData enemyReskinData) { if (DefaultValues == null) { EnemyReskinConfigDataDefault enemyReskinConfigDataDefault2 = (DefaultValues = new EnemyReskinConfigDataDefault()); } if (enemyReskinData != null) { EnemyReskinData = enemyReskinData; string section = "Enemy Reskins"; Enabled = ConfigHelper.Bind(section, EnemyReskinData.EnemyName + " | Enabled", DefaultValues.Enabled, requiresRestart: false, "Enable " + EnemyReskinData.EnemyName + " reskin."); } } } [Serializable] public class EnemyReskinConfigDataDefault { public bool Enabled = true; public EnemyReskinConfigDataDefault() { } public EnemyReskinConfigDataDefault(bool enabled) { Enabled = enabled; } } [Serializable] public class EnemyReskinData { public string EnemyName; public GameObject Prefab; public EnemyReskinConfigData ConfigData { get; private set; } public EnemyReskinData(string enemyName, GameObject prefab, EnemyReskinConfigDataDefault defaultConfigValues = null) { EnemyName = enemyName; Prefab = prefab; ConfigData = new EnemyReskinConfigData(defaultConfigValues); } public void BindConfigs() { if (ConfigData == null) { EnemyReskinConfigData enemyReskinConfigData2 = (ConfigData = new EnemyReskinConfigData()); } ConfigData.BindConfigs(this); } } [CreateAssetMenu(fileName = "HalloweenAssets", menuName = "HalloweenTheme/HalloweenAssets")] public class HalloweenAssets : ScriptableObject { public List<MoonReskinData> MoonReskinDataList = new List<MoonReskinData>(); public List<ItemReskinData> ItemReskinDataList = new List<ItemReskinData>(); public List<EnemyReskinData> EnemyReskinDataList = new List<EnemyReskinData>(); public List<SpawnableOutsideObjectWithRarity> DefaultSpawnableOutsideObjects = new List<SpawnableOutsideObjectWithRarity>(); internal void Initialize() { foreach (ItemReskinData itemReskinData in ItemReskinDataList) { itemReskinData.BindConfigs(); } foreach (EnemyReskinData enemyReskinData in EnemyReskinDataList) { enemyReskinData.BindConfigs(); } foreach (MoonReskinData moonReskinData in MoonReskinDataList) { moonReskinData.BindConfigs(); } } public MoonReskinData GetMoonReskinData(string planetName) { if (string.IsNullOrWhiteSpace(planetName)) { return null; } foreach (MoonReskinData moonReskinData in MoonReskinDataList) { if ((Object)(object)moonReskinData.Prefab == (Object)null || !(moonReskinData.PlanetName == planetName)) { continue; } return moonReskinData; } return null; } public bool TryGetMoonReskinData(string planetName, out MoonReskinData moonReskinData) { moonReskinData = GetMoonReskinData(planetName); return moonReskinData != null; } public ItemReskinData GetItemReskinData(string itemName) { if (string.IsNullOrWhiteSpace(itemName)) { return null; } foreach (ItemReskinData itemReskinData in ItemReskinDataList) { if ((Object)(object)itemReskinData.Prefab == (Object)null || !(itemReskinData.ItemName == itemName)) { continue; } return itemReskinData; } return null; } public bool TryGetItemReskinData(string itemName, out ItemReskinData itemReskinData) { itemReskinData = GetItemReskinData(itemName); return itemReskinData != null; } public EnemyReskinData GetEnemyReskinData(string enemyName) { if (string.IsNullOrWhiteSpace(enemyName)) { return null; } foreach (EnemyReskinData enemyReskinData in EnemyReskinDataList) { if ((Object)(object)enemyReskinData.Prefab == (Object)null || !(enemyReskinData.EnemyName == enemyName)) { continue; } return enemyReskinData; } return null; } public bool TryGetEnemyReskinData(string enemyName, out EnemyReskinData enemyReskinData) { enemyReskinData = GetEnemyReskinData(enemyName); return enemyReskinData != null; } } public class ItemProperties { public AudioClip GrabSFX; public AudioClip DropSFX; public AudioClip PocketSFX; public AudioClip ThrowSFX; public float VerticalOffset; public int FloorYOffset; public bool AllowDroppingAheadOfPlayer; public Vector3 RestingRotation; public Vector3 RotationOffset; public Vector3 PositionOffset; public ItemProperties(AudioClip grabSFX, AudioClip dropSFX, AudioClip pocketSFX, AudioClip throwSFX, float verticalOffset, int floorYOffset, bool allowDroppingAheadOfPlayer, Vector3 restingRotation, Vector3 rotationOffset, Vector3 positionOffset) { //IL_003e: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) GrabSFX = grabSFX; DropSFX = dropSFX; PocketSFX = pocketSFX; ThrowSFX = throwSFX; VerticalOffset = verticalOffset; FloorYOffset = floorYOffset; AllowDroppingAheadOfPlayer = allowDroppingAheadOfPlayer; RestingRotation = restingRotation; RotationOffset = rotationOffset; PositionOffset = positionOffset; } public ItemProperties(Item item) { //IL_005e: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) GrabSFX = item.grabSFX; DropSFX = item.dropSFX; PocketSFX = item.pocketSFX; ThrowSFX = item.throwSFX; VerticalOffset = item.verticalOffset; FloorYOffset = item.floorYOffset; AllowDroppingAheadOfPlayer = item.allowDroppingAheadOfPlayer; RestingRotation = item.restingRotation; RotationOffset = item.rotationOffset; PositionOffset = item.positionOffset; } } [Serializable] public class ItemReskinConfigData { public ItemReskinConfigDataDefault DefaultValues { get; private set; } public ConfigEntry<bool> Enabled { get; private set; } public ItemReskinData ItemReskinData { get; private set; } public ItemReskinConfigData() { DefaultValues = new ItemReskinConfigDataDefault(); } public ItemReskinConfigData(ItemReskinConfigDataDefault defaultValues) { DefaultValues = defaultValues; } public void BindConfigs(ItemReskinData itemReskinData) { if (DefaultValues == null) { ItemReskinConfigDataDefault itemReskinConfigDataDefault2 = (DefaultValues = new ItemReskinConfigDataDefault()); } if (itemReskinData != null) { ItemReskinData = itemReskinData; string section = "Item Reskins"; Enabled = ConfigHelper.Bind(section, ItemReskinData.ItemName + " | Enabled", DefaultValues.Enabled, requiresRestart: true, "Enable " + ItemReskinData.ItemName + " reskin. (Requires a full game restart for changes to fully apply!)"); } } } [Serializable] public class ItemReskinConfigDataDefault { public bool Enabled = true; public ItemReskinConfigDataDefault() { } public ItemReskinConfigDataDefault(bool enabled) { Enabled = enabled; } } [Serializable] public class ItemReskinData { public string ItemName; public GameObject Prefab; public ItemReskinConfigData ConfigData { get; private set; } public ItemReskinData(string itemName, GameObject prefab, ItemReskinConfigDataDefault defaultConfigValues = null) { ItemName = itemName; Prefab = prefab; ConfigData = new ItemReskinConfigData(defaultConfigValues); } public void BindConfigs() { if (ConfigData == null) { ItemReskinConfigData itemReskinConfigData2 = (ConfigData = new ItemReskinConfigData()); } ConfigData.BindConfigs(this); } } [Serializable] public class MoonReskinConfigData { [field: SerializeField] public MoonReskinConfigDataDefault DefaultValues { get; private set; } public ConfigEntry<bool> Enabled { get; private set; } public ConfigEntry<bool> OverrideWeather { get; private set; } public ConfigEntry<float> OverrideWeatherChance { get; private set; } public MoonReskinData MoonReskinData { get; private set; } public MoonReskinConfigData(MoonReskinConfigDataDefault defaultValues = null) { DefaultValues = defaultValues; } public void BindConfigs(MoonReskinData moonReskinData) { if (DefaultValues == null) { MoonReskinConfigDataDefault moonReskinConfigDataDefault2 = (DefaultValues = new MoonReskinConfigDataDefault()); } if (moonReskinData != null) { MoonReskinData = moonReskinData; string section = MoonReskinData.PlanetName + " Reskin"; Enabled = ConfigHelper.Bind(section, "Enabled", DefaultValues.Enabled, requiresRestart: false, "Enable " + MoonReskinData.PlanetName + " reskin."); if (!MoonReskinData.DisableWeatherOverride) { OverrideWeather = ConfigHelper.Bind(section, "OverrideWeather", DefaultValues.OverrideWeather, requiresRestart: false, "If enabled, " + MoonReskinData.PlanetName + " will have a chance to have a custom dark and foggy weather applied based on OverrideWeatherChance."); OverrideWeatherChance = ConfigHelper.Bind(section, "OverrideWeatherChance", DefaultValues.OverrideWeatherChance, requiresRestart: false, "The percent chance a custom dark and foggy weather will be applied. (Requires OverrideWeather to be enabled)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f)); } } } } [Serializable] public class MoonReskinConfigDataDefault { public bool Enabled = true; public bool OverrideWeather = true; public float OverrideWeatherChance = 50f; public MoonReskinConfigDataDefault() { } public MoonReskinConfigDataDefault(bool enabled, bool overrideWeather, float overrideWeatherChance) { Enabled = enabled; OverrideWeather = overrideWeather; OverrideWeatherChance = overrideWeatherChance; } } [Serializable] public class MoonReskinData { public string PlanetName; public GameObject Prefab; public List<SpawnableOutsideObjectWithRarity> SpawnableOutsideObjects = new List<SpawnableOutsideObjectWithRarity>(); public bool DisableWeatherOverride; [field: SerializeField] public MoonReskinConfigData ConfigData { get; private set; } public MoonReskinData(string planetName, GameObject levelPrefab, List<SpawnableOutsideObjectWithRarity> spawnableOutsideObjects, MoonReskinConfigDataDefault defaultConfigValues = null) { PlanetName = planetName; Prefab = levelPrefab; SpawnableOutsideObjects = spawnableOutsideObjects; ConfigData = new MoonReskinConfigData(defaultConfigValues); } public void BindConfigs() { if (!string.IsNullOrWhiteSpace(PlanetName)) { if (ConfigData == null) { MoonReskinConfigData moonReskinConfigData2 = (ConfigData = new MoonReskinConfigData()); } ConfigData.BindConfigs(this); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }