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 ServersideQoL ControlCenter v2.1.0
ServersideQoL.ControlCenter.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using ServersideQoL.Utilities; [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("ArgusMagnus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("ArgusMagnus")] [assembly: AssemblyDescription("Lets you configure all available vanilla global keys such as skill loss/gain rate, carry weight multiplier, food constumption rate, etc.")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+204f9f33466a3fbfe830fe172b162a96aaba64cd")] [assembly: AssemblyProduct("ServersideQoL.ControlCenter")] [assembly: AssemblyTitle("ServersideQoL.ControlCenter")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArgusMagnus/ValheimServersideQoL")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Count; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Count; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Count; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List<T> items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return _items.Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return _items.IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 ServersideQoL.ControlCenter { public sealed class Config : ConfigBase<Config> { private sealed record FieldInfoEx(FieldInfo Field, object? RestoreValueObject, double RestoreValue) { public double ComparisonValue { get; set; } = double.NaN; } public override ConfigEntry<bool> Enabled { get; } = ConfigBase<Config>.BindEx<bool>(cfg, true, "Enables/disables the entire mod", (AcceptableValueBase)null, (Deprecated<Config>)null, "Enabled"); public IReadOnlyList<ConfigEntryBase> GlobalKeys { get; } = Get((GlobalKeys)40, cfg, "Sets the value for the '{0}' global key", "GlobalKeys"); public Config(ConfigFile cfg, Logger logger) : base(cfg, logger) { } private static IReadOnlyList<ConfigEntryBase> Get(GlobalKeys? maxEclusive, ConfigFile cfg, string descriptionFormat, [CallerMemberName] string section = null) { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Expected O, but got Unknown //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Expected O, but got Unknown List<(double, double)> list = new List<(double, double)>(); List<double> list2 = new List<double>(); list2.Add(-3.4028234663852886E+38); list2.Add(-2147483648.0); list2.AddRange(Enumerable.Range(-100, 100).Select((Func<int, double>)((int x) => x))); list2.Add(2147483647.0); list2.Add(3.4028234663852886E+38); IEnumerable<double> enumerable = new <>z__ReadOnlyList<double>(list2); Dictionary<string, string> dictionary = new Dictionary<string, string>(); List<FieldInfoEx> list3 = (from x in typeof(Game).GetFields(BindingFlags.Static | BindingFlags.Public) where !x.IsLiteral && !x.IsInitOnly select new FieldInfoEx(x, x.GetValue(null), TryGetAsDouble(x)) into x where !double.IsNaN(x.RestoreValue) select x).ToList(); MethodInfo methodInfo = null; try { Game.UpdateWorldRates(new HashSet<string>(), dictionary); } catch (NullReferenceException) { } foreach (FieldInfoEx item2 in list3) { item2.ComparisonValue = TryGetAsDouble(item2.Field); } List<ConfigEntryBase> list4 = new List<ConfigEntryBase>(); HashSet<string> hashSet = new HashSet<string>(); foreach (GlobalKeys value3 in Enum.GetValues(typeof(GlobalKeys))) { if (maxEclusive.HasValue && SQoLEnumUtils.ToInt64<GlobalKeys>(value3) >= SQoLEnumUtils.ToInt64<GlobalKeys>(maxEclusive.Value)) { continue; } string text = ((object)value3/*cast due to .constrained prefix*/).ToString(); string key = text.ToLower(); FieldInfo fieldInfo = null; object value = null; double num = double.NaN; list.Clear(); foreach (double item3 in enumerable) { dictionary.Clear(); dictionary.Add(key, FormattableString.Invariant($"{item3}")); hashSet.Clear(); try { Game.UpdateWorldRates(hashSet, dictionary); } catch (NullReferenceException) { } double num2 = double.NaN; if ((object)fieldInfo == null) { int index; (fieldInfo, value, num, num2, index) = list3.Select((FieldInfoEx x, int i) => (Field: x.Field, RestoreValueObject: x.RestoreValueObject, ComparisonValue: x.ComparisonValue, Value: TryGetAsDouble(x.Field), i: i)).FirstOrDefault<(FieldInfo, object, double, double, int)>(((FieldInfo Field, object RestoreValueObject, double ComparisonValue, double Value, int i) x) => x.ComparisonValue != x.Value); if ((object)fieldInfo != null) { list3.RemoveAt(index); } } else { num2 = TryGetAsDouble(fieldInfo); if (num2 == num) { num2 = double.NaN; } } if (!double.IsNaN(num2)) { list.Add((item3, num2)); } } if (list != null && list.Count > 0 && (object)fieldInfo != null) { double min = list.Min<(double, double)>(((double TestValue, double Value) x) => x.Value); double max = list.Max<(double, double)>(((double TestValue, double Value) x) => x.Value); IEnumerable<(double, double)> source = list.Where<(double, double)>(((double TestValue, double Value) x) => x.Value != 0.0 && x.Value > min && x.Value < max); double num3 = (source.Any() ? source.Average<(double, double)>(((double TestValue, double Value) x) => x.TestValue / x.Value) : 1.0); min *= num3; max *= num3; num *= num3; AcceptableValueBase val2 = null; if (min > -3.4028234663852886E+38 && max < 3.4028234663852886E+38 && min < max) { val2 = (AcceptableValueBase)Activator.CreateInstance(typeof(AcceptableValueRange<>).MakeGenericType(fieldInfo.FieldType), Convert.ChangeType(min, fieldInfo.FieldType), Convert.ChangeType(max, fieldInfo.FieldType)); } if ((object)methodInfo == null) { methodInfo = new Func<ConfigFile, string, bool, string, AcceptableValueBase, Deprecated<Config>, string, ConfigEntry<bool>>(ConfigBase<Config>.BindEx<bool>).Method.GetGenericMethodDefinition(); } ConfigEntryBase item = (ConfigEntryBase)methodInfo.MakeGenericMethod(fieldInfo.FieldType).Invoke(null, new object[7] { cfg, section, Convert.ChangeType(num, fieldInfo.FieldType), string.Format(descriptionFormat, text), val2, null, text }); list4.Add(item); } else { list4.Add((ConfigEntryBase)(object)ConfigBase<Config>.BindEx<bool>(cfg, section, false, string.Format(descriptionFormat, text), (AcceptableValueBase)null, (Deprecated<Config>)null, text)); } fieldInfo?.SetValue(null, value); } foreach (FieldInfoEx item4 in list3) { item4.Field.SetValue(null, item4.RestoreValueObject); } return list4; static double TryGetAsDouble(FieldInfo field) { object value2 = field.GetValue(null); try { return (double)Convert.ChangeType(value2, typeof(double)); } catch { return double.NaN; } } } } [BepInPlugin("ArgusMagnus.ServersideQoL.ControlCenter", "ServersideQoL.ControlCenter", "2.1.0")] public sealed class ControlCenterPlugin : ServersideQoLPluginBase<ControlCenterPlugin, Config> { public const string Author = "ArgusMagnus"; public const string PluginName = "ServersideQoL.ControlCenter"; public const string PluginGuid = "ArgusMagnus.ServersideQoL.ControlCenter"; public const string PluginVersion = "2.1.0"; public const string PluginInformationalVersion = "2.1.0"; private DateTimeOffset BuildTimestamp { get; } = new DateTimeOffset(639259375552933999L, default(TimeSpan)); protected override Config CreateConfigSingleton(ConfigFile configFile, Logger logger) { return new Config(configFile, logger); } protected override void RegisterProcessors(IProcessorCollection processors) { processors.Add<Processor>(); } private void Awake() { } } [Processor("bd8fd3f9-3acd-40de-8f8f-3feab6054678")] internal sealed class Processor : Processor<Processor.PrefabInfo> { public sealed record PrefabInfo : ProcessorPrefabInfo { public override bool IsValid => false; [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("PrefabInfo"); stringBuilder.Append(" { "); if (((ProcessorPrefabInfo)this).PrintMembers(stringBuilder)) { stringBuilder.Append(' '); } stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] protected override bool PrintMembers(StringBuilder builder) { return ((ProcessorPrefabInfo)this).PrintMembers(builder); } [CompilerGenerated] public override int GetHashCode() { return ((ProcessorPrefabInfo)this).GetHashCode(); } [CompilerGenerated] public sealed override bool Equals(ProcessorPrefabInfo? other) { return ((object)this).Equals((object?)other); } [CompilerGenerated] public bool Equals(PrefabInfo? other) { if ((object)this != other) { return ((ProcessorPrefabInfo)this).Equals((ProcessorPrefabInfo)(object)other); } return true; } [CompilerGenerated] private PrefabInfo(PrefabInfo original) : base((ProcessorPrefabInfo)(object)original) { } public PrefabInfo() { } } protected override void Initialize() { ((ConfigBase<Config>)(object)ConfigBase<Config>.Instance).ConfigChanged -= OnConfigChanged; foreach (ConfigEntryBase globalKey in ConfigBase<Config>.Instance.GlobalKeys) { OnConfigChanged(globalKey); } ((ConfigBase<Config>)(object)ConfigBase<Config>.Instance).ConfigChanged += OnConfigChanged; } private void OnConfigChanged(object sender, SettingChangedEventArgs args) { OnConfigChanged(args.ChangedSetting); } private void OnConfigChanged(ConfigEntryBase cfg) { if (cfg.DefaultValue.Equals(cfg.BoxedValue)) { ZoneSystem.instance.GlobalKeyRemove(cfg.Definition.Key.ToLowerInvariant(), false); } else if (cfg.SettingType == typeof(bool)) { ZoneSystem.instance.GlobalKeyAdd(cfg.Definition.Key.ToLowerInvariant(), false); } else { ZoneSystem.instance.GlobalKeyAdd(FormattableString.Invariant($"{cfg.Definition.Key.ToLowerInvariant()} {cfg.BoxedValue}"), false); } ZoneSystem.instance.SendGlobalKeys(0L); } protected override ProcessResult Process(ServersideQoLZDO zdo, IReadOnlyList<Peer> peers, PrefabInfo prefabInfo) { throw new NotSupportedException(); } } }