Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ServersideQoL PortalProgression WorldAdvancementProgression v0.1.0
plugins/ServersideQoLPortalProgressionWorldAdvancementProgression.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using VentureValheim.Progression; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("ServersideQoLPortalProgressionWorldAdvancementProgression")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("ServersideQoLPortalProgressionWorldAdvancementProgression")] [assembly: AssemblyTitle("ServersideQoLPortalProgressionWorldAdvancementProgression")] [assembly: AssemblyVersion("0.1.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace PortalProgressionWorldAdvancement { [BepInPlugin("Bananas4Dragons.ServersideQoL.PortalProgression.WorldAdvancementProgression", "ServersideQoL PortalProgression WorldAdvancementProgression", "0.1.0")] [BepInDependency("com.orianaventure.mod.WorldAdvancementProgression", "1.0.0")] [BepInDependency("com.jotunn.jotunn", "2.30.0")] [BepInIncompatibility("ArgusMagnus.ServersideQoL.PortalProgression")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(KeyManager), "IsTeleportable", new Type[] { typeof(string), typeof(bool) })] private static class ProgressionItemCheck { private static bool Prefix(string name, bool teleportable, ref bool __result) { Plugin instance = _instance; if (instance == null || instance._enabled?.Value != true || teleportable || !instance._itemKeys.TryGetValue(name, out ConfigEntry<string> value)) { return true; } HashSet<string> privateKeys = (ProgressionPlugin.CE_UsePrivateKeys.Value ? KeyManager.Instance.PrivateKeysList : null); __result = PortalRules.Allows(value.Value, privateKeys); return false; } } [HarmonyPatch(typeof(Inventory), "IsTeleportable", new Type[] { typeof(bool) })] private static class KeepVanillaQuestItemRestriction { [HarmonyPriority(0)] private static void Postfix(Inventory __instance, ref bool __result) { Player localPlayer = Player.m_localPlayer; if (!__result) { return; } Plugin? instance = _instance; if (instance == null || instance._enabled?.Value != true || !Object.op_Implicit((Object)(object)localPlayer) || ((Humanoid)localPlayer).GetInventory() != __instance) { return; } foreach (ItemData allItem in __instance.GetAllItems()) { if (allItem.m_shared.m_toolTier >= 1000) { __result = false; break; } } } } public const string Id = "Bananas4Dragons.ServersideQoL.PortalProgression.WorldAdvancementProgression"; private const string Section = "PortalProgression"; private readonly Dictionary<string, ConfigEntry<string>> _itemKeys = new Dictionary<string, ConfigEntry<string>>(StringComparer.Ordinal); private ConfigEntry<bool>? _enabled; private Harmony? _harmony; private static Plugin? _instance; private void Awake() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("PortalProgression", "Enabled", true, Synced("Use this mod's private-key rules for the items listed below.")); foreach (KeyValuePair<string, string> defaultKey in PortalRules.DefaultKeys) { _itemKeys.Add(defaultKey.Key, ((BaseUnityPlugin)this).Config.Bind<string>("PortalProgression", defaultKey.Key, defaultKey.Value, Synced("Private key required to teleport this item. Use -- to keep the item restricted."))); } _harmony = new Harmony("Bananas4Dragons.ServersideQoL.PortalProgression.WorldAdvancementProgression"); _instance = this; try { _harmony.PatchAll(typeof(Plugin).Assembly); } catch { _harmony.UnpatchSelf(); _instance = null; throw; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Private-key portal rules loaded for " + _itemKeys.Count + " items.")); } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private static ConfigDescription Synced(string description) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } }); } } internal static class PortalRules { internal static readonly IReadOnlyDictionary<string, string> DefaultKeys = new Dictionary<string, string>(StringComparer.Ordinal) { ["BlackMetal"] = "defeated_goblinking", ["BlackMetalScrap"] = "defeated_goblinking", ["Bronze"] = "defeated_gdking", ["BronzeScrap"] = "defeated_gdking", ["CharredCogwheel"] = "defeated_fader", ["chest_hildir1"] = "--", ["chest_hildir2"] = "--", ["chest_hildir3"] = "--", ["Copper"] = "defeated_gdking", ["CopperOre"] = "defeated_gdking", ["CopperScrap"] = "defeated_gdking", ["DragonEgg"] = "defeated_dragon", ["DvergrNeedle"] = "defeated_queen", ["Flametal"] = "defeated_fader", ["FlametalNew"] = "defeated_fader", ["FlametalOre"] = "defeated_fader", ["FlametalOreNew"] = "defeated_fader", ["Gold"] = "defeated_frozenking_p3", ["GoldOre"] = "defeated_frozenking_p3", ["Iron"] = "defeated_bonemass", ["IronOre"] = "defeated_bonemass", ["Ironpit"] = "defeated_bonemass", ["IronScrap"] = "defeated_bonemass", ["MechanicalSpring"] = "defeated_queen", ["Silver"] = "defeated_dragon", ["SilverOre"] = "defeated_dragon", ["Tin"] = "defeated_gdking", ["TinOre"] = "defeated_gdking" }; internal static bool Allows(string configuredKey, ISet<string>? privateKeys) { string text = configuredKey.Trim().ToLowerInvariant(); if (text.Length != 0 && text != "--") { return privateKeys?.Contains(text) ?? false; } return false; } } }