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 HeyListen v1.2.1
HeyListen.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ComfyLib; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Animations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HeyListen")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HeyListen")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("eb95ade7-560b-4c07-9fcf-6e94de32fdab")] [assembly: AssemblyFileVersion("1.2.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HeyListen { public sealed class DemisterBallControl : MonoBehaviour { public static readonly Color NoColor = new Color(-1f, -1f, -1f, -1f); private long _lastDataRevision; private float _lastBodyScale; private Color _lastBodyColor; private float _lastBodyBrightness; private Color _lastPointLightColor; private RendererSetting _demisterBallRenderer; private LightSetting _effectsPointLight; private ParticleSystemSetting _flameEffectsFlames; private ParticleSystemSetting _flameEffectsFlames2; private ParticleSystemSetting _flameEffectsFlare; private RendererSetting _flameEffectsEmbers; private RendererSetting _flameEffectsDistortion; private RendererSetting _flameEffectsEnergy; private ParticleSystemSetting _flameEffectsEnergy2; private RendererSetting _flameEffectsSparcs; public ZNetView NetView { get; private set; } private void Awake() { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) _lastDataRevision = -1L; _lastBodyScale = -1f; _lastBodyColor = NoColor; _lastBodyBrightness = -1f; _lastPointLightColor = NoColor; _demisterBallRenderer = new RendererSetting((Renderer)(object)((Component)((Component)this).transform.Find("demister_ball")).GetComponent<MeshRenderer>()); _effectsPointLight = new LightSetting(((Component)((Component)this).transform.Find("effects/Point light")).GetComponent<Light>()); _flameEffectsFlames = new ParticleSystemSetting(((Component)((Component)this).transform.Find("effects/flame/flames")).GetComponent<ParticleSystem>()); _flameEffectsFlames2 = new ParticleSystemSetting(((Component)((Component)this).transform.Find("effects/flame/flames_local")).GetComponent<ParticleSystem>()); _flameEffectsFlare = new ParticleSystemSetting(((Component)((Component)this).transform.Find("effects/flame/flare")).GetComponent<ParticleSystem>()); _flameEffectsEmbers = new RendererSetting((Renderer)(object)((Component)((Component)this).transform.Find("effects/flame/embers")).GetComponent<ParticleSystemRenderer>()); _flameEffectsDistortion = new RendererSetting((Renderer)(object)((Component)((Component)this).transform.Find("effects/flame/distortiion")).GetComponent<ParticleSystemRenderer>()); _flameEffectsEnergy = new RendererSetting((Renderer)(object)((Component)((Component)this).transform.Find("effects/flame/energy")).GetComponent<ParticleSystemRenderer>()); _flameEffectsEnergy2 = new ParticleSystemSetting(((Component)((Component)this).transform.Find("effects/flame/energy (1)")).GetComponent<ParticleSystem>()); _flameEffectsSparcs = new RendererSetting((Renderer)(object)((Component)((Component)this).transform.Find("effects/flame/sparcs_front")).GetComponent<ParticleSystemRenderer>()); NetView = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)NetView) && NetView.IsValid()) { ((MonoBehaviour)this).StartCoroutine(UpdateDemisterBallCoroutine()); } } private void OnDestroy() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = Vector3.one; _demisterBallRenderer.Reset(); _effectsPointLight.Reset(); _flameEffectsFlames.Reset(); _flameEffectsFlames2.Reset(); _flameEffectsFlare.Reset(); _flameEffectsEmbers.Reset(); _flameEffectsDistortion.Reset(); _flameEffectsEnergy.Reset(); _flameEffectsEnergy2.Reset(); _flameEffectsSparcs.Reset(); } private IEnumerator UpdateDemisterBallCoroutine() { WaitForSeconds waitInterval = new WaitForSeconds(2f); while (Object.op_Implicit((Object)(object)NetView) && NetView.IsValid()) { UpdateDemisterBall(); yield return waitInterval; } } public void UpdateDemisterBall(bool forceUpdate = false) { if (Object.op_Implicit((Object)(object)NetView) && NetView.IsValid() && PluginConfig.IsModEnabled.Value && (forceUpdate || _lastDataRevision < NetView.m_zdo.DataRevision)) { _lastDataRevision = NetView.m_zdo.DataRevision; UpdateBodyScale(forceUpdate); UpdateBodyColor(forceUpdate); UpdatePointLightColor(forceUpdate); UpdateFlameEffects(); } } private void UpdateBodyScale(bool forceUpdate = false) { //IL_002f: 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_003a: 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_004d: 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) float @float = NetView.m_zdo.GetFloat(WispManager.DemisterBallBodyScaleHashCode, -1f); if (forceUpdate || @float != _lastBodyScale) { _lastBodyScale = @float; Vector3 val = Vector3.one * @float; ((Component)this).transform.localScale = val; _flameEffectsFlames.SetScale(val); _flameEffectsFlames2.SetScale(val); } } private void UpdateBodyColor(bool forceUpdate = false) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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) Color color = NetView.m_zdo.GetColor(WispManager.DemisterBallBodyColorHashCode, NoColor); float num = Mathf.Clamp(NetView.m_zdo.GetFloat(WispManager.DemisterBallBodyBrightnessHashCode, -1f), -1f, 2f); if (forceUpdate || !(color == _lastBodyColor) || num != _lastBodyBrightness) { if (num >= 0f && color != NoColor) { _demisterBallRenderer.SetColor(color); _demisterBallRenderer.SetEmissionColor(color * new Color(num, num, num, 1f)); } else { _demisterBallRenderer.SetColor(_demisterBallRenderer.OriginalColor); _demisterBallRenderer.SetEmissionColor(_demisterBallRenderer.OriginalEmissionColor); } _lastBodyColor = color; _lastBodyBrightness = num; } } private void UpdatePointLightColor(bool forceUpdate) { //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_001a: 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_0034: 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_0020: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) Color color = NetView.m_zdo.GetColor(WispManager.DemisterBallPointLightColorHashCode, NoColor); if (forceUpdate || !(color == _lastPointLightColor)) { _effectsPointLight.SetColor((color == NoColor) ? _effectsPointLight.OriginalColor : color); _lastPointLightColor = color; } } public void UpdateFlameEffects() { //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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) PluginConfig.FlameEffects @int = (PluginConfig.FlameEffects)NetView.m_zdo.GetInt(WispManager.FlameEffectsEnabledHashCode, (int)PluginConfig.DefaultFlameEffects); _flameEffectsFlames.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Flames)); _flameEffectsFlames2.SetActive(@int.HasFlag(PluginConfig.FlameEffects.FlamesL)); _flameEffectsFlare.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Flare)); _flameEffectsDistortion.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Distortion)); _flameEffectsEmbers.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Embers)); _flameEffectsDistortion.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Distortion)); _flameEffectsEnergy.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Energy)); _flameEffectsEnergy2.SetActive(@int.HasFlag(PluginConfig.FlameEffects.EnergyII)); _flameEffectsSparcs.SetActive(@int.HasFlag(PluginConfig.FlameEffects.Sparcs)); if (NetView.m_zdo.TryGetColor(WispManager.FlameEffectsColorHashCode, out var result)) { _flameEffectsFlames.SetColorOverLifetimeColor(result); _flameEffectsFlames2.SetColorOverLifetimeColor(result); _flameEffectsFlare.SetStartColor(result.SetAlpha(0.1f)); _flameEffectsEnergy2.SetStartColor(result.SetAlpha(0.1f)); } else { _flameEffectsFlames.SetColorOverLifetimeColor(_flameEffectsFlames.OriginalColorOveLifetimeColor); _flameEffectsFlames2.SetColorOverLifetimeColor(_flameEffectsFlames2.OriginalColorOveLifetimeColor); _flameEffectsFlare.SetStartColor(_flameEffectsFlare.OriginalStartColor); _flameEffectsEnergy2.SetStartColor(_flameEffectsEnergy2.OriginalStartColor); } UpdateFlameEffectsRenderer(_flameEffectsEmbers, WispManager.FlameEffectsEmbersColorHashCode, WispManager.FlameEffectsEmbersBrightnessHashCode); UpdateFlameEffectsRenderer(_flameEffectsSparcs, WispManager.FlameEffectsSparcsColorHashCode, WispManager.FlameEffectsSparcsBrightnessHashCode); } private void UpdateFlameEffectsRenderer(RendererSetting rendererSetting, int colorHashCode, int brightnessHashCode) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (NetView.m_zdo.TryGetColor(colorHashCode, out var result) && NetView.m_zdo.TryGetFloat(brightnessHashCode, out var result2)) { rendererSetting.SetColor(result).SetEmissionColor(result * new Color(result2, result2, result2, 1f)); } else { rendererSetting.SetColor(rendererSetting.OriginalColor).SetEmissionColor(rendererSetting.OriginalEmissionColor); } } } public static class WispManager { public static readonly int ColorShaderId = Shader.PropertyToID("_Color"); public static readonly int EmissionColorShaderId = Shader.PropertyToID("_EmissionColor"); public static readonly int DemisterBallBodyScaleHashCode = StringExtensionMethods.GetStableHashCode("DemisterBallBodyScale"); public static readonly int DemisterBallBodyColorHashCode = StringExtensionMethods.GetStableHashCode("DemisterBallBodyColor"); public static readonly int DemisterBallBodyBrightnessHashCode = StringExtensionMethods.GetStableHashCode("DemisterBallBodyBrightness"); public static readonly int DemisterBallPointLightColorHashCode = StringExtensionMethods.GetStableHashCode("DemisterBallPointLightColor"); public static readonly int FlameEffectsEnabledHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsEnabled"); public static readonly int FlameEffectsColorHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsColor"); public static readonly int FlameEffectsEmbersColorHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsEmbersColor"); public static readonly int FlameEffectsEmbersBrightnessHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsEmbersBrightness"); public static readonly int FlameEffectsSparcsColorHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsSparcsColor"); public static readonly int FlameEffectsSparcsBrightnessHashCode = StringExtensionMethods.GetStableHashCode("FlameEffectsSparcsBrightness"); public static SE_Demister LocalPlayerDemister { get; set; } public static DemisterBallControl LocalPlayerDemisterBall { get; set; } public static ZNetView LocalPlayerDemisterBallNetView { get; set; } public static void SetLocalPlayerDemisterBallControl(DemisterBallControl demisterBallControl) { LocalPlayerDemisterBall = demisterBallControl; LocalPlayerDemisterBallNetView = demisterBallControl.NetView; UpdateDemisterBallControlZdo(LocalPlayerDemisterBallNetView.m_zdo); LocalPlayerDemisterBall.UpdateDemisterBall(forceUpdate: true); } public static void UpdatePlayerDemisterBall() { if (Object.op_Implicit((Object)(object)LocalPlayerDemisterBall) && Object.op_Implicit((Object)(object)LocalPlayerDemisterBallNetView)) { UpdateDemisterBallControlZdo(LocalPlayerDemisterBallNetView.m_zdo); LocalPlayerDemisterBall.UpdateDemisterBall(forceUpdate: true); } } public static void UpdatePlayerDemisterBallFlameEffects() { if (Object.op_Implicit((Object)(object)LocalPlayerDemisterBall) && Object.op_Implicit((Object)(object)LocalPlayerDemisterBallNetView)) { UpdateDemisterBallControlZdo(LocalPlayerDemisterBallNetView.m_zdo); LocalPlayerDemisterBall.UpdateFlameEffects(); } } public static void UpdateUseCustomSettings() { bool flag = PluginConfig.IsModEnabled.Value && PluginConfig.DemisterBallUseCustomSettings.Value; DemisterBallControl demisterBallControl = default(DemisterBallControl); foreach (Demister instance in Demister.m_instances) { GameObject gameObject = ((Component)((Component)instance).transform.root).gameObject; if (!((Object)gameObject).name.StartsWith("demister_ball", StringComparison.Ordinal)) { continue; } if (gameObject.TryGetComponent<DemisterBallControl>(ref demisterBallControl)) { if (!flag) { Object.Destroy((Object)(object)demisterBallControl); } } else if (flag) { gameObject.AddComponent<DemisterBallControl>(); } } if (flag) { LocalPlayerDemisterBall = null; LocalPlayerDemisterBallNetView = null; } } private static void UpdateDemisterBallControlZdo(ZDO zdo) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) zdo.Set(DemisterBallBodyScaleHashCode, PluginConfig.DemisterBallBodyScale.Value); zdo.Set(DemisterBallBodyColorHashCode, PluginConfig.DemisterBallBodyColor.Value); zdo.Set(DemisterBallBodyBrightnessHashCode, PluginConfig.DemisterBallBodyBrightness.Value); zdo.Set(DemisterBallPointLightColorHashCode, PluginConfig.DemisterBallPointLightColor.Value); zdo.Set(FlameEffectsEnabledHashCode, (int)PluginConfig.DemisterBallFlameEffectsEnabled.Value, false); zdo.Set(FlameEffectsColorHashCode, PluginConfig.DemisterBallFlameEffectsColor.Value); zdo.Set(FlameEffectsEmbersColorHashCode, PluginConfig.FlameEffectsEmbersColor.Value); zdo.Set(FlameEffectsEmbersBrightnessHashCode, PluginConfig.FlameEffectsEmbersBrightness.Value); zdo.Set(FlameEffectsSparcsColorHashCode, PluginConfig.FlameEffectsSparcsColor.Value); zdo.Set(FlameEffectsSparcsBrightnessHashCode, PluginConfig.FlameEffectsSparcsBrightness.Value); } public static void SetupParentConstraint() { if (Object.op_Implicit((Object)(object)LocalPlayerDemister) && Object.op_Implicit((Object)(object)LocalPlayerDemister.m_ballInstance) && (Object)(object)((StatusEffect)LocalPlayerDemister).m_character == (Object)(object)Player.m_localPlayer) { ParentConstraint parentConstraint = default(ParentConstraint); if (!LocalPlayerDemister.m_ballInstance.TryGetComponent<ParentConstraint>(ref parentConstraint)) { parentConstraint = LocalPlayerDemister.m_ballInstance.AddComponent<ParentConstraint>(); } SetupParentConstraint(parentConstraint, ((StatusEffect)LocalPlayerDemister).m_character); } } public static void SetupParentConstraint(ParentConstraint parentConstraint, Character character) { //IL_002b: 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_0022: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) parentConstraint.constraintActive = PluginConfig.DemisterBallLockPosition.Value; ConstraintSource val; if (parentConstraint.sourceCount < 1) { val = default(ConstraintSource); parentConstraint.AddSource(val); } val = default(ConstraintSource); ((ConstraintSource)(ref val)).sourceTransform = (Transform)(PluginConfig.DemisterBallLockTarget.Value switch { PluginConfig.LockTarget.Head => character.m_head, PluginConfig.LockTarget.Eye => character.m_eye, _ => ((Component)character).transform, }); ((ConstraintSource)(ref val)).weight = 1f; ConstraintSource val2 = val; parentConstraint.SetSource(0, val2); parentConstraint.SetTranslationOffset(0, PluginConfig.DemisterBallLockOffset.Value); } } [BepInPlugin("redseiko.valheim.heylisten", "HeyListen", "1.2.1")] public sealed class HeyListen : BaseUnityPlugin { public const string PluginGuid = "redseiko.valheim.heylisten"; public const string PluginName = "HeyListen"; public const string PluginVersion = "1.2.1"; private static ManualLogSource _logger; private void Awake() { _logger = ((BaseUnityPlugin)this).Logger; PluginConfig.BindConfig(((BaseUnityPlugin)this).Config); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.heylisten"); } public static void LogInfo(object obj) { _logger.LogInfo((object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {obj}"); Chat.m_instance.AddMessage(obj); } public static void LogError(object obj) { _logger.LogError((object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {obj}"); Chat.m_instance.AddMessage(obj); } } [HarmonyPatch(typeof(Demister))] internal static class DemisterPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AwakePostfix(ref Demister __instance) { if (PluginConfig.IsModEnabled.Value && PluginConfig.DemisterBallUseCustomSettings.Value) { GameObject gameObject = ((Component)((Component)__instance).transform.root).gameObject; DemisterBallControl demisterBallControl = default(DemisterBallControl); if (((Object)gameObject).name.StartsWith("demister_ball", StringComparison.InvariantCulture) && !gameObject.TryGetComponent<DemisterBallControl>(ref demisterBallControl)) { gameObject.AddComponent<DemisterBallControl>(); } } } } [HarmonyPatch(typeof(SE_Demister))] internal static class SEDemisterPatch { [HarmonyPostfix] [HarmonyPatch("Setup")] private static void SetupPostfix(SE_Demister __instance, Character character) { if (PluginConfig.IsModEnabled.Value && (Object)(object)character == (Object)(object)Player.m_localPlayer) { __instance.m_noiseSpeed *= Random.Range(0.8f, 1.2f); __instance.m_noiseDistance *= Random.Range(0.8f, 1.2f); __instance.m_noiseDistanceInterior *= Random.Range(0.8f, 1.2f); __instance.m_noiseDistanceYScale *= Random.Range(0.8f, 1.2f); } } [HarmonyPrefix] [HarmonyPatch("UpdateStatusEffect")] private static void UpdateStatusEffectPrefix(SE_Demister __instance, ref bool __state) { if (PluginConfig.IsModEnabled.Value) { __state = Object.op_Implicit((Object)(object)__instance.m_ballInstance); } } [HarmonyPostfix] [HarmonyPatch("UpdateStatusEffect")] private static void UpdateStatusEffectPostfix(SE_Demister __instance, ref bool __state) { if (PluginConfig.IsModEnabled.Value && Object.op_Implicit((Object)(object)__instance.m_ballInstance) && (!__state || !Object.op_Implicit((Object)(object)WispManager.LocalPlayerDemisterBall)) && (Object)(object)((StatusEffect)__instance).m_character == (Object)(object)Player.m_localPlayer) { WispManager.LocalPlayerDemister = __instance; DemisterBallControl localPlayerDemisterBallControl = default(DemisterBallControl); if (__instance.m_ballInstance.TryGetComponent<DemisterBallControl>(ref localPlayerDemisterBallControl)) { WispManager.SetLocalPlayerDemisterBallControl(localPlayerDemisterBallControl); } ParentConstraint val = default(ParentConstraint); if (!__instance.m_ballInstance.TryGetComponent<ParentConstraint>(ref val)) { WispManager.SetupParentConstraint(__instance.m_ballInstance.AddComponent<ParentConstraint>(), ((StatusEffect)__instance).m_character); } } } } public static class PluginConfig { public enum LockTarget { Head, Eye, Transform } [Flags] public enum FlameEffects { None = 0, Flames = 1, FlamesL = 2, Flare = 4, Embers = 8, Distortion = 0x10, Energy = 0x20, EnergyII = 0x40, Sparcs = 0x80 } public static readonly FlameEffects DefaultFlameEffects = FlameEffects.Flare | FlameEffects.Embers | FlameEffects.EnergyII | FlameEffects.Sparcs; public static ConfigEntry<bool> IsModEnabled { get; private set; } public static ConfigEntry<bool> DemisterBallLockPosition { get; private set; } public static ConfigEntry<Vector3> DemisterBallLockOffset { get; private set; } public static ConfigEntry<LockTarget> DemisterBallLockTarget { get; private set; } public static ConfigEntry<bool> DemisterBallUseCustomSettings { get; private set; } public static ConfigEntry<float> DemisterBallBodyScale { get; private set; } public static ConfigEntry<Color> DemisterBallBodyColor { get; private set; } public static ConfigEntry<float> DemisterBallBodyBrightness { get; private set; } public static ConfigEntry<Color> DemisterBallPointLightColor { get; private set; } public static ConfigEntry<FlameEffects> DemisterBallFlameEffectsEnabled { get; private set; } public static ConfigEntry<Color> DemisterBallFlameEffectsColor { get; private set; } public static ConfigEntry<Color> FlameEffectsEmbersColor { get; private set; } public static ConfigEntry<float> FlameEffectsEmbersBrightness { get; private set; } public static ConfigEntry<Color> FlameEffectsSparcsColor { get; private set; } public static ConfigEntry<float> FlameEffectsSparcsBrightness { get; private set; } public static void BindConfig(ConfigFile config) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod."); IsModEnabled.OnSettingChanged<bool>(WispManager.UpdateUseCustomSettings); IsModEnabled.OnSettingChanged<bool>(WispManager.SetupParentConstraint); DemisterBallLockPosition = config.BindInOrder("DemisterBall", "demisterBallLockPosition", defaultValue: true, "SE_Demister.m_ballPrefab.transform.position lock to player."); DemisterBallLockPosition.OnSettingChanged<bool>(WispManager.SetupParentConstraint); DemisterBallLockOffset = config.BindInOrder<Vector3>("DemisterBall", "demisterBallLockOffset", new Vector3(-0.2f, 0.5f, 0f), "SE_Demister.m_ballPrefab.transform.position offset when locked to player."); DemisterBallLockOffset.OnSettingChanged<Vector3>(WispManager.SetupParentConstraint); DemisterBallLockTarget = config.BindInOrder("DemisterBall", "demisterBallLockTarget", LockTarget.Head, "Which target to offset from when locked to player."); DemisterBallLockTarget.OnSettingChanged<LockTarget>(WispManager.SetupParentConstraint); DemisterBallUseCustomSettings = config.BindInOrder("DemisterBall.Customization", "demisterBallUseCustomSettings", defaultValue: true, "Enables DemisterBall (Wisp) customization."); DemisterBallUseCustomSettings.OnSettingChanged<bool>(WispManager.UpdateUseCustomSettings); DemisterBallBodyScale = config.BindInOrder("Effects.Body", "bodyScale", 1f, "SE_demister.m_ballPrefab.transform.localScale", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f)); DemisterBallBodyScale.OnSettingChanged<float>(WispManager.UpdatePlayerDemisterBall); DemisterBallBodyColor = config.BindInOrder<Color>("Effects.Body", "bodyColor", new Color(0f, 0.832f, 1f, 1f), "SE Demister.m_ballPrefab.color"); DemisterBallBodyColor.OnSettingChanged<Color>(WispManager.UpdatePlayerDemisterBall); DemisterBallBodyBrightness = config.BindInOrder("Effects.Body", "bodyBrightness", 1.2f, "SE_Demister.m_ballPrefab.brightness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f)); DemisterBallBodyBrightness.OnSettingChanged<float>(WispManager.UpdatePlayerDemisterBall); DemisterBallPointLightColor = config.BindInOrder<Color>("Effects.PointLight", "pointLightColor", new Color(0.482f, 0.803f, 1f, 1f), "SE_Demister.m_ballPrefab/effects/Point light.color"); DemisterBallPointLightColor.OnSettingChanged<Color>(WispManager.UpdatePlayerDemisterBall); DemisterBallFlameEffectsEnabled = config.BindInOrder("FlameEffects", "flameEffectsEnabled", DefaultFlameEffects, "SE_Demister.m_ballPrefab/effects/flame/..."); DemisterBallFlameEffectsEnabled.OnSettingChanged<FlameEffects>(WispManager.UpdatePlayerDemisterBallFlameEffects); DemisterBallFlameEffectsColor = config.BindInOrder<Color>("FlameEffects", "flameEffectsColor", new Color(0.482f, 0.803f, 1f, 1f), "SE_Demister.m_ballPrefab/effects/flame/... color."); DemisterBallFlameEffectsColor.OnSettingChanged<Color>(WispManager.UpdatePlayerDemisterBallFlameEffects); BindFlameEffectsEmbersConfig(config); BindFlameEffectsSparcsConfig(config); } public static void BindFlameEffectsEmbersConfig(ConfigFile config) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) FlameEffectsEmbersColor = config.BindInOrder<Color>("FlameEffects.Embers", "embersColor", new Color(0f, 0.677f, 1f, 1f), "m_ballPrefab/effects/flame/embers.color"); FlameEffectsEmbersColor.OnSettingChanged<Color>(WispManager.UpdatePlayerDemisterBallFlameEffects); FlameEffectsEmbersBrightness = config.BindInOrder("FlameEffects.Embers", "embersBrightness", 5.34f, "m_ballPrefab/effects/flame/embers.brightness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5.34f)); FlameEffectsEmbersBrightness.OnSettingChanged<float>(WispManager.UpdatePlayerDemisterBallFlameEffects); } public static void BindFlameEffectsSparcsConfig(ConfigFile config) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) FlameEffectsSparcsColor = config.BindInOrder<Color>("FlameEffects.Sparcs", "sparcsColor", new Color(0f, 0.677f, 1f, 1f), "m_ballPrefab/effects/flame/sparcs.color"); FlameEffectsSparcsColor.OnSettingChanged<Color>(WispManager.UpdatePlayerDemisterBallFlameEffects); FlameEffectsSparcsBrightness = config.BindInOrder("FlameEffects.Sparcs", "sparcsBrightness", 5.34f, "m_ballPrefab/effects/flame/sparcs.brightness", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5.34f)); FlameEffectsSparcsBrightness.OnSettingChanged<float>(WispManager.UpdatePlayerDemisterBallFlameEffects); } } } namespace ComfyLib { public static class ZDOExtensions { public static void Set(this ZDO zdo, int key, Color value) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (ZDOHelper.InitAndSet<Quaternion>(ZDOExtraData.s_quats, zdo.m_uid, key, new Quaternion(value.r, value.g, value.b, value.a))) { zdo.IncreaseDataRevision(); } } public static Color GetColor(this ZDO zdo, int key, Color defaultValue) { //IL_0006: 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_001f: 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_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_0037: Unknown result type (might be due to invalid IL or missing references) Quaternion val = default(Quaternion); if (ZDOExtraData.s_quats.TryGetValue(zdo.m_uid, out var value) && value.TryGetValue(key, ref val)) { return new Color(val.x, val.y, val.z, val.w); } return defaultValue; } public static bool TryGetColor(this ZDO zdo, int key, out Color result) { //IL_0006: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Quaternion val = default(Quaternion); if (ZDOExtraData.s_quats.TryGetValue(zdo.m_uid, out var value) && value.TryGetValue(key, ref val)) { result = new Color(val.x, val.y, val.z, val.w); return true; } result = default(Color); return false; } public static bool TryGetFloat(this ZDO zdo, int key, out float result) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (ZDOExtraData.s_floats.TryGetValue(zdo.m_uid, out var value) && value.TryGetValue(key, ref result)) { return true; } result = 0f; return false; } } public sealed class LightSetting { private readonly Light _light; public Vector3 OriginalScale { get; } public Vector3 CurrentScale { get; private set; } public Color OriginalColor { get; } public Color CurrentColor { get; private set; } public LightSetting(Light light) { //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_0020: 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_0031: 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) _light = light; OriginalScale = ((Component)light).transform.localScale; CurrentScale = OriginalScale; OriginalColor = light.color; CurrentColor = OriginalColor; } public LightSetting Reset() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) SetScale(OriginalScale); SetColor(OriginalColor); return this; } public LightSetting SetScale(Vector3 scale) { //IL_0000: 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_000f: 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) if (scale != CurrentScale) { CurrentScale = scale; ((Component)_light).transform.localScale = scale; } return this; } public LightSetting SetColor(Color color) { //IL_0000: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (color != CurrentColor) { CurrentColor = color; _light.color = color; } return this; } } public static class ParticleSystemExtensions { public static MainModule Main(this ParticleSystem particleSystem) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return particleSystem.main; } public static MainModule SetStartColor(this MainModule main, MinMaxGradient color) { //IL_0002: 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) ((MainModule)(ref main)).startColor = color; return main; } public static ColorOverLifetimeModule ColorOverLifetime(this ParticleSystem particleSystem) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return particleSystem.colorOverLifetime; } public static ColorOverLifetimeModule SetColor(this ColorOverLifetimeModule colorOverLifetime, MinMaxGradient color) { //IL_0002: 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) ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = color; return colorOverLifetime; } public static string ToDebugString(this MinMaxGradient minMaxGradient) { //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_0022: Expected I4, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00e6: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref minMaxGradient)).mode; return (int)mode switch { 0 => $"Color: {((MinMaxGradient)(ref minMaxGradient)).color:F3}", 2 => $"TwoColor: ColorMin ({((MinMaxGradient)(ref minMaxGradient)).colorMin:F3}), ColorMax ({((MinMaxGradient)(ref minMaxGradient)).colorMax:F3})", 1 => "Gradient: " + ((MinMaxGradient)(ref minMaxGradient)).gradient.ToDebugString(), 3 => "TwoGradients: GradientMin (" + ((MinMaxGradient)(ref minMaxGradient)).gradientMin.ToDebugString() + "), GradientMax (" + ((MinMaxGradient)(ref minMaxGradient)).gradientMax.ToDebugString() + ")", 4 => "RandomColor: " + ((MinMaxGradient)(ref minMaxGradient)).gradient.ToDebugString(), _ => $"{minMaxGradient}", }; } public static string ToDebugString(this Gradient gradient) { return string.Format("ColorKeys = [{0}], AlphaKeys = [{1}]", string.Join(", ", gradient.colorKeys.Select((GradientColorKey key) => $"({key.time:F3} {key.color:F3})")), string.Join(", ", gradient.alphaKeys.Select((GradientAlphaKey key) => $"({key.time:F3} {key.alpha:F3})"))); } } public sealed class ParticleSystemSetting { private readonly ParticleSystem _particleSystem; public Vector3 OriginalScale { get; } public Vector3 CurrentScale { get; private set; } public MinMaxGradient OriginalStartColor { get; } public MinMaxGradient CurrentStartColor { get; private set; } public MinMaxGradient OriginalColorOveLifetimeColor { get; } public MinMaxGradient CurrentColorOverLifetimeColor { get; private set; } public ParticleSystemSetting(ParticleSystem particleSystem) { //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_0020: 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_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) //IL_0040: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) _particleSystem = particleSystem; OriginalScale = ((Component)particleSystem).transform.localScale; CurrentScale = OriginalScale; MainModule main = particleSystem.main; OriginalStartColor = ((MainModule)(ref main)).startColor; CurrentStartColor = OriginalStartColor; ColorOverLifetimeModule colorOverLifetime = particleSystem.colorOverLifetime; OriginalColorOveLifetimeColor = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; CurrentColorOverLifetimeColor = OriginalColorOveLifetimeColor; } public ParticleSystemSetting Reset() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SetScale(OriginalScale); SetStartColor(OriginalStartColor); SetColorOverLifetimeColor(OriginalColorOveLifetimeColor); return this; } public ParticleSystemSetting SetActive(bool active) { ((Component)_particleSystem).gameObject.SetActive(active); return this; } public ParticleSystemSetting SetScale(Vector3 scale) { //IL_0000: 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_000f: 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) if (scale != CurrentScale) { CurrentScale = scale; ((Component)_particleSystem).transform.localScale = scale; } return this; } public ParticleSystemSetting SetStartColor(Color color) { //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) return this.SetStartColor(new MinMaxGradient(color)); } public ParticleSystemSetting SetStartColor(MinMaxGradient color) { //IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) CurrentStartColor = color; _particleSystem.Main().SetStartColor(CurrentStartColor); return this; } public ParticleSystemSetting SetColorOverLifetimeColor(Color color) { //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) return this.SetColorOverLifetimeColor(new MinMaxGradient(color)); } public ParticleSystemSetting SetColorOverLifetimeColor(MinMaxGradient color) { //IL_0001: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) CurrentColorOverLifetimeColor = color; _particleSystem.ColorOverLifetime().SetColor(CurrentColorOverLifetimeColor); return this; } } public sealed class RendererSetting { private static readonly int _colorShaderId = Shader.PropertyToID("_Color"); private static readonly int _emissionColorShaderId = Shader.PropertyToID("_EmissionColor"); private readonly Renderer _renderer; public Vector3 OriginalScale { get; } public Vector3 CurrentScale { get; private set; } public Color OriginalColor { get; } public Color OriginalEmissionColor { get; } public Color CurrentColor { get; private set; } public Color CurrentEmissionColor { get; private set; } public RendererSetting(Renderer renderer) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_004f: 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_005b: 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_0073: Unknown result type (might be due to invalid IL or missing references) _renderer = renderer; OriginalScale = ((Component)_renderer).transform.localScale; OriginalColor = _renderer.material.GetColor(_colorShaderId); OriginalEmissionColor = _renderer.material.GetColor(_emissionColorShaderId); CurrentScale = OriginalScale; CurrentColor = OriginalColor; CurrentEmissionColor = CurrentEmissionColor; } public RendererSetting Reset() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SetScale(OriginalScale); SetColor(OriginalColor); SetEmissionColor(OriginalEmissionColor); return this; } public RendererSetting SetActive(bool active) { ((Component)_renderer).gameObject.SetActive(active); return this; } public RendererSetting SetScale(Vector3 scale) { //IL_0000: 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_000f: 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) if (scale != CurrentScale) { CurrentScale = scale; ((Component)_renderer).transform.localScale = scale; } return this; } public RendererSetting SetColor(Color color) { //IL_0000: 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_000f: 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) if (color != CurrentColor) { CurrentColor = color; _renderer.material.SetColor(_colorShaderId, color); } return this; } public RendererSetting SetEmissionColor(Color color) { //IL_0000: 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_000f: 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) if (color != CurrentEmissionColor) { CurrentEmissionColor = color; _renderer.material.SetColor(_emissionColorShaderId, color); } return this; } } public static class ConfigFileExtensions { internal sealed class ConfigurationManagerAttributes { public Action<ConfigEntryBase> CustomDrawer; public bool? Browsable; public bool? HideDefaultButton; public bool? HideSettingName; public bool? IsAdvanced; public int? Order; public bool? ReadOnly; } private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>(); private static int GetSettingOrder(string section) { if (!_sectionToSettingOrder.TryGetValue(section, out var value)) { value = 0; } _sectionToSettingOrder[section] = value - 1; return value; } public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1] { new ConfigurationManagerAttributes { Browsable = browsable, CustomDrawer = null, HideDefaultButton = hideDefaultButton, HideSettingName = hideSettingName, IsAdvanced = isAdvanced, Order = GetSettingOrder(section), ReadOnly = readOnly } })); } public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = browsable, CustomDrawer = customDrawer, HideDefaultButton = hideDefaultButton, HideSettingName = hideSettingName, IsAdvanced = isAdvanced, Order = GetSettingOrder(section), ReadOnly = readOnly } })); } public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler) { configEntry.SettingChanged += delegate { settingChangedHandler(); }; } public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler) { configEntry.SettingChanged += delegate(object _, EventArgs eventArgs) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue); }; } public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler) { configEntry.SettingChanged += delegate(object _, EventArgs eventArgs) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue); }; } } public static class ChatExtensions { public static void AddMessage(this Chat chat, object obj) { if (Object.op_Implicit((Object)(object)chat)) { ((Terminal)chat).AddString($"{obj}"); chat.m_hideTimer = 0f; } } } public static class ColorExtensions { public static Color SetAlpha(this Color color, float alpha) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) color.a = alpha; return color; } } public static class ObjectExtensions { public static T FirstByNameOrThrow<T>(this T[] unityObjects, string name) where T : Object { foreach (T val in unityObjects) { if (((Object)val).name == name) { return val; } } throw new InvalidOperationException($"Could not find Unity object of type {typeof(T)} with name: {name}"); } public static T Ref<T>(this T unityObject) where T : Object { if (!Object.op_Implicit((Object)(object)unityObject)) { return default(T); } return unityObject; } } }