using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Atlyss.NoSparkleEffect.SoftDependencies;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Nessie.ATLYSS.EasySettings;
using Nessie.ATLYSS.EasySettings.UIElements;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Atlyss.NoSparkleEffect")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Atlyss.NoSparkleEffect")]
[assembly: AssemblyTitle("Atlyss.NoSparkleEffect")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
}
namespace Atlyss.NoSparkleEffect
{
[BepInPlugin("ATLYSS.NoSparkleEffect", "No Sparkle Effect", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Mod : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__14_0;
internal void <Awake>b__14_0()
{
EasySettingsCompatibility.AddHeader("No Sparkle Effect");
EasySettingsCompatibility.AddToggle("Allow Audio", AllowAudio);
EasySettingsCompatibility.AddToggle("Allow Particle Effect", AllowParticleEffect);
}
}
private const string modGUID = "ATLYSS.NoSparkleEffect";
private const string modName = "No Sparkle Effect";
private const string modVersion = "1.0.0";
private static readonly Harmony harmony = new Harmony("ATLYSS.NoSparkleEffect");
public static ManualLogSource Log = new ManualLogSource("No Sparkle Effect");
public static Mod Instance;
public static ConfigEntry<bool> AllowAudio { get; set; }
public static ConfigEntry<bool> AllowParticleEffect { get; set; }
public void Awake()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
Log = Logger.CreateLogSource("ATLYSS.NoSparkleEffect");
Log.LogInfo((object)"No Sparkle Effect Startup...");
AllowAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Allow Audio", false, new ConfigDescription("Toggle whether the audio from the vanity sparkle effect happens", (AcceptableValueBase)null, Array.Empty<object>()));
AllowParticleEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Allow Particle Effect", false, new ConfigDescription("Toggle whether the particle effect from the vanity sparkle effect happens", (AcceptableValueBase)null, Array.Empty<object>()));
if (EasySettingsCompatibility.enabled)
{
UnityEvent onInitialized = EasySettingsCompatibility.OnInitialized;
object obj = <>c.<>9__14_0;
if (obj == null)
{
UnityAction val = delegate
{
EasySettingsCompatibility.AddHeader("No Sparkle Effect");
EasySettingsCompatibility.AddToggle("Allow Audio", AllowAudio);
EasySettingsCompatibility.AddToggle("Allow Particle Effect", AllowParticleEffect);
};
<>c.<>9__14_0 = val;
obj = (object)val;
}
onInitialized.AddListener((UnityAction)obj);
EasySettingsCompatibility.OnApplySettings.AddListener((UnityAction)delegate
{
((BaseUnityPlugin)this).Config.Save();
});
}
Log.LogInfo((object)"Patching...");
harmony.PatchAll();
Log.LogInfo((object)"Patched!");
}
}
}
namespace Atlyss.NoSparkleEffect.SoftDependencies
{
public static class EasySettingsCompatibility
{
private const MethodImplOptions SoftDepend = MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization;
public const string modGUID = "EasySettings";
private static bool _warnedAboutTextFields = false;
private static bool _warnedAboutModTabs = false;
private static bool? _enabled;
private static BaseUnityPlugin? _plugin;
public static Version CurrentVersion { get; private set; } = new Version("1.3.0");
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("EasySettings");
_plugin = (Chainloader.PluginInfos.TryGetValue("EasySettings", out var value) ? value.Instance : null);
if ((Object)(object)_plugin == (Object)null)
{
Mod.Log.LogWarning((object)"Soft dependency EasySettings was not found.");
}
else
{
CurrentVersion = _plugin.Info.Metadata.Version;
}
}
return _enabled.Value;
}
}
public static UnityEvent OnInitialized
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
return Settings.OnInitialized;
}
}
public static UnityEvent OnCancelSettings
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
return Settings.OnCancelSettings;
}
}
public static UnityEvent OnApplySettings
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
return Settings.OnApplySettings;
}
}
public static UnityEvent OnCloseSettings
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
get
{
return Settings.OnCloseSettings;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static SettingsTab GetOrAddCustomTab(string label)
{
if (CurrentVersion < new Version(1, 3, 0))
{
if (!_warnedAboutModTabs)
{
_warnedAboutModTabs = true;
Mod.Log.LogWarning((object)$"EasySettings mod tabs are not supported in version {CurrentVersion} (need {new Version(1, 3, 0)})");
Mod.Log.LogWarning((object)"This means that this mod won't be able to initialize mod tabs, so you may have some missing stuff.");
Mod.Log.LogWarning((object)"Please update EasySettings or edit the configuration manually instead.");
}
return null;
}
return GetOrAddCustomTabInternal(label);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static SettingsTab GetOrAddCustomTabInternal(string label)
{
return Settings.GetOrAddCustomTab(label);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddSpace()
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddSpace()).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddHeader(string label)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddHeader(label)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddButton(string buttonLabel, UnityAction onClick)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddButton(buttonLabel, onClick)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddToggle(string label, ConfigEntry<bool> config)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddToggle(label, config)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddSlider(string label, ConfigEntry<float> config, bool wholeNumbers = false)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddSlider(label, config, wholeNumbers)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddAdvancedSlider(string label, ConfigEntry<float> config, bool wholeNumbers = false)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddAdvancedSlider(label, config, wholeNumbers)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddAdvancedSlider(string label, ConfigEntry<float> config, float min, float max, bool wholeNumbers = false)
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
AtlyssAdvancedSlider element = Settings.ModTab.AddAdvancedSlider(label, config.Value, min, max, wholeNumbers);
AtlyssAdvancedSlider obj = element;
if (obj != null)
{
obj.OnValueChanged.AddListener((UnityAction<float>)delegate(float newValue)
{
config.Value = newValue;
});
}
AtlyssAdvancedSlider obj2 = element;
if (obj2 != null)
{
obj2.OnResetClicked.AddListener((UnityAction)delegate
{
element.SetValue((float)((ConfigEntryBase)config).DefaultValue);
});
}
return ((Component)((BaseAtlyssElement)element).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddAdvancedSliderInTab(SettingsTab tab, string label, ConfigEntry<float> config, float min, float max, bool wholeNumbers = false)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
AtlyssAdvancedSlider element = tab.AddAdvancedSlider(label, config.Value, min, max, wholeNumbers);
AtlyssAdvancedSlider obj = element;
if (obj != null)
{
obj.OnValueChanged.AddListener((UnityAction<float>)delegate(float newValue)
{
config.Value = newValue;
});
}
AtlyssAdvancedSlider obj2 = element;
if (obj2 != null)
{
obj2.OnResetClicked.AddListener((UnityAction)delegate
{
element.SetValue((float)((ConfigEntryBase)config).DefaultValue);
});
}
return ((Component)((BaseAtlyssElement)element).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddDropdown<T>(string label, ConfigEntry<T> config) where T : Enum
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddDropdown<T>(label, config)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddKeyButton(string label, ConfigEntry<KeyCode> config)
{
return ((Component)((BaseAtlyssElement)Settings.ModTab.AddKeyButton(label, config)).Root).gameObject;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static GameObject AddTextField(string label, ConfigEntry<string> config, string preset = "Text...")
{
if (CurrentVersion < new Version(1, 2, 0))
{
if (!_warnedAboutTextFields)
{
_warnedAboutTextFields = true;
Mod.Log.LogWarning((object)$"EasySettings text fields are not supported in version {CurrentVersion} (need {new Version(1, 2, 0)})");
Mod.Log.LogWarning((object)"This means that this mod won't be able to initialize text field settings, so you may have some missing stuff.");
Mod.Log.LogWarning((object)"Please update EasySettings or edit the configuration manually instead.");
}
return null;
}
return AddTextFieldInternal(label, config, preset);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static GameObject AddTextFieldInternal(string label, ConfigEntry<string> config, string preset = "Text...")
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
string value = config.Value;
AtlyssTextField val = Settings.ModTab.AddTextField(label, config, preset);
val.InputField.characterLimit = 0;
val.InputField.SetTextWithoutNotify(value);
val.Apply();
RectTransform component = ((Component)val.InputField).GetComponent<RectTransform>();
if (Object.op_Implicit((Object)(object)component))
{
component.SetInsetAndSizeFromParentEdge((Edge)1, 10f, component.sizeDelta.x * 1.5f);
}
return ((Component)((BaseAtlyssElement)val).Root).gameObject;
}
}
}
namespace Atlyss.NoSparkleEffect.Patches
{
[HarmonyPatch(typeof(PlayerVisual), "UserCode_Rpc_VanitySparkleEffect")]
internal static class PlayerVisual__UserCode_Rpc_VanitySparkleEffect
{
[HarmonyPrefix]
internal static bool AdjustSparklyEffect(PlayerVisual __instance)
{
if (!Object.op_Implicit((Object)(object)Player._mainPlayer) || (Object)(object)Player._mainPlayer.Network_playerMapInstance != (Object)(object)__instance._player.Network_playerMapInstance || Player._mainPlayer._bufferingStatus || __instance._player._bufferingStatus)
{
return false;
}
if (Mod.AllowParticleEffect.Value)
{
__instance._vanity_sparkleEffect.Play();
}
if (Mod.AllowAudio.Value)
{
((Component)__instance._vanity_sparkleEffect).GetComponent<AudioSource>().Play();
}
return false;
}
}
}