Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Stage fog v0.13.0
BepInEx/plugins/AlienSkies/AlienSkies.dll
Decompiled a day 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace AlienSkies; internal sealed class AdditionalStage { public readonly StageLook look; public readonly StageBalance balance; public readonly string climate; public readonly string fillColor; public readonly string[] hues; public readonly float distance; internal AdditionalStage(string id, string climate, float distance, string zenith, string near, string mid, string far, string cool, string warm, string fill, string ramp) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) this.climate = climate; this.distance = distance; fillColor = fill; hues = ramp.Split(' '); balance = new StageBalance(0.985f, 0.68f, 1.011891f, 1f, 0.25f, (climate == "wet") ? 0.16f : 0.14f, H(near), H(mid), H(far), H(cool), H(warm)); look = new StageLook(id, H(zenith), H(mid) * 0.65f, H(warm), H(fill) * 0.58f, H(fill), H(near) * 0.7f, 0.9f, 0f, 0.6f, 0f, moon: false); } private static Color H(string hex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ColorUtility.TryParseHtmlString(hex, ref result); return result; } } internal static class AdditionalStages { private static readonly Dictionary<string, AdditionalStage> profiles; public static readonly string[] Ids; static AdditionalStages() { profiles = new Dictionary<string, AdditionalStage>(); Ids = new string[17] { "rootjungle", "skymeadow", "habitat", "habitatfall", "helminthroost", "lakes", "lakesnight", "lemuriantemple", "village", "villagenight", "ironalluvium2", "conduitcanyon", "nest", "repurposedcrater", "fungal", "mire", "sanctum" }; Add("rootjungle", "wet", 0f, "#102C29", "#304D46", "#739887", "#B4C8AF", "#75A8A0", "#B2BD83", "#A7C3AF", "#436F65 #64958A #8AB2A0 #AEC7B2 #CBD8C5"); Add("skymeadow", "open", 0f, "#241D42", "#49415F", "#9385AB", "#C9BDD0", "#9E98C8", "#C6A9C2", "#BFB6D1", "#6C628E #8C7EAA #AA9CBD #C4B5CF #D9CCDF"); Add("habitat", "wet", 0.26f, "#183236", "#3C5559", "#829C96", "#BEC9AF", "#89ADA9", "#BCC09A", "#B2C7BD", "#527C7F #749C9A #99B6AA #BCCBB9 #D4DDCB"); Add("habitatfall", "dust", 0.15f, "#342C26", "#555443", "#A28D6C", "#CCBCA0", "#A6AC85", "#C9A17F", "#C8BBA2", "#777B58 #98926D #B5A883 #CEBDA1 #DFD1BD"); Add("helminthroost", "ash", 0.2f, "#291518", "#593F40", "#A37370", "#C5A696", "#AA858E", "#C59378", "#C4ABA5", "#805658 #A37572 #BC9490 #D0B2A9 #DFCCC3"); Add("lakes", "wet", 0.17f, "#26312F", "#4D4D53", "#929889", "#C6C5B0", "#9B9DB5", "#C0B197", "#BBC7B6", "#6C7477 #8C9994 #ADB7A5 #C8CDBB #DBDDCE"); Add("lakesnight", "wet", 0.108f, "#20162F", "#41394F", "#80738F", "#B6ADC6", "#938BAF", "#B79CAB", "#ABA5C2", "#615477 #807098 #9D91B3 #BBAFCB #D0C8DD"); Add("lemuriantemple", "cave", 0.17f, "#122B30", "#344D51", "#708F91", "#B0C3BF", "#7EACAD", "#B0BDA6", "#A5BFC0", "#476E76 #669398 #8EB0B0 #B0C8C3 #CDDBD3"); Add("village", "dust", 0.231f, "#292D32", "#454F53", "#88938B", "#C0C5B2", "#96ABAA", "#BAB69A", "#B9C0B5", "#62777C #819893 #A3B3A3 #C0CCB8 #D5DDCB"); Add("villagenight", "dust", 0.18f, "#171F31", "#364355", "#738599", "#B0BECA", "#8B9DB8", "#B4B7BF", "#A8B6CB", "#4F6686 #708BA6 #94AABF #B4C1D3 #CDD3E1"); Add("ironalluvium2", "dust", 0.15f, "#172C2C", "#354D49", "#75968A", "#B6C4AC", "#81ADA5", "#B4BA94", "#ACC1B4", "#4B746B #6B978A #94B2A0 #B7C9B4 #D0DACC"); Add("conduitcanyon", "dust", 0.24f, "#192734", "#3D4D5B", "#7C8C9E", "#B6C1CC", "#8FABC0", "#B0B4C4", "#AFBDCE", "#566E89 #788FA9 #9BACBF #BAC7D6 #D2D9E2"); Add("nest", "open", 0.1f, "#272B33", "#4C4D52", "#8C929F", "#BDC4CC", "#99A8BA", "#BCB1AB", "#BDC1CB", "#6B7184 #8A93A9 #A7B0C3 #C2C9D5 #D9DCE4"); Add("repurposedcrater", "dust", 0.15f, "#2B252D", "#50474F", "#A08380", "#CBB5A2", "#9BA3B1", "#C79F88", "#C6B5AC", "#746B7D #99868F #B9A1A4 #CFBBB6 #E0D2C8"); Add("fungal", "cave", 0.18f, "#21242F", "#464552", "#87879B", "#BEBFCD", "#9A9FBF", "#B7A6BC", "#B5B7CC", "#686981 #888BA5 #A7ADC0 #C1C6D5 #D6D9E3"); Add("mire", "wet", 0.11f, "#1D252B", "#3E484E", "#7E8A88", "#B9BDB0", "#87A4A6", "#B4AC96", "#ADBDB4", "#586F75 #7B9494 #9FB0A8 #BFCBBE #D5DBCE"); Add("sanctum", "cave", 0.13f, "#20272D", "#434B52", "#84928F", "#BBC8BF", "#91ABB1", "#B2B6AA", "#B3C2BF", "#606F7C #819397 #A2B2AE #BFCEC4 #D5DFD5"); } private static void Add(string id, string climate, float distance, string zenith, string near, string mid, string far, string cool, string warm, string fill, string ramp) { profiles.Add(id, new AdditionalStage(id, climate, distance, zenith, near, mid, far, cool, warm, fill, ramp)); } public static AdditionalStage For(string id) { AdditionalStage value; return (id != null && profiles.TryGetValue(id, out value)) ? value : null; } public static string[] WithExisting(string[] existing) { List<string> list = new List<string>(existing); list.AddRange(Ids); return list.ToArray(); } } [BepInPlugin("local.alienskies", "Alien Skies", "0.13.0")] public sealed class Plugin : BaseUnityPlugin { private sealed class ArtProfile { public ConfigEntry<float> opacity; public ConfigEntry<float> power; public ConfigEntry<float> range; public ConfigEntry<float> clear; public ConfigEntry<float> nearOpacity; public ConfigEntry<float> midOpacity; public ConfigEntry<float> farOpacity; public ConfigEntry<float> highlightLimit; public ConfigEntry<float> skyProtection; public ConfigEntry<float> distanceReference; public ConfigEntry<string> near; public ConfigEntry<string> mid; public ConfigEntry<string> far; public ConfigEntry<string> cool; public ConfigEntry<string> warm; } private sealed class Climate { public ConfigEntry<float> mistAmount; public ConfigEntry<float> flow; public ConfigEntry<float> height; public ConfigEntry<float> wind; public ConfigEntry<float> pockets; public ConfigEntry<float> motes; public ConfigEntry<float> fill; public ConfigEntry<float> fillRadius; public ConfigEntry<float> stars; public ConfigEntry<float> aurora; public ConfigEntry<float> sky; public ConfigEntry<string> fillColor; } private sealed class DepthColors { public ConfigEntry<string>[] stops; public ConfigEntry<float> strength; public ConfigEntry<float> curve; public ConfigEntry<float> native; public ConfigEntry<float> vertical; } [HarmonyPatch(typeof(PostProcessLayer), "CommandBuffersNeedUpdating")] private static class TraceFogCommands { private static void Postfix(PostProcessLayer __instance, bool __result) { Plugin instance = Instance; if (!((Object)(object)instance == (Object)null) && instance.traceRendering.Value && !(((Object)__instance).name != "Scene Camera")) { instance.commandCheckCount++; if (__result) { instance.commandRebuildCount++; } } } } [HarmonyPatch(typeof(RampFogRenderer), "Render")] private static class TraceFogRecord { private static void Prefix(RampFogRenderer __instance, PostProcessRenderContext context) { Plugin instance = Instance; if (!((Object)(object)instance == (Object)null) && instance.traceRendering.Value && Object.op_Implicit((Object)(object)context.camera) && !(((Object)context.camera).name != "Scene Camera")) { instance.fogRecordCount++; if (instance.fogRecordCount <= 3) { RampFog settings = ((PostProcessEffectRenderer<RampFog>)(object)__instance).settings; ((BaseUnityPlugin)instance).Logger.LogInfo((object)("FOG RECORD frame=" + Time.frameCount + " custom=" + instance.FogActive(context) + " camera=" + ((Object)context.camera).GetInstanceID() + " intensity=" + ((ParameterOverride<float>)(object)settings.fogIntensity).value + " power=" + ((ParameterOverride<float>)(object)settings.fogPower).value + " zero=" + ((ParameterOverride<float>)(object)settings.fogZero).value + " one=" + ((ParameterOverride<float>)(object)settings.fogOne).value + " sky=" + ((ParameterOverride<float>)(object)settings.skyboxStrength).value + " height=" + ((ParameterOverride<float>)(object)settings.fogHeightStart).value + "," + ((ParameterOverride<float>)(object)settings.fogHeightEnd).value + "," + ((ParameterOverride<float>)(object)settings.fogHeightIntensity).value)); } } } } private sealed class FogCommandState { public bool active; public int scene; public int revision; } [HarmonyPatch(typeof(PostProcessLayer), "OnPreCull")] private static class PrepareSkyPatch { private static void Prefix(PostProcessLayer __instance) { Plugin instance = Instance; if (!((Object)(object)instance == (Object)null)) { Camera component = ((Component)__instance).GetComponent<Camera>(); if (Object.op_Implicit((Object)(object)component) && ((Object)component).name == "Scene Camera") { instance.PrepareSky(component); instance.SyncFogCommands(__instance, component); } } } } [HarmonyPatch(typeof(RampFogRenderer), "Render")] private static class FogRenderPatch { private static Shader fogShader; private static bool loggedDirect; private static bool Prefix(RampFogRenderer __instance, PostProcessRenderContext context) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) Plugin instance = Instance; if ((Object)(object)instance == (Object)null || !instance.FogActive(context)) { return true; } Scene activeScene = SceneManager.GetActiveScene(); StageLook stageLook = StageLook.For(((Scene)(ref activeScene)).name); StageBalance stageBalance = StageBalance.For(stageLook.id); RampFog settings = ((PostProcessEffectRenderer<RampFog>)(object)__instance).settings; if (!Object.op_Implicit((Object)(object)fogShader)) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val in array) { if (Object.op_Implicit((Object)(object)val) && ((Object)val).name == "Hidden/PostProcess/RampFog") { fogShader = val; break; } } } if (!Object.op_Implicit((Object)(object)fogShader)) { return true; } if (!loggedDirect) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"Direct fog command path active; shared fog settings untouched."); loggedDirect = true; } bool flag = instance.refinedAtmosphere.Value && Object.op_Implicit((Object)(object)instance.seamlessFogShader) && Object.op_Implicit((Object)(object)instance.skyCube); PropertySheet val2 = context.propertySheets.Get(flag ? instance.seamlessFogShader : fogShader); if (flag) { val2.properties.SetTexture("_ASSky", (Texture)(object)instance.skyCube); } ArtProfile artProfile = (instance.refinedAtmosphere.Value ? instance.artProfiles[stageLook.id] : null); val2.properties.SetFloat("_FogIntensity", (artProfile != null) ? Mathf.Clamp01(artProfile.opacity.Value) : stageBalance.fogStrength); val2.properties.SetFloat("_FogPower", (artProfile != null) ? Mathf.Clamp(artProfile.power.Value, 0.25f, 3f) : stageBalance.powerScale); float num = ((artProfile != null && artProfile.distanceReference.Value > 0f) ? Mathf.Clamp(artProfile.distanceReference.Value, 0.01f, 1f) : Mathf.Max(0.01f, ((ParameterOverride<float>)(object)settings.fogOne).value)); float num2 = ((artProfile != null && artProfile.distanceReference.Value > 0f) ? 0f : Mathf.Max(0f, ((ParameterOverride<float>)(object)settings.fogZero).value)); if (artProfile != null) { num2 = Mathf.Max(num2, num * Mathf.Clamp(artProfile.clear.Value, 0f, 0.25f)); } val2.properties.SetFloat("_FogZero", num2); val2.properties.SetFloat("_FogOne", Mathf.Max(num2 + 0.01f, num * ((artProfile != null) ? Mathf.Clamp(artProfile.range.Value, 0.2f, 2f) : stageBalance.rangeScale))); val2.properties.SetFloat("_FogHeightStart", ((ParameterOverride<float>)(object)settings.fogHeightStart).value); val2.properties.SetFloat("_FogHeightEnd", ((ParameterOverride<float>)(object)settings.fogHeightEnd).value); val2.properties.SetFloat("_FogHeightIntensity", ((ParameterOverride<float>)(object)settings.fogHeightIntensity).value); Color near = ((artProfile != null) ? ArtColor(artProfile.near, stageBalance.near) : stageBalance.near); Color mid = ((artProfile != null) ? ArtColor(artProfile.mid, stageBalance.mid) : stageBalance.mid); Color far = ((artProfile != null) ? ArtColor(artProfile.far, stageBalance.far) : stageBalance.far); if (artProfile != null) { FogPalette(artProfile, stageBalance, out near, out mid, out far); near.a = Mathf.Clamp01(artProfile.nearOpacity.Value); mid.a = Mathf.Clamp01(artProfile.midOpacity.Value); far.a = Mathf.Clamp01(artProfile.farOpacity.Value); } if (flag) { instance.BindDepthColors(val2, stageLook.id, near, far); } val2.properties.SetColor("_FogColorStart", near); val2.properties.SetColor("_FogColorMid", mid); val2.properties.SetColor("_FogColorEnd", far); val2.properties.SetFloat("_SkyboxStrength", (artProfile != null) ? Mathf.Clamp01(artProfile.skyProtection.Value) : ((stageLook.id == "abyssal") ? 0f : 0.92f)); RuntimeUtilities.BlitFullscreenTriangle(context.command, context.source, context.destination, val2, 0, false, (Rect?)null); return false; } } private sealed class SurfacePool { public Light light; public Vector3 key; public Vector3 ground; public bool assigned; public float fade; } private sealed class FogState { public float strength; public Color start; public Color mid; public Color end; } private sealed class LightState { public float intensity; public Color color; } private sealed class CameraSkyState { public Material material; public bool enabled; public bool created; } private const int MistSide = 7; private const int MistCells = 49; private const int MistLayers = 3; private const int MistCount = 147; private const float MistSpacing = 24f; private readonly Dictionary<string, ArtProfile> artProfiles = new Dictionary<string, ArtProfile>(); private ConfigEntry<bool> refinedAtmosphere; private ConfigEntry<float> mistStrength; private ConfigEntry<float> mistSpeed; private ConfigEntry<float> spillStrength; private ConfigEntry<float> spillRange; private ConfigEntry<float> detailStrength; private int artRevision; private bool skyReloadPending; private ConfigEntry<float> density; private ConfigEntry<bool> localGlow; private Camera atmosphereCamera; private GameObject atmosphereRoot; private ParticleSystem motes; private ParticleSystem mist; private Material particleMaterial; private Material mistMaterial; private Texture2D mistTexture; private Texture2D particleTexture; private Particle[] moteBuffer; private Particle[] mistBuffer; private Vector3[] anchors; private bool[] validAnchors; private float[] anchorHeadroom; private float[] anchorBirth; private readonly List<Light> glowLights = new List<Light>(); private readonly List<Renderer> glowSources = new List<Renderer>(); private readonly List<float> glowIntensities = new List<float>(); private readonly List<float> glowBirths = new List<float>(); private Light fireflyLightA; private Light fireflyLightB; private float nextParticles; private float nextGlowScan; private int effectScene = -1; private bool atmosphereFailed; private bool diagnosticsReported; private int lastGlowCount = -1; private readonly Dictionary<string, Climate> climates = new Dictionary<string, Climate>(); private ConfigEntry<bool> combatMistRelief; private float localVisibility = 1f; private ConfigEntry<float> skyLuminance; private ConfigEntry<float> atmosphereHighlightLimit; private readonly Dictionary<string, DepthColors> depthColors = new Dictionary<string, DepthColors>(); private Cubemap nativeSkyCube; private Color nativeSkyTint = Color.white; private float nativeSkyRotation; private ConfigEntry<bool> traceRendering; private int fogRecordCount; private int commandCheckCount; private int commandRebuildCount; private float nextFogReport; internal static Plugin Instance; private Harmony fogPatch; private readonly Dictionary<PostProcessLayer, FogCommandState> fogCommands = new Dictionary<PostProcessLayer, FogCommandState>(); private ConfigEntry<bool> foregroundEnabled; private ConfigEntry<float> environmentIntensity; private ConfigEntry<float> environmentRadius; private ConfigEntry<float> abyssalMist; private ConfigEntry<float> abyssalMotes; private ConfigEntry<string> environmentCool; private ConfigEntry<string> environmentWarm; private readonly SurfacePool[] surfacePools = new SurfacePool[4]; private readonly Vector3[] surfaceKeys = (Vector3[])(object)new Vector3[25]; private readonly Vector3[] surfaceGround = (Vector3[])(object)new Vector3[25]; private readonly float[] surfaceHeadroom = new float[25]; private readonly bool[] surfaceValid = new bool[25]; private float nextSurfaceSurvey; private bool surfaceReportPending = true; private int reportedSurfaceCount = -1; private Vector3[] mistKeys; private Vector3[] mistPositions; private bool[] mistAssigned; private bool[] mistGrounded; private float[] mistBirth; private float[] mistHeadroom; private ConfigEntry<bool> skyEnabled; private ConfigEntry<float> brightness; private ConfigEntry<int> lightingTestMode; private Material material; private readonly Dictionary<RampFog, FogState> fogOriginals = new Dictionary<RampFog, FogState>(); private readonly Dictionary<Light, LightState> lightOriginals = new Dictionary<Light, LightState>(); private bool directionalOverrideActive; private int lightingCameraId; private SphericalHarmonicsL2 savedProbe; private bool lightingSaved; private int lightingScene; private AmbientMode ambientMode; private Color ambientSky; private Color ambientEquator; private Color ambientGround; private Color ambientLight; private float ambientIntensity; private float nextLightScan; private float nextScan; private float nextFogScan; private float meshScanUntil; private Cubemap skyCube; private Material originalSky; private readonly Dictionary<Skybox, CameraSkyState> cameraOriginals = new Dictionary<Skybox, CameraSkyState>(); private readonly Dictionary<Renderer, Material[]> meshOriginals = new Dictionary<Renderer, Material[]>(); private string stage = ""; private StageLook look; private bool missingShader; private bool renderFailed; private readonly HashSet<int> loggedCameras = new HashSet<int>(); private ConfigEntry<bool> extremeAmbience; private ConfigEntry<bool> radialLighting; private Shader seamlessFogShader; private void ConfigureArtControls() { //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) refinedAtmosphere = ((BaseUnityPlugin)this).Config.Bind<bool>("Art direction", "RefinedAtmosphere", true, "F10 compares the refinement with the approved 0.9 fog and mist. F8 still toggles the entire addon."); detailStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Art direction", "DetailStrength", 0.18f, "New mist hue and upper-sky artwork blend over the accepted dense atmosphere, 0-1. Zero restores the old mist/sky treatment while keeping added stages."); mistStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Art direction", "MistOpacity", 1f, "Mist opacity multiplier, 0-2. Independent of distance fog and mote density."); mistSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Art direction", "MistSpeed", 0.65f, "Mist movement speed, 0-2. Zero stops movement; fade-in still runs."); spillStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Art direction", "SpillIntensity", 0.7f, "Added emissive point-light intensity multiplier, 0-2. Native lights/materials are untouched."); spillRange = ((BaseUnityPlugin)this).Config.Bind<float>("Art direction", "SpillRadius", 0.7f, "Added emissive light range multiplier, 0.25-2."); string[] ids = StageLook.Ids; foreach (string text in ids) { StageBalance stageBalance = StageBalance.For(text); string text2 = "Fog - " + text; bool flag = text == "abyssal"; AdditionalStage additionalStage = AdditionalStages.For(text); ArtProfile artProfile = new ArtProfile(); artProfile.opacity = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Opacity", flag ? 0.84f : stageBalance.fogStrength, "Distance-fog maximum strength, 0-1. Not exposure."); artProfile.power = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "Curve", flag ? 1.05f : stageBalance.powerScale, "Depth-ramp power, 0.25-3; larger values reserve more clear foreground."); artProfile.range = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "RangeScale", flag ? 0.56f : stageBalance.rangeScale, "Scale of the map's native far-fog distance, 0.2-2. Smaller brings the far palette closer."); artProfile.clear = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "ClearNearFraction", flag ? 0.045f : ((additionalStage != null) ? 0.018f : 0f), "Near-color plateau as a fraction of native far-fog distance, 0-0.25. NearOpacity controls its transparency."); artProfile.nearOpacity = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "NearOpacity", flag ? 0.38f : ((additionalStage != null) ? 0.48f : 0.3f), "Near haze alpha, 0-1, multiplied by Opacity. Keep a translucent colored atmosphere close to the camera."); artProfile.midOpacity = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "MiddleOpacity", (additionalStage != null) ? 0.96f : 0.88f, "Middle haze alpha, 0-1. Smoothly interpolated within each stage's depth range. Changes silhouette transmission without shifting the color ramp or the fully opaque distant endpoint."); artProfile.farOpacity = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "FarOpacity", 1f, "Far haze alpha, 0-1. One preserves the luminous distant atmosphere."); artProfile.highlightLimit = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "HighlightLimit", 0f, "Zero preserves the accepted palette. Optional fog luminance ceiling 0.15-0.8; does not change scene exposure."); artProfile.skyProtection = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "SkyProtection", flag ? 0f : 0.92f, "Native sky fog subtraction, 0-1. Smaller blends more far haze into the sky. Independent of terrain opacity."); artProfile.distanceReference = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "DistanceReference", additionalStage?.distance ?? (text switch { "acres" => 0.12f, "siren" => 0.12f, "sulfur" => 0.11f, "iron" => 0.15f, "aphelian" => 0.12f, "forest" => 0.1f, _ => 0f, }), "Normalized depth reference before RangeScale; zero inherits native volume distance. Fixed references prevent extreme range changes between new-stage fog volumes."); artProfile.near = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "NearColor", Hex(stageBalance.near), "Near haze color as #RRGGBB; preserves stage hue identity."); artProfile.mid = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "MiddleColor", Hex((Color)(flag ? new Color(0.53f, 0.43f, 0.61f) : stageBalance.mid)), "Middle haze color as #RRGGBB; independent of fog density."); artProfile.far = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "FarColor", Hex((Color)(flag ? new Color(0.82f, 0.68f, 0.56f) : stageBalance.far)), "Distant haze color as #RRGGBB; keep luminance restrained."); artProfile.cool = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "MistCool", Hex((Color)(flag ? new Color(0.6f, 0.49f, 0.73f) : stageBalance.mistCool)), "Cool local mist color as #RRGGBB."); artProfile.warm = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "MistWarm", Hex((Color)(flag ? new Color(0.79f, 0.56f, 0.64f) : stageBalance.mistWarm)), "Warm local mist color as #RRGGBB."); artProfiles.Add(text, artProfile); } ((BaseUnityPlugin)this).Config.SettingChanged += ArtSettingChanged; } private void ArtSettingChanged(object sender, SettingChangedEventArgs args) { artRevision++; } private static string Hex(Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return "#" + ColorUtility.ToHtmlStringRGB(color); } private static Color ArtColor(ConfigEntry<string> value, Color fallback) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Color val = default(Color); return ColorUtility.TryParseHtmlString(value.Value, ref val) ? val : fallback; } private void UpdateArtControls() { if (Input.GetKeyDown((KeyCode)291)) { refinedAtmosphere.Value = !refinedAtmosphere.Value; skyReloadPending = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Art comparison: " + (refinedAtmosphere.Value ? "refined" : "approved 0.9 baseline"))); } if (Input.GetKeyDown((KeyCode)290)) { try { ((BaseUnityPlugin)this).Config.Reload(); artRevision++; skyReloadPending = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Art settings reloaded; fog commands and sky will refresh."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not reload art settings: " + ex.Message)); } } } private void ConfigureAtmosphere() { ConfigureTestLook(); density = ((BaseUnityPlugin)this).Config.Bind<float>("Atmosphere", "Density", 1f, "Particle density: 0 disables particles, 0.5 is lighter, 1 default, maximum 1.5."); localGlow = ((BaseUnityPlugin)this).Config.Bind<bool>("Atmosphere", "ObjectLightSpill", true, "Up to six nearby shadowless lights for emissive lamps/crystals/flames. No light per particle."); } private void ResetAtmosphere() { if (Object.op_Implicit((Object)(object)atmosphereRoot)) { Object.Destroy((Object)(object)atmosphereRoot); } if (Object.op_Implicit((Object)(object)particleMaterial)) { Object.Destroy((Object)(object)particleMaterial); } if (Object.op_Implicit((Object)(object)mistMaterial)) { Object.Destroy((Object)(object)mistMaterial); } if (Object.op_Implicit((Object)(object)mistTexture)) { Object.Destroy((Object)(object)mistTexture); } mistMaterial = null; mistTexture = null; if (Object.op_Implicit((Object)(object)particleTexture)) { Object.Destroy((Object)(object)particleTexture); } atmosphereRoot = null; particleMaterial = null; particleTexture = null; glowLights.Clear(); glowSources.Clear(); glowIntensities.Clear(); glowBirths.Clear(); fireflyLightA = null; fireflyLightB = null; ResetSurfaceLighting(); motes = null; mist = null; anchors = null; validAnchors = null; anchorHeadroom = null; anchorBirth = null; localVisibility = 1f; ResetMistField(); effectScene = -1; nextParticles = 0f; nextGlowScan = 0f; atmosphereFailed = false; diagnosticsReported = false; lastGlowCount = -1; } private ParticleSystem MakeParticles(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(atmosphereRoot.transform); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 192; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = false; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = false; ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = ((name == "Low atmospheric wisps") ? mistMaterial : particleMaterial); ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; if (name == "Low atmospheric wisps") { component.alignment = (ParticleSystemRenderSpace)3; } val2.Pause(); return val2; } private void BuildAtmosphere() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) Shader val = null; Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array) { if (Object.op_Implicit((Object)(object)val2) && ((Object)val2).name == "Particles/Standard Unlit" && val2.isSupported) { val = val2; break; } } if (!Object.op_Implicit((Object)(object)val)) { array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array) { if (Object.op_Implicit((Object)(object)val2) && ((Object)val2).name == "Sprites/Default" && val2.isSupported) { val = val2; break; } } } if (!Object.op_Implicit((Object)(object)val)) { atmosphereFailed = true; ((BaseUnityPlugin)this).Logger.LogWarning((object)"Ambient particles unavailable: no loaded supported particle shader."); return; } particleTexture = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array2 = (Color[])(object)new Color[1024]; for (int j = 0; j < 32; j++) { for (int k = 0; k < 32; k++) { float num = ((float)k - 15.5f) / 15.5f; float num2 = ((float)j - 15.5f) / 15.5f; float num3 = Mathf.Pow(Mathf.Clamp01(1f - num * num - num2 * num2), 3f); ref Color reference = ref array2[j * 32 + k]; reference = new Color(1f, 1f, 1f, num3); } } particleTexture.SetPixels(array2); particleTexture.Apply(false, true); particleMaterial = new Material(val); particleMaterial.SetTexture("_MainTex", (Texture)(object)particleTexture); if (particleMaterial.HasProperty("_Color")) { particleMaterial.SetColor("_Color", Color.white); } if (particleMaterial.HasProperty("_Mode")) { particleMaterial.SetFloat("_Mode", 2f); } particleMaterial.SetInt("_SrcBlend", 5); particleMaterial.SetInt("_DstBlend", 10); particleMaterial.SetInt("_ZWrite", 0); particleMaterial.EnableKeyword("_ALPHABLEND_ON"); particleMaterial.renderQueue = 3000; BuildMistMaterial(); atmosphereRoot = new GameObject("AlienSkies-" + look.id + "-Atmosphere"); motes = MakeParticles("World ambient motes"); mist = MakeParticles("Low atmospheric wisps"); MainModule main = mist.main; ((MainModule)(ref main)).startSize3D = true; moteBuffer = (Particle[])(object)new Particle[144]; mistBuffer = (Particle[])(object)new Particle[147]; InitializeMistField(); anchors = (Vector3[])(object)new Vector3[144]; validAnchors = new bool[144]; anchorHeadroom = new float[144]; anchorBirth = new float[144]; Scene activeScene = SceneManager.GetActiveScene(); effectScene = ((Scene)(ref activeScene)).handle; for (int l = 0; l < 144; l++) { PlaceAnchor(l, ((Component)atmosphereCamera).transform.position); } if (look.id == "wetland") { fireflyLightA = MakeLight("Firefly cluster A"); fireflyLightB = MakeLight("Firefly cluster B"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Stage atmosphere ready: " + look.id + "; pooled particles, maximum six object spill lights.")); } private Light MakeLight(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(atmosphereRoot.transform); Light val2 = val.AddComponent<Light>(); val2.type = (LightType)2; val2.shadows = (LightShadows)0; val2.range = 5f; val2.intensity = 0.45f; return val2; } private void PlaceAnchor(int i, Vector3 center) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) float num = Hash(new Vector3((float)i, 17f, 4f)) * MathF.PI * 2f; float num2 = 7f + Hash(new Vector3((float)i, 9f, 6f)) * 25f; Vector3 val = center + new Vector3(Mathf.Cos(num) * num2, 24f, Mathf.Sin(num) * num2); bool[] array = validAnchors; Vector3 down = Vector3.down; LayerIndex world = LayerIndex.world; RaycastHit val2 = default(RaycastHit); array[i] = Physics.Raycast(val, down, ref val2, 90f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1); ref Vector3 reference = ref anchors[i]; reference = (validAnchors[i] ? (((RaycastHit)(ref val2)).point + Vector3.up * 0.4f) : (center + new Vector3(Mathf.Cos(num) * num2, -2f, Mathf.Sin(num) * num2))); anchorBirth[i] = Time.time; float[] array2 = anchorHeadroom; float num3; if (validAnchors[i]) { Vector3 val3 = anchors[i]; Vector3 up = Vector3.up; world = LayerIndex.world; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, up, ref val4, 20f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1)) { num3 = ((RaycastHit)(ref val4)).distance; goto IL_0153; } } num3 = 20f; goto IL_0153; IL_0153: array2[i] = num3; } private void UpdateAtmosphere() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_100a: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_11af: Unknown result type (might be due to invalid IL or missing references) //IL_1173: Unknown result type (might be due to invalid IL or missing references) //IL_119a: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0d19: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d40: Unknown result type (might be due to invalid IL or missing references) //IL_0d47: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d58: Unknown result type (might be due to invalid IL or missing references) //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) //IL_0d62: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_09da: Unknown result type (might be due to invalid IL or missing references) //IL_0a10: Unknown result type (might be due to invalid IL or missing references) //IL_0a15: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Unknown result type (might be due to invalid IL or missing references) //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) //IL_0a46: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0fd3: Unknown result type (might be due to invalid IL or missing references) //IL_0fd5: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_0bac: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0c01: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) //IL_0b06: Unknown result type (might be due to invalid IL or missing references) //IL_0b0b: Unknown result type (might be due to invalid IL or missing references) //IL_0b10: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0c69: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Unknown result type (might be due to invalid IL or missing references) //IL_0b3d: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_083b: Unknown result type (might be due to invalid IL or missing references) //IL_0c6f: Unknown result type (might be due to invalid IL or missing references) //IL_0c4d: Unknown result type (might be due to invalid IL or missing references) //IL_0c32: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0f02: Unknown result type (might be due to invalid IL or missing references) //IL_0f03: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) if (density == null) { return; } Scene activeScene; int num; if (skyEnabled.Value && !renderFailed && Object.op_Implicit((Object)(object)Run.instance) && look != null && Object.op_Implicit((Object)(object)atmosphereCamera)) { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == stage) { num = (StageLook.IsRoute(stage) ? 1 : 0); goto IL_0077; } } num = 0; goto IL_0077; IL_0077: bool flag = (byte)num != 0; if (Object.op_Implicit((Object)(object)atmosphereRoot)) { atmosphereRoot.SetActive(flag); } if (!flag || atmosphereFailed) { return; } try { int num2 = effectScene; activeScene = SceneManager.GetActiveScene(); if (num2 != ((Scene)(ref activeScene)).handle) { ResetAtmosphere(); } if (!Object.op_Implicit((Object)(object)atmosphereRoot)) { BuildAtmosphere(); } if (!Object.op_Implicit((Object)(object)atmosphereRoot)) { return; } UpdateForegroundLighting(); UpdateLocalVisibility(); if (Time.unscaledTime < nextParticles) { return; } nextParticles = Time.unscaledTime + 0.05f; float time = Time.time; Vector3 position = ((Component)atmosphereCamera).transform.position; int num3 = (int)(Time.unscaledTime * 20f) % 36 * 4; for (int i = 0; i < 4; i++) { int num4 = num3 + i; if (validAnchors[num4]) { Vector3 val = anchors[num4] - position; if (!(((Vector3)(ref val)).sqrMagnitude > 1600f)) { continue; } } PlaceAnchor(num4, position); } float num5 = Mathf.Clamp(density.Value, 0f, 1.5f); bool value = extremeAmbience.Value; AdditionalStage additionalStage = AdditionalStages.For(look.id); bool flag2 = look.id == "delta" || look.id == "forest"; bool flag3 = look.id == "aqueduct" || look.id == "iron" || (additionalStage != null && (additionalStage.climate == "dust" || additionalStage.climate == "ash")); int num6 = ((look.id == "wetland") ? 64 : (flag2 ? 60 : ((look.id == "abyssal") ? 72 : ((look.id == "siren") ? 40 : 48)))); bool flag4 = look.id == "abyssal" && refinedAtmosphere.Value; Climate climate = climates[look.id]; bool value2 = refinedAtmosphere.Value; int num7 = Mathf.Min(144, (int)((float)num6 * num5 * (value2 ? Mathf.Clamp(climate.motes.Value, 0f, 2f) : 1f) * (flag4 ? Mathf.Clamp(abyssalMotes.Value, 0f, 2f) : 1f) * (value ? 3f : 1f))); Color color = default(Color); for (int num4 = 0; num4 < num7; num4++) { float num8 = Hash(new Vector3((float)num4, 5f, 11f)); float num9 = time + num8 * 30f; Vector3 val2 = anchors[num4]; float num10 = 0.55f + 0.45f * Mathf.Sin(time * (0.8f + num8) + num8 * 50f); float num12; if (additionalStage != null) { float num11 = Mathf.Repeat(num8 + time * 0.025f, 1f); bool flag5 = additionalStage.climate == "ash"; val2 += new Vector3(Mathf.Sin(num9 * 0.1f) * 2.8f, 0.3f + (flag5 ? (1f - num11) : num11) * (flag3 ? 1.7f : 3f), Mathf.Cos(num9 * 0.12f) * 1.8f); color = Color.Lerp(additionalStage.balance.mistCool, additionalStage.balance.mistWarm, num8); color.a = 0.22f * Mathf.Sin(num11 * MathF.PI); num12 = 0.05f + num8 * 0.06f; } else if (look.id == "wetland") { val2 += new Vector3(Mathf.Sin(num9 * 0.48f) * 1.8f, 0.6f + Mathf.Sin(num9 * 0.7f) * 0.4f, Mathf.Cos(num9 * 0.41f) * 1.8f); ((Color)(ref color))..ctor(0.78f, 1f, 0.25f, 0.28f + num10 * 0.6f); num12 = 0.08f + num8 * 0.055f; } else if (flag2) { float num13 = 0.35f + 0.65f * Mathf.Pow(0.5f + 0.5f * Mathf.Sin(time * 0.32f), 3f); val2 += new Vector3(Mathf.Sin(num9 * 0.18f) * 12f * num13, Mathf.Repeat(num8 * 8f - time * 0.65f, 8f), Mathf.Sin(num9 * 0.14f) * 5f * num13); ((Color)(ref color))..ctor(0.85f, 0.92f, 1f, 0.16f + 0.38f * num13); num12 = 0.07f + num8 * 0.1f; } else if (look.id == "abyssal") { val2 += new Vector3(Mathf.Sin(num9 * 0.25f) * 1.2f, Mathf.Repeat(num8 * 5f + time * 0.48f, 5f), Mathf.Cos(num9 * 0.31f) * 1.2f); ((Color)(ref color))..ctor(1f, 0.3f, 0.055f, 0.35f + num10 * 0.3f); num12 = 0.06f + num8 * 0.055f; if (flag4) { bool flag6 = num4 % 4 == 0; float num11 = Mathf.Repeat(num8 + time * (flag6 ? 0.065f : 0.035f), 1f); float num14 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0f, 0.12f, num11)) * (1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.82f, 1f, num11))); val2 = anchors[num4] + new Vector3(Mathf.Sin(num9 * 0.12f) * 2.5f, flag6 ? (0.4f + num11 * 5f) : (0.4f + (1f - num11) * 6f), Mathf.Cos(num9 * 0.1f) * 1.8f); color = (flag6 ? new Color(1f, 0.42f, 0.16f, 0.55f * num14) : new Color(0.62f, 0.54f, 0.61f, 0.26f * num14)); num12 = (flag6 ? (0.055f + num8 * 0.045f) : (0.045f + num8 * 0.075f)); color.a *= Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(2f, 6f, Vector3.Distance(val2, position))); } } else if (look.id == "acres") { float num11 = Mathf.Repeat(num8 + time * 0.025f, 1f); val2 += new Vector3(Mathf.Sin(num9 * 0.13f) * 3f, 0.3f + (1f - num11) * 3f, Mathf.Cos(num9 * 0.1f) * 2f); color = Color.Lerp(new Color(0.63f, 0.37f, 0.35f), new Color(0.77f, 0.61f, 0.43f), num8); color.a = 0.24f * Mathf.Sin(num11 * MathF.PI); num12 = 0.055f + num8 * 0.06f; } else if (look.id == "sulfur") { float num11 = Mathf.Repeat(num8 + time * 0.035f, 1f); val2 += new Vector3(Mathf.Sin(num9 * 0.1f) * 2f, 0.3f + num11 * 3.8f, Mathf.Cos(num9 * 0.13f) * 1.5f); color = Color.Lerp(new Color(0.43f, 0.6f, 0.45f), new Color(0.73f, 0.65f, 0.35f), num8); color.a = 0.22f * Mathf.Sin(num11 * MathF.PI); num12 = 0.065f + num8 * 0.06f; } else if (look.id == "siren" || look.id == "aphelian") { float num11 = Mathf.Repeat(num8 + time * 0.025f, 1f); val2 += new Vector3(Mathf.Sin(num9 * 0.09f) * 4f, 0.3f + num11 * 2.8f, Mathf.Cos(num9 * 0.11f) * 2f); color = ((look.id == "siren") ? new Color(0.49f, 0.72f, 0.73f, 0.24f) : new Color(0.74f, 0.65f, 0.51f, 0.23f)); color.a *= Mathf.Sin(num11 * MathF.PI); num12 = 0.055f + num8 * 0.06f; } else { float num15 = 1f + Mathf.Sin(time * 0.25f) * 0.4f; val2 += new Vector3(Mathf.Sin(num9 * 0.14f) * 9f * num15, 0.3f + Mathf.Repeat(num8 * 2f + time * 0.08f, 2f), Mathf.Cos(num9 * 0.12f) * 4f); color = (flag3 ? new Color(0.75f, 0.49f, 0.3f, 0.2f) : ((look.id == "roost") ? new Color(0.34f, 0.56f, 0.38f, 0.35f) : new Color(0.79f, 0.79f, 0.5f, 0.32f))); num12 = (flag3 ? (0.12f + num8 * 0.13f) : (0.08f + num8 * 0.1f)); } if (value2) { float num16 = ClimateWeather(anchors[num4], time * Mathf.Clamp(climate.flow.Value, 0f, 2f)); float num17 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(5f, 18f, anchorHeadroom[num4])); float num18 = climate.wind.Value * (MathF.PI / 180f); val2 += new Vector3(Mathf.Cos(num18), 0f, Mathf.Sin(num18)) * Mathf.Sin(num9 * 0.07f) * num16 * num17 * 2.5f; if (flag2 || flag3) { color.a *= 0.25f + 0.75f * num17; } float num19 = val2.y - anchors[num4].y; if (flag2) { color.a *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(7f, 8f, num19)); } if (flag3 || look.id == "roost" || look.id == "plains") { color.a *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(1.9f, 2.3f, num19)); } color.a *= Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((time - anchorBirth[num4]) / 2f)); color.a *= Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.05f, 0.6f, num19)); color.a *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(anchorHeadroom[num4] - 1.5f, anchorHeadroom[num4], num19)); float num20 = Vector3.Distance(position, val2); color.a *= Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(1.5f, 5f, num20)); color.a *= Mathf.Lerp(0.6f + 0.4f * localVisibility, 1f, Mathf.InverseLerp(12f, 35f, num20)); } if (value) { num12 *= 2.3f; color.a = Mathf.Min(1f, color.a * 2.2f); } if (!validAnchors[num4]) { color.a = 0f; } WriteParticle(ref moteBuffer[num4], val2, color, num12); } motes.SetParticles(moteBuffer, num7); int num21 = UpdateMistField(position, time, num5, value); mist.SetParticles(mistBuffer, num21); if (!diagnosticsReported) { int num22 = 0; for (int num4 = 0; num4 < num7; num4++) { if (validAnchors[num4]) { num22++; } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Effect check " + look.id + ": shader=" + ((Object)particleMaterial.shader).name + ", motes=" + motes.particleCount + ", valid ground anchors=" + num22 + "/" + num7 + ", mist=" + mist.particleCount + ", density=" + num5 + ". Movement is evaluated at 20Hz; visual confirmation still needed.")); diagnosticsReported = true; } if (Object.op_Implicit((Object)(object)fireflyLightA)) { SetClusterLight(fireflyLightA, anchors[2], time, 0f, num5); SetClusterLight(fireflyLightB, anchors[11], time, 2f, num5); } UpdateObjectGlow(position); if (Object.op_Implicit((Object)(object)material) && material.HasProperty("_Rotation")) { material.SetFloat("_Rotation", Mathf.Sin(time * 0.015f) * 1.25f); } } catch (Exception ex) { atmosphereFailed = true; if (Object.op_Implicit((Object)(object)atmosphereRoot)) { atmosphereRoot.SetActive(false); } ((BaseUnityPlugin)this).Logger.LogError((object)("Ambient effects disabled after error: " + ex)); } } private static void WriteParticle(ref Particle particle, Vector3 position, Color color, float size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) ((Particle)(ref particle)).position = position; ((Particle)(ref particle)).startColor = Color32.op_Implicit(color); ((Particle)(ref particle)).startSize = size; ((Particle)(ref particle)).startLifetime = 10f; ((Particle)(ref particle)).remainingLifetime = 10f; ((Particle)(ref particle)).velocity = Vector3.zero; } private void SetClusterLight(Light light, Vector3 at, float t, float phase, float d) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ((Component)light).transform.position = at + Vector3.up; light.color = new Color(0.65f, 0.9f, 0.28f); light.intensity = ((d > 0f) ? ((0.12f + 0.1f * (1f + Mathf.Sin(t * 0.8f + phase))) * (extremeAmbience.Value ? 3f : 1f)) : 0f); light.range = 4f; } private void UpdateObjectGlow(Vector3 center) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) Bounds bounds; Vector3 val; if (Time.unscaledTime >= nextGlowScan) { nextGlowScan = Time.unscaledTime + 5f; for (int num = glowLights.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)glowSources[num]) && glowSources[num].enabled) { bounds = glowSources[num].bounds; val = ((Bounds)(ref bounds)).center - center; if (!(((Vector3)(ref val)).sqrMagnitude > 1600f)) { continue; } } if (Object.op_Implicit((Object)(object)glowLights[num])) { Object.Destroy((Object)(object)((Component)glowLights[num]).gameObject); } glowLights.RemoveAt(num); glowSources.RemoveAt(num); glowIntensities.RemoveAt(num); glowBirths.RemoveAt(num); } if (localGlow.Value) { Renderer[] array = Resources.FindObjectsOfTypeAll<Renderer>(); foreach (Renderer val2 in array) { if (glowLights.Count >= 6) { break; } if (!Object.op_Implicit((Object)(object)val2) || !val2.enabled) { continue; } Scene scene = ((Component)val2).gameObject.scene; if (((Scene)(ref scene)).handle != effectScene || val2 is ParticleSystemRenderer) { continue; } bounds = val2.bounds; val = ((Bounds)(ref bounds)).center - center; if (((Vector3)(ref val)).sqrMagnitude > 1225f || glowSources.Contains(val2)) { continue; } string text = ((Object)((Component)val2).gameObject).name.ToLowerInvariant(); if (!text.Contains("crystal") && !text.Contains("lamp") && !text.Contains("light") && !text.Contains("fire") && !text.Contains("lava") && !text.Contains("beacon")) { continue; } Color val3 = Color.black; Material[] sharedMaterials = val2.sharedMaterials; foreach (Material val4 in sharedMaterials) { if (Object.op_Implicit((Object)(object)val4) && (val4.HasProperty("_EmissionColor") || val4.HasProperty("_EmColor"))) { Color val5 = val4.GetColor(val4.HasProperty("_EmissionColor") ? "_EmissionColor" : "_EmColor"); if (val4.HasProperty("_EmPower")) { val5 *= Mathf.Max(0f, val4.GetFloat("_EmPower")); } if (((Color)(ref val5)).maxColorComponent > ((Color)(ref val3)).maxColorComponent) { val3 = val5; } } } if (!(((Color)(ref val3)).maxColorComponent < 0.15f)) { Light val6 = MakeLight("Emissive spill: " + ((Object)((Component)val2).gameObject).name); val6.color = val3 / ((Color)(ref val3)).maxColorComponent; val6.range = ((look.id == "abyssal") ? 8f : 6f); val6.intensity = Mathf.Clamp(((Color)(ref val3)).maxColorComponent * 0.3f, 0.2f, 0.8f); if (look.id == "abyssal") { val6.color = Color.Lerp(val6.color, new Color(1f, 0.57f, 0.27f), 0.3f); } glowLights.Add(val6); glowSources.Add(val2); glowIntensities.Add(val6.intensity); glowBirths.Add(Time.time); } } } } if (lastGlowCount != glowLights.Count) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Object spill check " + look.id + ": " + glowLights.Count + " nearby emissive sources (cap six); enabled=" + localGlow.Value)); lastGlowCount = glowLights.Count; } for (int num = 0; num < glowLights.Count; num++) { if (Object.op_Implicit((Object)(object)glowLights[num])) { Renderer val7 = glowSources[num]; Light obj = glowLights[num]; int enabled; if (localGlow.Value && Object.op_Implicit((Object)(object)val7) && val7.enabled) { bounds = val7.bounds; val = ((Bounds)(ref bounds)).center - center; enabled = ((((Vector3)(ref val)).sqrMagnitude < 1600f) ? 1 : 0); } else { enabled = 0; } ((Behaviour)obj).enabled = (byte)enabled != 0; glowLights[num].range = ((look.id == "abyssal") ? 8f : 6f) * (refinedAtmosphere.Value ? Mathf.Clamp(spillRange.Value, 0.25f, 2f) : 1f); float num2; if (!Object.op_Implicit((Object)(object)val7)) { num2 = 0f; } else { bounds = val7.bounds; num2 = 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(30f, 40f, Vector3.Distance(((Bounds)(ref bounds)).center, center))); } float num3 = num2; num3 *= Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((Time.time - glowBirths[num]) / 1.5f)); glowLights[num].intensity = glowIntensities[num] * (refinedAtmosphere.Value ? Mathf.Clamp(spillStrength.Value, 0f, 2f) : 1f) * num3; if (Object.op_Implicit((Object)(object)val7)) { Transform transform = ((Component)glowLights[num]).transform; bounds = val7.bounds; transform.position = ((Bounds)(ref bounds)).center; } } } } private static float Luminance(Color c) { return c.r * 0.2126f + c.g * 0.7152f + c.b * 0.0722f; } private static Color LimitHaze(Color c, float limit) { //IL_0001: 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_0071: 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) float num = Luminance(c); float num2 = limit * 0.72f; if (num > num2) { float num3 = num - num2; float num4 = num2 + (limit - num2) * num3 / (num3 + limit - num2); float num5 = num4 / Mathf.Max(num, 0.0001f); c.r *= num5; c.g *= num5; c.b *= num5; } return c; } private static void FogPalette(ArtProfile art, StageBalance basis, out Color near, out Color mid, out Color far) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0096: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) near = ArtColor(art.near, basis.near); mid = ArtColor(art.mid, basis.mid); far = ArtColor(art.far, basis.far); if (art.highlightLimit.Value > 0f) { float num = Mathf.Clamp(art.highlightLimit.Value, 0.15f, 0.8f); near = LimitHaze(near, num * 0.52f); mid = LimitHaze(mid, num * 0.78f); far = LimitHaze(far, num); } } private static Color LayeredMist(Color near, Color mid, Color far, Color cool, Color warm, float depth, float hue, int layer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) //IL_0036: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) //IL_0062: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) Color val = Color.Lerp(cool, warm, Mathf.Clamp01(hue + (float)(layer - 1) * 0.12f)); Color val2 = Color.Lerp(near, val, 0.32f); Color val3 = Color.Lerp(mid, cool, 0.4f); Color val4 = Color.Lerp(mid, val, 0.52f); Color val5 = Color.Lerp(far, warm, 0.34f); float num = Mathf.Lerp(Luminance(near) * 1.08f, Luminance(far) * 0.96f, depth); float num2 = Mathf.Clamp01(depth) * 4f; Color val6 = ((num2 < 1f) ? Color.Lerp(val2, val3, Smooth01(num2)) : ((num2 < 2f) ? Color.Lerp(val3, val4, Smooth01(num2 - 1f)) : ((!(num2 < 3f)) ? Color.Lerp(val5, far, Smooth01(num2 - 3f)) : Color.Lerp(val4, val5, Smooth01(num2 - 2f))))); val6 *= num / Mathf.Max(0.001f, Luminance(val6)); val6.a = 1f; return val6; } private static float Smooth01(float value) { value = Mathf.Clamp01(value); return value * value * (3f - 2f * value); } private void ConfigureClimates() { combatMistRelief = ((BaseUnityPlugin)this).Config.Bind<bool>("Art direction", "CombatMistRelief", true, "Smoothly reduce nearby billboard mist and motes when the local player attacks or takes damage. Does not alter distant fog, HUD or gameplay effects."); string[] ids = StageLook.Ids; foreach (string text in ids) { AdditionalStage additionalStage = AdditionalStages.For(text); bool flag = text == "abyssal"; bool flag2 = text == "wetland" || text == "sulfur"; bool flag3 = text == "delta" || text == "forest"; bool flag4 = text == "aqueduct" || text == "iron" || text == "acres"; if (additionalStage != null) { flag = additionalStage.climate == "cave"; flag2 = additionalStage.climate == "wet"; flag4 = additionalStage.climate == "dust" || additionalStage.climate == "ash"; } string text2 = "Climate - " + text; Climate climate = new Climate(); climate.mistAmount = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "MistAmount", flag2 ? 1.4f : (flag ? 1.3f : 1.15f), "Local mist multiplier, 0-2. Abyssal also uses its Environment MistAmount multiplier."); climate.flow = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "FlowSpeed", flag3 ? 0.8f : (flag4 ? 0.65f : (flag2 ? 0.3f : 0.45f)), "Stage flow speed, 0-2, multiplied by the global MistSpeed. Gentle nonuniform drift with calm periods."); climate.height = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "MistHeight", flag2 ? 0.75f : (flag4 ? 0.55f : 1f), "Height scale of local mist layers, 0.35-1.5; ceiling-tested."); climate.wind = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "WindHeading", (text == "roost") ? 120f : ((text == "plains") ? 35f : (flag4 ? 70f : (flag2 ? 155f : (flag3 ? 220f : 15f)))), "World-space wind heading in degrees. Camera rotation does not change flow."); climate.pockets = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "PocketVariation", 0.65f, "Spatial mist density variation, 0-1. Creates clearer corridors and richer pockets."); climate.motes = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "MoteAmount", flag2 ? 1.1f : 1f, "Stage-specific particle count, 0-2; total capped at 144."); climate.fill = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "FillIntensity", flag3 ? 1.5f : (flag2 ? 2f : 2.5f), "Local terrain-fill intensity, 0-8. Abyssal uses Environment - abyssal intensity instead."); climate.fillRadius = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "FillRadius", 30f, "Local terrain-fill radius, 12-44. Abyssal uses Environment - abyssal radius instead."); climate.fillColor = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "FillColor", (additionalStage != null) ? additionalStage.fillColor : (flag2 ? "#A5C1B7" : (flag3 ? "#B6C7DB" : (flag4 ? "#B6A5C5" : ((text == "plains") ? "#C1B3CD" : "#ADC5D1")))), "Soft terrain-fill color; native materials retained. Abyssal uses its existing cool/warm colors."); climate.stars = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "StarAmount", flag ? 0f : 0.18f, "Subtle star brightness multiplier, 0-1. No stars inside Abyssal. F9 refreshes sky artwork."); climate.aurora = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "AuroraAmount", flag3 ? 0.45f : 0f, "Stage aurora multiplier, 0-1; restrained mint bands on Delta, no cavern phenomena. F9 refreshes sky artwork."); climate.sky = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "SkyBrightness", 1f, "Stage sky-art brightness multiplier, 0.5-1.3, separate from atmosphere and scene exposure. F9 refreshes sky artwork."); climates.Add(text, climate); } } private void UpdateLocalVisibility() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); bool flag = Object.op_Implicit((Object)(object)val) && (!val.outOfCombat || !val.outOfDanger); float num = ((combatMistRelief.Value && flag) ? 0.38f : 1f); localVisibility = Mathf.MoveTowards(localVisibility, num, Time.deltaTime * ((num < localVisibility) ? 0.55f : 0.18f)); } private static float ClimateWeather(Vector3 position, float time) { //IL_0015: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.24f, 0.76f, Noise(position * 0.006f + new Vector3(time * 0.007f, 19f, (0f - time) * 0.004f)))); } private void ConfigureCosmos() { skyLuminance = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "LuminanceLimit", 0.38f, "Shared sky/far-terrain luminance ceiling, 0.15-0.65. Does not affect fog density or nearby lighting."); } private static string[] StageHues(string id) { switch (id) { case "roost": return new string[5] { "#385E9C", "#4E8FAA", "#80B6CF", "#A8BEDE", "#C0C0DE" }; case "plains": return new string[5] { "#64567E", "#87749D", "#AD93B3", "#C5ADC7", "#D6C3D6" }; case "aqueduct": return new string[5] { "#765365", "#A07781", "#BD9698", "#D1B1A5", "#DFCCBE" }; case "wetland": return new string[5] { "#3F6D63", "#63968A", "#89B1A0", "#ADC5B1", "#C6D2C1" }; case "delta": return new string[5] { "#555F96", "#798CB7", "#9DB6CD", "#BAC6DD", "#CFD1E6" }; case "abyssal": return new string[5] { "#806390", "#A081B0", "#BCA0C7", "#D2B8CF", "#E1CFD5" }; case "aphelian": return new string[5] { "#826C91", "#AA8FA8", "#C5ACBC", "#D6C3CA", "#E3D6D2" }; case "iron": return new string[5] { "#7C677C", "#9C8292", "#B99FAA", "#CBB7BD", "#DACDCD" }; case "forest": return new string[5] { "#536F91", "#7498B2", "#9BBBCD", "#BACBDF", "#CDD2E4" }; case "sulfur": return new string[5] { "#687E64", "#899E7C", "#B0BB95", "#CBCDAE", "#DDDCC5" }; case "siren": return new string[5] { "#466F88", "#689BA6", "#93B9BF", "#B2CAD3", "#CDD6DF" }; default: { AdditionalStage additionalStage = AdditionalStages.For(id); if (additionalStage != null) { return additionalStage.hues; } return new string[5] { "#7D5C74", "#A57E8D", "#C49FAD", "#D7BBC5", "#E2D0D5" }; } } } private void ConfigureDepthColors() { atmosphereHighlightLimit = ((BaseUnityPlugin)this).Config.Bind<float>("Sky", "AtmosphereHighlightLimit", 0.32f, "Soft peak-channel limit for custom fog and sky only, 0.1-0.65. Preserves hue ratios and prevents bright pastel haze from feeding broad bloom. Zero restores the previous highlight response. No change to scene exposure, fog opacity or distance."); string[] ids = StageLook.Ids; foreach (string text in ids) { string text2 = "Color ramp - " + text; string[] array = StageHues(text); DepthColors depthColors = new DepthColors(); depthColors.stops = new ConfigEntry<string>[5]; for (int j = 0; j < 5; j++) { depthColors.stops[j] = ((BaseUnityPlugin)this).Config.Bind<string>(text2, "Hue" + (j + 1), array[j], "Related atmosphere hue at depth stop " + (j + 1) + " of five; foreground inherits NearColor. RGB only; does not change fog opacity."); } depthColors.strength = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "DepthColorStrength", 0.85f, "Blend of the multi-hue depth colors, 0-1. Does not affect fog alpha or distance."); depthColors.curve = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "DepthColorCurve", 1.1f, "Independent color progression curve, 0.5-2. Fog density curve is unchanged."); depthColors.native = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "NativeSkyBlend", 0.42f, "Retained native cubemap color and detail, 0-1. Same sky result is used for far terrain to prevent bright cutouts."); depthColors.vertical = ((BaseUnityPlugin)this).Config.Bind<float>(text2, "VerticalSkyVariation", 0.45f, "Subtle vertical sky gradient strength, 0-1. Independent of depth colors and visibility."); this.depthColors.Add(text, depthColors); } } private static Color HueValue(Color color, float value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) color *= value / Mathf.Max(0.001f, Luminance(color)); color.a = 1f; return color; } private Color[] RampColors(string id, Color near, Color far) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0073: Unknown result type (might be due to invalid IL or missing references) DepthColors depthColors = this.depthColors[id]; Color[] array = (Color[])(object)new Color[5]; float num = Luminance(near); float num2 = Mathf.Max(num, Luminance(far)); Color val = default(Color); for (int i = 0; i < 5; i++) { ColorUtility.TryParseHtmlString(StageHues(id)[i], ref val); val = ArtColor(depthColors.stops[i], val); ref Color reference = ref array[i]; reference = HueValue(val, Mathf.Lerp(num, num2, (float)(i + 1) / 5f)); } return array; } private void ReadNativeSky(Camera camera) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) nativeSkyCube = null; nativeSkyTint = Color.white; nativeSkyRotation = 0f; Material val = originalSky; Skybox component = ((Component)camera).GetComponent<Skybox>(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled && Object.op_Implicit((Object)(object)component.material) && (Object)(object)component.material != (Object)(object)material) { val = component.material; } else if (Object.op_Implicit((Object)(object)component)) { string text = stage; Scene activeScene = SceneManager.GetActiveScene(); if (text == ((Scene)(ref activeScene)).name && cameraOriginals.TryGetValue(component, out var value) && value.enabled && Object.op_Implicit((Object)(object)value.material) && (Object)(object)value.material != (Object)(object)material) { val = value.material; } } if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)(object)material) { return; } string[] array = new string[3] { "_Tex", "_Cubemap", "_Cube" }; foreach (string text2 in array) { if (val.HasProperty(text2)) { ref Cubemap reference = ref nativeSkyCube; Texture texture = val.GetTexture(text2); reference = (Cubemap)(object)((texture is Cubemap) ? texture : null); if (Object.op_Implicit((Object)(object)nativeSkyCube)) { break; } } } if (!Object.op_Implicit((Object)(object)nativeSkyCube)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Native sky has no reusable cubemap; using color gradient only: " + ((Object)val).name)); return; } if (((Object)nativeSkyCube).name == "skyboxFoggyFull") { Cubemap val2 = null; Cubemap[] array2 = Resources.FindObjectsOfTypeAll<Cubemap>(); foreach (Cubemap val3 in array2) { if (((Object)val3).name == "skyboxFoggyFullNoPlanet") { val2 = val3; break; } } if (!Object.op_Implicit((Object)(object)val2)) { foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { array = allLoadedAssetBundle.GetAllAssetNames(); foreach (string text3 in array) { if (text3.ToLowerInvariant().Contains("skyboxfoggyfullnoplanet")) { val2 = allLoadedAssetBundle.LoadAsset<Cubemap>(text3); break; } } if (Object.op_Implicit((Object)(object)val2)) { break; } } } if (!Object.op_Implicit((Object)(object)val2)) { nativeSkyCube = null; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Planet-free native sky unavailable; using gradient fallback."); return; } nativeSkyCube = val2; } if (val.HasProperty("_Tint")) { nativeSkyTint = val.GetColor("_Tint") * 2f; } if (val.HasProperty("_Exposure")) { nativeSkyTint *= Mathf.Clamp(val.GetFloat("_Exposure"), 0f, 2f); } if (val.HasProperty("_Rotation")) { nativeSkyRotation = val.GetFloat("_Rotation") * (MathF.PI / 180f); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Atmosphere retains native sky texture: " + ((Object)nativeSkyCube).name + " from " + ((Object)val).name)); } private void BindDepthColors(PropertySheet sheet, string id, Color near, Color far) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) DepthColors depthColors = this.depthColors[id]; Color[] array = RampColors(id, near, far); for (int i = 0; i < 5; i++) { sheet.properties.SetVector("_ASRamp" + (i + 1), Color.op_Implicit(array[i])); } sheet.properties.SetVector("_ASColorControls", new Vector4(Mathf.Clamp01(depthColors.strength.Value), Mathf.Clamp(depthColors.curve.Value, 0.5f, 2f), 0f, 0f)); sheet.properties.SetTexture("_ASNativeSky", (Texture)(object)(Object.op_Implicit((Object)(object)nativeSkyCube) ? nativeSkyCube : skyCube)); sheet.properties.SetVector("_ASSkyControls", new Vector4(Object.op_Implicit((Object)(object)nativeSkyCube) ? Mathf.Clamp01(depthColors.native.Value) : 0f, Mathf.Clamp(skyLuminance.Value, 0.15f, 0.65f), (atmosphereHighlightLimit.Value > 0f) ? Mathf.Clamp(atmosphereHighlightLimit.Value, 0.1f, 0.65f) : 0f, 0f)); sheet.properties.SetVector("_ASNativeTint", Color.op_Implicit(nativeSkyTint)); sheet.properties.SetVector("_ASNativeRotation", new Vector4(Mathf.Cos(nativeSkyRotation), Mathf.Sin(nativeSkyRotation), 0f, 0f)); } private void ConfigureFogDiagnostics() { traceRendering = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostics", "TraceFog", false, "Log fog command rebuilds and relevant keys for troubleshooting."); } private void TraceFogInput() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!traceRendering.Value) { return; } KeyCode[] array = (KeyCode[])(object)new KeyCode[4] { (KeyCode)289, (KeyCode)27, (KeyCode)278, (KeyCode)302 }; foreach (KeyCode val in array) { if (Input.GetKeyDown(val)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Concat("FOG INPUT frame=", Time.frameCount, " key=", val, " enabled=", skyEnabled.Value, " scale=", Time.timeScale)); } } if (!(Time.unscaledTime < nextFogReport)) { nextFogReport = Time.unscaledTime + 3f; if (Object.op_Implicit((Object)(object)Run.instance)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("FOG TRACE frame=" + Time.frameCount + " enabled=" + skyEnabled.Value + " pause=" + PauseManager.isPaused + " scale=" + Time.timeScale + " checks=" + commandCheckCount + " rebuilds=" + commandRebuildCount + " fogRecords=" + fogRecordCount)); } commandCheckCount = (commandRebuildCount = (fogRecordCount = 0)); } } private bool FogActive(Camera camera) { //IL_003c: 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) int result; if (skyEnabled.Value && !renderFailed && Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)camera) && ((Object)camera).name == "Scene Camera") { Scene activeScene = SceneManager.GetActiveScene(); result = (StageLook.IsRoute(((Scene)(ref activeScene)).name) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } internal bool FogActive(PostProcessRenderContext context) { return FogActive(context.camera); } private void SyncFogCommands(PostProcessLayer layer, Camera camera) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) bool flag = FogActive(camera); Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; if (!fogCommands.TryGetValue(layer, out var value) || value.active != flag || value.scene != handle || value.revision != artRevision) { layer.OnVolumeSettingsChanged(); fogCommands[layer] = new FogCommandState { active = flag, scene = handle, revision = artRevision }; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Fog commands invalidated: camera=" + ((Object)camera).GetInstanceID() + " custom=" + flag + " scene=" + handle)); } } private void ReleaseFogCommands() { foreach (KeyValuePair<PostProcessLayer, FogCommandState> fogCommand in fogCommands) { if (Object.op_Implicit((Object)(object)fogCommand.Key)) { fogCommand.Key.OnVolumeSettingsChanged(); } } fogCommands.Clear(); } private void ConfigureForegroundLighting() { foregroundEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Environment - abyssal", "Enabled", true, "F5 toggles up to four world-anchored terrain lights across supported stages. Legacy config location retained. No player-following light."); environmentIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Environment - abyssal", "Intensity", 4.5f, "Terrain light intensity, 0-8. Deliberately strong art trial; no global exposure change."); environmentRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Environment - abyssal", "Radius", 34f, "Terrain light radius, 12-44 world units."); environmentCool = ((BaseUnityPlugin)this).Config.Bind<string>("Environment - abyssal", "CoolColor", "#ADA7CF", "Neutral lavender surface light, #RRGGBB."); environmentWarm = ((BaseUnityPlugin)this).Config.Bind<string>("Environment - abyssal", "WarmColor", "#D6AAA0", "Muted warm reflected-light accent, #RRGGBB."); abyssalMist = ((BaseUnityPlugin)this).Config.Bind<float>("Environment - abyssal", "MistAmount", 1.3f, "Abyssal local-mist multiplier, 0-2; independent of distance fog."); abyssalMotes = ((BaseUnityPlugin)this).Config.Bind<float>("Environment - abyssal", "AmbientAmount", 1.5f, "Abyssal ash/ember count multiplier, 0-2; bounded by the particle pool."); } private void ResetSurfaceLighting() { for (int i = 0; i < surfacePools.Length; i++) { surfacePools[i] = null; } reportedSurfaceCount = -1; nextSurfaceSurvey = 0f; surfaceReportPending = true; } private void SurveySurfaceLighting(Vector3 center) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.FloorToInt(center.x / 16f); int num2 = Mathf.FloorToInt(center.z / 16f); int num3 = 0; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); RaycastHit val4 = default(RaycastHit); RaycastHit val6 = default(RaycastHit); for (int i = num2 - 2; i <= num2 + 2; i++) { int num4 = num - 2; while (num4 <= num + 2) { ((Vector3)(ref val))..ctor((float)num4, Mathf.Floor(center.y / 8f), (float)i); ((Vector3)(ref val2))..ctor(((float)num4 + 0.5f) * 16f, center.y + 5f, ((float)i + 0.5f) * 16f); surfaceValid[num3] = false; Vector3 val3 = val2; Vector3 down = Vector3.down; LayerIndex world = LayerIndex.world; if (Physics.Raycast(val3, down, ref val4, 25f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) && !(((RaycastHit)(ref val4)).normal.y < 0.35f) && !(Mathf.Abs(((RaycastHit)(ref val4)).point.y - center.y) > 12f)) { Vector3 val5 = ((RaycastHit)(ref val4)).point + Vector3.up * 0.25f; Vector3 up = Vector3.up; world = LayerIndex.world; float num5 = (Physics.Raycast(val5, up, ref val6, 18f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val6)).distance : 18f); if (!(num5 < 3f)) { surfaceKeys[num3] = val; surfaceGround[num3] = val5; surfaceHeadroom[num3] = num5; surfaceValid[num3] = true; } } num4++; num3++; } } } private bool SurfaceKeyUsed(Vector3 key, Vector3 ground) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) SurfacePool[] array = surfacePools; foreach (SurfacePool surfacePool in array) { if (surfacePool == null || !surfacePool.assigned) { continue; } if (!(surfacePool.key == key)) { Vector3 val = surfacePool.ground - ground; if (!(((Vector3)(ref val)).sqrMagnitude < 196f)) { continue; } } return true; } return false; } private void UpdateForegroundLighting() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to