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 StarLevelSystem v0.19.1
plugins/StarLevelSystem.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using MonoMod.Utils; using SimpleJson; using Splatform; using StarLevelSystem.Data; using StarLevelSystem.Modifiers; using StarLevelSystem.Modifiers.Control; using StarLevelSystem.common; using StarLevelSystem.modules; using StarLevelSystem.modules.AnimationAndSpeed; using StarLevelSystem.modules.CreatureSetup; using StarLevelSystem.modules.Damage; using StarLevelSystem.modules.Health; using StarLevelSystem.modules.LevelSystem; using StarLevelSystem.modules.Loot; using StarLevelSystem.modules.Raids; using StarLevelSystem.modules.Sizes; using StarLevelSystem.modules.UI; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("StarLevelSystem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StarLevelSystem")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.19.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.19.1.0")] [CompilerGenerated] internal delegate void <>f__AnonymousDelegate0<T1, T2, T3>(T1 arg1 = default(T1), T2 arg2 = default(T2), T3 arg3 = default(T3)); namespace StarLevelSystem { [PublicAPI] public static class API { private static readonly Type APIReciever; private static readonly MethodInfo UpdateCreatureLevel; private static readonly MethodInfo UpdateCreatureColorization; private static readonly MethodInfo GetBaseAttributeValue; private static readonly MethodInfo UpdateCreatureBaseAttributes; private static readonly MethodInfo GetAllBaseAttributeValues; private static readonly MethodInfo SetAllBaseAttributeValues; private static readonly MethodInfo GetPerLevelAttributeValue; private static readonly MethodInfo UpdateCreaturePerLevelAttributes; private static readonly MethodInfo GetAllPerLevelAttributeValues; private static readonly MethodInfo SetAllPerLevelAttributeValues; private static readonly MethodInfo GetCreatureDamageRecievedModifier; private static readonly MethodInfo UpdateCreatureDamageRecievedModifier; private static readonly MethodInfo GetAllDamageRecievedModifiers; private static readonly MethodInfo SetAllDamageRecievedModifiers; private static readonly MethodInfo GetCreatureDamageBonus; private static readonly MethodInfo UpdateCreatureDamageBonus; private static readonly MethodInfo GetAllDamageBonus; private static readonly MethodInfo SetAllDamageBonus; private static readonly MethodInfo ApplyUpdatesToCreature; private static readonly MethodInfo GetPossibleModifiersForType; private static readonly MethodInfo GetAllModifiersForCreature; private static readonly MethodInfo AddModifierToCreature; private static readonly MethodInfo AddNewModifierToSLS; public static bool IsAvailable => APIReciever != null; static API() { APIReciever = Type.GetType("StarLevelSystem.modules.APIReciever, StarLevelSystem"); UpdateCreatureLevel = APIReciever.GetMethod("UpdateCreatureLevel", BindingFlags.Static | BindingFlags.Public); UpdateCreatureColorization = APIReciever.GetMethod("UpdateCreatureColorization", BindingFlags.Static | BindingFlags.Public); GetBaseAttributeValue = APIReciever.GetMethod("GetBaseAttributeValue", BindingFlags.Static | BindingFlags.Public); UpdateCreatureBaseAttributes = APIReciever.GetMethod("UpdateCreatureBaseAttributes", BindingFlags.Static | BindingFlags.Public); GetAllBaseAttributeValues = APIReciever.GetMethod("GetAllBaseAttributeValues", BindingFlags.Static | BindingFlags.Public); SetAllBaseAttributeValues = APIReciever.GetMethod("SetAllBaseAttributeValues", BindingFlags.Static | BindingFlags.Public); GetPerLevelAttributeValue = APIReciever.GetMethod("GetPerLevelAttributeValue", BindingFlags.Static | BindingFlags.Public); UpdateCreaturePerLevelAttributes = APIReciever.GetMethod("UpdateCreaturePerLevelAttributes", BindingFlags.Static | BindingFlags.Public); GetAllPerLevelAttributeValues = APIReciever.GetMethod("GetAllPerLevelAttributeValues", BindingFlags.Static | BindingFlags.Public); SetAllPerLevelAttributeValues = APIReciever.GetMethod("SetAllPerLevelAttributeValues", BindingFlags.Static | BindingFlags.Public); GetCreatureDamageRecievedModifier = APIReciever.GetMethod("GetCreatureDamageRecievedModifier", BindingFlags.Static | BindingFlags.Public); UpdateCreatureDamageRecievedModifier = APIReciever.GetMethod("UpdateCreatureDamageRecievedModifier", BindingFlags.Static | BindingFlags.Public); GetAllDamageRecievedModifiers = APIReciever.GetMethod("GetAllDamageRecievedModifiers", BindingFlags.Static | BindingFlags.Public); SetAllDamageRecievedModifiers = APIReciever.GetMethod("SetAllDamageRecievedModifiers", BindingFlags.Static | BindingFlags.Public); GetCreatureDamageBonus = APIReciever.GetMethod("GetCreatureDamageBonus", BindingFlags.Static | BindingFlags.Public); UpdateCreatureDamageBonus = APIReciever.GetMethod("UpdateCreatureDamageBonus", BindingFlags.Static | BindingFlags.Public); GetAllDamageBonus = APIReciever.GetMethod("GetAllDamageBonus", BindingFlags.Static | BindingFlags.Public); SetAllDamageBonus = APIReciever.GetMethod("SetAllDamageBonus", BindingFlags.Static | BindingFlags.Public); ApplyUpdatesToCreature = APIReciever.GetMethod("ApplyUpdatesToCreature", BindingFlags.Static | BindingFlags.Public); GetPossibleModifiersForType = APIReciever.GetMethod("GetPossibleModifiersForType", BindingFlags.Static | BindingFlags.Public); GetAllModifiersForCreature = APIReciever.GetMethod("GetAllModifiersForCreature", BindingFlags.Static | BindingFlags.Public); AddModifierToCreature = APIReciever.GetMethod("AddModifierToCreature", BindingFlags.Static | BindingFlags.Public); AddNewModifierToSLS = APIReciever.GetMethod("AddNewModifierToSLS", BindingFlags.Static | BindingFlags.Public); } public static bool SetCreatureLevel(Character creatureId, int newLevel) { return (bool)UpdateCreatureLevel.Invoke(null, new object[2] { creatureId, newLevel }); } public static bool SetCreatureColorization(Character creatureId, float value, float hue, float sat, bool emission = false) { return (bool)UpdateCreatureColorization.Invoke(null, new object[5] { creatureId, value, hue, sat, emission }); } public static float GetCreatureBaseAttribute(Character creatureId, int attribute) { return (float)GetBaseAttributeValue.Invoke(null, new object[2] { creatureId, attribute }); } public static bool SetCreatureBaseAttribute(Character creatureId, int attribute, float value) { return (bool)UpdateCreatureBaseAttributes.Invoke(null, new object[3] { creatureId, attribute, value }); } public static Dictionary<int, float> GetAllCreatureBaseAttributes(Character creatureId) { return (Dictionary<int, float>)GetAllBaseAttributeValues.Invoke(null, new object[1] { creatureId }); } public static bool SetAllCreatureBaseAttributes(Character creatureId, Dictionary<int, float> attributes) { return (bool)SetAllBaseAttributeValues.Invoke(null, new object[2] { creatureId, attributes }); } public static float GetCreaturePerLevelAttribute(Character creatureId, int attribute) { return (float)GetPerLevelAttributeValue.Invoke(null, new object[2] { creatureId, attribute }); } public static bool SetCreaturePerLevelAttribute(Character creatureId, int attribute, float value) { return (bool)UpdateCreaturePerLevelAttributes.Invoke(null, new object[3] { creatureId, attribute, value }); } public static Dictionary<int, float> GetAllCreaturePerLevelAttributes(Character creatureId) { return (Dictionary<int, float>)GetAllPerLevelAttributeValues.Invoke(null, new object[1] { creatureId }); } public static bool SetAllCreaturePerLevelAttributes(Character creatureId, Dictionary<int, float> attributes) { return (bool)SetAllPerLevelAttributeValues.Invoke(null, new object[2] { creatureId, attributes }); } public static float GetCreatureDamageReceivedModifier(Character creatureId, int damageType) { return (float)GetCreatureDamageRecievedModifier.Invoke(null, new object[2] { creatureId, damageType }); } public static bool SetCreatureDamageReceivedModifier(Character creatureId, int damageType, float value) { return (bool)UpdateCreatureDamageRecievedModifier.Invoke(null, new object[3] { creatureId, damageType, value }); } public static Dictionary<int, float> GetAllCreatureDamageReceivedModifiers(Character creatureId) { return (Dictionary<int, float>)GetAllDamageRecievedModifiers.Invoke(null, new object[1] { creatureId }); } public static bool SetAllCreatureDamageReceivedModifiers(Character creatureId, Dictionary<int, float> attributes) { return (bool)SetAllDamageRecievedModifiers.Invoke(null, new object[2] { creatureId, attributes }); } public static float GetCreatureFlatDamageBonus(Character creatureId, int damageType) { return (float)GetCreatureDamageBonus.Invoke(null, new object[2] { creatureId, damageType }); } public static bool SetCreatureFlatDamageBonus(Character creatureId, int damageType, float value) { return (bool)UpdateCreatureDamageBonus.Invoke(null, new object[3] { creatureId, damageType, value }); } public static Dictionary<int, float> GetAllCreatureFlatDamageBonuses(Character creatureId) { return (Dictionary<int, float>)GetAllDamageBonus.Invoke(null, new object[1] { creatureId }); } public static bool SetAllCreatureFlatDamageBonuses(Character creatureId, Dictionary<int, float> attributes) { return (bool)SetAllDamageBonus.Invoke(null, new object[2] { creatureId, attributes }); } public static bool ApplyCreatureUpdates(Character creatureId) { return (bool)ApplyUpdatesToCreature.Invoke(null, new object[1] { creatureId }); } public static List<string> GetPossibleModifiers(int modType = 0) { return (List<string>)GetPossibleModifiersForType.Invoke(null, new object[1] { modType }); } public static Dictionary<string, int> GetCreaturesModifiers(Character creatureId) { return (Dictionary<string, int>)GetAllModifiersForCreature.Invoke(null, new object[1] { creatureId }); } public static bool AddModifierToTargetCreature(Character creatureId, string modifierName, int modifierType, bool update = true) { return (bool)AddModifierToCreature.Invoke(null, new object[4] { creatureId, modifierName, modifierType, update }); } public static bool AddNewModifier(int modifierID, string modifier_name, Delegate setupMethod = null, float selectionWeight = 10f, float basepower = 0f, float perlevelpower = 0f, Dictionary<Biome, List<string>> biomeConfig = null, int namingStyle = 2, string name_suffixes = null, string name_prefixes = null, int visualStyle = 0, Sprite starIcon = null, GameObject visualEffect = null, List<string> allowed_creatures = null, List<string> unallowed_creatures = null, List<Biome> allowed_biomes = null) { return (bool)AddNewModifierToSLS.Invoke(null, new object[16] { modifierID, modifier_name, setupMethod, selectionWeight, basepower, perlevelpower, biomeConfig, namingStyle, name_suffixes, name_prefixes, visualStyle, starIcon, visualEffect, allowed_creatures, unallowed_creatures, allowed_biomes }); } } internal class ValConfig { [CompilerGenerated] private sealed class <OnClientReceiveColorConfigs>d__137 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientReceiveColorConfigs>d__137(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; Colorization.UpdateYamlConfig(package.ReadString()); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientReceiveCreatureLootConfigs>d__138 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientReceiveCreatureLootConfigs>d__138(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; LootSystemData.UpdateYamlConfig(package.ReadString()); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientReceiveLevelConfigs>d__136 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientReceiveLevelConfigs>d__136(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; LevelSystemData.UpdateYamlConfig(package.ReadString()); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientReceiveModifiersConfigs>d__139 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientReceiveModifiersConfigs>d__139(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; CreatureModifiersData.UpdateModifierConfig(package.ReadString()); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientReceiveRaidConfigs>d__145 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientReceiveRaidConfigs>d__145(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; RaidsData.UpdateYamlConfig(package.ReadString()); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientRecieveForcePlayMusic>d__141 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientRecieveForcePlayMusic>d__141(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; string text = package.ReadString(); DataObjects.Music music = DataObjects.yamldeserializer.Deserialize<DataObjects.Music>(text); MusicMan.instance.TriggerMusic(music.ToString()); <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientRecieveForceRemoveNearbyEvents>d__142 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientRecieveForceRemoveNearbyEvents>d__142(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; RaidControl.RemoveNearbyRunningEvents(); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientRecieveRaidStart>d__140 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientRecieveRaidStart>d__140(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; string text = package.ReadString(); RaidControl.StartRaidRunner(DataObjects.yamldeserializer.Deserialize<DataObjects.RaidDefinition>(text), ((Component)Player.m_localPlayer).transform.position); <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnClientRecieveRequestForPrivatekeys>d__143 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnClientRecieveRequestForPrivatekeys>d__143(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if (<>1__state != 0) { return false; } <>1__state = -1; if ((Object)(object)Player.m_localPlayer == (Object)null) { return false; } List<string> privateKeysSanitize = Player.m_localPlayer.GetPrivateKeysSanitize(); string text = DataObjects.yamlserializerJsonCompat.Serialize((object)privateKeysSanitize); ZPackage val = new ZPackage(); val.Write(text); if (string.IsNullOrEmpty(text) || privateKeysSanitize.Count <= 0) { Logger.LogDebug("No private keys recieved from player: " + ((Character)Player.m_localPlayer).m_name + ", skipping update to the server."); return false; } if (ZNet.instance.GetServerPeer() != null && ZNet.instance.IsCurrentServerDedicated()) { Logger.LogDebug("Sending private keys to server: " + text); ClientSendPlayerPrivateKeysRPC.SendPackage(ZNet.instance.GetServerPeer().m_uid, val); } else { Logger.LogDebug("Updating server with private keys: " + text); string localUserPlatformAndID = SLSExtensions.GetLocalUserPlatformAndID(); if (string.IsNullOrEmpty(localUserPlatformAndID)) { Logger.LogWarning("Could not update player private keys. Players platform was not detected."); return false; } RaidControl.UpdateOrAddPlayerPrivateKeys(localUserPlatformAndID, privateKeysSanitize); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnServerRecieveConfigs>d__135 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnServerRecieveConfigs>d__135(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; Logger.LogDebug("Server recieved config from client, rejecting due to being the server."); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <OnServerRecievePlayerPrivateKeys>d__144 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZPackage package; public long sender; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnServerRecievePlayerPrivateKeys>d__144(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; string text = package.ReadString(); List<string> privatekeys = DataObjects.yamldeserializer.Deserialize<List<string>>(text); RaidControl.UpdateOrAddPlayerPrivateKeys(sender, privatekeys); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ConfigFile cfg; internal const string LevelSettingsFileName = "LevelSettings.yaml"; internal const string ColorSettingsFileName = "ColorSettings.yaml"; internal const string LootSettingsFileName = "LootSettings.yaml"; internal const string ModifiersFileName = "Modifiers.yaml"; internal const string RaidSettingsFileName = "RaidSettings.yaml"; internal const string StarLevelSystem = "StarLevelSystem"; internal const string ServerRaidSavedData = "ServerRaidSavedData.yaml"; internal const string SavedData = "SavedData"; internal static string levelsFilePath = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "LevelSettings.yaml"); internal static string colorsFilePath = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "ColorSettings.yaml"); internal static string creatureLootFilePath = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "LootSettings.yaml"); internal static string creatureModifierFilePath = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "Modifiers.yaml"); internal static string raidsFilePath = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "RaidSettings.yaml"); internal static string raidsServerSavedData = Path.Combine(Paths.ConfigPath, "StarLevelSystem", "SavedData", "ServerRaidSavedData.yaml"); internal static bool RecievedConfigsFromServer = false; private static CustomRPC LevelSettingsRPC; private static CustomRPC ColorSettingsRPC; private static CustomRPC CreatureLootSettingsRPC; private static CustomRPC ModifiersRPC; private static CustomRPC RaidsRPC; internal static CustomRPC ClientSendPlayerPrivateKeysRPC; internal static CustomRPC ClientStartRaidRPC; internal static CustomRPC ClientForcePlayMusicRPC; internal static CustomRPC ClientClearNearbyEventsRPC; public static ConfigEntry<bool> EnableDebugMode; public static ConfigEntry<int> MaxLevel; public static ConfigEntry<bool> OverlevedCreaturesGetRerolledOnLoad; public static ConfigEntry<bool> EnableMapRingsForDistanceBonus; public static ConfigEntry<bool> DistanceBonusIsFromStarterTemple; public static ConfigEntry<int> MiniMapRingGeneratorUpdatesPerFrame; public static ConfigEntry<string> DistanceRingColorOptions; public static ConfigEntry<bool> ControlSpawnerLevels; public static ConfigEntry<bool> ForceControlAllSpawns; public static ConfigEntry<string> SpawnsAlwaysControlled; public static ConfigEntry<bool> ControlBossSpawns; public static ConfigEntry<bool> ControlAbilitySpawnedCreatures; public static ConfigEntry<bool> EnableCreatureScalingPerLevel; public static ConfigEntry<bool> EnableScalingInDungeons; public static ConfigEntry<float> PerLevelScaleBonus; public static ConfigEntry<float> PerLevelLootScale; public static ConfigEntry<bool> ScaleAllLootByLevel; public static ConfigEntry<int> LootDropsPerTick; public static ConfigEntry<string> LootDropCalculationType; public static ConfigEntry<bool> LootEggsDropIncreaseStacks; public static ConfigEntry<bool> EggLevelDeterminedByItemQuality; public static ConfigEntry<bool> OffspringCanBeStrongerThanParents; public static ConfigEntry<float> OffspringGainExtraLevelChance; public static ConfigEntry<bool> OffspringCanBeInfertile; public static ConfigEntry<float> OffspringChanceToBeInfertile; public static ConfigEntry<float> EnemyHealthMultiplier; public static ConfigEntry<float> BossEnemyHealthMultiplier; public static ConfigEntry<float> EnemyHealthPerWorldLevel; public static ConfigEntry<float> EnemyDamageLevelMultiplier; public static ConfigEntry<float> BossEnemyDamageMultiplier; public static ConfigEntry<bool> EnableScalingBirds; public static ConfigEntry<float> BirdSizeScalePerLevel; public static ConfigEntry<bool> EnableScalingFish; public static ConfigEntry<float> FishSizeScalePerLevel; public static ConfigEntry<bool> EnableTreeScaling; public static ConfigEntry<float> TreeSizeScalePerLevel; public static ConfigEntry<bool> UseDeterministicTreeScaling; public static ConfigEntry<bool> RandomizeTameChildrenLevels; public static ConfigEntry<bool> RandomizeTameChildrenModifiers; public static ConfigEntry<bool> SpawnMultiplicationAppliesToTames; public static ConfigEntry<bool> BossCreaturesNeverSpawnMultiply; public static ConfigEntry<bool> EnableColorization; public static ConfigEntry<bool> EnableRockLevels; public static ConfigEntry<bool> EnableRidableCreatureSizeFixes; public static ConfigEntry<bool> MultipliedNightSpawnsRemovedDuringDay; public static ConfigEntry<float> PerLevelTreeLootScale; public static ConfigEntry<float> PerLevelBirdLootScale; public static ConfigEntry<float> PerLevelMineRockLootScale; public static ConfigEntry<float> PerLevelDestructibleLootScale; public static ConfigEntry<int> FishMaxLevel; public static ConfigEntry<int> BirdMaxLevel; public static ConfigEntry<int> TreeMaxLevel; public static ConfigEntry<int> RockMaxLevel; public static ConfigEntry<int> DestructibleMaxLevel; public static ConfigEntry<int> MaxMajorModifiersPerCreature; public static ConfigEntry<int> MaxMinorModifiersPerCreature; public static ConfigEntry<bool> LimitCreatureModifiersToCreatureStarLevel; public static ConfigEntry<float> ChanceMajorModifier; public static ConfigEntry<float> ChanceMinorModifier; public static ConfigEntry<bool> EnableBossModifiers; public static ConfigEntry<float> ChanceOfBossModifier; public static ConfigEntry<int> MaxBossModifiersPerBoss; public static ConfigEntry<bool> SplittersInheritLevel; public static ConfigEntry<int> LimitCreatureModifierPrefixes; public static ConfigEntry<bool> MinorModifiersFirstInName; public static ConfigEntry<bool> EnableDistanceLevelScalingBonus; public static ConfigEntry<bool> EnableMultiplayerEnemyHealthScaling; public static ConfigEntry<bool> EnableMultiplayerEnemyDamageScaling; public static ConfigEntry<int> MultiplayerScalingRequiredPlayersNearby; public static ConfigEntry<float> MultiplayerEnemyDamageModifier; public static ConfigEntry<float> MultiplayerEnemyHealthModifier; public static ConfigEntry<int> NumberOfCacheUpdatesPerFrame; public static ConfigEntry<bool> OutputColorizationGeneratorsData; public static ConfigEntry<int> FallbackDelayBeforeCreatureSetup; public static ConfigEntry<float> InitialDelayBeforeSetup; public static ConfigEntry<bool> EnableDebugOutputForDamage; public static ConfigEntry<bool> EnableDebugOutputLevelRolls; public static ConfigEntry<bool> EnableDebugLootDetails; public static ConfigEntry<bool> UseStarShapedModifierIcons; public static ConfigEntry<float> EnemyHealthbarScalarX; public static ConfigEntry<float> EnemyHealthbarScalarY; public static ConfigEntry<bool> EnableEnemyHeathbarNumberDisplay; public static ConfigEntry<float> HealthDisplayFontSizeAdjustment; public static ConfigEntry<bool> OnlyControlVanillaAreaSpawners; public static ConfigEntry<bool> OverrideCreatureModifiedHealth; public static ConfigEntry<bool> UseVanillaRaidConfiguration; public static ConfigEntry<float> RaidEventRate; public static ConfigEntry<int> MaxActiveRaids; public static ConfigEntry<int> MaxRaidAttemptsPerPlayer; public static ConfigEntry<float> RaidPerPlayerUpdateCheck; public static ConfigEntry<int> ServerTimeBetweenRaidStartChecks; public static ConfigEntry<float> ConfigPollIntervalSeconds; public ValConfig(ConfigFile cf) { cfg = cf; cfg.SaveOnConfigSet = true; CreateConfigValues(cf); ConfigFileWatcher.Register(cfg.ConfigFilePath, OnMainConfigFileChanged); } public void SetupConfigRPCs() { //IL_0011: 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_0027: Expected O, but got Unknown //IL_0027: Expected O, but got Unknown //IL_003d: 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_0053: Expected O, but got Unknown //IL_0053: Expected O, but got Unknown //IL_0069: 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_007f: Expected O, but got Unknown //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ab: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00d7: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0103: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_012f: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_015b: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0187: Expected O, but got Unknown LevelSettingsRPC = NetworkManager.Instance.AddRPC("SLS_LevelsRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientReceiveLevelConfigs)); ColorSettingsRPC = NetworkManager.Instance.AddRPC("SLS_ColorsRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientReceiveColorConfigs)); CreatureLootSettingsRPC = NetworkManager.Instance.AddRPC("SLS_CreatureLootRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientReceiveCreatureLootConfigs)); ModifiersRPC = NetworkManager.Instance.AddRPC("SLS_ModifiersRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientReceiveModifiersConfigs)); RaidsRPC = NetworkManager.Instance.AddRPC("SLS_RaidsRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientReceiveRaidConfigs)); ClientSendPlayerPrivateKeysRPC = NetworkManager.Instance.AddRPC("SLS_SendPlayerKeysRPC", new CoroutineHandler(OnServerRecievePlayerPrivateKeys), new CoroutineHandler(OnClientRecieveRequestForPrivatekeys)); ClientStartRaidRPC = NetworkManager.Instance.AddRPC("SLS_ClientStartRaidRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientRecieveRaidStart)); ClientForcePlayMusicRPC = NetworkManager.Instance.AddRPC("SLS_ClientForcePlayMusicRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientRecieveForcePlayMusic)); ClientClearNearbyEventsRPC = NetworkManager.Instance.AddRPC("SLS_ClientForceRemoveNearbyEventsRPC", new CoroutineHandler(OnServerRecieveConfigs), new CoroutineHandler(OnClientRecieveForceRemoveNearbyEvents)); SynchronizationManager.Instance.AddInitialSynchronization(ClientSendPlayerPrivateKeysRPC, (Func<ZPackage>)SendRequestForPrivateKeys); SynchronizationManager.Instance.AddInitialSynchronization(LevelSettingsRPC, (Func<ZPackage>)SendLevelsConfigs); SynchronizationManager.Instance.AddInitialSynchronization(ColorSettingsRPC, (Func<ZPackage>)SendColorsConfigs); SynchronizationManager.Instance.AddInitialSynchronization(CreatureLootSettingsRPC, (Func<ZPackage>)SendCreatureLootConfigs); SynchronizationManager.Instance.AddInitialSynchronization(ModifiersRPC, (Func<ZPackage>)SendModifierConfigs); SynchronizationManager.Instance.AddInitialSynchronization(RaidsRPC, (Func<ZPackage>)SendRaidConfigs); } private void CreateConfigValues(ConfigFile Config) { //IL_001a: 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_002c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0070: 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_0082: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown EnableDebugMode = Config.Bind<bool>("Client config", "EnableDebugMode", false, new ConfigDescription("Enables Debug logging.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdvanced = true } })); EnableDebugMode.SettingChanged += Logger.enableDebugLogging; Logger.CheckEnableDebugLogging(); EnableDebugOutputForDamage = Config.Bind<bool>("Client config", "EnableDebugOutputForDamage", false, new ConfigDescription("Enables Detailed logging for damage calculations, warning, lots of logging.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdvanced = true } })); EnableDebugOutputLevelRolls = Config.Bind<bool>("Client config", "EnableDebugOutputLevelRolls", false, new ConfigDescription("Enables Detailed logging for creature levelup rolls.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdvanced = true } })); EnableDebugLootDetails = Config.Bind<bool>("Client config", "EnableDebugLootDetails", false, new ConfigDescription("Enables Detailed logging for loot generation.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdvanced = true } })); MaxLevel = BindServerConfig("LevelSystem", "MaxLevel", 20, "The Maximum number of stars that a creature can have", advanced: false, 1, 200); MaxLevel.SettingChanged += UpdateLevelsOnChange.ModifyLoadedCreatureLevels; OverlevedCreaturesGetRerolledOnLoad = BindServerConfig("LevelSystem", "OverlevedCreaturesGetRerolledOnLoad", value: true, "Rerolls creature levels which are above maximum defined level, when those creatures are loaded. This will automatically clean up overleveled creatures if you reduce the max level."); EnableCreatureScalingPerLevel = BindServerConfig("LevelSystem", "EnableCreatureScalingPerLevel", value: true, "Enables started creatures to get larger for each star"); EnableDistanceLevelScalingBonus = BindServerConfig("LevelSystem", "EnableDistanceLevelScalingBonus", value: true, "Creatures further away from the center of the world have a higher chance to levelup, this is a bonus applied to existing creature/biome configuration."); EnableMapRingsForDistanceBonus = BindServerConfig("LevelSystem", "EnableMapRingsForDistanceBonus", value: true, "Enables map rings to show distance levels, this is a visual aid to help you see how far away from the center of the world you are."); EnableMapRingsForDistanceBonus.SettingChanged += DistanceScaleSystem.UpdateMapRingEnableSettingOnChange; DistanceBonusIsFromStarterTemple = BindServerConfig("LevelSystem", "DistanceBonusIsFromStarterTemple", value: false, "When enabled the distance bonus is calculated from the starter temple instead of world center, typically this makes little difference. But can help ensure your starting area is more correctly calculated."); DistanceBonusIsFromStarterTemple.SettingChanged += DistanceScaleSystem.OnRingCenterChanged; DistanceRingColorOptions = BindServerConfig("LevelSystem", "DistanceRingColorOptions", "White,Blue,Teal,Green,Yellow,Purple,Orange,Pink,Purple,Red,Grey", "The colors that distance rings will use, if there are more rings than colors, the color pattern will be repeated. (Optional, use an HTML hex color starting with # to have a custom color.) Available options: Red, Orange, Yellow, Green, Teal, Blue, Purple, Pink, Gray, Brown, Black"); DistanceRingColorOptions.SettingChanged += DistanceScaleSystem.UpdateMapColorSettingsOnChange; MiniMapRingGeneratorUpdatesPerFrame = BindServerConfig("LevelSystem", "MiniMapRingGeneratorUpdatesPerFrame", 1000, "The number of ring points to calculate per frame when generating the minimap rings. Higher values make this go faster, but can get it killed or cause instability.", advanced: true); PerLevelScaleBonus = BindServerConfig("LevelSystem", "PerLevelScaleBonus", 0.1f, "The additional size that a creature grows each star level.", advanced: true, 0f, 2f); PerLevelScaleBonus.SettingChanged += SizeModifications.StarLevelScaleChanged; EnableScalingInDungeons = BindServerConfig("LevelSystem", "EnableScalingInDungeons", value: false, "Enables scaling in dungeons, this can cause creatures to become stuck."); EnableColorization = BindServerConfig("LevelSystem", "EnableColorization", value: true, "Enables this mods colorization of creatures based on their star level."); EnemyHealthMultiplier = BindServerConfig("LevelSystem", "EnemyHealthMultiplier", 1f, "The amount of health that each level gives a creature, vanilla is 1x.", advanced: false, 0f, 5f); EnemyHealthPerWorldLevel = BindServerConfig("LevelSystem", "EnemyHealthPerWorldLevel", 0.2f, "The percent amount of health that each world level gives a creature, vanilla is 2x (eg 200% more health each world level).", advanced: false, 0f, 2f); EnemyDamageLevelMultiplier = BindServerConfig("LevelSystem", "EnemyDamageLevelMultiplier", 0.1f, "The amount of damage that each level gives a creatures, vanilla is 0.5x (eg 50% more damage each level).", advanced: false, 0f, 2f); BossEnemyHealthMultiplier = BindServerConfig("LevelSystem", "BossEnemyHealthMultiplier", 0.3f, "The amount of health that each level gives a boss. 1 is 100% more health per level.", advanced: false, 0f, 5f); BossEnemyDamageMultiplier = BindServerConfig("LevelSystem", "BossEnemyDamageMultiplier", 0.02f, "The amount of damage that each level gives a boss. 1 is 100% more damage per level.", advanced: false, 0f, 5f); RandomizeTameChildrenLevels = BindServerConfig("LevelSystem", "RandomizeTameLevels", value: false, "Randomly rolls bred creature levels, instead of inheriting from parent."); RandomizeTameChildrenModifiers = BindServerConfig("LevelSystem", "RandomizeTameChildrenModifiers", value: true, "Randomly rolls bred creatures modifiers instead of inheriting from a parent"); SpawnMultiplicationAppliesToTames = BindServerConfig("LevelSystem", "SpawnMultiplicationAppliesToTames", value: false, "Spawn multipliers set on creature or biome will apply to produced tames when enabled."); BossCreaturesNeverSpawnMultiply = BindServerConfig("LevelSystem", "BossCreaturesNeverSpawnMultiply", value: true, "Boss creatures never have spawn multipliers applied to them."); EnableRidableCreatureSizeFixes = BindServerConfig("LevelSystem", "EnableRidableCreatureSizeFixes", value: true, "Enables collider fixes for ridable creatures (lox and Askavin)."); MultipliedNightSpawnsRemovedDuringDay = BindServerConfig("LevelSystem", "MultipliedNightSpawnsRemovedDuringDay", value: true, "When true, night spawns will be flagged to despawn during the day, which will result in them running away and despawning. This can be disabled if desired."); EnableScalingBirds = BindServerConfig("ObjectLevels", "EnableScalingBirds", value: true, "Enables birds to scale with the level system. This will cause them to become larger and give more drops."); EnableScalingBirds.SettingChanged += UpdateLevelsOnChange.UpdateBirdSizeOnConfigChange; BirdSizeScalePerLevel = BindServerConfig("ObjectLevels", "BirdSizeScalePerLevel", 0.1f, "The amount of size that birds gain per level. 0.1 = 10% larger per level.", advanced: true, 0f, 2f); BirdSizeScalePerLevel.SettingChanged += UpdateLevelsOnChange.UpdateBirdSizeOnConfigChange; EnableScalingFish = BindServerConfig("ObjectLevels", "EnableScalingFish", value: true, "Enables star scaling for fish. This does potentially allow huge fish."); EnableScalingFish.SettingChanged += UpdateLevelsOnChange.UpdateFishSizeOnConfigChange; EnableRockLevels = BindServerConfig("ObjectLevels", "EnableRockLevels", value: false, "Enables level scaling for rocks."); FishMaxLevel = BindServerConfig("ObjectLevels", "FishMaxLevel", 20, "Sets the max level that fish can scale up to.", advanced: true, 1); BirdMaxLevel = BindServerConfig("ObjectLevels", "BirdMaxLevel", 10, "Sets the max level that birds can scale up to.", advanced: true, 1); TreeMaxLevel = BindServerConfig("ObjectLevels", "TreeMaxLevel", 10, "Sets the max level that trees can scale up to.", advanced: true, 1); RockMaxLevel = BindServerConfig("ObjectLevels", "RockMaxLevel", 10, "Sets the max level that rocks can scale up to.", advanced: true, 1); DestructibleMaxLevel = BindServerConfig("ObjectLevels", "DestructibleMaxLevel", 1, "Sets the max level that generic destructibles can be leveled to", advanced: true, 1); FishSizeScalePerLevel = BindServerConfig("ObjectLevels", "FishSizeScalePerLevel", 0.1f, "The amount of size that fish gain per level 0.1 = 10% larger per level."); FishSizeScalePerLevel.SettingChanged += UpdateLevelsOnChange.UpdateFishSizeOnConfigChange; EnableTreeScaling = BindServerConfig("ObjectLevels", "EnableTreeScaling", value: true, "Enables level scaling of trees. Make the trees bigger than reasonable? sure why not."); EnableTreeScaling.SettingChanged += UpdateLevelsOnChange.UpdateTreeSizeOnConfigChange; UseDeterministicTreeScaling = BindServerConfig("ObjectLevels", "UseDeterministicTreeScaling", value: true, "Scales the level of trees based on biome and distance from the center/spawn. This does not randomize tree levels, but reduces network usage."); TreeSizeScalePerLevel = BindServerConfig("ObjectLevels", "TreeSizeScalePerLevel", 0.1f, "The amount of size that trees gain per level 0.1 = 10% larger per level."); TreeSizeScalePerLevel.SettingChanged += UpdateLevelsOnChange.UpdateTreeSizeOnConfigChange; PerLevelTreeLootScale = BindServerConfig("ObjectLevels", "PerLevelTreeLootScale", 0.2f, "The amount of additional wood that each level grants for a tree.", advanced: true); PerLevelBirdLootScale = BindServerConfig("ObjectLevels", "PerLevelBirdLootScale", 0.3f, "Per level additional loot that birds gain.", advanced: true); PerLevelMineRockLootScale = BindServerConfig("ObjectLevels", "PerLevelMineRockLootScale", 0.2f, "The amount of additional stones and ores that each level grants for a rock", advanced: true); PerLevelDestructibleLootScale = BindServerConfig("ObjectLevels", "PerLevelDestructibleLootScale", 0.2f, "The amount of additional loot that destructible items grant for each level", advanced: true); MultiplayerEnemyDamageModifier = BindServerConfig("Multiplayer", "MultiplayerEnemyDamageModifier", 0.05f, "The additional amount of damage enemies will do to players, when there is a group of players together, per player. .2 = 20%. Vanilla gives creatures 4% more damage per player nearby.", advanced: true, 0f, 2f); MultiplayerEnemyHealthModifier = BindServerConfig("Multiplayer", "MultiplayerEnemyHealthModifier", 0.2f, "Enemies take reduced damage when there is a group of players, vanilla gives creatures 30% damage resistance per player nearby.", advanced: true, 0f, 0.99f); MultiplayerScalingRequiredPlayersNearby = BindServerConfig("Multiplayer", "MultiplayerScalingRequiredPlayersNearby", 3, "The number of players in a local area required to cause monsters to gain bonus health and/or damage.", advanced: true, 1, 20); EnableMultiplayerEnemyHealthScaling = BindServerConfig("Multiplayer", "EnableMultiplayerEnemyHealthScaling", value: true, "Wether or not creatures gain more health when players are grouped up."); EnableMultiplayerEnemyDamageScaling = BindServerConfig("Multiplayer", "EnableMultiplayerEnemyDamageScaling", value: false, "Wether or not creatures gain more damage when players are grouped up."); ControlSpawnerLevels = BindServerConfig("LevelSystem", "ControlSpawnerLevels", value: true, "Overrides spawner levels to be controlled by SLS (this impacts all naturally spawning creatures)"); ControlAbilitySpawnedCreatures = BindServerConfig("LevelSystem", "ControlAbilitySpawnedCreatures", value: true, "Forces creatures spawned from abilities to be controlled by SLS. This primarily impacts things such as the roots from Elder."); ControlBossSpawns = BindServerConfig("LevelSystem", "ControlBossSpawns", value: true, "Forces boss creatures to be controlled by SLS. Bosses will not get star levels if this is disabled."); ForceControlAllSpawns = BindServerConfig("LevelSystem", "ForceControlAllSpawns", value: false, "Forces all creatures to be controlled by SLS, this includes creatures spawned from player abilities and items. This will override creature levels, other mods must use the API to ensure their spawned creature levels are set."); SpawnsAlwaysControlled = BindServerConfig("LevelSystem", "SpawnsAlwaysControlled", "piece_TrainingDummy", "A list of creatures which always get their level set"); SpawnsAlwaysControlled.SettingChanged += LevelSelection.LeveledCreatureListChanged; LevelSelection.SetupForceLeveledCreatureList(); PerLevelLootScale = BindServerConfig("LootSystem", "PerLevelLootScale", 1f, "The amount of additional loot that a creature provides per each star level", advanced: false, 0f, 4f); LootDropCalculationType = BindServerConfig("LootSystem", "LootDropCaluationType", "PerLevel", "The type of loot calculation to use. Per Level ", LootStyles.AllowedLootFactors); LootDropCalculationType.SettingChanged += LootStyles.LootFactorChanged; LootDropsPerTick = BindServerConfig("LootSystem", "LootDropsPerTick", 20, "The number of loot drops that are generated per tick, reducing this will reduce lag when massive amounts of loot is generated at once.", advanced: true, 1, 100); ScaleAllLootByLevel = BindServerConfig("LootSystem", "ScaleAllLootByLevel", value: false, "Enables scaling of all loot which does not normally scale per level. Typically this is just trophies."); LootEggsDropIncreaseStacks = BindServerConfig("LootSystem", "LootEggsDropIncreaseStacks", value: true, "This causes higher level chickens (and other egg producers) to drop MORE eggs instead of higher leveled ones."); EggLevelDeterminedByItemQuality = BindServerConfig("LootSystem", "EggLevelDeterminedByItemQuality", value: false, "When enabled, the level of egg grown creatures is determined by the eggs quality level. Otherwise the grown creature uses its default level configuration."); OffspringCanBeStrongerThanParents = BindServerConfig("LevelSystem", "OffspringCanBeStrongerThanParents", value: false, "When enabled, creatures that are bred can have higher levels than their parents. Otherwise, they will be capped at the highest parent level."); OffspringGainExtraLevelChance = BindServerConfig("LevelSystem", "OffspringGainExtraLevelChance", 0.05f, "When enabled, creatures that are bred have a chance to gain an extra level above their parents. Chance is based on this value, 0.1 = 10% chance.", advanced: false, 0f, 1f); OffspringCanBeInfertile = BindServerConfig("LevelSystem", "OffspringCanBeInfertile", value: false, "When enabled, creatures produced from breeding have a chance to be infertile."); OffspringChanceToBeInfertile = BindServerConfig("LevelSystem", "OffspringChanceToBeInfertile", 0.5f, "When enabled, the chance that a creature produced from breeding will be infertile.", advanced: true, 0f, 1f); UseVanillaRaidConfiguration = BindServerConfig("Raids", "UseVanillaRaidConfiguration", value: false, "Reverts to use vanilla raid configuration when enabled."); RaidEventRate = BindServerConfig("Raids", "RaidEventRate", 1f, "The rate at which raid events occur (Vanilla is 1.0), higher values result in less frequent raids, lower values results in more frequent raids. This modifies the raid timing settings which are set per-raid.", advanced: false, 0.001f, 10f); MaxRaidAttemptsPerPlayer = BindServerConfig("Raids", "MaxRaidAttemptsPerPlayer", 5, "The Maximum number of times to try to activate a raid for a given player. The available raids will be shuffled each time before rolling their activation chance. With 10 raids defined the randomly selected first X will get a chance to spawn.", advanced: true, 0, 50); RaidPerPlayerUpdateCheck = BindServerConfig("Raids", "RaidPerPlayerUpdateCheck", 10f, "The Interval in minutes between updating the valid raids for each player. Reduce if you want new raids to become available faster for players, increase to reduce pressure on server.", advanced: true, 1f, 120f); ServerTimeBetweenRaidStartChecks = BindServerConfig("Raids", "ServerTimeBetweenRaidStartChecks", 25, "Number of minutes between when the server whill check to start raids (raids can still be on cooldown and will not be started).", advanced: true, 1, 120); MaxActiveRaids = BindServerConfig("Raids", "MaxActiveRaids", 10, "The maximum number of concurrent raids, automatically limited to 1 per player."); MaxMajorModifiersPerCreature = BindServerConfig("Modifiers", "MaxMajorModifiersPerCreature", 1, "The default number of major modifiers that a creature can have."); MaxMinorModifiersPerCreature = BindServerConfig("Modifiers", "MaxMinorModifiersPerCreature", 1, "The default number of minor modifiers that a creature can have."); LimitCreatureModifiersToCreatureStarLevel = BindServerConfig("Modifiers", "LimitCreatureModifiersToCreatureStarLevel", value: true, "Limits the number of modifiers that a creature can have based on its level."); ChanceMajorModifier = BindServerConfig("Modifiers", "ChanceMajorModifier", 0.15f, "The chance that a creature will have a major modifier (creatures can have BOTH major and minor modifiers).", advanced: false, 0f, 1f); ChanceMajorModifier.SettingChanged += CreatureModifiersData.ClearProbabilityCaches; ChanceMinorModifier = BindServerConfig("Modifiers", "ChanceMinorModifier", 0.25f, "The chance that a creature will have a minor modifier (creatures can have BOTH major and minor modifiers).", advanced: false, 0f, 1f); ChanceMinorModifier.SettingChanged += CreatureModifiersData.ClearProbabilityCaches; EnableBossModifiers = BindServerConfig("Modifiers", "EnableBossModifiers", value: true, "Wether or not bosses can spawn with modifiers."); ChanceOfBossModifier = BindServerConfig("Modifiers", "ChanceOfBossModifier", 0.75f, "The chance that a boss will have a modifier.", advanced: false, 0f, 1f); ChanceOfBossModifier.SettingChanged += CreatureModifiersData.ClearProbabilityCaches; MaxBossModifiersPerBoss = BindServerConfig("Modifiers", "MaxBossModifiersPerBoss", 2, "The maximum number of modifiers that a boss can have."); SplittersInheritLevel = BindServerConfig("Modifiers", "SplittersInheritLevel", value: true, "Wether or not creatures spawned from the Splitter modifier inherit the level of the parent creature."); LimitCreatureModifierPrefixes = BindServerConfig("Modifiers", "LimitCreatureModifierPrefixes", 3, "Maximum number of prefix names to use when building a creatures name."); MinorModifiersFirstInName = BindServerConfig("Modifiers", "MinorModifiersFirstInName", value: false, "Enables or disables ordering of modifiers for naming. If enabled, minor modifiers will be sorted first eg: Fast Poisonous"); UseStarShapedModifierIcons = BindServerConfig("Modifiers", "UseStarShapedModifierIcons", value: true, "When enabled, uses modifier icons that are star shaped. When disabled, uses non-star shaped modifier icons. Requires a restart.", null, advanced: true); EnemyHealthbarScalarX = BindServerConfig("UI", "EnemyHealthbarScalarX", 1f, "The scale of the health bar for typical enemies. This does not impact bosses or players.", advanced: false, 0f, 4f); EnemyHealthbarScalarY = BindServerConfig("UI", "EnemyHealthbarScalarY", 1.75f, "The scale of the health bar for typical enemies. This does not impact bosses or players.", advanced: false, 0f, 4f); HealthDisplayFontSizeAdjustment = BindServerConfig("UI", "HealthDisplayFontSizeAdjustment", 0.8f, "Percentage modification for the font size on creature health."); EnableEnemyHeathbarNumberDisplay = BindServerConfig("UI", "EnableEnemyHeathbarNumberDisplay", value: false, "Enables a numerical display for enemy creatures health"); NumberOfCacheUpdatesPerFrame = BindServerConfig("Misc", "NumberOfCacheUpdatesPerFrame", 10, "Number of cache updates to process when performing live updates", advanced: true, 1); OutputColorizationGeneratorsData = BindServerConfig("Misc", "OutputColorizationGeneratorsData", value: false, "Writes out color generators to a debug file. This can be useful if you want to hand pick color settings from generated values."); InitialDelayBeforeSetup = BindServerConfig("Misc", "InitialDelayBeforeSetup", 0.5f, "The delay waited before a creature is setup, this is the delay that the person controlling the creature will wait before setup. Higher values will delay setup."); FallbackDelayBeforeCreatureSetup = BindServerConfig("Misc", "FallbackDelayBeforeCreatureSetup", 5, "The number of seconds non-owned creatures we will waited on before loading their modified attributes. This is a fallback setup."); ConfigPollIntervalSeconds = BindServerConfig("Misc", "ConfigPollIntervalSeconds", 30f, "The number of seconds between checks for changes in the yaml config files.", advanced: true, 1f, 300f); OnlyControlVanillaAreaSpawners = BindServerConfig("ModCompat", "OnlyControlVanillaAreaSpawners", value: true, "When enabled, will only control the spawned level from an AreaSpawner if it is a vanilla one."); OverrideCreatureModifiedHealth = BindServerConfig("ModCompat", "OverrideCreatureModifiedHealth", value: false, "When enabled, will always set creatures health based on the SLS settings for the creature. This overrides other mods changes to creatures."); } internal static void RecievedServerUpdates() { RecievedConfigsFromServer = true; } internal void LoadYamlConfigs() { string[] files = Directory.GetFiles(GetSecondaryConfigDirectoryPath()); bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; string[] array = files; foreach (string text in array) { if (text.Contains("LevelSettings.yaml")) { Logger.LogDebug("Found level configuration: " + text); levelsFilePath = text; flag = true; } if (text.Contains("ColorSettings.yaml")) { Logger.LogDebug("Found color configuration: " + text); colorsFilePath = text; flag2 = true; } if (text.Contains("LootSettings.yaml")) { Logger.LogDebug("Found loot configuration: " + text); creatureLootFilePath = text; flag3 = true; } if (text.Contains("Modifiers.yaml")) { Logger.LogDebug("Found modifier configuration: " + text); creatureModifierFilePath = text; flag4 = true; } if (text.Contains("RaidSettings.yaml")) { Logger.LogDebug("Found raid configuration: " + text); raidsFilePath = text; flag5 = true; } } if (!flag4) { Logger.LogDebug("Loot config missing, recreating."); using StreamWriter streamWriter = new StreamWriter(creatureModifierFilePath); string value = "#################################################\n# Star Level System Expanded - Creature Modifier Configuration\n#################################################\n"; streamWriter.WriteLine(value); streamWriter.WriteLine(CreatureModifiersData.GetModifierDefaultConfig()); } if (!flag3) { Logger.LogDebug("Loot config missing, recreating."); using StreamWriter streamWriter2 = new StreamWriter(creatureLootFilePath); string value2 = "#################################################\n# Star Level System Expanded - Creature loot configuration\n#################################################\n"; streamWriter2.WriteLine(value2); streamWriter2.WriteLine(LootSystemData.YamlDefaultConfig()); } if (!flag) { Logger.LogDebug("Level config file missing, recreating."); using StreamWriter streamWriter3 = new StreamWriter(levelsFilePath); string value3 = "#################################################\n# Star Level System Expanded - Level Settings\n#################################################\n"; streamWriter3.WriteLine(value3); streamWriter3.WriteLine(LevelSystemData.YamlDefaultConfig()); } if (!flag2) { Logger.LogDebug("Color config file missing, recreating."); using StreamWriter streamWriter4 = new StreamWriter(colorsFilePath); string value4 = "#################################################\n# Star Level System Expanded - Creature Level Color Settings\n#################################################\n"; streamWriter4.WriteLine(value4); streamWriter4.WriteLine(Colorization.YamlDefaultConfig()); } if (!flag5) { Logger.LogDebug("Raid config file missing, recreating."); using StreamWriter streamWriter5 = new StreamWriter(raidsFilePath); string value5 = "#################################################\n# Star Level System Expanded - Raid Settings\n#################################################\n"; streamWriter5.WriteLine(value5); streamWriter5.WriteLine(RaidsData.YamlDefaultConfig()); } ConfigFileWatcher.Register(colorsFilePath, UpdateColorSettings); ConfigFileWatcher.Register("LevelSettings.yaml", UpdateLevelSettings); ConfigFileWatcher.Register(creatureModifierFilePath, UpdateModifierSettings); ConfigFileWatcher.Register(creatureLootFilePath, UpdateLootSettings); ConfigFileWatcher.Register(raidsFilePath, UpdateRaidSettings); } private static void UpdateColorSettings(string fullFileName) { Logger.LogDebug("Triggering Color Settings update."); Colorization.UpdateYamlConfig(File.ReadAllText(fullFileName)); ColorSettingsRPC.SendPackage(ZNet.instance.m_peers, SendFileAsZPackage(fullFileName)); } private static void UpdateLevelSettings(string fullFileName) { Logger.LogDebug("Triggering Level Settings update."); LevelSystemData.UpdateYamlConfig(File.ReadAllText(fullFileName)); LevelSettingsRPC.SendPackage(ZNet.instance.m_peers, SendFileAsZPackage(fullFileName)); } private static void UpdateLootSettings(string fullFileName) { Logger.LogDebug("Triggering Loot Settings update."); LootSystemData.UpdateYamlConfig(File.ReadAllText(fullFileName)); CreatureLootSettingsRPC.SendPackage(ZNet.instance.m_peers, SendFileAsZPackage(fullFileName)); } private static void UpdateModifierSettings(string fullFileName) { Logger.LogDebug("Triggering Modifiers Settings update."); CreatureModifiersData.UpdateModifierConfig(File.ReadAllText(fullFileName)); ModifiersRPC.SendPackage(ZNet.instance.m_peers, SendFileAsZPackage(fullFileName)); } private static void UpdateRaidSettings(string fullFileName) { Logger.LogDebug("Triggering Raid Settings update."); RaidsData.UpdateYamlConfig(File.ReadAllText(fullFileName)); RaidsRPC.SendPackage(ZNet.instance.m_peers, SendFileAsZPackage(fullFileName)); } private static void OnMainConfigFileChanged(string _) { if (!((Object)(object)ZNet.instance == (Object)null) && ZNet.instance.IsServer()) { Logger.LogInfo("Configuration file has been changed, reloading settings."); cfg.Reload(); } } private static ZPackage SendFileAsZPackage(string filepath) { //IL_0007: 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_0014: Expected O, but got Unknown string text = File.ReadAllText(filepath); ZPackage val = new ZPackage(); val.Write(text); return val; } private static ZPackage SendLevelsConfigs() { return SendFileAsZPackage(levelsFilePath); } private static ZPackage SendCreatureLootConfigs() { return SendFileAsZPackage(creatureLootFilePath); } private static ZPackage SendColorsConfigs() { return SendFileAsZPackage(colorsFilePath); } private static ZPackage SendModifierConfigs() { return SendFileAsZPackage(creatureModifierFilePath); } private static ZPackage SendRaidConfigs() { return SendFileAsZPackage(raidsFilePath); } private static ZPackage SendRequestForPrivateKeys() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new ZPackage(); } [IteratorStateMachine(typeof(<OnServerRecieveConfigs>d__135))] public static IEnumerator OnServerRecieveConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnServerRecieveConfigs>d__135(0); } [IteratorStateMachine(typeof(<OnClientReceiveLevelConfigs>d__136))] private static IEnumerator OnClientReceiveLevelConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientReceiveLevelConfigs>d__136(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientReceiveColorConfigs>d__137))] private static IEnumerator OnClientReceiveColorConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientReceiveColorConfigs>d__137(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientReceiveCreatureLootConfigs>d__138))] private static IEnumerator OnClientReceiveCreatureLootConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientReceiveCreatureLootConfigs>d__138(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientReceiveModifiersConfigs>d__139))] private static IEnumerator OnClientReceiveModifiersConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientReceiveModifiersConfigs>d__139(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientRecieveRaidStart>d__140))] private static IEnumerator OnClientRecieveRaidStart(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientRecieveRaidStart>d__140(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientRecieveForcePlayMusic>d__141))] private static IEnumerator OnClientRecieveForcePlayMusic(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientRecieveForcePlayMusic>d__141(0) { package = package }; } [IteratorStateMachine(typeof(<OnClientRecieveForceRemoveNearbyEvents>d__142))] private static IEnumerator OnClientRecieveForceRemoveNearbyEvents(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientRecieveForceRemoveNearbyEvents>d__142(0); } [IteratorStateMachine(typeof(<OnClientRecieveRequestForPrivatekeys>d__143))] internal static IEnumerator OnClientRecieveRequestForPrivatekeys(long sender, ZPackage _) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientRecieveRequestForPrivatekeys>d__143(0); } [IteratorStateMachine(typeof(<OnServerRecievePlayerPrivateKeys>d__144))] private static IEnumerator OnServerRecievePlayerPrivateKeys(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnServerRecievePlayerPrivateKeys>d__144(0) { sender = sender, package = package }; } [IteratorStateMachine(typeof(<OnClientReceiveRaidConfigs>d__145))] private static IEnumerator OnClientReceiveRaidConfigs(long sender, ZPackage package) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OnClientReceiveRaidConfigs>d__145(0) { package = package }; } public static string GetSecondaryConfigDirectoryPath() { return Directory.CreateDirectory(Path.Combine(Paths.ConfigPath, "StarLevelSystem")).FullName; } public static string GetSavedDataSecondaryConfigDirectoryPath() { return Directory.CreateDirectory(Path.Combine(Paths.ConfigPath, "StarLevelSystem", "SavedData")).FullName; } public static ConfigEntry<bool> BindServerConfig(string catagory, string key, bool value, string description, AcceptableValueBase acceptableValues = null, bool advanced = false) { //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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown return cfg.Bind<bool>(catagory, key, value, new ConfigDescription(description, acceptableValues, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true, IsAdvanced = advanced } })); } public static ConfigEntry<int> BindServerConfig(string catagory, string key, int value, string description, bool advanced = false, int valmin = 0, int valmax = 150) { //IL_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown return cfg.Bind<int>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(valmin, valmax), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true, IsAdvanced = advanced } })); } public static ConfigEntry<float> BindServerConfig(string catagory, string key, float value, string description, bool advanced = false, float valmin = 0f, float valmax = 150f) { //IL_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown return cfg.Bind<float>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(valmin, valmax), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true, IsAdvanced = advanced } })); } public static ConfigEntry<string> BindServerConfig(string catagory, string key, string value, string description, AcceptableValueList<string> acceptableValues = null, bool advanced = false) { //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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown return cfg.Bind<string>(catagory, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)acceptableValues, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true, IsAdvanced = advanced } })); } } internal class Logger { public static LogLevel Level = (LogLevel)16; public static void enableDebugLogging(object sender, EventArgs e) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (ValConfig.EnableDebugMode.Value) { Level = (LogLevel)32; } else { Level = (LogLevel)16; } } public static void CheckEnableDebugLogging() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (ValConfig.EnableDebugMode.Value) { Level = (LogLevel)32; } else { Level = (LogLevel)16; } } public static void LogDebug(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)Level >= 32) { StarLevelSystem.Log.LogInfo((object)message); } } public static void LogInfo(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)Level >= 16) { StarLevelSystem.Log.LogInfo((object)message); } } public static void LogWarning(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Level >= 4) { StarLevelSystem.Log.LogWarning((object)message); } } public static void LogError(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Level >= 2) { StarLevelSystem.Log.LogError((object)message); } } } [BepInPlugin("MidnightsFX.StarLevelSystem", "StarLevelSystem", "0.19.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("org.bepinex.plugins.creaturelevelcontrol")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class StarLevelSystem : BaseUnityPlugin { public const string PluginGUID = "MidnightsFX.StarLevelSystem"; public const string PluginName = "StarLevelSystem"; public const string PluginVersion = "0.19.1"; public ValConfig cfg; public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization(); public static AssetBundle EmbeddedResourceBundle; public static ManualLogSource Log; public static Harmony HarmonyInstance { get; private set; } public void Awake() { Log = ((BaseUnityPlugin)this).Logger; cfg = new ValConfig(((BaseUnityPlugin)this).Config); cfg.SetupConfigRPCs(); cfg.LoadYamlConfigs(); TaskRunner.Setup(); Compatibility.CheckModCompat(); EmbeddedResourceBundle = AssetUtils.LoadAssetBundleFromResources("StarLevelSystem.assets.starlevelsystems", typeof(StarLevelSystem).Assembly); HarmonyInstance = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "MidnightsFX.StarLevelSystem"); Colorization.Init(); LevelSystemData.Init(); LootSystemData.Init(); CreatureModifiersData.Init(); RaidsData.Init(); LocalizationLoader.AddLocalizations(); PrefabManager.OnVanillaPrefabsAvailable += CreatureModifiersData.LoadPrefabs; PrefabManager.OnVanillaPrefabsAvailable += UpdateLevelsOnChange.UpdateFishmaxLevel; PrefabManager.OnVanillaPrefabsAvailable += UIHudControl.SetDefaultStar; PrefabManager.OnPrefabsRegistered += LootSystemData.AttachPrefabsWhenReady; MinimapManager.OnVanillaMapDataLoaded += DistanceScaleSystem.DelayedMinimapSetup; PrefabManager.OnPrefabsRegistered += SizeModifications.PrepareSizeRefCache; SynchronizationManager.OnConfigurationSynchronized += delegate { ValConfig.RecievedServerUpdates(); }; UIHudControl.LoadAssets(); RaidControl.LoadAssets(); TerminalCommands.AddCommands(); } } } namespace StarLevelSystem.modules { public static class APIReciever { public static bool UpdateCreatureLevel(Character chara, int level) { if ((Object)(object)chara == (Object)null) { return false; } Logger.LogDebug($"SLS-API: Update Creature level {chara} - {level}"); LevelSelection.SetAndUpdateCharacterLevel(chara, level); return true; } public static bool UpdateCreatureColorization(Character chara, float value, float hue, float sat, bool emission = false) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry cacheEntry = CompositeLazyCache.GetCacheEntry(chara); if (cacheEntry == null) { return false; } cacheEntry.Colorization = Colorization.DetermineCharacterColorization(chara, chara.m_level); CompositeLazyCache.UpdateCharacterCacheEntry(chara, cacheEntry); Colorization.ApplyColorizationWithoutLevelEffects(((Component)chara).gameObject, cacheEntry.Colorization); return true; } public static float GetBaseAttributeValue(Character chara, int attribute) { if ((Object)(object)chara == (Object)null) { return -1f; } return CompositeLazyCache.GetAndSetLocalCache(chara)?.CreatureBaseValueModifiers[(DataObjects.CreatureBaseAttribute)attribute] ?? (-1f); } public static bool UpdateCreatureBaseAttributes(Character chara, int attribute, float value) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } andSetLocalCache.CreatureBaseValueModifiers[(DataObjects.CreatureBaseAttribute)attribute] = value; if (attribute == 4) { SizeModifications.SetSizeModification(((Component)chara).gameObject, chara.m_nview, andSetLocalCache, update: true); } return true; } public static Dictionary<int, float> GetAllBaseAttributes(Character chara) { if ((Object)(object)chara == (Object)null) { return null; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return null; } Dictionary<int, float> dictionary = new Dictionary<int, float>(); foreach (KeyValuePair<DataObjects.CreatureBaseAttribute, float> creatureBaseValueModifier in andSetLocalCache.CreatureBaseValueModifiers) { dictionary[(int)creatureBaseValueModifier.Key] = creatureBaseValueModifier.Value; } return dictionary; } public static bool SetAllBaseAttributes(Character chara, Dictionary<int, float> attributes) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } foreach (KeyValuePair<int, float> attribute in attributes) { andSetLocalCache.CreatureBaseValueModifiers[(DataObjects.CreatureBaseAttribute)attribute.Key] = attribute.Value; } CompositeLazyCache.UpdateCharacterCacheEntry(chara, andSetLocalCache); SpeedModifications.ApplySpeedModifications(chara, andSetLocalCache); DamageModifications.ApplyDamageModification(chara, andSetLocalCache); SizeModifications.SetSizeModification(((Component)chara).gameObject, chara.m_nview, andSetLocalCache, update: true); HealthModifications.ForceApplyHealthModifications(chara, andSetLocalCache); return true; } public static float GetPerLevelAttributeValue(Character chara, int attribute) { if ((Object)(object)chara == (Object)null) { return -1f; } return CompositeLazyCache.GetAndSetLocalCache(chara)?.CreaturePerLevelValueModifiers[(DataObjects.CreaturePerLevelAttribute)attribute] ?? (-1f); } public static bool UpdateCreaturePerLevelAttributes(Character chara, int attribute, float value) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } andSetLocalCache.CreaturePerLevelValueModifiers[(DataObjects.CreaturePerLevelAttribute)attribute] = value; if (attribute == 4) { SizeModifications.SetSizeModification(((Component)chara).gameObject, chara.m_nview, andSetLocalCache, update: true); } return true; } public static Dictionary<int, float> GetAllPerLevelAttributes(Character chara) { if ((Object)(object)chara == (Object)null) { return null; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return null; } Dictionary<int, float> dictionary = new Dictionary<int, float>(); foreach (KeyValuePair<DataObjects.CreaturePerLevelAttribute, float> creaturePerLevelValueModifier in andSetLocalCache.CreaturePerLevelValueModifiers) { dictionary[(int)creaturePerLevelValueModifier.Key] = creaturePerLevelValueModifier.Value; } return dictionary; } public static bool SetAllPerLevelAttributes(Character chara, Dictionary<int, float> attributes) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } foreach (KeyValuePair<int, float> attribute in attributes) { andSetLocalCache.CreaturePerLevelValueModifiers[(DataObjects.CreaturePerLevelAttribute)attribute.Key] = attribute.Value; } CompositeLazyCache.UpdateCharacterCacheEntry(chara, andSetLocalCache); SpeedModifications.ApplySpeedModifications(chara, andSetLocalCache); DamageModifications.ApplyDamageModification(chara, andSetLocalCache); SizeModifications.SetSizeModification(((Component)chara).gameObject, chara.m_nview, andSetLocalCache, update: true); HealthModifications.ForceApplyHealthModifications(chara, andSetLocalCache); return true; } public static float GetCreatureDamageRecievedModifier(Character chara, int attribute) { if ((Object)(object)chara == (Object)null) { return -1f; } return CompositeLazyCache.GetAndSetLocalCache(chara)?.DamageRecievedModifiers[(DataObjects.DamageType)attribute] ?? (-1f); } public static bool UpdateCreatureDamageRecievedModifier(Character chara, int attribute, float value) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } andSetLocalCache.DamageRecievedModifiers[(DataObjects.DamageType)attribute] = value; return true; } public static Dictionary<int, float> GetAllDamageRecievedModifiers(Character chara) { if ((Object)(object)chara == (Object)null) { return null; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return null; } Dictionary<int, float> dictionary = new Dictionary<int, float>(); foreach (KeyValuePair<DataObjects.DamageType, float> damageRecievedModifier in andSetLocalCache.DamageRecievedModifiers) { dictionary[(int)damageRecievedModifier.Key] = damageRecievedModifier.Value; } return dictionary; } public static bool SetAllDamageRecievedModifiers(Character chara, Dictionary<int, float> attributes) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } foreach (KeyValuePair<int, float> attribute in attributes) { andSetLocalCache.DamageRecievedModifiers[(DataObjects.DamageType)attribute.Key] = attribute.Value; } CompositeLazyCache.UpdateCharacterCacheEntry(chara, andSetLocalCache); DamageModifications.ApplyDamageModification(chara, andSetLocalCache); return true; } public static float GetCreatureDamageBonus(Character chara, int attribute) { if ((Object)(object)chara == (Object)null) { return -1f; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return -1f; } if (andSetLocalCache.CreatureDamageBonus.ContainsKey((DataObjects.DamageType)attribute)) { return andSetLocalCache.CreatureDamageBonus[(DataObjects.DamageType)attribute]; } return 0f; } public static bool UpdateCreatureDamageBonus(Character chara, int attribute, float value) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } if (!andSetLocalCache.CreatureDamageBonus.ContainsKey((DataObjects.DamageType)attribute)) { andSetLocalCache.CreatureDamageBonus[(DataObjects.DamageType)attribute] = value; } else { andSetLocalCache.CreatureDamageBonus.Add((DataObjects.DamageType)attribute, value); } return true; } public static Dictionary<int, float> GetAllDamageBonus(Character chara) { if ((Object)(object)chara == (Object)null) { return null; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return null; } Dictionary<int, float> dictionary = new Dictionary<int, float>(); foreach (KeyValuePair<DataObjects.DamageType, float> creatureDamageBonu in andSetLocalCache.CreatureDamageBonus) { dictionary[(int)creatureDamageBonu.Key] = creatureDamageBonu.Value; } return dictionary; } public static bool SetAllDamageBonus(Character chara, Dictionary<int, float> attributes) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } foreach (KeyValuePair<int, float> attribute in attributes) { andSetLocalCache.CreatureDamageBonus[(DataObjects.DamageType)attribute.Key] = attribute.Value; } CompositeLazyCache.UpdateCharacterCacheEntry(chara, andSetLocalCache); DamageModifications.ApplyDamageModification(chara, andSetLocalCache); return true; } public static bool ApplyUpdatesToCreature(Character chara) { if ((Object)(object)chara == (Object)null) { return false; } DataObjects.CharacterCacheEntry andSetLocalCache = CompositeLazyCache.GetAndSetLocalCache(chara); if (andSetLocalCache == null) { return false; } SpeedModifications.ApplySpeedModifications(chara, andSetLocalCache); DamageModifications.ApplyDamageModification(chara, andSetLocalCache); SizeModifications.SetSizeModification(((Component)chara).gameObject, chara.m_nview, andSetLocalCache, update: true); HealthModifications.ForceApplyHealthModifications(chara, andSetLocalCache); return true; } public static List<string> GetPossibleModifiersForType(int modifierType) { List<string> list = new List<string>(); switch (modifierType) { case 0: foreach (string key in CreatureModifiersData.ActiveCreatureModifiers.MajorModifiers.Keys) { list.Add(key); } break; case 1: foreach (string key2 in CreatureModifiersData.ActiveCreatureModifiers.MinorModifiers.Keys) { list.Add(key2); } break; case 2: foreach (string key3 in CreatureModifiersData.ActiveCreatureModifiers.BossModifiers.Keys) { list.Add(key3); } break; default: Logger.LogWarning($"Invalid modifier type {modifierType} passed to GetAllPossibleModifiers. Valid types are 0 (Major), 1 (Minor), 2 (Boss)."); break; } return list; } public static Dictionary<string, int> GetAllModifiersForCreature(Character chara) { Dictionary<string, DataObjects.ModifierType> creatureModifiers = CompositeLazyCache.GetCreatureModifiers(chara); if (creatureModifiers == null) { return null; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (KeyValuePair<string, DataObjects.ModifierType> item in creatureModifiers) { dictionary.Add(item.Key.ToString(), (int)item.Value); } return dictionary; } public static bool AddModifierToCreature(Character chara, string modifierName, int modifierType, bool update = true) { if (CompositeLazyCache.GetAndSetLocalCache(chara) == null) { return false; } return CreatureModifiers.AddCreatureModifier(chara, (DataObjects.ModifierType)modifierType, modifierName, update); } public static bool AddNewModifierToSLS(int modifierID, string modifier_name, Delegate setupMethod = null, float selectionWeight = 10f, float basepower = 0f, float perlevelpower = 0f, Dictionary<Biome, List<string>> biomeConfig = null, int namingStyle = 2, string name_suffixes = null, string name_prefixes = null, int visualStyle = 0, Sprite starIcon = null, GameObject visualEffect = null, List<string> allowed_creatures = null, List<string> unallowed_creatures = null, List<Biome> allowed_biomes = null) { if (CreatureModifiersData.ModifierNamesLookupTable.ContainsID(modifierID)) { Logger.LogWarning($"Modifier ID {modifierID} already exists as {CreatureModifiersData.ModifierNamesLookupTable.GetValue(modifierID)}, please choose a different ID"); return false; } CreatureModifiersData.ModifierNamesLookupTable.AddValue(modifier_name, modifierID); DataObjects.CreatureModifierDefinition creatureModifierDefinition = new DataObjects.CreatureModifierDefinition(); if ((Object)(object)starIcon != (Object)null) { creatureModifierDefinition.StarVisualAPI = starIcon; creatureModifierDefinition.StarVisual = ((Object)starIcon).name; } if ((Object)(object)visualEffect != (Object)null) { creatureModifierDefinition.VisualEffectAPI = visualEffect; creatureModifierDefinition.VisualEffect = ((Object)visualEffect).name; } if ((object)setupMethod != null) { creatureModifierDefinition.SetupEvent = setupMethod; } if (name_suffixes != null) { creatureModifierDefinition.NameSuffix = name_suffixes; } if (name_prefixes != null) { creatureModifierDefinition.NamePrefix = name_prefixes; } if (namingStyle > 2 || namingStyle < 0) { namingStyle = 2; } creatureModifierDefinition.namingConvention = (DataObjects.NameSelectionStyle)namingStyle; if (visualStyle > 3 || visualStyle < 0) { visualStyle = 0; } creatureModifierDefinition.VisualEffectStyle = (DataObjects.VisualEffectStyle)visualStyle; DataObjects.CreatureModifierConfiguration creatureModifierConfiguration = new DataObjects.CreatureModifierConfiguration(); creatureModifierConfiguration.Config = new DataObjects.CreatureModConfig { BasePower = basepower, PerlevelPower = perlevelpower, BiomeObjects = biomeConfig }; creatureModifierConfiguration.SelectionWeight = selectionWeight; if (allowed_creatures != null) { creatureModifierConfiguration.AllowedCreatures = allowed_creatures; } if (unallowed_creatures != null) { creatureModifierConfiguration.UnallowedCreatures = unallowed_creatures; } if (allowed_biomes != null) { creatureModifierConfiguration.AllowedBiomes = allowed_biomes; } CreatureModifiersData.ClearProbabilityCaches(); return true; } } public static class Colorization { [HarmonyPatch(typeof(LevelEffects), "SetupLevelVisualization")] public static class PreventDefaultLevelSetup { public static bool Prefix() { return false; } } public static DataObjects.CreatureColorizationSettings creatureColorizationSettings = defaultColorizationSettings; private static DataObjects.CreatureColorizationSettings defaultColorizationSettings = new DataObjects.CreatureColorizationSettings { characterSpecificColorization = ColorizationData.characterColorizationData, defaultLevelColorization = ColorizationData.defaultColorizationData, characterColorGenerators = ColorizationData.defaultColorGenerators }; public static List<Color> mapRingColors = new List<Color>(); public static readonly Dictionary<string, string> defaultColors = new Dictionary<string, string> { { "Red", "#ff1a1a" }, { "Orange", "#ff9933" }, { "Yellow", "#ffff1a" }, { "Green", "#50f83a" }, { "Teal", "#18e7a9" }, { "Blue", "#00abff" }, { "Purple", "#c966ff" }, { "Pink", "#ff4dcf" }, { "Gray", "#999999" }, { "Brown", "#b37700" }, { "Black", "#333333" }, { "White", "#f2f2f2" } }; public static DataObjects.ColorDef defaultColorization = new DataObjects.ColorDef { hue = 0f, saturation = 0f, value = 0f, IsEmissive = false }; public static void Init() { creatureColorizationSettings = defaultColorizationSettings; try { UpdateYamlConfig(File.ReadAllText(ValConfig.colorsFilePath)); } catch (Exception arg) { Logger.LogWarning((object)$"There was an error updating the Color Level values, defaults will be used. Exception: {arg}"); } } public static string YamlDefaultConfig() { return DataObjects.yamlserializer.Serialize((object)defaultColorizationSettings); } public static bool UpdateYamlConfig(string yaml) { try { Colorization.creatureColorizationSettings = DataObjects.yamldeserializer.Deserialize<DataObjects.CreatureColorizationSettings>(yaml); foreach (KeyValuePair<int, DataObjects.ColorDef> item in defaultColorizationSettings.defaultLevelColorization) { if (!Colorization.creatureColorizationSettings.defaultLevelColorization.Keys.Contains(item.Key)) { Colorization.creatureColorizationSettings.defaultLevelColorization.Add(item.Key, item.Value); } } if (Colorization.creatureColorizationSettings.characterColorGenerators != null) { Logger.LogInfo("Running color generators"); DataObjects.CreatureColorizationSettings creatureColorizationSettings = Colorization.creatureColorizationSettings; if (creatureColorizationSettings.characterSpecificColorization == null) { Dictionary<string, Dictionary<int, DataObjects.ColorDef>> dictionary2 = (creatureColorizationSettings.characterSpecificColorization = new Dictionary<string, Dictionary<int, DataObjects.ColorDef>>()); } foreach (KeyValuePair<string, List<DataObjects.ColorRangeDef>> characterColorGenerator in Colorization.creatureColorizationSettings.characterColorGenerators) { Logger.LogInfo("Building color range for " + characterColorGenerator.Key); foreach (DataObjects.ColorRangeDef item2 in characterColorGenerator.Value) { BuildAddColorRange(characterColorGenerator.Key, item2); } } if (ValConfig.OutputColorizationGeneratorsData.Value) { File.WriteAllText(Path.Combine(Paths.ConfigPath, "StarLevelSystem", "DebugGeneratedColorValues.yaml"), DataObjects.yamlserializer.Serialize((object)Colorization.creatureColorizationSettings)); } } Logger.LogInfo("Updated ColorizationSettings."); Character[] array = Resources.FindObjectsOfTypeAll<Character>(); foreach (Character val in array) { if (val.m_level > 1) { DataObjects.CharacterCacheEntry cacheEntry = CompositeLazyCache.GetCacheEntry(val); if (cacheEntry != null) { cacheEntry.Colorization = DetermineCharacterColorization(val, val.m_level); CompositeLazyCache.UpdateCharacterCacheEntry(val, cacheEntry); ApplyColorizationWithoutLevelEffects(((Component)val).gameObject, cacheEntry.Colorization); } } } } catch (Exception ex) { StarLevelSystem.Log.LogError((object)("Failed to parse ColorizationSettings YAML: " + ex.Message)); StarLevelSystem.Log.LogError((object)"Colorization will use internal defaults."); Colorization.creatureColorizationSettings = defaultColorizationSettings; return false; } return true; } public static void ApplyLevelVisual(Character charc) { LevelEffects componentInChildren = ((Component)charc).gameObject.GetComponentInChildren<LevelEffects>(); if (!((Object)(object)componentInChildren == (Object)null) && componentInChildren.m_levelSetups != null && componentInChildren.m_levelSetups.Count > 0) { LevelSetup val = componentInChildren.m_levelSetups[Random.Range(0, componentInChildren.m_levelSetups.Count - 1)]; if ((Object)(object)val.m_enableObject != (Object)null) { val.m_enableObject.SetActive(true); } } } internal s