Decompiled source of LightingTweaks v1.0.7
LightingTweaks.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak; using Photon.Pun; using TechnicalTweaks.Patches; using TechnicalTweaks.Patches.Mutations; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using Zorro.Core; [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("LightingTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a54034d029c7a67c2c94ed38ad5907a210391175")] [assembly: AssemblyProduct("LightingTweaks")] [assembly: AssemblyTitle("LightingTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } internal class BiomeMoonConfig { public string Key { get; set; } public BiomeType Biome { get; set; } public Color? MoonColorStart { get; set; } public Color? MoonColorMid { get; set; } public Color? MoonColorEnd { get; set; } public float? MoonIntensity { get; set; } public float? AmbientDarkness { get; set; } public float? BrightnessTarget { get; set; } public float? AmbienceStrengthTarget { get; set; } public float? AmbienceMin { get; set; } public float? DuskStart { get; set; } public float? NightStart { get; set; } public float? PeakStart { get; set; } public float? PeakEnd { get; set; } public float? NightEnd { get; set; } public float? DawnStart { get; set; } public bool HasCustomStart => MoonColorStart.HasValue; public bool HasCustomMid => MoonColorMid.HasValue; public bool HasCustomEnd => MoonColorEnd.HasValue; public bool HasCustomIntensity => MoonIntensity.HasValue; public bool HasCustomAmbient => AmbientDarkness.HasValue; } namespace TechnicalTweaks { [BepInPlugin("jill920.LightingTweaks", "Lighting Tweaks", "1.0.6")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; internal static ManualLogSource Log; internal static ConfigEntry<bool> ItemLight; internal static ConfigEntry<bool> KilnTweak; internal static ConfigEntry<bool> CitadelTweak; internal static ConfigEntry<bool> CitadelStairsTweak; internal static ConfigEntry<bool> MoonLightEnable; internal static float MoonIntensityMin = 0.015f; internal static float MoonIntensityMax = 4f; internal static ConfigEntry<bool> AmbientEnable; internal static BiomeMoonConfig[] BiomeConfigs = new BiomeMoonConfig[11] { new BiomeMoonConfig { Key = "SHORE", Biome = (BiomeType)0, MoonColorMid = new Color(0.6f, 0.7f, 1f, 0.7f), MoonIntensity = 1f, AmbienceStrengthTarget = 0.8f, AmbienceMin = 0.1f }, new BiomeMoonConfig { Key = "TROPICS", Biome = (BiomeType)1, MoonColorMid = new Color(0.7f, 0.9f, 1f, 1f), MoonIntensity = 1f, AmbienceStrengthTarget = 0.65f, AmbienceMin = 0.065f }, new BiomeMoonConfig { Key = "ALPINE", Biome = (BiomeType)2, MoonColorMid = new Color(0.5f, 0.8f, 1f, 1f), MoonIntensity = 4f, AmbienceStrengthTarget = 0.7f, AmbienceMin = 0.13f }, new BiomeMoonConfig { Key = "MESA", Biome = (BiomeType)6, MoonColorMid = new Color(0.8f, 0.8f, 0.55f, 1f), MoonIntensity = 3f, AmbienceStrengthTarget = 0.25f, AmbienceMin = 0.025f }, new BiomeMoonConfig { Key = "ROOTS", Biome = (BiomeType)7, MoonColorStart = new Color(0.15f, 0.09f, 0.2f, 0.15f), MoonColorMid = new Color(0.3f, 0.7f, 1f, 1f), MoonColorEnd = new Color(1f, 0.5f, 0.8f, 1f), MoonIntensity = 4f, AmbienceStrengthTarget = 0.75f, AmbienceMin = 0.05f }, new BiomeMoonConfig { Key = "GLOOM", Biome = (BiomeType)8, MoonColorMid = new Color(0.7f, 0.6f, 0.9f, 1f), MoonIntensity = 2f, AmbienceStrengthTarget = 0.8f, AmbienceMin = 0.02f }, new BiomeMoonConfig { Key = "THE CITADEL", Biome = (BiomeType)9, MoonColorStart = new Color(0.3f, 0.5f, 0.7f, 0f), MoonColorMid = new Color(0.5f, 0.8f, 1f, 0f), MoonColorEnd = new Color(0.3f, 0.5f, 0.7f, 0f), MoonIntensity = 0.1f, AmbienceStrengthTarget = 0.8f, AmbienceMin = 0.01f }, new BiomeMoonConfig { Key = "NADIR", Biome = (BiomeType)17, MoonColorStart = new Color(0.05f, 0.02f, 0.1f, 1f), MoonColorMid = new Color(0.1f, 0.05f, 0.3f, 1f), MoonColorEnd = new Color(0.05f, 0.02f, 0.1f, 1f), MoonIntensity = 5f, AmbienceStrengthTarget = 0.8f, AmbienceMin = 0.1f }, new BiomeMoonConfig { Key = "PEAK", Biome = (BiomeType)5, MoonColorMid = new Color(0.4f, 0.5f, 1f, 0f), MoonIntensity = 0f, AmbienceStrengthTarget = 0.8f, AmbienceMin = 0.1f }, new BiomeMoonConfig { Key = "CALDERA", Biome = (BiomeType)3, MoonColorMid = new Color(1f, 0.55f, 0.25f, 1f), MoonIntensity = 3f, AmbienceStrengthTarget = 0.7f, AmbienceMin = 0.13f }, new BiomeMoonConfig { Key = "THE KILN", Biome = (BiomeType)3, MoonColorMid = new Color(1f, 0.35f, 0.15f, 0.5f), MoonIntensity = 0.4f, AmbienceStrengthTarget = 0.1f, AmbienceMin = 0.02f } }; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("jill920.technicaltweaks"); ItemLight = ((BaseUnityPlugin)this).Config.Bind<bool>("Item Lights", "Enable", true, "Enable item light emission. Default: true"); KilnTweak = ((BaseUnityPlugin)this).Config.Bind<bool>("Biome Tweak", "Kiln", true, "Enable tweaks for Kiln (Needs reload). Default: true"); CitadelTweak = ((BaseUnityPlugin)this).Config.Bind<bool>("Biome Tweak", "Citadel", true, "Enable tweaks for Citadel (Needs reload). Default: true"); CitadelStairsTweak = ((BaseUnityPlugin)this).Config.Bind<bool>("Biome Tweak", "Citadel Stairs", false, "Enable tweaks for Citadel Stairs (Needs reload). Default: false"); MoonLightEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Moon Shadows", "Enable", true, "Enable Moon light at night. Default: true"); AmbientEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Ambient Darkness", "Enable", true, "Enable per-biome custom darkness. Default: true"); Log = ((BaseUnityPlugin)this).Logger; AssetBundleRegistry.Initialize(); SmokeMutations.Register(); FogSurfaceMutations.RegisterShaderRule(); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Technical Tweaks loaded successfully!"); } } } namespace TechnicalTweaks.Patches { [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class Airport_Start { [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name.Contains("Airport")) { AirportFix(); } } private static void AirportFix() { //IL_004a: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map/BL_Airport/Lights/Light (24)"); GameObject val2 = GameObject.Find("Map/BL_Airport/Lights/Light (25)"); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null)) { val.transform.rotation = Quaternion.Euler(300f, 90f, 0f); val.transform.localRotation = Quaternion.Euler(300f, 90f, 0f); val2.transform.rotation = Quaternion.Euler(300f, 90f, 270f); val2.transform.localRotation = Quaternion.Euler(300f, 90f, 0f); GameObject val3 = new GameObject("Light"); val3.transform.SetParent(val.transform, true); val3.transform.localPosition = new Vector3(0f, 0f, 0f); val3.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); GameObject val4 = new GameObject("Light"); val4.transform.SetParent(val2.transform, true); val4.transform.localPosition = new Vector3(0f, 0f, 0f); val4.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); Light val5 = val3.gameObject.AddComponent<Light>(); UniversalAdditionalLightData val6 = val3.gameObject.AddComponent<UniversalAdditionalLightData>(); val5.color = new Color(1f, 0.7f, 0.3f, 1f); val5.type = (LightType)0; val5.innerSpotAngle = 25f; val5.spotAngle = 45f; val5.range = 15f; val5.intensity = 6f; ((Behaviour)val5).enabled = true; val5.shadows = (LightShadows)2; val6.usePipelineSettings = true; ((Behaviour)val6).enabled = true; val6.softShadowQuality = (SoftShadowQuality)0; Light val7 = val4.gameObject.AddComponent<Light>(); UniversalAdditionalLightData val8 = val4.gameObject.AddComponent<UniversalAdditionalLightData>(); val7.color = new Color(1f, 0.7f, 0.3f, 1f); val7.type = (LightType)0; val7.innerSpotAngle = 25f; val7.spotAngle = 45f; val7.range = 15f; val7.intensity = 6f; ((Behaviour)val7).enabled = true; val7.shadows = (LightShadows)2; val8.usePipelineSettings = true; ((Behaviour)val8).enabled = true; val8.softShadowQuality = (SoftShadowQuality)0; } } } internal static class AmbientDarknessCore { internal static readonly int _brightnessID = Shader.PropertyToID("_Brightness"); internal static readonly int _ambienceStrengthID = Shader.PropertyToID("_AmbienceStrength"); internal static readonly int _ambienceMinID = Shader.PropertyToID("_AmbienceMin"); internal static readonly int _brightnessAltID = Shader.PropertyToID("brightness"); internal static readonly int _ambienceStrengthAltID = Shader.PropertyToID("ambienceStrength"); internal static readonly int _ambienceMinAltID = Shader.PropertyToID("ambienceMin"); internal const float AMBIENCE_MIN_FLOOR = 0f; internal const float AMBIENCE_MIN_VANILLA = 0.2f; internal const float BRIGHTNESS_MAX = 1f; public static void Apply() { if (!((Object)(object)DayNightManager.instance == (Object)null)) { if (!IsInGameScene() || !Plugin.AmbientEnable.Value) { SetShaderValues(1f, 1f, 0.2f); return; } float timeOfDayNormalized = DayNightManager.instance.timeOfDayNormalized; float moonVisibility = BiomeMoonManager.GetMoonVisibility(timeOfDayNormalized); BiomeMoonConfig currentConfig = BiomeMoonManager.GetCurrentConfig(); float num = Mathf.Clamp(currentConfig?.BrightnessTarget ?? 1f, 0f, 1f); float num2 = Mathf.Max(currentConfig?.AmbienceStrengthTarget ?? 1f, 0f); float num3 = Mathf.Max((currentConfig?.AmbienceMin).GetValueOrDefault(), 0f); float brightness = Mathf.Lerp(1f, num, moonVisibility); float ambienceStrength = Mathf.Lerp(1f, num2, moonVisibility); float ambienceMin = Mathf.Lerp(0.2f, num3, moonVisibility); SetShaderValues(brightness, ambienceStrength, ambienceMin); } } private static bool IsInGameScene() { MountainProgressHandler instance = Singleton<MountainProgressHandler>.Instance; if ((Object)(object)instance == (Object)null) { return false; } if (instance.progressPoints == null || instance.progressPoints.Length == 0) { return false; } if ((Object)(object)Character.localCharacter == (Object)null) { return false; } return true; } private static void SetShaderValues(float brightness, float ambienceStrength, float ambienceMin) { Shader.SetGlobalFloat("_Brightness", brightness); Shader.SetGlobalFloat("_AmbienceStrength", ambienceStrength); Shader.SetGlobalFloat("_AmbienceMin", ambienceMin); Shader.SetGlobalFloat("brightness", brightness); Shader.SetGlobalFloat("ambienceStrength", ambienceStrength); Shader.SetGlobalFloat("ambienceMin", ambienceMin); } } [HarmonyPatch(typeof(DayNightManager), "UpdateCycle")] internal static class DayNightManager_UpdateCycle_AmbientPatch { [HarmonyPostfix] private static void Postfix() { AmbientDarknessCore.Apply(); } } [HarmonyPatch(typeof(MountainProgressHandler), "SetSegmentComplete")] internal static class MountainProgressHandler_SetSegmentComplete_Patch { [HarmonyPostfix] private static void Postfix() { BiomeMoonManager.UpdateCurrentBiome(); AmbientDarknessCore.Apply(); } } [HarmonyPatch(typeof(MountainProgressHandler), "JumpToSegment")] internal static class MountainProgressHandler_JumpToSegment_Patch { [HarmonyPostfix] private static void Postfix() { BiomeMoonManager.UpdateCurrentBiome(); AmbientDarknessCore.Apply(); } } [HarmonyPatch] internal static class LightVolume_AmbientPatch { private static MethodInfo _targetMethod; private static MethodInfo TargetMethod() { if (_targetMethod != null) { return _targetMethod; } try { Type type = Type.GetType("LightVolume, LightVolume.Runtime"); if (type != null) { _targetMethod = type.GetMethod("SetShaderVars", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } catch { } return _targetMethod; } [HarmonyPostfix] private static void Postfix() { AmbientDarknessCore.Apply(); } } public class AdvancedLightFlicker : MonoBehaviour { private Light _light; private AudioSource _audioSource; private Vector3 _basePosition; private float _baseIntensity; private float _timer; public void Init(float baseIntensity, Vector3 baseLocalPosition) { //IL_0021: 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) _light = ((Component)this).GetComponent<Light>(); _audioSource = ((Component)this).GetComponent<AudioSource>(); _baseIntensity = baseIntensity; _basePosition = baseLocalPosition; _timer = Random.Range(0f, 100f); } private void Update() { //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_light)) { return; } if ((Object)(object)_audioSource != (Object)null && !((Behaviour)_audioSource).enabled) { if (((Behaviour)_light).enabled) { ((Behaviour)_light).enabled = false; } } else if (((Behaviour)_light).enabled) { _timer += Time.deltaTime * 1.2f; float timer = _timer; float num = Mathf.Sin(timer * 4.2f) * 0.2f; float num2 = Mathf.Sin(timer * 6.8f + 1.5f) * 0.15f; float num3 = Mathf.Sin(timer * 9.3f + 3.7f) * 0.08f; float num4 = Mathf.Sign(Mathf.Sin(timer * 2.3f)) * 0.1f; float num5 = (0f - Mathf.Sign(Mathf.Sin(timer * 3.1f + 0.8f))) * 0.08f; float num6 = num + num2 + num3 + num4 + num5; float num7 = 1f + num6; num7 = Mathf.Clamp(num7, 0.9f, 1.1f); _light.intensity = _baseIntensity * num7; float num8 = Mathf.Sin(timer * 2.8f) * 0.25f; float num9 = Mathf.Sin(timer * 4.5f + 2.1f) * 0.18f; float num10 = Mathf.Sin(timer * 5.9f + 1.3f) * 0.12f; float num11 = Mathf.Sign(Mathf.Sin(timer * 1.7f + 0.4f)) * 0.08f; float num12 = Mathf.Sign(Mathf.Sin(timer * 2.2f + 1.1f)) * 0.06f; float num13 = Mathf.Sign(Mathf.Sin(timer * 1.9f + 2.5f)) * 0.08f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num8 + num11, num9 + num12, num10 + num13); ((Component)this).transform.localPosition = _basePosition + val; } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class GhostFire_Pyre_LightPatch { private const string TargetName = "BlueFlame"; private const string ParentPathSubString = "Ghost Fires/Belltower/Pyre"; [HarmonyPostfix] private static void Postfix() { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == "BlueFlame" && GetHierarchyPath(val).Contains("Ghost Fires/Belltower/Pyre")) { SetupFakeLight(((Component)val).gameObject); } } } private static void SetupFakeLight(GameObject go) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_005c: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go.transform.Find("PyreLightSource") != (Object)null)) { GameObject val = new GameObject("PyreLightSource"); val.transform.SetParent(go.transform, false); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 0f, 2f); val.transform.localPosition = val2; Light val3 = val.AddComponent<Light>(); val.AddComponent<UniversalAdditionalLightData>(); val3.type = (LightType)2; val3.intensity = 10f; val3.range = 18f; val3.color = new Color(0.65f, 0f, 1f, 1f); val3.shadows = (LightShadows)2; ((Behaviour)val3).enabled = true; AdvancedLightFlicker advancedLightFlicker = val.AddComponent<AdvancedLightFlicker>(); advancedLightFlicker.Init(10f, val2); } } private static string GetHierarchyPath(Transform transform) { string text = ((Object)transform).name; while ((Object)(object)transform.parent != (Object)null) { transform = transform.parent; text = ((Object)transform).name + "/" + text; } return text; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class SleepyFog_Plane_ShadowPatch { private const string TargetParentName = "SleepyFog"; private const string TargetChildName = "Plane"; [HarmonyPostfix] private static void Postfix() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); int num = 0; Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name != "SleepyFog") { continue; } Transform val2 = val.Find("Plane"); if (!((Object)(object)val2 == (Object)null)) { MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>(); if (!((Object)(object)component == (Object)null) && (int)((Renderer)component).shadowCastingMode > 0) { ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; num++; } } } if (num <= 0) { } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class CloudRingOnVolcanoModel { private const string PEAK_KILN_PARENT_PATH = "Map/Biome_4/Caldera/Volcano/Volcano_Segment/Peak_Kiln Variant"; private const string SOURCE_RING_NAME = "Cloud Ring (1)"; private const string NEW_RING_NAME = "Cloud Ring (3)"; private const string VOLCANO_MODEL_PATH = "Map/Biome_4/Caldera/VolcanoModel"; [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name.Contains("Level_")) { RestoreCloudRingOnVolcanoModel(); } } public static void RestoreCloudRingOnVolcanoModel() { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) GameObject val = FindCloudRing(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[CloudRing3] Source 'Cloud Ring (1)' not found"); return; } GameObject val2 = GameObject.Find("Map/Biome_4/Caldera/VolcanoModel"); if ((Object)(object)val2 == (Object)null) { val2 = FindByName("VolcanoModel"); } if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"[CloudRing3] 'VolcanoModel' destination not found"); return; } if ((Object)(object)val2.transform.Find("Cloud Ring (3)") != (Object)null) { Plugin.Log.LogInfo((object)"[CloudRing3] 'Cloud Ring (3)' already present — skipping"); return; } GameObject val3 = Object.Instantiate<GameObject>(val); ((Object)val3).name = "Cloud Ring (3)"; val3.transform.SetParent(val2.transform, false); val3.transform.localPosition = new Vector3(0f, 7f, -1f); val3.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val3.transform.localScale = new Vector3(2.2f, 2.2f, 2.2f); ParticleSystem component = val3.GetComponent<ParticleSystem>(); ParticleSystemRenderer component2 = val3.GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { MainModule main = component.main; ShapeModule shape = component.shape; ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(45f); ((MainModule)(ref main)).maxParticles = 100; ((ShapeModule)(ref shape)).donutRadius = 12f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(8f, 12f); ((MainModule)(ref main)).prewarm = true; ((MainModule)(ref main)).loop = true; if ((Object)(object)component2 != (Object)null) { Material val4 = FindMaterial("VolumeParticles"); if ((Object)(object)val4 != (Object)null) { ((Renderer)component2).sharedMaterial = val4; Plugin.Log.LogInfo((object)("[CloudRing3] Renderer material → " + ((Object)val4).name)); } else { Plugin.Log.LogWarning((object)"[CloudRing3] 'VolumeParticlesThick' not found — keeping original"); } if (component2.maxParticleSize < 1f) { component2.maxParticleSize = 1f; } } } val3.SetActive(true); if ((Object)(object)component != (Object)null) { component.Clear(true); if (!component.isPlaying) { component.Play(); } MainModule main2 = component.main; ManualLogSource log = Plugin.Log; string[] obj = new string[7] { "[CloudRing3] Spawned 'Cloud Ring (3)' | ", $"localPos={val3.transform.localPosition} ", $"worldPos={val3.transform.position} ", null, null, null, null }; MinMaxCurve val5 = ((MainModule)(ref main2)).startSize; obj[3] = $"startSize={((MinMaxCurve)(ref val5)).constant} "; ShapeModule shape2 = component.shape; obj[4] = $"donutRadius={((ShapeModule)(ref shape2)).donutRadius} "; val5 = ((MainModule)(ref main2)).startLifetime; object arg = ((MinMaxCurve)(ref val5)).constantMin; val5 = ((MainModule)(ref main2)).startLifetime; obj[5] = $"lifetime={arg}..{((MinMaxCurve)(ref val5)).constantMax} "; obj[6] = $"prewarm={((MainModule)(ref main2)).prewarm}"; log.LogInfo((object)string.Concat(obj)); } } private static GameObject FindCloudRing() { GameObject val = GameObject.Find("Map/Biome_4/Caldera/Volcano/Volcano_Segment/Peak_Kiln Variant"); if ((Object)(object)val != (Object)null) { Transform val2 = val.transform.Find("Cloud Ring (1)"); if ((Object)(object)val2 != (Object)null) { return ((Component)val2).gameObject; } } Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val3 in array2) { if (((Object)val3).name == "Cloud Ring (1)") { return ((Component)val3).gameObject; } } return null; } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } private static Material FindMaterial(string name) { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); Material[] array2 = array; foreach (Material val in array2) { if ((Object)(object)val != (Object)null && ((Object)val).name == name) { return val; } } return null; } } [HarmonyPatch(typeof(Campfire), "Update")] internal static class CampfireGlowPatch { private static void Postfix(Campfire __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) bool flag = (int)__instance.state == 1; bool flag2 = flag; Transform val = ((Component)__instance).transform.Find("TT_CampfireGlow"); if ((Object)(object)val == (Object)null && flag2) { GameObject val2 = new GameObject("TT_CampfireGlow"); val2.transform.SetParent(((Component)__instance).transform, false); val2.transform.localPosition = new Vector3(0f, 2f, 0f); Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = new Color(1f, 0.6f, 0f, 1f); val3.range = 15f; val3.shadows = (LightShadows)2; val3.intensity = 9f; UniversalAdditionalLightData val4 = val2.AddComponent<UniversalAdditionalLightData>(); val4.usePipelineSettings = true; val4.softShadowQuality = (SoftShadowQuality)0; AdvancedLightFlicker advancedLightFlicker = val2.AddComponent<AdvancedLightFlicker>(); advancedLightFlicker.Init(10f, val2.transform.localPosition); } else if ((Object)(object)val != (Object)null) { Light component = ((Component)val).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = flag2; } } } } [HarmonyPatch(typeof(Candle), "Update")] internal static class CandleFixPatch { private static readonly Color PurpleColor = new Color(0.6f, 0.1f, 1f); private static void Postfix(Candle __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ItemLight.Value) { Transform val = (((Object)(object)__instance.fireParticle != (Object)null) ? ((Component)__instance.fireParticle).transform : ((Component)__instance).transform); Light val2 = ((Component)val).GetComponent<Light>(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<Light>(); val2.type = (LightType)2; val2.color = PurpleColor; val2.intensity = 6f; val2.range = 18f; val2.shadows = (LightShadows)2; val2.shadowStrength = 0.85f; UniversalAdditionalLightData val3 = ((Component)val).gameObject.AddComponent<UniversalAdditionalLightData>(); val3.usePipelineSettings = true; val3.softShadowQuality = (SoftShadowQuality)0; } bool flag = (((Behaviour)val2).enabled = (Object)(object)__instance.awakeField != (Object)null && __instance.awakeField.activeSelf); val2.intensity = (flag ? 6f : 0f); } } } [HarmonyPatch(typeof(DayNightManager), "Update")] internal static class EternalPeak { private const float LOCKED_TIME = 23.5f; [HarmonyPrefix] private static bool Prefix(DayNightManager __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)BiomeMoonManager.GetCurrentBiome() != 5) { return true; } __instance.HazeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)0)); __instance.RimFresnelDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)1)); __instance.LavaAlphaDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)2)); __instance.BandFogDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)3)); __instance.SunSizeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)4)); __instance.timeOfDay = 23.5f; if (PhotonNetwork.IsMasterClient) { __instance.syncTimer += Time.deltaTime; if (__instance.syncTimer > 5f) { PhotonView value = Traverse.Create((object)__instance).Field("photonView").GetValue<PhotonView>(); if ((Object)(object)value != (Object)null) { value.RPC("RPCA_SyncTime", (RpcTarget)0, new object[2] { __instance.dayCount, __instance.timeOfDay }); } __instance.syncTimer = 0f; } } __instance.UpdateCycle(); return false; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class EternalTemple_Start { [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name.Contains("Level_")) { TempleFix(); if (Plugin.CitadelStairsTweak.Value && name.Contains("Level_")) { TempleStairFix(); } } } private static void TempleStairFix() { //IL_0042: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map/Biome_4/Gloom/Temple_Segment/Central Tower Entrance/Central Tower Entry/Stairs"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[EternalTemple] 'Middle Stairs' not found"); return; } val.transform.localPosition = new Vector3(8f, 0f, 3.5f); val.transform.rotation = Quaternion.Euler(270f, 0f, 0f); GameObject val2 = GameObject.Find("Map/Biome_4/Gloom/Temple_Segment/Central Tower Exit/Central Tower exit/Stairs (1)"); if (!((Object)(object)val2 == (Object)null)) { val2.transform.localPosition = new Vector3(-7.15f, -2.94f, 22.140871f); val2.transform.localRotation = Quaternion.Euler(0f, 0f, -81.5f); val2.transform.localScale = new Vector3(1.21f, 1f, 1f); } } private static void TempleFix() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map/Biome_4/Gloom/Temple_Segment/RisingGloom/SleepyFog (1)"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[EternalTemple] 'SleepyFog (1)' not found"); return; } GameObject val2 = new GameObject("GloomLight"); val2.transform.SetParent(val.transform, true); val2.transform.localPosition = new Vector3(37f, -1f, -16.1029f); Light val3 = val2.gameObject.AddComponent<Light>(); UniversalAdditionalLightData val4 = val2.gameObject.AddComponent<UniversalAdditionalLightData>(); val3.type = (LightType)2; val3.color = new Color(0.45f, 0.5f, 1f, 1f); val3.shadows = (LightShadows)2; val3.range = 100f; val3.intensity = 7f; ((Behaviour)val3).enabled = true; val4.usePipelineSettings = true; ((Behaviour)val4).enabled = true; val4.softShadowQuality = (SoftShadowQuality)0; GameObject val5 = GameObject.Find("Map/Biome_4/Gloom/Gloom Temple/SpecialDay Temple"); GameObject val6 = GameObject.Find("Map/Biome_4/Gloom/Gloom Temple/SpecialDay Temple/Light"); if ((Object)(object)val5 == (Object)null || (Object)(object)val6 == (Object)null) { Plugin.Log.LogWarning((object)"[EternalTemple] 'SpecialDay Temple' or 'SpecialDay Temple/Light' not found"); return; } Light component = val6.GetComponent<Light>(); component.shadows = (LightShadows)2; SpecialDayZone component2 = val5.GetComponent<SpecialDayZone>(); if ((Object)(object)component == (Object)null) { return; } if ((Object)(object)component2 == (Object)null) { Plugin.Log.LogWarning((object)"[EternalTemple] 'SpecialDay Temple' does not have a SpecialDayZone component"); return; } val5.transform.localPosition = new Vector3(-6.82f, 67f, 75.8f); component2.bounds = new Bounds(new Vector3(6f, 874.3087f, 2111.37f), new Vector3(120f, 550f, 180f)); component2.outerBounds = new Bounds(new Vector3(6f, 874.3087f, 2111.37f), new Vector3(127.5f, 560f, 200f)); component2.blendSize = 20f; if (!((Object)(object)val5 == (Object)null)) { GameObject val7 = GameObject.Find("Map/Biome_4/Gloom/Temple_Segment/Peak/SpecialDay Peak"); if (!((Object)(object)val7 == (Object)null)) { val7.transform.localPosition = new Vector3(7.5f, 1210f, 1912.9f); SpecialDayZone component3 = val7.GetComponent<SpecialDayZone>(); component3.bounds = new Bounds(new Vector3(-5.8f, 1210f, 2142.78f), new Vector3(300f, 100f, 400f)); component3.outerBounds = new Bounds(new Vector3(-5.8f, 1210f, 2142.78f), new Vector3(300f, 110f, 400f)); component3.blendSize = 20f; } } } } [HarmonyPatch(typeof(DayNightManager), "UpdateCycle")] internal static class SpecialSunColorGlobalWriter { private static readonly int _SpecialDaySunColorID = Shader.PropertyToID("_SpecialDaySunColor"); [HarmonyPostfix] private static void Postfix(DayNightManager __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Shader.SetGlobalColor(_SpecialDaySunColorID, __instance.specialSunColor); } } [HarmonyPatch(typeof(SpecialDayZone), "OnEnable")] internal static class RemovePeakHeightFogPatch { [HarmonyPostfix] private static void Postfix(SpecialDayZone __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || !((Object)__instance).name.Contains("SpecialDay Peak") || __instance.globalShaderVals == null) { return; } List<ShaderVal> list = new List<ShaderVal>(); for (int i = 0; i < __instance.globalShaderVals.Length; i++) { ShaderVal val = __instance.globalShaderVals[i]; if ((int)val.parameter == 5) { Plugin.Log.LogWarning((object)("[PeakFog] Removed HeightFogAmount entry from '" + ((Object)__instance).name + "'")); } else { list.Add(val); } } __instance.globalShaderVals = list.ToArray(); } } [HarmonyPatch(typeof(DayNightManager), "BlendProfiles")] internal static class TempleDeepFogColorInjector { private static readonly Color TempleDeepFog = new Color(0.03f, 0.05f, 0.78f, 1f); private static readonly Color GenericDeepFog = new Color(0.9f, 0.9f, 0.9f, 1f); [HarmonyPrefix] private static void Prefix(DayNightProfile profile) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if ((Object)(object)profile == (Object)null || profile.globalStaticShaderColors == null) { return; } ShaderParametersColors[] globalStaticShaderColors = profile.globalStaticShaderColors; for (int i = 0; i < globalStaticShaderColors.Length; i++) { if ((int)globalStaticShaderColors[i].parameter == 7) { return; } } Color paramValue = (((Object)profile).name.Contains("Temple") ? TempleDeepFog : GenericDeepFog); ShaderParametersColors val = new ShaderParametersColors { parameter = (ShaderParams)7, paramValue = paramValue }; ShaderParametersColors[] array = (ShaderParametersColors[])(object)new ShaderParametersColors[globalStaticShaderColors.Length + 1]; Array.Copy(globalStaticShaderColors, array, globalStaticShaderColors.Length); array[globalStaticShaderColors.Length] = val; profile.globalStaticShaderColors = array; } } [HarmonyPatch(typeof(DayNightManager), "Update")] internal static class EternalTemple_Update { private const float LOCKED_TIME = 23.5f; [HarmonyPrefix] private static bool Prefix(DayNightManager __instance) { if (BiomeMoonManager.GetCurrentBiomeKey() != "THE CITADEL") { return true; } __instance.HazeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)0)); __instance.RimFresnelDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)1)); __instance.LavaAlphaDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)2)); __instance.BandFogDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)3)); __instance.SunSizeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)4)); __instance.timeOfDay = 23.5f; if (PhotonNetwork.IsMasterClient) { __instance.syncTimer += Time.deltaTime; if (__instance.syncTimer > 5f) { PhotonView value = Traverse.Create((object)__instance).Field("photonView").GetValue<PhotonView>(); if ((Object)(object)value != (Object)null) { value.RPC("RPCA_SyncTime", (RpcTarget)0, new object[2] { __instance.dayCount, __instance.timeOfDay }); } __instance.syncTimer = 0f; } } __instance.UpdateCycle(); return false; } } [HarmonyPatch(typeof(DayNightManager), "Update")] internal static class EternalVolcano { private const float LOCKED_TIME = 23.5f; [HarmonyPrefix] private static bool Prefix(DayNightManager __instance) { if (BiomeMoonManager.GetCurrentBiomeKey() != "THE KILN") { return true; } __instance.HazeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)0)); __instance.RimFresnelDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)1)); __instance.LavaAlphaDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)2)); __instance.BandFogDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)3)); __instance.SunSizeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)4)); __instance.timeOfDay = 23.5f; if (PhotonNetwork.IsMasterClient) { __instance.syncTimer += Time.deltaTime; if (__instance.syncTimer > 5f) { PhotonView value = Traverse.Create((object)__instance).Field("photonView").GetValue<PhotonView>(); if ((Object)(object)value != (Object)null) { value.RPC("RPCA_SyncTime", (RpcTarget)0, new object[2] { __instance.dayCount, __instance.timeOfDay }); } __instance.syncTimer = 0f; } } __instance.UpdateCycle(); return false; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class FinalSceneFix { private static readonly Color FinalSunColor = new Color(0.6695f, 0.4248f, 0.7717f, 1f); private const float NightIntensity = 3f; private const float DayIntensity = 3f; [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name.Contains("Level_")) { FixFinalCutscenePeak(); } } private static void FixFinalCutscenePeak() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("SpecialDay Peak FinalCutscene"); if ((Object)(object)val == (Object)null) { val = FindByName("SpecialDay Peak FinalCutscene"); } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[FinalSceneFix] Could not find 'SpecialDay Peak FinalCutscene'"); return; } Transform val2 = val.transform.Find("Directional Light"); if ((Object)(object)val2 == (Object)null) { Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "Directional Light") { val2 = val3; break; } } } if ((Object)(object)val2 != (Object)null) { Light component = ((Component)val2).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { component.shadows = (LightShadows)2; } else { Plugin.Log.LogWarning((object)"[FinalSceneFix] 'Directional Light' has no Light component"); } } else { Plugin.Log.LogWarning((object)"[FinalSceneFix] Could not find 'Directional Light' child"); } SpecialDayZone component2 = val.GetComponent<SpecialDayZone>(); if ((Object)(object)component2 == (Object)null) { Plugin.Log.LogWarning((object)"[FinalSceneFix] 'SpecialDay Peak FinalCutscene' has no SpecialDayZone component"); return; } component2.specialSunColor = FinalSunColor; component2.nightLightIntensity = 3f; component2.daylLightIntensity = 3f; } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } } public class FlareLightFlicker : MonoBehaviour { private Light _light; private ParticleSystem _particleSystem; private Transform _lightTransform; private float _baseIntensity; private float _seed; public void Init(Light light, ParticleSystem particleSystem, float baseIntensity) { _light = light; _lightTransform = ((Component)light).transform; _particleSystem = particleSystem; _baseIntensity = baseIntensity; _seed = Random.Range(0f, 1000f); } private void Update() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_light) && Object.op_Implicit((Object)(object)_particleSystem)) { bool isEmitting = _particleSystem.isEmitting; if (((Behaviour)_light).enabled != isEmitting) { ((Behaviour)_light).enabled = isEmitting; } if (((Behaviour)_light).enabled) { float num = Time.time * 35f + _seed; float num2 = Time.time * 65f + _seed; float num3 = Mathf.PerlinNoise(num, 0f); _light.intensity = _baseIntensity * Mathf.Lerp(0.4f, 1.3f, num3); float num4 = (Mathf.PerlinNoise(num2, 10f) - 0.5f) * 0.12f; float num5 = (Mathf.PerlinNoise(num2, 20f) - 0.5f) * 0.12f; float num6 = (Mathf.PerlinNoise(num2, 30f) - 0.5f) * 0.12f; _lightTransform.localPosition = new Vector3(num4, num5, num6); } } } } [HarmonyPatch(typeof(Flare), "EnableFlareVisuals")] internal static class Flare_EnableFlareVisuals_Patch { [HarmonyPostfix] private static void Postfix(Flare __instance) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.ItemLight.Value) { return; } ParticleSystem[] array = Object.FindObjectsByType<ParticleSystem>((FindObjectsSortMode)0); ParticleSystem[] array2 = array; foreach (ParticleSystem val in array2) { if (!((Object)((Component)val).gameObject).name.Contains("Particle System") || !((Object)(object)((Component)val).transform.parent != (Object)null) || !((Object)((Component)val).transform.parent).name.Contains("VFX_FlareSmoke")) { continue; } GameObject gameObject = ((Component)val).gameObject; if (!((Object)(object)gameObject.GetComponent<FlareLightFlicker>() != (Object)null)) { GameObject val2 = new GameObject("FlareLightSource"); val2.transform.SetParent(gameObject.transform, false); Light val3 = val2.AddComponent<Light>(); val2.AddComponent<UniversalAdditionalLightData>(); val3.type = (LightType)2; val3.intensity = 8f; val3.range = 16f; val3.shadows = (LightShadows)2; Color flareColor = __instance.flareColor; if (flareColor != Color.clear) { val3.color = flareColor; } ((Behaviour)val3).enabled = val.isEmitting; FlareLightFlicker flareLightFlicker = gameObject.AddComponent<FlareLightFlicker>(); flareLightFlicker.Init(val3, val, 12f); } } } } [HarmonyPatch(typeof(Jetpack))] internal static class JetpackFixPatch { private const string LightName = "JetpackThrusterLight"; private static readonly Color BlueColor = new Color(0.3f, 0.6f, 1f, 1f); private static readonly Vector3 ThrusterOffset = new Vector3(0f, -0.4f, 0f); private const float LightIntensity = 8f; private const float LightRange = 3f; [HarmonyPostfix] [HarmonyPatch("ActivateJetpack")] private static void ActivatePostfix(Jetpack __instance) { SetLightState(__instance, isActive: true); } [HarmonyPostfix] [HarmonyPatch("ForceStopJetpack")] private static void StopPostfix(Jetpack __instance) { SetLightState(__instance, isActive: false); } private static void SetLightState(Jetpack instance, bool isActive) { if (!Plugin.ItemLight.Value) { TryDisableExistingLight(instance); return; } Light orCreateLight = GetOrCreateLight(instance); if (!((Object)(object)orCreateLight == (Object)null)) { ((Behaviour)orCreateLight).enabled = isActive; orCreateLight.intensity = (isActive ? 8f : 0f); } } private static Light GetOrCreateLight(Jetpack instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)instance.jetpackParticles != (Object)null) ? ((Component)instance.jetpackParticles).transform : ((Component)instance).transform); Transform val2 = val.Find("JetpackThrusterLight"); if ((Object)(object)val2 != (Object)null) { Light component = ((Component)val2).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { return component; } } GameObject val3 = new GameObject("JetpackThrusterLight"); val3.transform.SetParent(val, false); val3.transform.localPosition = ThrusterOffset; Light val4 = val3.AddComponent<Light>(); val4.type = (LightType)2; val4.color = BlueColor; val4.intensity = 0f; val4.range = 3f; val4.shadows = (LightShadows)0; val4.shadowStrength = 0.85f; ((Behaviour)val4).enabled = false; UniversalAdditionalLightData val5 = val3.AddComponent<UniversalAdditionalLightData>(); val5.usePipelineSettings = true; val5.softShadowQuality = (SoftShadowQuality)0; return val4; } private static void TryDisableExistingLight(Jetpack instance) { Transform val = (((Object)(object)instance.jetpackParticles != (Object)null) ? ((Component)instance.jetpackParticles).transform : ((Component)instance).transform); Transform val2 = val.Find("JetpackThrusterLight"); if (!((Object)(object)val2 == (Object)null)) { Light component = ((Component)val2).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; component.intensity = 0f; } } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class LavaBubblesOnPlane { private const string LAVA_BUBBLES_PATH = "Map/Biome_4/Caldera/Volcano/Caldera_Segment/Lava Bubbles"; private const string BUBBLES_CHILD_NAME = "Bubbles"; private const string PLANE_PATH = "Map/Biome_4/Caldera/Volcano/Volcano_Segment/Mechanics/RisingLava/Lava/Plane"; private const string CLONE_NAME = "TT_LavaBubblesOnPlane"; [HarmonyPostfix] private static void Postfix() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map/Biome_4/Caldera/Volcano/Caldera_Segment/Lava Bubbles"); if ((Object)(object)val == (Object)null) { val = FindByName("Lava Bubbles"); } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[LavaBubblesOnPlane] Source 'Lava Bubbles' not found"); return; } Transform val2 = val.transform.Find("Bubbles"); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"[LavaBubblesOnPlane] Source 'Bubbles' child not found"); return; } GameObject val3 = GameObject.Find("Map/Biome_4/Caldera/Volcano/Volcano_Segment/Mechanics/RisingLava/Lava/Plane"); if ((Object)(object)val3 == (Object)null) { val3 = FindByParentChain("Plane", new string[2] { "RisingLava", "Lava" }); } if ((Object)(object)val3 == (Object)null) { Plugin.Log.LogWarning((object)"[LavaBubblesOnPlane] Destination 'Plane' not found"); return; } if ((Object)(object)val3.transform.Find("TT_LavaBubblesOnPlane") != (Object)null) { Plugin.Log.LogInfo((object)"[LavaBubblesOnPlane] Clone already present on Plane — skipping"); return; } GameObject val4 = Object.Instantiate<GameObject>(((Component)val2).gameObject); ((Object)val4).name = "TT_LavaBubblesOnPlane"; val4.transform.SetParent(val3.transform, false); val4.transform.localPosition = new Vector3(0f, 0f, 0f); val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = new Vector3(1f, 1f, 1f); val4.SetActive(true); ParticleSystem component = val4.GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { component.playbackSpeed = 1.6f; MainModule main = component.main; ((MainModule)(ref main)).maxParticles = 60; ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).scale = new Vector3(66f, 0.5f, 66f); Plugin.Log.LogInfo((object)("[LavaBubblesOnPlane] Attached clone to " + GetPath(val3.transform) + " " + $"at world pos {val4.transform.position}")); } else { Plugin.Log.LogWarning((object)"[LavaBubblesOnPlane] Clone has no ParticleSystem"); } } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } private static GameObject FindByParentChain(string name, string[] requiredAncestorNames) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name != name) { continue; } bool flag = true; foreach (string text in requiredAncestorNames) { bool flag2 = false; Transform parent = val.parent; while ((Object)(object)parent != (Object)null) { if (((Object)parent).name == text) { flag2 = true; break; } parent = parent.parent; } if (!flag2) { flag = false; break; } } if (flag) { return ((Component)val).gameObject; } } return null; } private static string GetPath(Transform t) { string text = ((Object)t).name; while ((Object)(object)t.parent != (Object)null) { t = t.parent; text = ((Object)t).name + "/" + text; } return text; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class KilnFix { private const float LightIntensity = 12f; private const float LightRange = 60f; private static readonly Color LightColor = new Color(1f, 0.4906f, 0.08f, 1f); [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name.Contains("Level_") && Plugin.KilnTweak.Value) { AttachLavaLight(); MoveVolcanoSmoke(); } } private static void AttachLavaLight() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Mechanics/RisingLava/Lava/Plane"); if ((Object)(object)val == (Object)null) { val = GameObject.Find("Map/Mechanics/RisingLava/Lava/Plane"); } if ((Object)(object)val == (Object)null) { val = FindByParentChain("Plane", new string[2] { "RisingLava", "Lava" }); } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[KilnLavaLight] Could not find Mechanics/RisingLava/Lava/Plane"); } else if ((Object)(object)val.GetComponent<Light>() == (Object)null) { Light val2 = val.AddComponent<Light>(); val2.type = (LightType)2; val2.intensity = 12f; val2.range = 60f; val2.shadows = (LightShadows)2; val2.color = LightColor; UniversalAdditionalLightData val3 = val.AddComponent<UniversalAdditionalLightData>(); val3.usePipelineSettings = true; val3.softShadowQuality = (SoftShadowQuality)0; Plugin.Log.LogInfo((object)("[KilnLavaLight] Attached lava light to " + GetPath(val.transform))); } } private static void MoveVolcanoSmoke() { GameObject val = GameObject.Find("Map/Biome_4/Caldera/Volcano/Caldera_Segment/volcano Smoke"); if ((Object)(object)val == (Object)null) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val2 in array2) { if (((Object)val2).name == "volcano smoke") { val = ((Component)val2).gameObject; break; } } } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[KilnLavaLight] Could not find 'volcano smoke'"); return; } GameObject val3 = GameObject.Find("Map/Biome_4/Caldera/Volcano/Volcano_Segment"); if ((Object)(object)val3 == (Object)null) { Transform[] array3 = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array4 = array3; foreach (Transform val4 in array4) { if (((Object)val4).name == "Volcano_Segment") { val3 = ((Component)val4).gameObject; break; } } } if ((Object)(object)val3 == (Object)null) { Plugin.Log.LogWarning((object)"[KilnLavaLight] Could not find 'Volcano_Segment' destination"); return; } val.transform.SetParent(val3.transform, true); Plugin.Log.LogInfo((object)("[KilnLavaLight] Moved 'volcano smoke' to " + GetPath(val3.transform))); } private static GameObject FindByParentChain(string name, string[] requiredAncestorNames) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name != name) { continue; } bool flag = true; foreach (string text in requiredAncestorNames) { bool flag2 = false; Transform parent = val.parent; while ((Object)(object)parent != (Object)null) { if (((Object)parent).name == text) { flag2 = true; break; } parent = parent.parent; } if (!flag2) { flag = false; break; } } if (flag) { return ((Component)val).gameObject; } } return null; } private static string GetPath(Transform t) { string text = ((Object)t).name; while ((Object)(object)t.parent != (Object)null) { t = t.parent; text = ((Object)t).name + "/" + text; } return text; } } [HarmonyPatch(typeof(Lantern))] internal static class LanternFixPatch { private const float DefaultLanternIntensity = 10f; [HarmonyPatch("Awake")] [HarmonyPrefix] private static void FixFaerieLanternOnAwake(Lantern __instance) { if (__instance.lightIntensity <= 0f) { __instance.lightIntensity = 10f; } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void FixFaerieLanternAndUpdateLight(Lantern __instance) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 if (Plugin.ItemLight.Value && !((Object)(object)__instance.lanternLight == (Object)null)) { Light lanternLight = __instance.lanternLight; if (((Component)lanternLight).gameObject.activeSelf && lanternLight.intensity <= 0.01f) { __instance.lightIntensity = 10f; lanternLight.intensity = 10f; } if ((int)lanternLight.shadows == 0) { lanternLight.shadows = (LightShadows)2; lanternLight.shadowStrength = 0.85f; lanternLight.shadowBias = 0.05f; lanternLight.shadowNormalBias = 0.4f; lanternLight.range = 16f; } UniversalAdditionalLightData val = ((Component)lanternLight).GetComponent<UniversalAdditionalLightData>(); if ((Object)(object)val == (Object)null) { val = ((Component)lanternLight).gameObject.AddComponent<UniversalAdditionalLightData>(); } if ((Object)(object)val != (Object)null && !val.usePipelineSettings) { val.usePipelineSettings = true; val.softShadowQuality = (SoftShadowQuality)0; } } } } [HarmonyPatch(typeof(PlayerTrackParticles), "Start")] internal static class LavaBubblesYTrackPatch { private const string LAVA_BUBBLES_OBJ_NAME = "Lava Bubbles"; private const string RIVER_OBJ_NAME = "River"; private const float BUBBLE_Y_OFFSET = 13f; private static Transform _riverTransform; [HarmonyPostfix] private static void Postfix(PlayerTrackParticles __instance) { if (!(((Object)((Component)__instance).gameObject).name != "Lava Bubbles")) { _riverTransform = FindRiver(((Component)__instance).transform); if (!((Object)(object)_riverTransform == (Object)null) && (Object)(object)((Component)__instance).gameObject.GetComponent<LavaBubblesYTracker>() == (Object)null) { LavaBubblesYTracker lavaBubblesYTracker = ((Component)__instance).gameObject.AddComponent<LavaBubblesYTracker>(); lavaBubblesYTracker.Init(_riverTransform, 13f); Plugin.Log.LogInfo((object)"[LavaBubbles] Y-tracking attached to 'Lava Bubbles'"); } } } private static Transform FindRiver(Transform bubbles) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown Transform val = bubbles; while ((Object)(object)val != (Object)null && ((Object)val).name != "Caldera_Segment") { val = val.parent; } if ((Object)(object)val == (Object)null) { return null; } Transform val2 = val.Find("River"); if ((Object)(object)val2 != (Object)null) { return val2; } foreach (Transform item in val) { Transform val3 = item; if (((Object)val3).name.StartsWith("River")) { return val3; } } return null; } } internal class LavaBubblesYTracker : MonoBehaviour { private Transform _source; private float _offset; public void Init(Transform source, float offset) { _source = source; _offset = offset; } private void LateUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_source == (Object)null)) { Vector3 position = ((Component)this).transform.position; float num = _source.position.y + _offset; if (position.y != num) { position.y = num; ((Component)this).transform.position = position; } } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class LavaBubblesSceneSetup { private const string BUBBLES_CHILD_NAME = "Bubbles"; private const float BUBBLES_PLAYBACK_SPEED = 1.5f; private const int BUBBLES_MAX_PARTICLES = 60; [HarmonyPostfix] private static void Postfix() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Map/Biome_4/Caldera/Volcano/Caldera_Segment/Lava Bubbles"); if ((Object)(object)val == (Object)null) { return; } if (!val.activeSelf) { val.SetActive(true); } PlayerTrackParticles component = val.GetComponent<PlayerTrackParticles>(); if ((Object)(object)component != (Object)null && !((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } Transform val2 = val.transform.Find("Bubbles"); if (!((Object)(object)val2 == (Object)null)) { if (!((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } ParticleSystem component2 = ((Component)val2).GetComponent<ParticleSystem>(); if (!((Object)(object)component2 == (Object)null)) { MainModule main = component2.main; ((MainModule)(ref main)).simulationSpeed = 1.5f; ((MainModule)(ref main)).maxParticles = 60; } } } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } } internal static class BiomeMoonManager { private struct Phases { public float DuskStart; public float NightStart; public float PeakStart; public float PeakEnd; public float NightEnd; public float DawnStart; } private static string _currentBiomeKey = "SHORE"; private static BiomeType _currentBiome = (BiomeType)0; private static BiomeMoonConfig _currentConfig; private static int _currentSegment = -1; private static bool _isInitialized; public static BiomeType GetCurrentBiome() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!_isInitialized) { UpdateCurrentBiome(); } return _currentBiome; } public static string GetCurrentBiomeKey() { if (!_isInitialized) { UpdateCurrentBiome(); } return _currentBiomeKey; } public static BiomeMoonConfig GetCurrentConfig() { if (_currentConfig == null || !_isInitialized) { UpdateCurrentBiome(); } return _currentConfig; } public static void UpdateCurrentBiome() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) try { MountainProgressHandler instance = Singleton<MountainProgressHandler>.Instance; if ((Object)(object)instance == (Object)null || instance.progressPoints == null) { SetCurrentBiome("SHORE", (BiomeType)0); return; } int maxProgressPointReached = instance.maxProgressPointReached; if (maxProgressPointReached == _currentSegment && _isInitialized) { return; } _currentSegment = maxProgressPointReached; BiomeType biome = (BiomeType)0; string key = "SHORE"; if (maxProgressPointReached >= 0 && maxProgressPointReached < instance.progressPoints.Length) { ProgressPoint val = instance.progressPoints[maxProgressPointReached]; biome = val.biome; if (!string.IsNullOrEmpty(val.title)) { key = val.title; } } else if (maxProgressPointReached >= instance.progressPoints.Length) { biome = (BiomeType)5; key = "PEAK"; } SetCurrentBiome(key, biome); } catch (Exception ex) { Debug.LogWarning((object)("[BiomeMoon] Failed to update biome: " + ex.Message)); SetCurrentBiome("SHORE", (BiomeType)0); } } private static void SetCurrentBiome(string key, BiomeType biome) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0031: Unknown result type (might be due to invalid IL or missing references) if (!(key == _currentBiomeKey) || biome != _currentBiome || !_isInitialized) { _currentBiomeKey = key; _currentBiome = biome; _currentConfig = GetConfigForKey(key, biome); _isInitialized = true; } } private static BiomeMoonConfig GetConfigForKey(string key, BiomeType biome) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) BiomeMoonConfig biomeMoonConfig = Plugin.BiomeConfigs.FirstOrDefault((BiomeMoonConfig c) => c.Key == key); if (biomeMoonConfig != null) { return biomeMoonConfig; } return Plugin.BiomeConfigs.FirstOrDefault((BiomeMoonConfig c) => c.Biome == biome); } private static Phases GetPhases(BiomeMoonConfig cfg) { return new Phases { DuskStart = (cfg?.DuskStart ?? 0.708f), NightStart = (cfg?.NightStart ?? 0.875f), PeakStart = (cfg?.PeakStart ?? 0.923f), PeakEnd = (cfg?.PeakEnd ?? 0.083f), NightEnd = (cfg?.NightEnd ?? 0.166f), DawnStart = (cfg?.DawnStart ?? 0.208f) }; } public static float GetMoonVisibility(float timeOfDayNormalized) { Phases phases = GetPhases(_currentConfig); if (timeOfDayNormalized >= phases.DuskStart && timeOfDayNormalized < phases.PeakStart) { return TechnicalTweaksHelper.SmoothStep(phases.DuskStart, phases.PeakStart, timeOfDayNormalized); } if (timeOfDayNormalized >= phases.PeakStart || timeOfDayNormalized < phases.PeakEnd) { return 1f; } if (timeOfDayNormalized >= phases.PeakEnd && timeOfDayNormalized < phases.DawnStart) { return 1f - TechnicalTweaksHelper.SmoothStep(phases.PeakEnd, phases.DawnStart, timeOfDayNormalized); } return 0f; } public static Color GetMoonColor(float timeOfDayNormalized, Color sunColor) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) Phases phases = GetPhases(_currentConfig); Color val = (Color)(((??)_currentConfig?.MoonColorStart) ?? TechnicalTweaksHelper.DEFAULT_MOON_START); Color val2 = (Color)(((??)_currentConfig?.MoonColorMid) ?? TechnicalTweaksHelper.DEFAULT_MOON_MID); Color val3 = (Color)(((??)_currentConfig?.MoonColorEnd) ?? TechnicalTweaksHelper.DEFAULT_MOON_END); if (timeOfDayNormalized >= phases.DuskStart && timeOfDayNormalized < phases.NightStart) { float num = TechnicalTweaksHelper.SmoothStep(phases.DuskStart, phases.NightStart, timeOfDayNormalized); return Color.Lerp(sunColor, val, num); } if (timeOfDayNormalized >= phases.NightStart && timeOfDayNormalized < phases.PeakStart) { float num2 = TechnicalTweaksHelper.SmoothStep(phases.NightStart, phases.PeakStart, timeOfDayNormalized); return Color.Lerp(val, val2, num2); } if (timeOfDayNormalized >= phases.PeakStart || timeOfDayNormalized < phases.PeakEnd) { return val2; } if (timeOfDayNormalized >= phases.PeakEnd && timeOfDayNormalized < phases.NightEnd) { float num3 = TechnicalTweaksHelper.SmoothStep(phases.PeakEnd, phases.NightEnd, timeOfDayNormalized); return Color.Lerp(val2, val3, num3); } if (timeOfDayNormalized >= phases.NightEnd && timeOfDayNormalized < phases.DawnStart) { float num4 = TechnicalTweaksHelper.SmoothStep(phases.NightEnd, phases.DawnStart, timeOfDayNormalized); return Color.Lerp(val3, sunColor, num4); } return sunColor; } public static float GetMoonIntensity(float timeOfDayNormalized) { float num = _currentConfig?.MoonIntensity ?? Plugin.MoonIntensityMax; float moonIntensityMin = Plugin.MoonIntensityMin; float moonVisibility = GetMoonVisibility(timeOfDayNormalized); return Mathf.Lerp(moonIntensityMin, num, moonVisibility); } public static float GetAmbientDarkness() { if (_currentConfig != null && _currentConfig.HasCustomAmbient) { return _currentConfig.AmbientDarkness.Value; } return 1f; } } [HarmonyPatch(typeof(DayNightManager), "UpdateCycle")] internal static class DayNightManager_UpdateCycle_Patch { [HarmonyPostfix] private static void Postfix(DayNightManager __instance) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.MoonLightEnable.Value || (Object)(object)__instance.moon == (Object)null || (Object)(object)__instance.sun == (Object)null) { return; } Light moon = __instance.moon; Light sun = __instance.sun; Transform transform = ((Component)moon).transform; Transform transform2 = ((Component)sun).transform; if ((Object)(object)__instance.earth != (Object)null && (Object)(object)transform.parent != (Object)(object)__instance.earth) { transform.SetParent(__instance.earth, false); } if (transform.localPosition != Vector3.zero) { transform.localPosition = Vector3.zero; } if (transform.localRotation != transform2.localRotation) { transform.localRotation = transform2.localRotation; } BiomeMoonManager.UpdateCurrentBiome(); float timeOfDayNormalized = __instance.timeOfDayNormalized; Color moonColor = BiomeMoonManager.GetMoonColor(timeOfDayNormalized, sun.color); if (moon.color != moonColor) { moon.color = moonColor; } if (((Behaviour)moon).enabled) { float moonIntensity = BiomeMoonManager.GetMoonIntensity(timeOfDayNormalized); if (moon.intensity != moonIntensity) { moon.intensity = moonIntensity; } moon.shadowStrength = 1f; moon.shadows = (LightShadows)2; moon.shadowCustomResolution = -1; moon.renderingLayerMask = 1; moon.range = 10f; } } } internal static class TechnicalTweaksHelper { internal const float DuskStart = 0.708f; internal const float NightStart = 0.875f; internal const float PeakStart = 0.923f; internal const float PeakEnd = 0.083f; internal const float NightEnd = 0.166f; internal const float DawnStart = 0.208f; public static readonly Color DEFAULT_MOON_START = new Color(0.15f, 0.09f, 0.2f, 0.15f); public static readonly Color DEFAULT_MOON_MID = new Color(0.15f, 0.76f, 1f, 1f); public static readonly Color DEFAULT_MOON_END = new Color(0.15f, 0.09f, 0.2f, 0.15f); public static float SmoothStep(float edge0, float edge1, float x) { if (edge0 == edge1) { return (x < edge0) ? 0f : 1f; } float num = (x - edge0) / (edge1 - edge0); num = Mathf.Clamp01(num); return num * num * (3f - 2f * num); } public static Color ParseColor(string colorString) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) string[] array = colorString.Split(','); if (array.Length >= 4) { float num = float.Parse(array[0].Trim()); float num2 = float.Parse(array[1].Trim()); float num3 = float.Parse(array[2].Trim()); float num4 = float.Parse(array[3].Trim()); return new Color(num, num2, num3, num4); } if (array.Length >= 3) { float num5 = float.Parse(array[0].Trim()); float num6 = float.Parse(array[1].Trim()); float num7 = float.Parse(array[2].Trim()); return new Color(num5, num6, num7, 1f); } return Color.white; } } internal static class SmokeAccessExamples { public static void Register() { Mutation.AccessMaterial("SporeSmoke").SetFloat("_Opacity", 0.1f).Register(); Mutation.AccessRenderer("VFX_PoisonExplo", "ParticleSystemRenderer").SetReceiveShadows(value: true).Register(); } } internal static class AssetBundleRegistry { private static readonly Dictionary<string, Object> _assets = new Dictionary<string, Object>(); private static readonly List<AssetBundle> _bundles = new List<AssetBundle>(); private static bool _initialized; public static void Initialize() { if (_initialized) { return; } _initialized = true; ManualLogSource log = Plugin.Log; string path = Path.Combine(Paths.BepInExRootPath, "plugins"); if (!Directory.Exists(path)) { return; } List<string> list = new List<string>(); string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories); foreach (string text in files) { string text2 = Path.GetExtension(text).ToLowerInvariant(); if (text2 == ".bundle" || text2 == ".unity3d" || Path.GetFileName(text).StartsWith("smokeshaderurp") || Path.GetFileName(text).StartsWith("lightingassets")) { list.Add(text); } } foreach (string item in list) { try { AssetBundle val = AssetBundle.LoadFromFile(item); if ((Object)(object)val == (Object)null) { log.LogWarning((object)("[AssetBundleRegistry] Failed to load " + item)); continue; } _bundles.Add(val); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text3 in allAssetNames) { Object val2 = val.LoadAsset(text3); if (!(val2 == (Object)null)) { if (!_assets.ContainsKey(text3)) { _assets[text3] = val2; } string name = val2.name; if (!_assets.ContainsKey(name)) { _assets[name] = val2; } } } } catch (Exception arg) { log.LogError((object)$"[AssetBundleRegistry] {item}: {arg}"); } } } public static T Get<T>(string name) where T : Object { if (!_initialized) { Initialize(); } if (_assets.TryGetValue(name, out var value)) { T val = (T)(object)((value is T) ? value : null); if (val != null) { return val; } } foreach (KeyValuePair<string, Object> asset in _assets) { Object value2 = asset.Value; T val2 = (T)(object)((value2 is T) ? value2 : null); if (val2 != null && asset.Value.name.Contains(name)) { return val2; } } if (typeof(T) == typeof(Shader)) { Shader val3 = Shader.Find(name); if ((Object)(object)val3 != (Object)null) { return (T)(object)((val3 is T) ? val3 : null); } } return default(T); } public static Shader GetShader(string name) { return AssetBundleRegistry.Get<Shader>(name); } public static Texture GetTexture(string name) { return AssetBundleRegistry.Get<Texture>(name); } public static Material GetMaterial(string name) { return AssetBundleRegistry.Get<Material>(name); } } internal static class SmokeMutations { public const string TargetShaderName = "SmokeParticleSimpleURP"; public static Shader CustomSmokeShader { get; private set; } public static void Register() { CustomSmokeShader = AssetBundleRegistry.GetShader("SmokeParticleSimpleURP"); if (!((Object)(object)CustomSmokeShader == (Object)null)) { Mutation.ReplaceShader("SmokeParticleSimple", CustomSmokeShader).ExcludeShaderNameContaining("Shader Graphs/").WithOverride("_ShadowStr", 0.48f) .Register(); } } } internal static class FogSurfaceMutations { public const string ReplacementShaderName = "FogSurfaceShadowedV2"; public const string FogMaterialNameContains = "FogSurface"; public const string SurfaceTypeTransparentKeyword = "_SURFACE_TYPE_TRANSPARENT"; public static Shader ReplacementShader { get; private set; } public static void RegisterShaderRule() { ReplacementShader = AssetBundleRegistry.GetShader("FogSurfaceShadowedV2"); if (!((Object)(object)ReplacementShader == (Object)null)) { Mutation.AccessMaterial("FogSurface").SetShader(ReplacementShader).Register(); } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class MutationSceneHook { [HarmonyPostfix] private static void Postfix() { Plugin.Log.LogWarning((object)"[Mutations] MutationSceneHook START postfix fired!"); try { MutationRegistry.ApplyToScene(); MutationRegistry.ApplyStatic(); } catch (Exception arg) { Plugin.Log.LogError((object)$"[Mutations] ApplyToScene threw: {arg}"); } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class BiomeLoadedHook { [HarmonyPostfix] private static void Postfix() { MutationRegistry.ApplyToScene(); } } [HarmonyPatch(typeof(SpawnGameObject), "Go")] internal static class MutationSpawnHook { [HarmonyPrefix] private static bool Prefix(SpawnGameObject __instance) { //IL_002d: 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) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.toSpawn == (Object)null) { return true; } GameObject root = Object.Instantiate<GameObject>(__instance.toSpawn, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); MutationRegistry.ApplyToHierarchy(root); return false; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class NadirFix { private static readonly Color VoidSpecialSunColor = new Color(0.5f, 0.5f, 0.5f, 1f); private static readonly Color PeakGateMoonColor = new Color(1f, 0.6016f, 0.3f, 1f); private const float PeakGateMoonIntensity = 12f; private const float PeakGateMoonRange = 20f; [HarmonyPostfix] private static void Postfix() { FixVoidSpecialDay(); FixPeakGateMoon(); } private static void FixVoidSpecialDay() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Void special day"); if ((Object)(object)val == (Object)null) { val = FindByName("Void special day"); } if ((Object)(object)val == (Object)null) { return; } Transform val2 = val.transform.Find("Directional Light"); if ((Object)(object)val2 == (Object)null) { Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "Directional Light") { val2 = val3; break; } } } if ((Object)(object)val2 != (Object)null) { Light component = ((Component)val2).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { component.shadows = (LightShadows)2; } } SpecialDayZone component2 = val.GetComponent<SpecialDayZone>(); if ((Object)(object)component2 != (Object)null) { component2.specialSunColor = VoidSpecialSunColor; } } private static void FixPeakGateMoon() { //IL_0098: 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) GameObject val = GameObject.Find("Peak Gate Moon"); if ((Object)(object)val == (Object)null) { val = FindByName("Peak Gate Moon"); } if (!((Object)(object)val == (Object)null)) { Light component = val.GetComponent<Light>(); if ((Object)(object)component == (Object)null) { component = val.AddComponent<Light>(); component.type = (LightType)2; component.shadows = (LightShadows)2; component.color = PeakGateMoonColor; component.intensity = 12f; component.range = 20f; } else { component.type = (LightType)2; component.shadows = (LightShadows)2; component.color = PeakGateMoonColor; component.intensity = 12f; component.range = 20f; } if ((Object)(object)val.GetComponent<UniversalAdditionalLightData>() == (Object)null) { UniversalAdditionalLightData val2 = val.AddComponent<UniversalAdditionalLightData>(); val2.usePipelineSettings = true; val2.softShadowQuality = (SoftShadowQuality)0; } } } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } } [HarmonyPatch(typeof(SFX_PlayOneShot))] internal static class NapBerryLightPatch { private class NapBerryLightController : MonoBehaviour { private Light _light; private float _phaseTimer; private const float Frequency = 4f; private void Awake() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) _light = ((Component)this).gameObject.GetComponent<Light>(); if ((Object)(object)_light == (Object)null) { _light = ((Component)this).gameObject.AddComponent<Light>(); _light.type = (LightType)2; _light.color = LightColor; _light.range = 15f; _light.shadows = (LightShadows)2; _light.shadowStrength = 0.85f; UniversalAdditionalLightData val = ((Component)this).gameObject.AddComponent<UniversalAdditionalLightData>(); val.usePipelineSettings = true; val.softShadowQuality = (SoftShadowQuality)0; } if ((Object)(object)_light != (Object)null) { ((Behaviour)_light).enabled = true; } } private void Update() { if (Plugin.ItemLight.Value && !((Object)(object)_light == (Object)null)) { if (!((Behaviour)_light).enabled) { ((Behaviour)_light).enabled = true; } _phaseTimer += Time.deltaTime * 4f; float t = _phaseTimer / (MathF.PI * 2f) % 1f; float num = CalculateLeftSkewedSine(t); _light.intensity = 6f * num; } } private float CalculateLeftSkewedSine(float t) { if (t < 0.25f) { float num = t / 0.25f; return num * num * (3f - 2f * num); } float num2 = (t - 0.25f) / 0.75f; return Mathf.Pow(1f - num2, 2f); } } [HarmonyPatch(typeof(Item), "Awake")] internal static class NapBerryCloneLightPatch { private const string NamePrefix = "napberry"; [HarmonyPostfix] private static void Postfix(Item __instance) { if (!Plugin.ItemLight.Value || (Object)(object)__instance == (Object)null) { return; } GameObject gameObject = ((Component)__instance).gameObject; if (!((Object)(object)gameObject == (Object)null) && ((Object)gameObject).name.StartsWith("napberry", StringComparison.OrdinalIgnoreCase)) { PhotonView component = gameObject.GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null) && component.isRuntimeInstantiated) { AttachLight(gameObject); } } } private static void AttachLight(GameObject go) { if (!((Object)(object)go.GetComponent<NapBerryCloneLightController>() != (Object)null)) { go.AddComponent<NapBerryCloneLightController>(); Plugin.Log.LogInfo((object)("[NapBerry] Attached clone light to " + ((Object)go).name)); } } } internal class NapBerryCloneLightController : MonoBehaviour { private static readonly Color LightColor = new Color(0.9128f, 0.3774f, 1f, 1f); private const float Intensity = 3f; private const float Range = 3f; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) Light component = ((Component)this).gameObject.GetComponent<Light>(); if ((Object)(object)component == (Object)null) { component = ((Component)this).gameObject.AddComponent<Light>(); component.type = (LightType)2; component.color = LightColor; component.intensity = 3f; component.range = 3f; component.shadows = (LightShadows)0; ((Behaviour)component).enabled = true; } } } private static readonly Color LightColor = new Color(0.9128f, 0.3774f, 1f, 1f); private const float MaxIntensity = 6f; private const float LightRange = 15f; [HarmonyPatch("Start")] [HarmonyPostfix] private static void AttachToFakeNapBerry(SFX_PlayOneShot __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).transform.parent == (Object)null) { return; } Transform parent = ((Component)__instance).transform.parent; if (!(((Object)parent).name == "Pivot")) { return; } Transform val = parent.Find("FakeNapBerry"); if ((Object)(object)val != (Object)null) { GameObject gameObject = ((Component)val).gameObject; if ((Object)(object)gameObject.GetComponent<NapBerryLightController>() == (Object)null) { gameObject.AddComponent<NapBerryLightController>(); } } } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class PeakFix { private const float LightIntensity = 12f; private const float RimFresnelValue = 0.2f; [HarmonyPostfix] private static void Postfix() { //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 activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!string.IsNullOrEmpty(name) && name.Contains("Level_")) { FixSpecialDayPeak(); } } private static void FixSpecialDayPeak() { GameObject val = GameObject.Find("Map/Biome_4/Caldera/Volcano/Volcano_Segment/Peak_Kiln Variant/SpecialDay Peak"); if ((Object)(object)val == (Object)null) { val = FindByName("SpecialDay Peak"); } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[PeakFix] Could not find 'SpecialDay Peak'"); return; } Transform val2 = val.transform.Find("Directional Light"); if ((Object)(object)val2 == (Object)null) { Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "Directional Light") { val2 = val3; break; } } } if ((Object)(object)val2 != (Object)null) { Light component = ((Component)val2).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { component.intensity = 12f; component.shadows = (LightShadows)2; } } SpecialDayZone component2 = val.GetComponent<SpecialDayZone>(); if (!((Object)(object)component2 == (Object)null) && component2.globalShaderVals != null && component2.globalShaderVals.Length >= 2) { ShaderVal val4 = component2.globalShaderVals[1]; val4.value = 0.2f; component2.globalShaderVals[1] = val4; } } private static GameObject FindByName(string name) { Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == name) { return ((Component)val).gameObject; } } return null; } } [HarmonyPatch(typeof(DayNightManager), "Start")] internal static class Crucible_Patch { private const string TargetName = "Particle System"; private const string ParentPathSubString = "Crucible"; [HarmonyPostfix] private static void Postfix() { if (!Plugin.CitadelTweak.Value) { return; } Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsInactive)1, (FindObjectsSortMode)0); Transform[] array2 = array; foreach (Transform val in array2) { if (((Object)val).name == "Particle System" && GetHierarchyPath(val).Contains("Crucible")) { SetupCrucible(((Component)val).gameObject); } } } private static void SetupCrucible(GameObject go) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go.GetComponent<Light>() != (Object)null)) { Light val = go.AddComponent<Light>(); go.AddComponent<UniversalAdditionalLightData>(); val.type = (LightType)2; val.intensity = 5f; val.range = 300f; val.color = new Color(1f, 0.58f, 0f, 1f); val.shadows = (LightShadows)2; ((Behaviour)val).enabled = true; } } private static string GetHierarchyPath(Transform transform) { string text = ((Object)transform).name; while ((Object)(object)transform.parent != (Object)null) { transform = transform.parent; text = ((Object)transform).name + "/" + text; } return text; } } } namespace TechnicalTweaks.Patches.Mutations { internal abstract class Action { public abstract string Describe(); public virtual void Apply(Object candidate) { } public virtual void ApplyStatic(string target) { } } internal class SetShaderAction : Action { public Shader Target; public bool PreserveRenderQueue = true; public override string Describe() { Shader target = Target; return "SetShader('" + ((target != null) ? ((Object)target).name : null) + "')"; } public override void Apply(Object candidate) { Material val = (Material)(object)((candidate is Material) ? candidate : null); if (val != null && !((Object)(object)Target == (Object)null) && !((Object)(object)val.shader == (Object)(object)Target)) { int renderQueue = val.renderQueue; string text = (((Object)(object)val.shader != (Object)null) ? ((Obj