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 Almanac v3.8.1
Almanac.dll
Decompiled 2 weeks 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.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using API; using Almanac.Achievements; using Almanac.Bounties; using Almanac.Data; using Almanac.ExternalAPIs; using Almanac.Lottery; using Almanac.Managers; using Almanac.Marketplace; using Almanac.NPC; using Almanac.Quests; using Almanac.Store; using Almanac.TreasureHunt; using Almanac.Tutorials; using Almanac.UI; using Almanac.Utilities; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using Splatform; using StarLevelSystem; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using Valheim.SettingsGui; using YamlDotNet.Serialization; [assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyProduct("Almanac")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("Almanac")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyFileVersion("3.8.1")] [assembly: AssemblyCompany("RustyMods")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.8.1.0")] [module: <52439c24-d795-4b34-9f60-184729e575bc>RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<b1f37f6e-2f5a-4bb5-8e8e-56921e044e63>Embedded] internal sealed class <b1f37f6e-2f5a-4bb5-8e8e-56921e044e63>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<b1f37f6e-2f5a-4bb5-8e8e-56921e044e63>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <744b8cc0-5738-418c-b36d-70454b97fe9f>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <744b8cc0-5738-418c-b36d-70454b97fe9f>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <744b8cc0-5738-418c-b36d-70454b97fe9f>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<b1f37f6e-2f5a-4bb5-8e8e-56921e044e63>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContextAttribute : Attribute { public readonly byte Flag; public <db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContextAttribute(byte P_0) { Flag = P_0; } } [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [<b1f37f6e-2f5a-4bb5-8e8e-56921e044e63>Embedded] [CompilerGenerated] internal sealed class <52439c24-d795-4b34-9f60-184729e575bc>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <52439c24-d795-4b34-9f60-184729e575bc>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LocalizationManager { [PublicAPI] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] private static BaseUnityPlugin _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] [method: <db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] [field: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] public static event Action OnLocalizationComplete; private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out var value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out var value2)) { text = value2.Aggregate(text, [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null) { if (convertConfigValue == null) { convertConfigValue = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary<string, Func<string>>(); } config.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { _ = plugin; } public static void LoadLocalizationLater(Localization __instance) { LoadLocalization(Localization.instance, __instance.GetSelectedLanguage()); } public static void SafeCallLocalizeComplete() { Localizer.OnLocalizationComplete?.Invoke(); } private static void LoadLocalization(Localization __instance, string language) { //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Paths.ConfigPath, plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string[] array = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' }); if (array.Length >= 2) { string text = array[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } } Dictionary<string, string> dictionary2 = new Dictionary<string, string>(); string text2 = null; if (dictionary.TryGetValue(language, out var value)) { text2 = File.ReadAllText(value); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } if (text2 == null && dictionary.TryGetValue("English", out var value2)) { text2 = File.ReadAllText(value2); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in ((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string>(2) { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalizationLater", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "SafeCallLocalizeComplete", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [return: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] private static byte[] LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] public static byte[] ReadEmbeddedFileBytes([<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] string resourceFileName, Assembly containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } public static class LocalizationManagerVersion { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public const string Version = "1.4.1"; } } namespace API { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] public static class EpicMMOSystem_API { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] private enum API_State { NotReady, NotInstalled, Ready } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] public enum Attribut { Strength, Agility, Intellect, Body, Vigour, Special } private static API_State state; private static MethodInfo eGetLevel; private static MethodInfo eAddExp; private static MethodInfo eGetAttribute; private static MethodInfo eGetAttributeRusty; private static MethodInfo eSetSingleRate; public static bool IsLoaded() { return state == API_State.Ready; } public static int GetLevel() { int result = 0; Init(); if (eGetLevel != null) { result = (int)eGetLevel.Invoke(null, null); } return result; } public static int GetAttribute(Attribut attribute) { int result = 0; Init(); if (eGetAttribute != null) { result = (int)eGetAttribute.Invoke(null, new object[1] { attribute }); } return result; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static int GetAttributeRusty(string attribute) { int result = 0; Init(); if (eGetAttributeRusty != null) { result = (int)eGetAttributeRusty.Invoke(null, new object[1] { attribute }); } return result; } public static void AddExp(int value) { Init(); eAddExp?.Invoke(null, new object[1] { value }); } public static void SetSingleRate(float rate) { Init(); eSetSingleRate?.Invoke(null, new object[1] { rate }); } static EpicMMOSystem_API() { state = API_State.NotReady; Init(); } private static void Init() { API_State aPI_State = state; if ((uint)(aPI_State - 1) > 1u) { if (Type.GetType("EpicMMOSystem.EpicMMOSystem, EpicMMOSystem") == null) { state = API_State.NotInstalled; return; } state = API_State.Ready; Type type = Type.GetType("API.EMMOS_API, EpicMMOSystem"); eGetLevel = type?.GetMethod("GetLevel", BindingFlags.Static | BindingFlags.Public); eAddExp = type?.GetMethod("AddExp", BindingFlags.Static | BindingFlags.Public); eGetAttribute = type?.GetMethod("GetAttribute", BindingFlags.Static | BindingFlags.Public); eGetAttributeRusty = type?.GetMethod("GetAttribute", BindingFlags.Static | BindingFlags.Public); eSetSingleRate = type?.GetMethod("SetSingleRate", BindingFlags.Static | BindingFlags.Public); } } } } namespace StarLevelSystem { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] [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 SetCreatureSpawnManagedMethod; private static readonly MethodInfo GetPossibleModifiersForType; private static readonly MethodInfo GetAllModifiersForCreature; private static readonly MethodInfo AddModifierToCreature; private static readonly MethodInfo AddNewModifierToSLS; private static readonly MethodInfo RegisterLocationResetTargetMethod; private static readonly MethodInfo UnregisterLocationResetTargetMethod; private static readonly MethodInfo GetRegisteredLocationResetTargetsMethod; private static readonly MethodInfo GetLocationResetTargetInfoMethod; private static readonly MethodInfo IsLocationResetReadyMethod; private static readonly MethodInfo GetLocationResetStatusMethod; private static readonly MethodInfo IsKnownResetTargetNameMethod; private static readonly MethodInfo GetLocationLastResetMethod; private static readonly MethodInfo GetSecondsUntilLocationResetMethod; private static readonly MethodInfo GetLocationResetInfoMethod; private static readonly MethodInfo GetChunkResetInfoMethod; private static readonly MethodInfo ResetNamedLocationMethod; private static readonly MethodInfo ResetLocationsInRadiusMethod; public static bool IsAvailable => APIReciever != null; public static bool SupportsLocationReset => ResetNamedLocationMethod != null; public static bool SupportsSpawnManaged => SetCreatureSpawnManagedMethod != null; static API() { APIReciever = Type.GetType("StarLevelSystem.modules.APIReciever, StarLevelSystem"); if (!(APIReciever == null)) { 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("GetAllBaseAttributes", BindingFlags.Static | BindingFlags.Public); SetAllBaseAttributeValues = APIReciever.GetMethod("SetAllBaseAttributes", BindingFlags.Static | BindingFlags.Public); GetPerLevelAttributeValue = APIReciever.GetMethod("GetPerLevelAttributeValue", BindingFlags.Static | BindingFlags.Public); UpdateCreaturePerLevelAttributes = APIReciever.GetMethod("UpdateCreaturePerLevelAttributes", BindingFlags.Static | BindingFlags.Public); GetAllPerLevelAttributeValues = APIReciever.GetMethod("GetAllPerLevelAttributes", BindingFlags.Static | BindingFlags.Public); SetAllPerLevelAttributeValues = APIReciever.GetMethod("SetAllPerLevelAttributes", 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); SetCreatureSpawnManagedMethod = APIReciever.GetMethod("SetCreatureSpawnManaged", 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); RegisterLocationResetTargetMethod = APIReciever.GetMethod("RegisterLocationResetTarget", BindingFlags.Static | BindingFlags.Public); UnregisterLocationResetTargetMethod = APIReciever.GetMethod("UnregisterLocationResetTarget", BindingFlags.Static | BindingFlags.Public); GetRegisteredLocationResetTargetsMethod = APIReciever.GetMethod("GetRegisteredLocationResetTargets", BindingFlags.Static | BindingFlags.Public); GetLocationResetTargetInfoMethod = APIReciever.GetMethod("GetLocationResetTargetInfo", BindingFlags.Static | BindingFlags.Public); IsLocationResetReadyMethod = APIReciever.GetMethod("IsLocationResetReady", BindingFlags.Static | BindingFlags.Public); GetLocationResetStatusMethod = APIReciever.GetMethod("GetLocationResetStatus", BindingFlags.Static | BindingFlags.Public); IsKnownResetTargetNameMethod = APIReciever.GetMethod("IsKnownResetTargetName", BindingFlags.Static | BindingFlags.Public); GetLocationLastResetMethod = APIReciever.GetMethod("GetLocationLastReset", BindingFlags.Static | BindingFlags.Public); GetSecondsUntilLocationResetMethod = APIReciever.GetMethod("GetSecondsUntilLocationReset", BindingFlags.Static | BindingFlags.Public); GetLocationResetInfoMethod = APIReciever.GetMethod("GetLocationResetInfo", BindingFlags.Static | BindingFlags.Public); GetChunkResetInfoMethod = APIReciever.GetMethod("GetChunkResetInfo", BindingFlags.Static | BindingFlags.Public); ResetNamedLocationMethod = APIReciever.GetMethod("ResetNamedLocation", BindingFlags.Static | BindingFlags.Public); ResetLocationsInRadiusMethod = APIReciever.GetMethod("ResetLocationsInRadius", BindingFlags.Static | BindingFlags.Public); } } private static object Call(MethodInfo method, object fallback, params object[] args) { if (method == null) { return fallback; } return method.Invoke(null, args); } 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 bool SetCreatureSpawnManaged(Character creatureId, bool managed = true) { return (bool)Call(SetCreatureSpawnManagedMethod, false, creatureId, managed); } 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 }); } public static bool RegisterLocationReset(string prefabName, string sourceId, float resetHours = 0f, string resetSchedule = null, bool enabled = true, int mode = 0, bool resetTerrain = false, float terrainRadius = 0f, float extraTerrainRadius = 0f, bool resetInterior = true, float minDistance = 0f, float maxDistance = 0f, Action<bool> onResult = null) { return (bool)Call(RegisterLocationResetTargetMethod, false, prefabName, sourceId, resetHours, resetSchedule, mode, resetTerrain, terrainRadius, extraTerrainRadius, resetInterior, minDistance, maxDistance, enabled, onResult); } public static bool UnregisterLocationReset(string prefabName, string sourceId, Action<bool> onResult = null) { return (bool)Call(UnregisterLocationResetTargetMethod, false, prefabName, sourceId, onResult); } public static bool GetRegisteredLocationResets(string sourceId, Action<List<string>> onResult) { return (bool)Call(GetRegisteredLocationResetTargetsMethod, false, sourceId, onResult); } public static bool GetLocationResetTargetInfo(string prefabName, Action<Dictionary<string, object>> onResult) { return (bool)Call(GetLocationResetTargetInfoMethod, false, prefabName, onResult); } public static bool IsLocationResetReady(Action<bool> onResult) { return (bool)Call(IsLocationResetReadyMethod, false, onResult); } public static bool GetLocationResetStatus(Action<Dictionary<string, object>> onResult) { return (bool)Call(GetLocationResetStatusMethod, false, onResult); } public static bool IsKnownLocationResetTarget(string prefabName, Action<bool> onResult) { return (bool)Call(IsKnownResetTargetNameMethod, false, prefabName, onResult); } public static bool GetLocationLastReset(string locationName, Vector3 center, float radius, Action<long> onResult) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(GetLocationLastResetMethod, false, locationName, center, radius, onResult); } public static bool GetSecondsUntilLocationReset(string locationName, Vector3 center, float radius, Action<double> onResult) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(GetSecondsUntilLocationResetMethod, false, locationName, center, radius, onResult); } public static bool GetLocationResetInfo(string locationName, Vector3 center, float radius, Action<Dictionary<string, object>> onResult) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(GetLocationResetInfoMethod, false, locationName, center, radius, onResult); } public static bool GetChunkResetInfo(Vector3 position, bool includePrefabs, Action<Dictionary<string, object>> onResult) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(GetChunkResetInfoMethod, false, position, includePrefabs, onResult); } public static bool ResetNamedLocation(string locationName, Vector3 center, float radius = 128f, int safety = 0, bool resetAllMatches = false, float safeWaitSeconds = 0f, bool includeDetail = false, Action<Dictionary<string, object>> onComplete = null) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(ResetNamedLocationMethod, false, locationName, center, radius, safety, resetAllMatches, safeWaitSeconds, includeDetail, onComplete); } public static bool ResetLocationsInRadius(Vector3 center, float radius = 128f, int safety = 0, float safeWaitSeconds = 0f, bool includeDetail = false, Action<Dictionary<string, object>> onComplete = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) return (bool)Call(ResetLocationsInRadiusMethod, false, center, radius, safety, safeWaitSeconds, includeDetail, onComplete); } } } namespace Almanac { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [PublicAPI] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static class API { public static int GetPlayerDeathCount(string creatureID) { CritterHelper.CritterInfo value; return CritterHelper.namedCritters.TryGetValue(creatureID, out value) ? PlayerInfo.GetPlayerStat(PlayerInfo.RecordType.Death, value.character.m_name) : 0; } public static int GetPlayerCompletedAchievements(Player player) { return player.GetCollectedAchievements().Count; } public static void AddTokens(Player player, int amount, bool message) { player.AddTokens(amount, message); } public static void RemoveTokens(Player player, int amount) { player.RemoveTokens(amount); } public static int GetTokens(Player player) { return player.GetTokens(); } } [PublicAPI] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static class Almanac_API { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] internal class Method { private const string Namespace = "Almanac"; private const string ClassName = "API"; private const string Assembly = "Almanac"; private const string API_LOCATION = "Almanac.API, Almanac"; private static readonly Dictionary<string, Type> CachedTypes = new Dictionary<string, Type>(); [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] private readonly MethodInfo info; [return: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 1, 2 })] public object[] Invoke([<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 1, 2 })] params object[] args) { object obj = info?.Invoke(null, args); object[] array = new object[args.Length + 1]; array[0] = obj; Array.Copy(args, 0, array, 1, args.Length); return array; } public Method(string typeNameWithAssembly, string methodName, BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public) { if (!TryGetType(typeNameWithAssembly, out var type)) { return; } if (type == null) { Debug.LogWarning((object)("Type resolution returned null for: '" + typeNameWithAssembly + "'")); return; } info = type.GetMethod(methodName, bindingFlags); if (info == null) { Debug.LogWarning((object)("Failed to find public static method '" + methodName + "' in type '" + type.FullName + "'. Verify the method name is correct, the method exists, and it is marked as public static. ")); } } public Method(string methodName, BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public) : this("Almanac.API, Almanac", methodName, bindingFlags) { } private static bool TryGetType(string typeNameWithAssembly, [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] out Type type) { if (CachedTypes.TryGetValue(typeNameWithAssembly, out type)) { return true; } Type type2 = Type.GetType(typeNameWithAssembly); if ((object)type2 == null) { Debug.LogWarning((object)("Failed to resolve type: '" + typeNameWithAssembly + "'. Verify the namespace, class name, and assembly name are correct. Ensure the assembly is loaded and accessible.")); return false; } type = type2; CachedTypes[typeNameWithAssembly] = type2; return true; } public Method(string typeNameWithAssembly, string methodName, params Type[] types) { if (!TryGetType(typeNameWithAssembly, out var type)) { return; } if (type == null) { Debug.LogWarning((object)("Type resolution returned null for: '" + typeNameWithAssembly + "'")); return; } info = type.GetMethod(methodName, types); if (info == null) { Debug.LogWarning((object)("Failed to find public static method '" + methodName + "' in type '" + type.FullName + "'. Verify the method name is correct, the method exists, and it is marked as public static. ")); } } public Method(string methodName, params Type[] types) : this("Almanac.API, Almanac", methodName, types) { } [PublicAPI] public ParameterInfo[] GetParameters() { return info?.GetParameters() ?? Array.Empty<ParameterInfo>(); } [PublicAPI] public static void ClearCache() { CachedTypes.Clear(); } } private static Method _GetPlayerDeathCount; private static Method _GetPlayerCompletedAchievements; private static Method _GetTokens; private static Method _AddTokens; private static Method _RemoveTokens; static Almanac_API() { if (IsLoaded()) { _GetPlayerDeathCount = new Method("GetPlayerDeathCount"); _GetPlayerCompletedAchievements = new Method("GetPlayerCompletedAchievements"); _GetTokens = new Method("GetTokens"); _AddTokens = new Method("AddTokens"); _RemoveTokens = new Method("RemoveTokens"); } } public static bool IsLoaded() { return Type.GetType("Almanac.API, Almanac") != null; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static int GetPlayerDeathCount(string creatureID) { object[] array = _GetPlayerDeathCount?.Invoke(creatureID); return (int)(((array != null) ? array[0] : null) ?? ((object)0)); } } [Flags] public enum RankType { KD = 1, Achievement = 2 } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static class Leaderboard { [Serializable] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public class LeaderboardInfo { private static Entries.EntryBuilder builder = new Entries.EntryBuilder(); public string PlayerName = string.Empty; public int CollectedAchievements; public int Kills; public int Deaths; public DateTime LastUpdated; public LeaderboardInfo(string playerName, int collectedAchievements, int kills, int deaths) { PlayerName = playerName; CollectedAchievements = collectedAchievements; Kills = kills; Deaths = deaths; LastUpdated = DateTime.UtcNow; } public LeaderboardInfo() { } public int GetRank() { RankType rankingFlags = Configs.RankingFlags; int num = 0; if (rankingFlags.HasFlag(RankType.Achievement)) { num += (int)((float)CollectedAchievements * Configs.RankingAchievementsFactor); } if (rankingFlags.HasFlag(RankType.KD)) { num += (int)((float)Mathf.Max(Kills / Math.Max(Deaths, 1), 0) * Configs.RankingKDFactor); } return num; } public List<Entries.Entry> ToEntries() { builder.Clear(); builder.Add(Keys.CollectedAchievement, CollectedAchievements); builder.Add(Keys.TotalKills, Kills); builder.Add(Keys.TotalDeaths, Deaths); builder.Add(Keys.Ratio, (Deaths == 0) ? ((float)Kills) : ((float)Kills / (float)Deaths)); builder.Add(Keys.LastUpdated, LastUpdated.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")); return builder.ToList(); } public void OnClick(AlmanacPanel panel, AlmanacPanel.ElementView.Element item) { panel.elementView.SetSelected(item); panel.description.Reset(); panel.description.SetName(PlayerName); ToEntries().Build(panel.description.view); panel.description.view.Resize(); } } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] private static string LeaderboardFileName; private static readonly CustomSyncedValue<string> SyncedLeaderboard = new CustomSyncedValue<string>(AlmanacPlugin.ConfigSync, "Almanac_Server_Synced_Leaderboard", ""); public static readonly Dictionary<string, LeaderboardInfo> players = new Dictionary<string, LeaderboardInfo>(); public static readonly AlmanacDir LeaderboardDir = new AlmanacDir(AlmanacPlugin.AlmanacDir.Path, "Leaderboards"); private static readonly ISerializer serializer = new SerializerBuilder().Build(); private static readonly IDeserializer deserializer = new DeserializerBuilder().Build(); public static void Setup() { AlmanacPlugin.OnZNetAwake += Initialize; SyncedLeaderboard.ValueChanged += OnSyncedLeaderboardChange; AlmanacPlugin.OnZNetSave += Save; AlmanacPlugin.OnPlayerProfileLoadPlayerDataPostfix += delegate { SendLocalPlayerInfo(); }; AlmanacPlugin.OnPlayerProfileSavePlayerDataPostfix += SendLocalPlayerInfo; } private static void Initialize() { if (Configs.AddLogs) { AlmanacPlugin.LogDebug("Almanac.Leaderboard.Initialize"); } LeaderboardFileName = ZNet.instance.GetWorldName() + ".Leaderboard.dat"; ZRoutedRpc.instance.Register<ZPackage>("RPC_Leaderboard", (Action<long, ZPackage>)RPC_Leaderboard); Read(); UpdateServerLeaderboard(); } private static void UpdateServerLeaderboard() { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer()) { string value = serializer.Serialize((object)players); SyncedLeaderboard.Value = value; if (Configs.AddLogs) { AlmanacPlugin.LogDebug("Server: Leaderboard.Update"); } } } private static void OnSyncedLeaderboardChange() { if (!Object.op_Implicit((Object)(object)ZNet.instance) || ZNet.instance.IsServer() || string.IsNullOrEmpty(SyncedLeaderboard.Value)) { return; } try { Dictionary<string, LeaderboardInfo> other = deserializer.Deserialize<Dictionary<string, LeaderboardInfo>>(SyncedLeaderboard.Value); players.Clear(); players.AddRange(other); if (Configs.AddLogs) { AlmanacPlugin.LogDebug("Client: Leaderboard.Update"); } } catch { AlmanacPlugin.LogWarning("Failed to parse server leaderboard"); } } public static List<LeaderboardInfo> GetLeaderboard() { return (from player in players.Values.ToList() orderby player.GetRank() select player).ToList(); } private static void SendLocalPlayerInfo() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)ZNet.instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).m_nview.IsValid()) { LeaderboardInfo leaderboardInfo = new LeaderboardInfo(Player.m_localPlayer.GetPlayerName(), Player.m_localPlayer.GetCollectedAchievements().Count, PlayerInfo.GetPlayerStat((PlayerStatType)6).Floor(), PlayerInfo.GetPlayerStat((PlayerStatType)0).Floor()); if (ZNet.instance.IsServer()) { players[leaderboardInfo.PlayerName] = leaderboardInfo; UpdateServerLeaderboard(); return; } ZPackage val = new ZPackage(); val.Write(leaderboardInfo.PlayerName); val.Write(leaderboardInfo.CollectedAchievements); val.Write(leaderboardInfo.Kills); val.Write(leaderboardInfo.Deaths); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RPC_Leaderboard", new object[1] { val }); } } public static void RPC_Leaderboard(long sender, ZPackage pkg) { string text = pkg.ReadString(); int collectedAchievements = pkg.ReadInt(); int kills = pkg.ReadInt(); int deaths = pkg.ReadInt(); players[text] = new LeaderboardInfo(text, collectedAchievements, kills, deaths); UpdateServerLeaderboard(); } private static void Save() { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer() && LeaderboardFileName != null) { string text = serializer.Serialize((object)players); byte[] content = CompressAndEncode(text); LeaderboardDir.WriteAllBytes(LeaderboardFileName, content); if (Configs.AddLogs) { AlmanacPlugin.LogDebug("Server: Almanac.Leaderboard.Save"); } } } private static void Read() { if (!Object.op_Implicit((Object)(object)ZNet.instance) || !ZNet.instance.IsServer() || LeaderboardFileName == null || !LeaderboardDir.FileExists(LeaderboardFileName)) { return; } try { byte[] compressedData = LeaderboardDir.ReadAllBytes(LeaderboardFileName); string text = DecompressAndDecode(compressedData); Dictionary<string, LeaderboardInfo> other = deserializer.Deserialize<Dictionary<string, LeaderboardInfo>>(text); players.Clear(); players.AddRange(other); } catch { AlmanacPlugin.LogWarning("Failed to parse server leaderboard: " + Path.GetFileName(LeaderboardFileName)); } } private static byte[] CompressAndEncode(string text) { byte[] bytes = Encoding.UTF8.GetBytes(text); using MemoryStream memoryStream = new MemoryStream(); using GZipStream gZipStream = new GZipStream(memoryStream, CompressionMode.Compress); gZipStream.Write(bytes, 0, bytes.Length); gZipStream.Close(); return memoryStream.ToArray(); } private static string DecompressAndDecode(byte[] compressedData) { using MemoryStream stream = new MemoryStream(compressedData); using GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress); using MemoryStream memoryStream = new MemoryStream(); gZipStream.CopyTo(memoryStream); return Encoding.UTF8.GetString(memoryStream.ToArray()); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [BepInPlugin("RustyMods.Almanac", "Almanac", "3.8.1")] [BepInIncompatibility("randyknapp.mods.auga")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class AlmanacPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerProfile), "SavePlayerData")] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] private static class PlayerProfile_SavePlayerData_Patch { [UsedImplicitly] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] private static void Prefix(Player player) { AlmanacPlugin.OnPlayerProfileSavePlayerDataPrefix?.Invoke(player); } [UsedImplicitly] private static void Postfix() { AlmanacPlugin.OnPlayerProfileSavePlayerDataPostfix?.Invoke(); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] [HarmonyPatch(typeof(PlayerProfile), "LoadPlayerData")] private static class PlayerProfile_LoadPlayerData_Patch { [UsedImplicitly] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] private static void Postfix(Player player) { AlmanacPlugin.OnPlayerProfileLoadPlayerDataPostfix?.Invoke(player); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] [HarmonyPatch(typeof(ZNet), "Save")] private static class ZNet_Save_Patch { [UsedImplicitly] private static void Postfix() { AlmanacPlugin.OnZNetSave?.Invoke(); } } [HarmonyPatch(typeof(ZNet), "Awake")] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] private static class ZNet_Awake_Patch { [UsedImplicitly] private static void Postfix() { AlmanacPlugin.OnZNetAwake?.Invoke(); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] [HarmonyPriority(0)] public class ZNetScene_Awake_Patch { [UsedImplicitly] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static void Postfix(ZNetScene __instance) { foreach (GameObject prefab in __instance.m_prefabs) { if (!((Object)(object)prefab == (Object)null)) { AlmanacPlugin.OnZNetScenePrefabs?.Invoke(prefab); } } AlmanacPlugin.OnZNetSceneAwake?.Invoke(); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] [HarmonyPriority(0)] [HarmonyPatch(typeof(ObjectDB), "Awake")] private static class ObjectDB_Awake_Patch { [UsedImplicitly] private static void Postfix() { if ((Object)(object)ZNetScene.instance == (Object)null) { return; } foreach (GameObject item in ObjectDB.instance.m_items) { if (!((Object)(object)item == (Object)null)) { AlmanacPlugin.OnObjectDBPrefabs?.Invoke(item); } } foreach (StatusEffect statusEffect in ObjectDB.instance.m_StatusEffects) { SpriteManager.OnObjectDBStatusEffects(statusEffect); } AlmanacPlugin.OnObjectDBAwake?.Invoke(); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] [HarmonyPatch(typeof(FejdStartup), "OnNewCharacterDone")] private static class FejdStartup_OnNewCharacterDone_Patch { [UsedImplicitly] private static void Prefix() { AlmanacPlugin.OnNewCharacterDone?.Invoke(); } } [Serializable] [CompilerGenerated] private sealed class <>c { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static readonly <>c <>9 = new <>c(); [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1, 1 })] public static Action<string[]> <>9__48_0; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Action<ZPackage> <>9__48_1; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1, 1 })] public static Action<string[]> <>9__48_2; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1, 1 })] public static Action<string[]> <>9__48_3; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1, 1 })] public static Action<string[]> <>9__48_4; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static ConsoleEventFailable <>9__49_0; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static Func<KeyValuePair<string, CommandData>, bool> <>9__49_1; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static Func<KeyValuePair<string, CommandData>, string> <>9__49_2; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_3; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_4; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_5; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_7; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_8; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 0, 1 })] public static Func<ConsoleEventArgs, bool> <>9__49_9; [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal void <SetupDiscordCommands>b__48_0(string[] args) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (args.Length < 2) { return; } string text = args[1].Trim(); if (!int.TryParse(args[2].Trim(), out var result)) { return; } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.GetPlayerName() == text) { Player.m_localPlayer.AddTokens(result); return; } ZNetPeer peerByPlayerName = ZNet.instance.GetPeerByPlayerName(text); if (peerByPlayerName != null) { ZPackage val = new ZPackage(); val.Write("!almanactokens"); val.Write(result); peerByPlayerName.m_rpc.Invoke("RPC_BotToClient", new object[1] { val }); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal void <SetupDiscordCommands>b__48_1(ZPackage pkg) { int amount = pkg.ReadInt(); Player.m_localPlayer.AddTokens(amount); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal void <SetupDiscordCommands>b__48_2(string[] _) { List<Leaderboard.LeaderboardInfo> leaderboard = Leaderboard.GetLeaderboard(); if (leaderboard.Count == 0) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "Leaderboard is empty"); return; } Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (Leaderboard.LeaderboardInfo item in leaderboard) { dictionary[item.PlayerName] = "```" + string.Join("\n", new List<string> { $"Achievements: {item.CollectedAchievements}", $"Kills: {item.Kills}", $"Deaths: {item.Deaths}", $"Rank: {item.GetRank()}" }) + "```"; } DiscordBot_API.SendWebhookTable(DiscordBot_API.Channel.Commands, "Leaderboard", dictionary); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal void <SetupDiscordCommands>b__48_3(string[] _) { List<MarketManager.MarketItem> marketItems = MarketManager.GetMarketItems(); if (marketItems.Count <= 0) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "No player items on marketplace"); return; } Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (MarketManager.MarketItem item in marketItems) { dictionary[item.itemData.m_shared.m_name] = $"```Cost: {item.GetCostPerUnit()} {Keys.AlmanacToken}\nPosted by: {item.PostedBy}\nDate posted: {item.DatePosted:yyyy-M-d dddd}```"; } DiscordBot_API.SendWebhookTable(DiscordBot_API.Channel.Commands, "Marketplace", dictionary); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal void <SetupDiscordCommands>b__48_4(string[] args) { if (args.Length >= 2) { string key = args[1].Trim(); if (!Leaderboard.players.Remove(key)) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "Failed to find leaderboard player"); } } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] internal object <SetupCommands>b__49_0(ConsoleEventArgs args) { if (args.Length < 2) { return false; } if (!CommandData.m_commands.TryGetValue(args[1], out var value)) { return false; } return value.Run(args); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] internal bool <SetupCommands>b__49_1(KeyValuePair<string, CommandData> x) { return !x.Value.IsSecret(); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] internal string <SetupCommands>b__49_2(KeyValuePair<string, CommandData> x) { return x.Key; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_3(ConsoleEventArgs _) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearRecords(); Player.m_localPlayer.ClearTokens(); Player.m_localPlayer.ClearSavedQuests(); Player.m_localPlayer.ClearSavedDialogues(); Player.m_localPlayer.ClearNotices(); return true; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_4(ConsoleEventArgs _) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearSavedQuests(); return true; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_5(ConsoleEventArgs _) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearSavedDialogues(); return true; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_7(ConsoleEventArgs _) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearRecords(); Player.m_localPlayer.ClearTokens(); Player.m_localPlayer.ClearSavedQuests(); Player.m_localPlayer.ClearSavedDialogues(); Player.m_localPlayer.ClearNotices(); Player.m_localPlayer.m_knownBiome.Clear(); Player.m_localPlayer.m_knownMaterial.Clear(); Player.m_localPlayer.m_knownRecipes.Clear(); Player.m_localPlayer.m_knownStations.Clear(); Player.m_localPlayer.m_knownTexts.Clear(); Player.m_localPlayer.m_trophies.Clear(); return true; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_8(ConsoleEventArgs args) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } if (args.Length < 3) { return false; } if (!int.TryParse(args[2], out var result)) { return false; } Player.m_localPlayer.AddTokens(result); return true; } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] internal bool <SetupCommands>b__49_9(ConsoleEventArgs args) { if (args.Length < 2) { return false; } if (!int.TryParse(args[1], out var result)) { return false; } LotteryManager.LotteryTotal = result; return true; } } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] internal const string ModName = "Almanac"; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] internal const string ModVersion = "3.8.1"; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] internal const string Author = "RustyMods"; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] private const string ModGUID = "RustyMods.Almanac"; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public const string ConfigFileName = "RustyMods.Almanac.cfg"; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public static readonly string ConfigFileFullPath; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] internal static string ConnectionError; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public readonly Harmony _harmony = new Harmony("RustyMods.Almanac"); [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public static readonly ConfigSync ConfigSync; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public static readonly AlmanacDir AlmanacDir; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public static AlmanacPlugin instance; public static event Action OnZNetAwake; public static event Action OnZNetSceneAwake; public static event Action OnZNetSave; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [method: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [field: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] public static event Action<Player> OnPlayerProfileLoadPlayerDataPostfix; public static event Action OnPlayerProfileSavePlayerDataPostfix; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [method: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [field: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] public static event Action<Player> OnPlayerProfileSavePlayerDataPrefix; public static event Action OnObjectDBAwake; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [method: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [field: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] public static event Action<GameObject> OnZNetScenePrefabs; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [method: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [field: <744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] public static event Action<GameObject> OnObjectDBPrefabs; public static event Action OnNewCharacterDone; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown instance = this; Configs.Load(); Clone._root = new GameObject("Almanac.PrefabManager.Clones"); Object.DontDestroyOnLoad((Object)(object)Clone._root); Clone._root.SetActive(false); Keys.Write(); Localizer.Load(); SpriteManager.RegisterCustomIcons(); StoreManager.Setup(); BountyManager.Setup(); TreasureManager.Setup(); AchievementManager.Setup(); CreatureGroup.Setup(); CustomEffectManager.Setup(); Filters.Setup(); LotteryManager.Setup(); MarketManager.Setup(); QuestManager.Setup(); Leaderboard.Setup(); CritterHelper.Setup(); ItemHelper.Setup(); PieceHelper.Setup(); PlayerInfo.Setup(); DialogueManager.Setup(); RandomTalkManager.Setup(); SetupCommands(); SetupDiscordCommands(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) QuestPanel questPanel = QuestPanel.instance; if (questPanel != null && !(Time.time - questPanel.lastInputTime < 0.1f) && ZInput.GetKeyDown(Configs.QuestKey, true)) { questPanel.lastInputTime = Time.time; questPanel.Toggle(); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static void LogInfo(string msg) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)msg); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static void LogWarning(string msg) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)msg); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static void LogError(string msg) { ((BaseUnityPlugin)instance).Logger.LogError((object)msg); } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static void LogDebug(string msg) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)msg); } private static void SetupDiscordCommands() { if (!DiscordBot_API.IsLoaded()) { return; } DiscordBot_API.RegisterCommand("!almanactokens", "give player tokens, `player name` `amount`", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (string[] args) => { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (args.Length >= 2) { string text = args[1].Trim(); if (int.TryParse(args[2].Trim(), out var result)) { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Player.m_localPlayer.GetPlayerName() == text) { Player.m_localPlayer.AddTokens(result); } else { ZNetPeer peerByPlayerName = ZNet.instance.GetPeerByPlayerName(text); if (peerByPlayerName != null) { ZPackage val = new ZPackage(); val.Write("!almanactokens"); val.Write(result); peerByPlayerName.m_rpc.Invoke("RPC_BotToClient", new object[1] { val }); } } } } }, [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ZPackage pkg) => { int amount = pkg.ReadInt(); Player.m_localPlayer.AddTokens(amount); }, adminOnly: true, isSecret: false, "fries"); DiscordBot_API.RegisterCommand("!almanacleaderboard", "show almanac leaderboard", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (string[] _) => { List<Leaderboard.LeaderboardInfo> leaderboard = Leaderboard.GetLeaderboard(); if (leaderboard.Count == 0) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "Leaderboard is empty"); } else { Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (Leaderboard.LeaderboardInfo item in leaderboard) { dictionary[item.PlayerName] = "```" + string.Join("\n", new List<string> { $"Achievements: {item.CollectedAchievements}", $"Kills: {item.Kills}", $"Deaths: {item.Deaths}", $"Rank: {item.GetRank()}" }) + "```"; } DiscordBot_API.SendWebhookTable(DiscordBot_API.Channel.Commands, "Leaderboard", dictionary); } }, null, adminOnly: false, isSecret: false, "brokenheart"); DiscordBot_API.RegisterCommand("!almanacstore", "displays player items on sale", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (string[] _) => { List<MarketManager.MarketItem> marketItems = MarketManager.GetMarketItems(); if (marketItems.Count <= 0) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "No player items on marketplace"); } else { Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (MarketManager.MarketItem item2 in marketItems) { dictionary[item2.itemData.m_shared.m_name] = $"```Cost: {item2.GetCostPerUnit()} {Keys.AlmanacToken}\nPosted by: {item2.PostedBy}\nDate posted: {item2.DatePosted:yyyy-M-d dddd}```"; } DiscordBot_API.SendWebhookTable(DiscordBot_API.Channel.Commands, "Marketplace", dictionary); } }); DiscordBot_API.RegisterCommand("!leaderboardremove", "removes player entry from leaderboard, `player name`", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (string[] args) => { if (args.Length >= 2) { string key = args[1].Trim(); if (!Leaderboard.players.Remove(key)) { DiscordBot_API.SendWebhookMessage(DiscordBot_API.Channel.Commands, "Failed to find leaderboard player"); } } }, null, adminOnly: true); } private void SetupCommands() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown object obj = <>c.<>9__49_0; if (obj == null) { ConsoleEventFailable val = [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (ConsoleEventArgs args) => { if (args.Length < 2) { return false; } CommandData value; return (!CommandData.m_commands.TryGetValue(args[1], out value)) ? ((object)false) : ((object)value.Run(args)); }; <>c.<>9__49_0 = val; obj = (object)val; } ConsoleCommand val2 = new ConsoleCommand("almanac", "Use help to find commands", (ConsoleEventFailable)obj, false, false, false, false, false, false, new ConsoleOptionsFetcher(Enumerable.ToList), false, false, false); CommandData commandData = new CommandData("reset", "clears all almanac data off player file", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs _) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearRecords(); Player.m_localPlayer.ClearTokens(); Player.m_localPlayer.ClearSavedQuests(); Player.m_localPlayer.ClearSavedDialogues(); Player.m_localPlayer.ClearNotices(); return true; }); CommandData commandData2 = new CommandData("reset_quests", "clears all quests from player file", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs _) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearSavedQuests(); return true; }); CommandData commandData3 = new CommandData("reset_dialogues", "clears all dialogues from player file", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs _) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearSavedDialogues(); return true; }); CommandData commandData4 = new CommandData("size", "prints the kilobyte size of almanac data on player file", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs _) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } int num = Player.m_localPlayer.GetTokensByteCount() + Player.m_localPlayer.GetRecordByteCount() + Player.m_localPlayer.GetQuestByteCount() + Player.m_localPlayer.GetDialogueByteCount(); double num2 = (double)num / 1024.0; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Almanac Data Size: {num2} kilobytes"); return true; }); CommandData commandData5 = new CommandData("full_reset", "clears all almanac data as well as valheim player data", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs _) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } Player.m_localPlayer.ClearRecords(); Player.m_localPlayer.ClearTokens(); Player.m_localPlayer.ClearSavedQuests(); Player.m_localPlayer.ClearSavedDialogues(); Player.m_localPlayer.ClearNotices(); Player.m_localPlayer.m_knownBiome.Clear(); Player.m_localPlayer.m_knownMaterial.Clear(); Player.m_localPlayer.m_knownRecipes.Clear(); Player.m_localPlayer.m_knownStations.Clear(); Player.m_localPlayer.m_knownTexts.Clear(); Player.m_localPlayer.m_trophies.Clear(); return true; }); CommandData commandData6 = new CommandData("tokens", "give local player almanac tokens", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs args) => { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } if (args.Length < 3) { return false; } if (!int.TryParse(args[2], out var result)) { return false; } Player.m_localPlayer.AddTokens(result); return true; }, null, isSecret: false, adminOnly: true); CommandData commandData7 = new CommandData("fullhouse", "[amount] Set current full house lottery reward", [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] (ConsoleEventArgs args) => { if (args.Length < 2) { return false; } if (!int.TryParse(args[1], out var result)) { return false; } LotteryManager.LotteryTotal = result; return true; }, null, isSecret: false, adminOnly: true); } static AlmanacPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + "RustyMods.Almanac.cfg"; ConnectionError = ""; ConfigSync = new ConfigSync("RustyMods.Almanac") { DisplayName = "Almanac", CurrentVersion = "3.8.1", MinimumRequiredVersion = "3.8.1" }; AlmanacDir = new AlmanacDir(Paths.ConfigPath, "Almanac"); instance = null; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown AlmanacPlugin.LogDebug("Registering version RPC handler"); peer.m_rpc.Register<ZPackage>("Almanac_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_Almanac_Version); AlmanacPlugin.LogDebug("Invoking version check"); ZPackage val = new ZPackage(); val.Write("3.8.1"); peer.m_rpc.Invoke("Almanac_VersionCheck", new object[1] { val }); } } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } AlmanacPlugin.LogWarning("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"); rpc.Invoke("Error", new object[1] { 3 }); return false; } private static void Postfix(ZNet __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RequestAdminSync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMax = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + AlmanacPlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { AlmanacPlugin.LogInfo("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] public static class RpcHandlers { public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>(); public static void RPC_Almanac_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); AlmanacPlugin.LogInfo("Version check, local: 3.8.1, remote: " + text); if (text != "3.8.1") { AlmanacPlugin.ConnectionError = "Almanac Installed: 3.8.1\n Needed: " + text; if (ZNet.instance.IsServer()) { AlmanacPlugin.LogWarning("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting"); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { AlmanacPlugin.LogInfo("Received same version from server!"); } else { AlmanacPlugin.LogInfo("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"); ValidatedPeers.Add(rpc); } } } } namespace Almanac.Utilities { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public class AlmanacDir { public readonly string Path; public bool Exists => Directory.Exists(Path); public AlmanacDir(string dir, string name) { Path = System.IO.Path.Combine(dir, name); EnsureDirectoryExists(); } private void EnsureDirectoryExists() { if (!Directory.Exists(Path)) { Directory.CreateDirectory(Path); } } public string[] GetFiles(string searchPattern = "*", bool includeSubDirs = false) { SearchOption searchOption = (includeSubDirs ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); return ExecuteWithRetry([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] () => Directory.GetFiles(Path, searchPattern, searchOption)); } public string[] GetDirectories(string searchPattern = "*") { return ExecuteWithRetry([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] () => Directory.GetDirectories(Path, searchPattern)); } public string CreateDir(string dirName) { string text = System.IO.Path.Combine(Path, dirName); if (Directory.Exists(text)) { return text; } Directory.CreateDirectory(text); return text; } public string WriteFile(string fileName, string content) { string fullPath = System.IO.Path.Combine(Path, fileName); ExecuteWithRetry(delegate { File.WriteAllText(fullPath, content); }); return fullPath; } public void WriteAllLines(string fileName, List<string> lines) { string fullPath = System.IO.Path.Combine(Path, fileName); ExecuteWithRetry(delegate { File.WriteAllLines(fullPath, lines); }); } public void WriteAllBytes(string fileName, byte[] content) { string fullPath = System.IO.Path.Combine(Path, fileName); ExecuteWithRetry(delegate { File.WriteAllBytes(fullPath, content); }); } public string ReadFile(string fileName) { string fullPath = System.IO.Path.Combine(Path, fileName); return ExecuteWithRetry([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] () => File.ReadAllText(fullPath)); } public IEnumerable<string> ReadAllLines(string fileName) { string fullPath = System.IO.Path.Combine(Path, fileName); return ExecuteWithRetry([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] () => File.ReadAllLines(fullPath)); } public byte[] ReadAllBytes(string fileName) { string fullPath = System.IO.Path.Combine(Path, fileName); return ExecuteWithRetry([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] () => File.ReadAllBytes(fullPath)); } public bool FileExists(string fileName) { string fullPath = System.IO.Path.Combine(Path, fileName); return ExecuteWithRetry(() => File.Exists(fullPath)); } public void DeleteFile(string fileName) { string fullPath = System.IO.Path.Combine(Path, fileName); ExecuteWithRetry(delegate { if (File.Exists(fullPath)) { File.Delete(fullPath); } }); } private T ExecuteWithRetry<[<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] T>(Func<T> operation) { try { return operation(); } catch (DirectoryNotFoundException) { EnsureDirectoryExists(); return operation(); } } private void ExecuteWithRetry(Action operation) { try { operation(); } catch (DirectoryNotFoundException) { EnsureDirectoryExists(); operation(); } } } public enum Toggle { On = 1, Off = 0 } public enum OrderType { None, Completed, NotCompleted, DisplayName, UniqueID } [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(1)] [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public static class Configs { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] public class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order = null; [UsedImplicitly] public bool? Browsable = null; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] [UsedImplicitly] public string Category = null; [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer = null; } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public class StringListConfig { public readonly List<string> list; public StringListConfig(List<string> items) { list = items; } public StringListConfig(string items) { list = items.Split(new char[1] { ',' }).ToList(); } public static void Draw(ConfigEntryBase cfg) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true; bool flag = false; List<string> list = new List<string>(); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); foreach (string item2 in new StringListConfig((string)cfg.BoxedValue).list) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string item = item2; string text = GUILayout.TextField(item2, Array.Empty<GUILayoutOption>()); if (text != item2 && !valueOrDefault) { flag = true; item = text; } if (GUILayout.Button("x", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; } else { list.Add(item); } if (GUILayout.Button("+", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { list.Add(""); flag = true; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = new StringListConfig(list).ToString(); } } public override string ToString() { return string.Join(",", list); } } [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(0)] public class SerializedRequirements { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] public struct Requirement { [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(1)] public string itemName; public int amount; public bool recover; } public static ConfigurationManagerAttributes attributes = new ConfigurationManagerAttributes { CustomDrawer = DrawConfigTable }; public readonly List<Requirement> Reqs; public static void DrawConfigTable(ConfigEntryBase cfg) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true; List<Requirement> list = new List<Requirement>(); bool flag = false; GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); foreach (Requirement req in new SerializedRequirements((string)cfg.BoxedValue).Reqs) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int num = req.amount; if (int.TryParse(GUILayout.TextField(num.ToString(), new GUIStyle(GUI.skin.textField) { fixedWidth = 40f }, Array.Empty<GUILayoutOption>()), out var result) && result != num && !valueOrDefault) { num = result; flag = true; } string text = GUILayout.TextField(req.itemName, new GUIStyle(GUI.skin.textField), Array.Empty<GUILayoutOption>()); string text2 = (valueOrDefault ? req.itemName : text); flag = flag || text2 != req.itemName; bool flag2 = req.recover; if (GUILayout.Toggle(req.recover, "Recover", new GUIStyle(GUI.skin.toggle) { fixedWidth = 67f }, Array.Empty<GUILayoutOption>()) != req.recover) { flag2 = !flag2; flag = true; } if (GUILayout.Button("x", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; } else { list.Add(new Requirement { amount = num, itemName = text2, recover = flag2 }); } if (GUILayout.Button("+", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; list.Add(new Requirement { amount = 1, itemName = "", recover = false }); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = new SerializedRequirements(list).ToString(); } } public SerializedRequirements(List<Requirement> reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) { Reqs = reqs.Split(new char[1] { ',' }).Select([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (string r) => { string[] array = r.Split(new char[1] { ':' }); int result; bool result2 = default(bool); return new Requirement { itemName = array[0], amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result), recover = (array.Length <= 2 || !bool.TryParse(array[2], out result2) || result2) }; }).ToList(); } public override string ToString() { return string.Join(",", Reqs.Select([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}")); } public static Requirement[] toPieceReqs(SerializedRequirements craft) { Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (Requirement r) => { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDrop val = ResItem(r); return (val == null) ? ((Requirement)null) : new Requirement { m_amount = r.amount, m_resItem = val, m_recover = r.recover }; })); return dictionary.Values.Where([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (Requirement v) => v != null).ToArray(); [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] static ItemDrop ResItem(Requirement r) { GameObject prefab = Helpers.GetPrefab(r.itemName); return (prefab != null) ? prefab.GetComponent<ItemDrop>() : null; } } } private static ConfigEntry<Toggle> _serverConfigLocked; private static ConfigEntry<Toggle> _KnowledgeWall; private static ConfigEntry<Toggle> _UseIgnoreList; private static ConfigEntry<Toggle> _ShowAllData; private static ConfigEntry<Color> _OutlineColor; private static ConfigEntry<Toggle> _Transparent; private static ConfigEntry<Toggle> _HideUnknownEntries; public static ConfigEntry<Vector3> _customizationPos; public static ConfigEntry<Vector3> _dialoguePos; public static ConfigEntry<Vector3> _panelPos; private static ConfigEntry<int> _TreasureCooldown; private static ConfigEntry<int> _BountyCooldown; private static ConfigEntry<int> _lotteryCost; private static ConfigEntry<int> _minFullHouse; private static ConfigEntry<Toggle> _generateBounties; private static ConfigEntry<float> _bountyRange; private static ConfigEntry<float> _treasureRange; private static ConfigEntry<float> _fullHouseChance; private static ConfigEntry<int> _lotteryMatchCount; private static ConfigEntry<int> _tokensPerSuccess; private static ConfigEntry<int> _iconOptionCount; private static ConfigEntry<Toggle> _broadcastWin; private static ConfigEntry<Toggle> _TreasureEnabled; private static ConfigEntry<Toggle> _BountyEnabled; private static ConfigEntry<Toggle> _AchievementsEnabled; private static ConfigEntry<Toggle> _lotteryEnabled; private static ConfigEntry<Toggle> _statusEffectsEnabled; private static ConfigEntry<Toggle> _storeEnabled; private static ConfigEntry<Toggle> _metricsEnabled; private static ConfigEntry<Toggle> _leaderboardEnabled; private static ConfigEntry<Toggle> _marketplaceEnabled; private static ConfigEntry<Toggle> _trophiesEnabled; private static ConfigEntry<Toggle> _itemsEnabled; private static ConfigEntry<Toggle> _piecesEnabled; private static ConfigEntry<Toggle> _creaturesEnabled; private static ConfigEntry<Toggle> _almanacEnabled; private static ConfigEntry<Vector2> _elementViewGridSize; public static ConfigEntry<Vector3> _questPanelPos; private static ConfigEntry<KeyCode> _questKey; private static ConfigEntry<Toggle> _autoHideDialogue; private static ConfigEntry<Toggle> _allowConversion; private static ConfigEntry<int> _conversionRate; private static ConfigEntry<string> _conversionItem; private static ConfigEntry<float> _scrollbarSensitivity; private static ConfigEntry<Toggle> _returnBountyCostWhenCancel; private static ConfigEntry<Toggle> _returnTreasureCostWhenCancel; private static ConfigEntry<Toggle> _checkNoCost; private static ConfigEntry<string> _adminList; private static ConfigEntry<Toggle> _enableAchievementNotices; private static ConfigEntry<Toggle> _enableAchievementEffects; private static ConfigEntry<int> _maxAchievementEffects; private static ConfigEntry<OrderType> _achievementOrdering; private static ConfigEntry<Toggle> _logging; public static ConfigEntry<PieceCategory> npc_category; public static ConfigEntry<string> npc_requirements; public static ConfigEntry<string> npc_station; public static ConfigEntry<RankType> _rankFlags; public static ConfigEntry<float> _rankAchievementsFactor; public static ConfigEntry<float> _rankKDFactor; public static PieceCategory NPC_Category => npc_category.Value; public static Requirement[] NPC_Requirements => SerializedRequirements.toPieceReqs(new SerializedRequirements(npc_requirements.Value)); [<744b8cc0-5738-418c-b36d-70454b97fe9f>Nullable(2)] public static CraftingStation NPC_Station { [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(2)] get { GameObject prefab = Helpers.GetPrefab(npc_station.Value); return ((prefab != null) ? prefab.GetComponent<CraftingStation>() : null) ?? null; } } public static RankType RankingFlags => _rankFlags.Value; public static float RankingAchievementsFactor => _rankAchievementsFactor.Value; public static float RankingKDFactor => _rankKDFactor.Value; public static bool UseIgnoreList => _UseIgnoreList.Value == Toggle.On; public static bool ShowBounties => _BountyEnabled.Value == Toggle.On; public static bool ShowAchievements => _AchievementsEnabled.Value == Toggle.On; public static bool ShowTreasures => _TreasureEnabled.Value == Toggle.On; public static bool ShowAllData => _ShowAllData.Value == Toggle.On; public static bool UseKnowledgeWall => _KnowledgeWall.Value == Toggle.On; public static bool AchievementEffectsEnabled => _enableAchievementEffects.Value == Toggle.On; public static int MaxAchievementEffects => _maxAchievementEffects.Value; public static bool ShowAchievementNotices => _enableAchievementNotices.Value == Toggle.On; public static bool Transparent => _Transparent.Value == Toggle.On; public static Color OutlineColor => _OutlineColor.Value; public static int BountyCooldown => _BountyCooldown.Value; public static float BountyRange => _bountyRange.Value; public static float TreasureRange => _treasureRange.Value; public static int TreasureCooldown => _TreasureCooldown.Value; public static bool ShowLottery => _lotteryEnabled.Value == Toggle.On; public static bool ShowStatusEffects => _statusEffectsEnabled.Value == Toggle.On; public static bool ShowStore => _storeEnabled.Value == Toggle.On; public static bool ShowMetrics => _metricsEnabled.Value == Toggle.On; public static bool ShowLeaderboard => _leaderboardEnabled.Value == Toggle.On; public static bool HideUnknownEntries => _HideUnknownEntries.Value == Toggle.On; public static int LotteryCost => _lotteryCost.Value; public static bool ShowMarketplace => _marketplaceEnabled.Value == Toggle.On; public static int MinFullHouse => _minFullHouse.Value; public static bool AllowConversion => _allowConversion.Value == Toggle.On; public static int ConversionRate => _conversionRate.Value; public static string ConversionItem => _conversionItem.Value; public static float ScrollbarSensitivity => _scrollbarSensitivity.Value; public static bool ReturnBountyCostWhenCancel => _returnBountyCostWhenCancel.Value == Toggle.On; public static bool ReturnTreasureCostWhenCancel => _returnTreasureCostWhenCancel.Value == Toggle.On; public static bool ShowTrophies => _trophiesEnabled.Value == Toggle.On; public static bool ShowItems => _itemsEnabled.Value == Toggle.On; public static bool ShowPieces => _piecesEnabled.Value == Toggle.On; public static bool ShowCreatures => _creaturesEnabled.Value == Toggle.On; public static bool ShowAlmanac => _almanacEnabled.Value == Toggle.On; public static Vector3 QuestPanelPos => _questPanelPos.Value; public static Vector2 ElementViewGridSize => _elementViewGridSize.Value; public static Vector3 CustomizationPos => _customizationPos.Value; public static Vector3 DialoguePos => _dialoguePos.Value; public static KeyCode QuestKey => _questKey.Value; public static Vector3 PanelPos => _panelPos.Value; public static bool GenerateBounties => _generateBounties.Value == Toggle.On; private static string AdminList => _adminList.Value; public static bool CheckNoCost => _checkNoCost.Value == Toggle.On; public static AlmanacPanel.Background.BackgroundOption bkgOption => Transparent ? AlmanacPanel.Background.BackgroundOption.Transparent : AlmanacPanel.Background.BackgroundOption.Opaque; public static OrderType AchievementOrderType => _achievementOrdering.Value; public static bool AddLogs => _logging.Value == Toggle.On; public static float FullHouseChance => _fullHouseChance.Value; public static int RequiredMatchCount => _lotteryMatchCount.Value; public static int TokensPerSuccess => _tokensPerSuccess.Value; public static int IconsCount => _iconOptionCount.Value; public static bool BroadcastWin => _broadcastWin.Value == Toggle.On; public static bool AutoHideDialogue => _autoHideDialogue.Value == Toggle.On; public static bool IsAdmin(string name) { return new StringListConfig(AdminList).list.Select([<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (string x) => x.ToLower()).Contains(name.ToLower()); } public static void Load() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Expected O, but got Unknown //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Expected O, but got Unknown //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Expected O, but got Unknown //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Expected O, but got Unknown //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Expected O, but got Unknown //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_08eb: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0a66: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Expected O, but got Unknown //IL_0ab9: Unknown result type (might be due to invalid IL or missing references) //IL_0ac4: Expected O, but got Unknown //IL_0af1: Unknown result type (might be due to invalid IL or missing references) //IL_0afc: Expected O, but got Unknown _serverConfigLocked = config("1 - General", "0 - Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); AlmanacPlugin.ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); _logging = config("1 - General", "Logging", Toggle.Off, "If on, will add development debug logs", synchronizedSetting: false); _KnowledgeWall = config("1 - General", "Knowledge Wall", Toggle.On, "If on, the plugin blacks out unknown items from the almanac"); _UseIgnoreList = config("1 - General", "Use Ignore List", Toggle.On, "If on, the plugin uses the IgnoreList.yml to filter almanac"); _ShowAllData = config("1 - General", "Show All Data", Toggle.Off, "If on, Almanac does not filter extra data, like prefab name and material name"); _allowConversion = config("1 - General", "Enable Conversion", Toggle.On, "If on, players can convert chosen item into almanac tokens"); _conversionRate = config("1 - General", "Conversion Rate", 50, "Set conversion ratio, ie. 50 coins for 1 token"); _conversionItem = config("1 - General", "Conversion Item", "Coins", "Set item to use to convert into almanac tokens"); _almanacEnabled = config("1 - General", "Almanac Button", Toggle.On, "If on, almanac button replaces trophies button"); _checkNoCost = config("1 - General", "Admin Tools Check No Cost", Toggle.Off, "If on, no cost must be enabled to use admin tools"); _enableAchievementNotices = config("1 - General", "Achievement Notices", Toggle.Off, "If on, will show notifications of achievement completion"); _adminList = config("1 - General", "Admin List", "", new ConfigDescription("Almanac admin list, names seperated by a comma", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = StringListConfig.Draw } })); _almanacEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.inventoryButton?.Show(ShowAlmanac); }; _lotteryEnabled = config("2 - Tabs", "Lottery", Toggle.On, "If on, lottery feature is enabled"); _lotteryEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.Lottery].SetActive(ShowLottery); }; _statusEffectsEnabled = config("2 - Tabs", "Status Effects", Toggle.On, "If on, status effects is enabled"); _statusEffectsEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.StatusEffects].SetActive(ShowStatusEffects); }; _AchievementsEnabled = config("2 - Tabs", "Achievements", Toggle.On, "If on, achievements is enabled"); _AchievementsEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.Achievements].SetActive(ShowAchievements); }; _storeEnabled = config("2 - Tabs", "Store", Toggle.On, "If on, store is enabled"); _storeEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.Store].SetActive(ShowStore); }; _metricsEnabled = config("2 - Tabs", "Metrics", Toggle.On, "If on, metrics is enabled"); _metricsEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.Metrics].SetActive(ShowMetrics); }; _leaderboardEnabled = config("2 - Tabs", "Leaderboard", Toggle.On, "If on, leaderboard is enabled"); _leaderboardEnabled.SettingChanged += [<db65bdda-1192-44e1-b4ba-ac51abc5960e>NullableContext(0)] (object _, EventArgs _) => { AlmanacPanel.instance?.Tabs[AlmanacPanel.Tab.TabOption.Leaderboard].SetActive(ShowLeaderboard); }; _marketplaceEnabled = config("2 - Tabs", "Marketplace", Toggle.On, "If o