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 QualityGlowFix v1.5.2
QualityGlowFix.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("QualityGlowFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QualityGlowFix")] [assembly: AssemblyTitle("QualityGlowFix")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace QualityGlowFix { public enum GlowMode { Off, Limited, Vanilla } [BepInPlugin("QualityGlowFix", "Quality Glow Fix", "1.5.2")] public class Plugin : BaseUnityPlugin { public const string Guid = "QualityGlowFix"; public const string Name = "Quality Glow Fix"; public const string Version = "1.5.2"; internal static ConfigEntry<GlowMode> Mode; internal static ConfigEntry<int> LevelsAboveMax; internal static ConfigEntry<float> Strength; internal static ConfigEntry<bool> LogEffects; internal static ConfigEntry<bool> FixSize; internal static ConfigEntry<float> ParticleSize; internal static ConfigEntry<float> LightStrength; internal static ConfigEntry<float> LightRange; internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown Mode = ((BaseUnityPlugin)this).Config.Bind<GlowMode>("1 - General", "GlowMode", GlowMode.Vanilla, "Off = no quality glow at all.\nLimited = items glow, but never brighter than GlowLevelsAboveMax, scaled by GlowStrength.\nVanilla = normal glow levels (the particle size fix below still applies if enabled)."); LevelsAboveMax = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Limited", "GlowLevelsAboveMax", 1, new ConfigDescription("Limited mode only. The brightest glow allowed, counted in levels above the item's normal max quality.\n1 = the glow of a quality 5 weapon (normal max 4), 2 = quality 6, and so on.\nItems above this level still glow, just no brighter than this.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); Strength = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Limited", "GlowStrength", 1f, new ConfigDescription("Limited mode only. Multiplier applied to the glow after the level cap.\n1 = normal strength for that level, 0.5 = half, 0.25 = a quarter.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())); FixSize = ((BaseUnityPlugin)this).Config.Bind<bool>("3 - Particle size", "FixParticleSize", true, "Every weapon uses the same glow effect, but vanilla scales the glow particles with each weapon's model scale.\nThat's why some weapons get a giant ball of glow (the Bronze axe's particles are ~29x bigger than the Bronze sword's).\nWhen true, the particles are the same size on every weapon; only the area they spawn in still follows the weapon's shape."); ParticleSize = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Particle size", "ParticleSize", 0.2f, new ConfigDescription("Particle size when FixParticleSize is true.\n0.33 = the vanilla look on the Bronze and Iron swords. 1.0 = the vanilla look on most other weapons (much bigger).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 3f), Array.Empty<object>())); LightStrength = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Light", "LightStrength", 0.5f, new ConfigDescription("Brightness of the light the glow casts on its surroundings.\n1 = vanilla, 0.5 = half, 0 = no light at all (the glow particles stay visible).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); LightRange = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Light", "LightRange", 0.5f, new ConfigDescription("How far that light reaches. 1 = vanilla, 0.5 = half the distance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>())); LogEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("5 - Diagnostics", "LogEffects", false, "Writes the settings of each glow effect to LogOutput.log the first time it appears.\nTurn on, look at / equip / drop the items you want to inspect, then turn off again."); Log = ((BaseUnityPlugin)this).Logger; Mode.SettingChanged += delegate { GlowPatch.RefreshAll(); }; LevelsAboveMax.SettingChanged += delegate { GlowPatch.RefreshAll(); }; Strength.SettingChanged += delegate { GlowPatch.RefreshAll(); }; FixSize.SettingChanged += delegate { GlowPatch.RefreshAll(); }; ParticleSize.SettingChanged += delegate { GlowPatch.RefreshAll(); }; LightStrength.SettingChanged += delegate { GlowPatch.RefreshAll(); }; LightRange.SettingChanged += delegate { GlowPatch.RefreshAll(); }; _harmony = new Harmony("QualityGlowFix"); _harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Quality Glow Fix 1.5.2 loaded. Mode: " + Mode.Value)); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(ParticleIntensityScaler), "SetQuality")] internal static class GlowPatch { private static readonly Dictionary<int, KeyValuePair<ParticleIntensityScaler, int>> Tracked = new Dictionary<int, KeyValuePair<ParticleIntensityScaler, int>>(); private static readonly FieldRef<ParticleIntensityScaler, int> LastLevel = AccessTools.FieldRefAccess<ParticleIntensityScaler, int>("lastItemDropLevel"); private static void Prefix(ParticleIntensityScaler __instance, ref int quality, out bool __state) { if (Tracked.Count > 1024) { Prune(); } Tracked[((Object)__instance).GetInstanceID()] = new KeyValuePair<ParticleIntensityScaler, int>(__instance, quality); int maxQuality = __instance.maxQuality; switch (Plugin.Mode.Value) { case GlowMode.Off: if (quality > maxQuality) { quality = maxQuality; } break; case GlowMode.Limited: { int num = maxQuality + Plugin.LevelsAboveMax.Value; if (quality > num) { quality = num; } break; } } __state = quality != LastLevel.Invoke(__instance); } private static void Postfix(ParticleIntensityScaler __instance, bool __state) { if (Plugin.LogEffects.Value) { EffectDump.Dump(__instance); } if (__state && Plugin.Mode.Value == GlowMode.Limited) { float value = Plugin.Strength.Value; if (!(value >= 1f) && !(__instance.intensity <= 0f)) { __instance.intensity *= value; __instance.ApplyIntensity(); } } } internal static void RefreshAll() { foreach (KeyValuePair<ParticleIntensityScaler, int> item in Tracked.Values.ToList()) { ParticleIntensityScaler key = item.Key; if (!((Object)(object)key == (Object)null)) { LastLevel.Invoke(key) = -1; key.SetQuality(item.Value); } } Prune(); } private static void Prune() { foreach (int item in (from p in Tracked where (Object)(object)p.Value.Key == (Object)null select p.Key).ToList()) { Tracked.Remove(item); } } } [HarmonyPatch(typeof(ParticleIntensityScaler), "ApplyIntensity")] internal static class EffectPatch { private class SystemRecord { public ParticleSystem System; public ParticleSystemScalingMode OriginalMode; public MinMaxCurve SizeBase; public MinMaxCurve SizeWritten; public bool SizeChanged; public bool LightsEnabled; public float LightsIntensity; public float LightsRange; } private class LightRecord { public Light Light; public float BaseIntensity; public float BaseRange; public float WrittenIntensity = float.NaN; public float WrittenRange = float.NaN; public LightLod Lod; public float LodOriginalRange; public bool LodReady; } private static readonly FieldRef<LightLod, Light> LodLight = AccessTools.FieldRefAccess<LightLod, Light>("m_light"); private static readonly FieldRef<LightLod, float> LodBaseRange = AccessTools.FieldRefAccess<LightLod, float>("m_baseRange"); private static readonly Dictionary<int, SystemRecord> Systems = new Dictionary<int, SystemRecord>(); private static readonly Dictionary<int, LightRecord> Lights = new Dictionary<int, LightRecord>(); private static void Postfix(ParticleIntensityScaler __instance) { //IL_0046: 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) if ((Object)(object)__instance == (Object)null) { return; } if (Systems.Count + Lights.Count > 4096) { Prune(); } HashSet<int> hashSet = new HashSet<int>(); ParticleSystem[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { ApplySystem(obj); LightsModule lights = obj.lights; Light light = ((LightsModule)(ref lights)).light; if ((Object)(object)light != (Object)null) { hashSet.Add(((Object)light).GetInstanceID()); } } Light[] componentsInChildren2 = ((Component)__instance).GetComponentsInChildren<Light>(true); foreach (Light val in componentsInChildren2) { if (!hashSet.Contains(((Object)val).GetInstanceID())) { ApplyLight(val); } } } private static void ApplySystem(ParticleSystem ps) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //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_0033: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; LightsModule lights = ps.lights; int instanceID = ((Object)ps).GetInstanceID(); if (!Systems.TryGetValue(instanceID, out var value)) { value = new SystemRecord { System = ps, OriginalMode = ((MainModule)(ref main)).scalingMode, SizeBase = ((MainModule)(ref main)).startSize, LightsEnabled = ((LightsModule)(ref lights)).enabled, LightsIntensity = ((LightsModule)(ref lights)).intensityMultiplier, LightsRange = ((LightsModule)(ref lights)).rangeMultiplier }; Systems[instanceID] = value; } if (!value.SizeChanged || !Same(((MainModule)(ref main)).startSize, value.SizeWritten)) { value.SizeBase = ((MainModule)(ref main)).startSize; } if (Plugin.FixSize.Value) { ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2; value.SizeWritten = Scale(value.SizeBase, Plugin.ParticleSize.Value); ((MainModule)(ref main)).startSize = value.SizeWritten; value.SizeChanged = true; } else if (value.SizeChanged) { ((MainModule)(ref main)).scalingMode = value.OriginalMode; ((MainModule)(ref main)).startSize = value.SizeBase; value.SizeChanged = false; } float value2 = Plugin.LightStrength.Value; ((LightsModule)(ref lights)).enabled = value.LightsEnabled && value2 > 0f; ((LightsModule)(ref lights)).intensityMultiplier = value.LightsIntensity * value2; ((LightsModule)(ref lights)).rangeMultiplier = value.LightsRange * Plugin.LightRange.Value; } private static void ApplyLight(Light light) { int instanceID = ((Object)light).GetInstanceID(); if (!Lights.TryGetValue(instanceID, out var value)) { value = new LightRecord { Light = light, BaseIntensity = light.intensity, BaseRange = light.range }; value.Lod = ((Component)light).GetComponent<LightLod>(); Lights[instanceID] = value; } if (!Mathf.Approximately(light.intensity, value.WrittenIntensity)) { value.BaseIntensity = light.intensity; } value.WrittenIntensity = value.BaseIntensity * Plugin.LightStrength.Value; light.intensity = value.WrittenIntensity; if ((Object)(object)value.Lod != (Object)null) { if (!((Object)(object)LodLight.Invoke(value.Lod) == (Object)null)) { if (!value.LodReady) { value.LodOriginalRange = LodBaseRange.Invoke(value.Lod); value.LodReady = true; } float num = value.LodOriginalRange * Plugin.LightRange.Value; LodBaseRange.Invoke(value.Lod) = num; if (light.range > 0f) { light.range = num; } } } else { if (!Mathf.Approximately(light.range, value.WrittenRange)) { value.BaseRange = light.range; } value.WrittenRange = value.BaseRange * Plugin.LightRange.Value; light.range = value.WrittenRange; } } private static MinMaxCurve Scale(MinMaxCurve c, float f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_001a: 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_000d: Invalid comparison between Unknown and I4 //IL_0032: 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) ParticleSystemCurveMode mode = ((MinMaxCurve)(ref c)).mode; if ((int)mode != 0) { if ((int)mode == 3) { return new MinMaxCurve(((MinMaxCurve)(ref c)).constantMin * f, ((MinMaxCurve)(ref c)).constantMax * f); } ((MinMaxCurve)(ref c)).curveMultiplier = ((MinMaxCurve)(ref c)).curveMultiplier * f; return c; } return new MinMaxCurve(((MinMaxCurve)(ref c)).constant * f); } private static bool Same(MinMaxCurve a, MinMaxCurve b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_001a: 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_001f: Invalid comparison between Unknown and I4 if (((MinMaxCurve)(ref a)).mode != ((MinMaxCurve)(ref b)).mode) { return false; } ParticleSystemCurveMode mode = ((MinMaxCurve)(ref a)).mode; if ((int)mode != 0) { if ((int)mode == 3) { if (Mathf.Approximately(((MinMaxCurve)(ref a)).constantMin, ((MinMaxCurve)(ref b)).constantMin)) { return Mathf.Approximately(((MinMaxCurve)(ref a)).constantMax, ((MinMaxCurve)(ref b)).constantMax); } return false; } return Mathf.Approximately(((MinMaxCurve)(ref a)).curveMultiplier, ((MinMaxCurve)(ref b)).curveMultiplier); } return Mathf.Approximately(((MinMaxCurve)(ref a)).constant, ((MinMaxCurve)(ref b)).constant); } private static void Prune() { foreach (int item in (from p in Systems where (Object)(object)p.Value.System == (Object)null select p.Key).ToList()) { Systems.Remove(item); } foreach (int item2 in (from p in Lights where (Object)(object)p.Value.Light == (Object)null select p.Key).ToList()) { Lights.Remove(item2); } } } internal static class EffectDump { private static readonly HashSet<int> Done = new HashSet<int>(); internal static void Dump(ParticleIntensityScaler scaler) { //IL_0091: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: 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) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scaler == (Object)null || !Done.Add(((Object)scaler).GetInstanceID())) { return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("[GlowDump] " + PathOf(((Component)scaler).transform, null, 8) + " | maxQuality=" + scaler.maxQuality + " intensity=" + scaler.intensity.ToString("0.###")); ParticleSystem[] componentsInChildren = ((Component)scaler).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { MainModule main = val.main; ShapeModule shape = val.shape; Transform transform = ((Component)val).transform; stringBuilder.AppendLine(" ParticleSystem '" + PathOf(transform, ((Component)scaler).transform, 8) + "' active=" + ((Component)val).gameObject.activeInHierarchy); string[] obj = new string[20] { " shape: enabled=", ((ShapeModule)(ref shape)).enabled.ToString(), " type=", ((object)((ShapeModule)(ref shape)).shapeType/*cast due to .constrained prefix*/).ToString(), " radius=", ((ShapeModule)(ref shape)).radius.ToString("0.###"), " radiusThickness=", ((ShapeModule)(ref shape)).radiusThickness.ToString("0.###"), " scale=", null, null, null, null, null, null, null, null, null, null, null }; Vector3 val2 = ((ShapeModule)(ref shape)).scale; obj[9] = ((Vector3)(ref val2)).ToString("F3"); obj[10] = " position="; val2 = ((ShapeModule)(ref shape)).position; obj[11] = ((Vector3)(ref val2)).ToString("F3"); obj[12] = " rotation="; val2 = ((ShapeModule)(ref shape)).rotation; obj[13] = ((Vector3)(ref val2)).ToString("F1"); obj[14] = " mesh="; obj[15] = (((Object)(object)((ShapeModule)(ref shape)).mesh != (Object)null) ? ((Object)((ShapeModule)(ref shape)).mesh).name : "-"); obj[16] = " meshRenderer="; obj[17] = (((Object)(object)((ShapeModule)(ref shape)).meshRenderer != (Object)null) ? ((Object)((ShapeModule)(ref shape)).meshRenderer).name : "-"); obj[18] = " skinnedMeshRenderer="; obj[19] = (((Object)(object)((ShapeModule)(ref shape)).skinnedMeshRenderer != (Object)null) ? ((Object)((ShapeModule)(ref shape)).skinnedMeshRenderer).name : "-"); stringBuilder.AppendLine(string.Concat(obj)); stringBuilder.AppendLine(" main: startSize=" + Curve(((MainModule)(ref main)).startSize) + " startLifetime=" + Curve(((MainModule)(ref main)).startLifetime) + " startSpeed=" + Curve(((MainModule)(ref main)).startSpeed) + " maxParticles=" + ((MainModule)(ref main)).maxParticles + " simulationSpace=" + ((object)((MainModule)(ref main)).simulationSpace/*cast due to .constrained prefix*/).ToString() + " scalingMode=" + ((object)((MainModule)(ref main)).scalingMode/*cast due to .constrained prefix*/).ToString()); LightsModule lights = val.lights; stringBuilder.AppendLine(" particleLights: enabled=" + ((LightsModule)(ref lights)).enabled + " ratio=" + ((LightsModule)(ref lights)).ratio.ToString("0.###") + " maxLights=" + ((LightsModule)(ref lights)).maxLights + " intensityMultiplier=" + ((LightsModule)(ref lights)).intensityMultiplier.ToString("0.###") + " rangeMultiplier=" + ((LightsModule)(ref lights)).rangeMultiplier.ToString("0.###") + " sizeAffectsRange=" + ((LightsModule)(ref lights)).sizeAffectsRange + " template=" + (((Object)(object)((LightsModule)(ref lights)).light != (Object)null) ? ((Object)((LightsModule)(ref lights)).light).name : "-")); EmissionModule emission = val.emission; string text = Curve(((EmissionModule)(ref emission)).rateOverTime); emission = val.emission; stringBuilder.AppendLine(" emission: rate=" + text + " bursts=" + ((EmissionModule)(ref emission)).burstCount); string[] obj2 = new string[6] { " transform: localPosition=", null, null, null, null, null }; val2 = transform.localPosition; obj2[1] = ((Vector3)(ref val2)).ToString("F3"); obj2[2] = " localScale="; val2 = transform.localScale; obj2[3] = ((Vector3)(ref val2)).ToString("F3"); obj2[4] = " lossyScale="; val2 = transform.lossyScale; obj2[5] = ((Vector3)(ref val2)).ToString("F3"); stringBuilder.AppendLine(string.Concat(obj2)); ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { stringBuilder.AppendLine(" renderer: enabled=" + ((Renderer)component).enabled + " renderMode=" + ((object)component.renderMode/*cast due to .constrained prefix*/).ToString() + " material=" + (((Object)(object)((Renderer)component).sharedMaterial != (Object)null) ? ((Object)((Renderer)component).sharedMaterial).name : "-") + " minParticleSize=" + component.minParticleSize.ToString("0.###") + " maxParticleSize=" + component.maxParticleSize.ToString("0.###")); } } Light[] componentsInChildren2 = ((Component)scaler).GetComponentsInChildren<Light>(true); foreach (Light val3 in componentsInChildren2) { stringBuilder.AppendLine(" Light '" + PathOf(((Component)val3).transform, ((Component)scaler).transform, 8) + "' enabled=" + ((Behaviour)val3).enabled + " type=" + ((object)val3.type/*cast due to .constrained prefix*/).ToString() + " range=" + val3.range.ToString("0.##") + " intensity=" + val3.intensity.ToString("0.##") + " color=" + ((object)val3.color/*cast due to .constrained prefix*/).ToString()); } Plugin.Log.LogInfo((object)stringBuilder.ToString()); } private static string Curve(MinMaxCurve c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) ParticleSystemCurveMode mode = ((MinMaxCurve)(ref c)).mode; if ((int)mode != 0) { if ((int)mode == 3) { return ((MinMaxCurve)(ref c)).constantMin.ToString("0.###") + "-" + ((MinMaxCurve)(ref c)).constantMax.ToString("0.###"); } return ((object)((MinMaxCurve)(ref c)).mode/*cast due to .constrained prefix*/).ToString() + " x" + ((MinMaxCurve)(ref c)).curveMultiplier.ToString("0.###"); } return ((MinMaxCurve)(ref c)).constant.ToString("0.###"); } private static string PathOf(Transform t, Transform stop, int max) { List<string> list = new List<string>(); Transform val = t; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)stop && list.Count < max) { list.Add(((Object)val).name); val = val.parent; } if ((Object)(object)t == (Object)(object)stop) { list.Add(((Object)t).name); } list.Reverse(); return string.Join("/", list); } } }