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 Architect v3.33.7
Architect/Architect.dll
Decompiled 4 days 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.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Architect.Api; using Architect.Behaviour.Abilities; using Architect.Behaviour.Custom; using Architect.Behaviour.Fixers; using Architect.Behaviour.Utility; using Architect.Config; using Architect.Config.Types; using Architect.Content; using Architect.Content.Custom; using Architect.Content.Preloads; using Architect.Editor; using Architect.Events; using Architect.Events.Blocks; using Architect.Events.Blocks.Config; using Architect.Events.Blocks.Config.Types; using Architect.Events.Blocks.Events; using Architect.Events.Blocks.Functions; using Architect.Events.Blocks.Objects; using Architect.Events.Blocks.Operators; using Architect.Events.Blocks.Outputs; using Architect.Events.Vars; using Architect.Multiplayer; using Architect.Multiplayer.Ssmp; using Architect.Multiplayer.Ssmp.Data; using Architect.Objects; using Architect.Objects.Categories; using Architect.Objects.Groups; using Architect.Objects.Placeable; using Architect.Objects.Tools; using Architect.Placements; using Architect.Prefabs; using Architect.Sharer; using Architect.Sharer.Info; using Architect.Sharer.States; using Architect.Storage; using Architect.Utils; using Architect.Workshop; using Architect.Workshop.Config; using Architect.Workshop.Items; using Architect.Workshop.Types; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using FsmMaster; using GlobalEnums; using GlobalSettings; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.Utils; using Newtonsoft.Json; using Patchwork.Handlers; using PolyAndCode.UI; using PrepatcherPlugin; using QuickWarp; using SSMP.Api.Client; using SSMP.Api.Client.Networking; using SSMP.Api.Server; using SSMP.Api.Server.Networking; using SSMP.Math; using SSMP.Networking.Packet; using Silksong.AssetHelper.ManagedAssets; using Silksong.AssetHelper.Plugin; using Silksong.DataManager; using Silksong.ModMenu; using Silksong.ModMenu.Elements; using Silksong.ModMenu.Models; using Silksong.ModMenu.Screens; using TMProOld; using TeamCherry.Localization; using TeamCherry.NestedFadeGroup; using TeamCherry.SharedUtils; using TeamCherry.Splines; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Audio; using UnityEngine.Bindings; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; using UnityStandardAssets.ImageEffects; using tk2dRuntime.TileMap; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("AsmResolver")] [assembly: IgnoresAccessChecksTo("AsmResolver.DotNet")] [assembly: IgnoresAccessChecksTo("AsmResolver.PE")] [assembly: IgnoresAccessChecksTo("AsmResolver.PE.File")] [assembly: IgnoresAccessChecksTo("BepInEx.AssemblyPublicizer")] [assembly: IgnoresAccessChecksTo("BepInEx.AssemblyPublicizer.MSBuild")] [assembly: IgnoresAccessChecksTo("FsmMaster")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Architect")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.33.7.0")] [assembly: AssemblyInformationalVersion("3.33.7+9cdc1a5ee33cb14527d6dbf800c64a62b97d3c68")] [assembly: AssemblyProduct("Architect")] [assembly: AssemblyTitle("Architect")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.33.7.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets { public Type? TargetType { get; } = targetType; public bool IncludeNestedTypes { get; set; } = true; public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Architect { public class ArchitectData { public Dictionary<string, string> StringVariables = new Dictionary<string, string>(); public Dictionary<string, float> FloatVariables = new Dictionary<string, float>(); public Dictionary<string, bool> BoolVariables = new Dictionary<string, bool>(); public bool HideVanillaMaps = false; public string CustomNeedle = string.Empty; public static ArchitectData Instance => ArchitectPlugin.Instance.SaveData ?? (ArchitectPlugin.Instance.SaveData = new ArchitectData()); } public class GlobalArchitectData { public Dictionary<string, KeyCode> Keybinds = new Dictionary<string, KeyCode>(); public string CurrentMap = ""; public string CurrentMapId = ""; public Dictionary<string, (List<string>, int)> CherryScores = new Dictionary<string, (List<string>, int)>(); public Dictionary<string, (List<string>, int)> GoldCherryScores = new Dictionary<string, (List<string>, int)>(); public Dictionary<int, (string, bool)> CustomSaveArt = new Dictionary<int, (string, bool)>(); public List<string> SavedMapNames = new List<string>(); public Dictionary<string, string> StringVariables = new Dictionary<string, string>(); public Dictionary<string, float> FloatVariables = new Dictionary<string, float>(); public Dictionary<string, bool> BoolVariables = new Dictionary<string, bool>(); public static GlobalArchitectData Instance => ArchitectPlugin.Instance.GlobalData ?? (ArchitectPlugin.Instance.GlobalData = new GlobalArchitectData()); public string MapLabel => Utility.IsNullOrWhiteSpace(CurrentMap) ? "Map Options" : CurrentMap; } [BepInPlugin("com.cometcake575.architect", "Architect", "3.33.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ArchitectPlugin : BaseUnityPlugin, ISaveDataMod<ArchitectData>, IRawSaveDataMod, IGlobalDataMod<GlobalArchitectData>, IRawGlobalDataMod { internal static ArchitectPlugin Instance; internal static ManualLogSource Logger; public static readonly Sprite BlankSprite = ResourceUtils.LoadSpriteResource("blank", (FilterMode)1, default(Vector4), 300f); public ArchitectData SaveData { get; set; } public GlobalArchitectData GlobalData { get; set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Architect has loaded!"); SceneUtils.Init(); PrefabManager.Init(); HookUtils.Init(); TitleUtils.Init(); StorageManager.Init(); Settings.Init(((BaseUnityPlugin)this).Config); MiscFixers.Init(); EnemyFixers.Init(); HazardFixers.Init(); InteractableFixers.Init(); Categories.Init(); ActionManager.Init(); CoopManager.Init(); WorkshopManager.Init(); ScriptManager.Init(); EditManager.Init(); VanillaObjects.Init(); SplineObjects.Init(); LegacyObjects.Init(); UtilityObjects.Init(); AbilityObjects.Init(); MiscObjects.Init(); CameraObjects.Init(); ParticleObjects.Init(); RespawnMarkerManager.Init(); PlacementManager.Init(); BroadcasterHooks.Init(); SharerManager.Init(); PreloadManager.Init(); EditorUI.Setup(); Architect.Objects.Groups.ConfigGroup.Init(); StorageManager.MakeBackup(DateTime.Now.ToString("yy-MM-dd-HH-mm-ss")); ProjectManager.Init(); typeof(GameManager).Hook("ResetSemiPersistentItems", (Action<Action<GameManager>, GameManager>)delegate(Action<GameManager> orig, GameManager self) { BoolVarBlock.SemiVars.Clear(); NumVarBlock.SemiVars.Clear(); StringVarBlock.SemiVars.Clear(); orig(self); }); FindMaps(); } private static void FindMaps() { string[] directories = Directory.GetDirectories(Paths.PluginPath, "Architect", SearchOption.AllDirectories); foreach (string text in directories) { if (text == Path.Combine(Paths.PluginPath, "Architect")) { continue; } string path = Path.Combine(text, "Scenes"); if (Directory.Exists(path)) { string[] files = Directory.GetFiles(path); foreach (string text2 in files) { if (text2.EndsWith(".architect.json")) { string sceneName = Path.GetFileNameWithoutExtension(text2).Replace(".architect", ""); MapLoader.LoadStandaloneMap(sceneName, text2); } } } string path2 = Path.Combine(text, "Prefabs"); if (Directory.Exists(path2)) { string[] files2 = Directory.GetFiles(path2); foreach (string text3 in files2) { if (text3.EndsWith(".architect.json")) { string prefabName = Path.GetFileNameWithoutExtension(text3).Replace(".architect", ""); MapLoader.LoadStandalonePrefab(prefabName, text3); } } } string text4 = Path.Combine(text, "Assets"); if (Directory.Exists(text4)) { CustomAssetManager.AssetPaths.Add(text4); } StorageManager.LoadPrefabs(text); string path3 = Path.Combine(text, "workshop.json"); if (File.Exists(path3)) { string text5 = File.ReadAllText(path3); DirectoryInfo parent = Directory.GetParent(text); if (parent == null) { break; } WorkshopManager.LoadExtWorkshop(parent.Name, JsonConvert.DeserializeObject<WorkshopData>(text5)); } StorageManager.Directories.Add(text); } } private void Start() { EditorUI.SetupCategories(); } private void Update() { if (Object.op_Implicit((Object)(object)HeroController.instance)) { EditManager.Update(); HazardFixers.UpdateLanterns(); } CursorManager.Update(); SharerManager.Update(); AbilityObjects.Update(); } } } namespace Architect.Workshop { public static class ConfigurationManager { public static readonly Dictionary<string, Architect.Workshop.Types.ConfigType> ConfigTypes = new Dictionary<string, Architect.Workshop.Types.ConfigType>(); public static Architect.Workshop.Types.ConfigType RegisterConfigType(Architect.Workshop.Types.ConfigType type) { ConfigTypes[type.Id] = type; return type; } public static Architect.Workshop.Types.ConfigValue DeserializeConfigValue(string configType, string serializedValue) { return ConfigTypes[configType].Deserialize(serializedValue); } } [JsonConverter(typeof(WorkshopDataConverter))] public class WorkshopData { public class WorkshopDataConverter : JsonConverter<WorkshopData> { public override void WriteJson(JsonWriter writer, WorkshopData value, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("items"); writer.WriteStartArray(); foreach (WorkshopItem item in value.Items) { writer.WriteStartObject(); writer.WritePropertyName("type"); writer.WriteValue(item.Type); writer.WritePropertyName("name"); writer.WriteValue(item.Id); writer.WritePropertyName("config"); serializer.Serialize(writer, (object)item.CurrentConfig.Values.ToDictionary((Architect.Workshop.Types.ConfigValue c) => c.GetTypeId(), (Architect.Workshop.Types.ConfigValue c) => c.SerializeValue())); writer.WriteEndObject(); } writer.WriteEndArray(); writer.WriteEndObject(); } public override WorkshopData ReadJson(JsonReader reader, Type objectType, WorkshopData existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 WorkshopData workshopData = new WorkshopData(); reader.Read(); reader.Read(); reader.Read(); while ((int)reader.TokenType == 1) { string key = ""; string arg = ""; Dictionary<string, Architect.Workshop.Types.ConfigValue> currentConfig = new Dictionary<string, Architect.Workshop.Types.ConfigValue>(); reader.Read(); while ((int)reader.TokenType == 4) { switch (reader.Value as string) { case "type": key = reader.ReadAsString(); break; case "name": arg = reader.ReadAsString(); break; case "config": reader.Read(); currentConfig = DeserializeConfig(serializer.Deserialize<Dictionary<string, string>>(reader)); break; } reader.Read(); } WorkshopItem workshopItem = WorkshopManager.WorkshopItems[key].Item2(arg); workshopItem.CurrentConfig = currentConfig; workshopData.Items.Add(workshopItem); reader.Read(); } reader.Read(); return workshopData; } private static Dictionary<string, Architect.Workshop.Types.ConfigValue> DeserializeConfig(Dictionary<string, string> data) { Dictionary<string, Architect.Workshop.Types.ConfigValue> dictionary = new Dictionary<string, Architect.Workshop.Types.ConfigValue>(); foreach (KeyValuePair<string, string> datum in data) { dictionary[datum.Key] = ConfigurationManager.DeserializeConfigValue(datum.Key, datum.Value); } return dictionary; } } public readonly List<WorkshopItem> Items = new List<WorkshopItem>(); public string ExternalSource; } public static class WorkshopManager { public static WorkshopData WorkshopData; public static readonly Dictionary<string, WorkshopItem> CustomItems = new Dictionary<string, WorkshopItem>(); public static readonly Dictionary<string, WorkshopItem> CustomEntries = new Dictionary<string, WorkshopItem>(); public static readonly Dictionary<string, WorkshopItem> CustomCrests = new Dictionary<string, WorkshopItem>(); public static readonly Dictionary<string, WorkshopItem> CustomQuests = new Dictionary<string, WorkshopItem>(); public static readonly Dictionary<string, WorkshopItem> CustomTools = new Dictionary<string, WorkshopItem>(); public static readonly Dictionary<string, (Vector2, Func<string, WorkshopItem>)> WorkshopItems = new Dictionary<string, (Vector2, Func<string, WorkshopItem>)>(); private static readonly List<WorkshopData> ExtWorkshops = new List<WorkshopData>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) Register<CustomItem>("Item", new Vector2(-300f, -150f), new List<Architect.Workshop.Types.ConfigType>[4] { Architect.Workshop.Config.ConfigGroup.CustomItem, Architect.Workshop.Config.ConfigGroup.SpriteItem, Architect.Workshop.Config.ConfigGroup.UsableItem, Architect.Workshop.Config.ConfigGroup.CourierItem }); Register<CustomTool>("Tool", new Vector2(-300f, -187.5f), new List<Architect.Workshop.Types.ConfigType>[4] { Architect.Workshop.Config.ConfigGroup.CustomTool, Architect.Workshop.Config.ConfigGroup.SpriteItem, Architect.Workshop.Config.ConfigGroup.UseToolSprites, Architect.Workshop.Config.ConfigGroup.RedTools }); Register<CustomJournalEntry>("Journal Entry", new Vector2(-100f, -187.5f), new List<Architect.Workshop.Types.ConfigType>[3] { Architect.Workshop.Config.ConfigGroup.JournalEntry, Architect.Workshop.Config.ConfigGroup.SpriteItem, Architect.Workshop.Config.ConfigGroup.JournalEntrySprites }); Register<CustomQuest>("Quest", new Vector2(-100f, -150f), new List<Architect.Workshop.Types.ConfigType>[4] { Architect.Workshop.Config.ConfigGroup.Quest, Architect.Workshop.Config.ConfigGroup.QuestSprites, new List<Architect.Workshop.Types.ConfigType>(), Architect.Workshop.Config.ConfigGroup.QuestItem }); Register<SceneGroup>("Scene Group", new Vector2(-300f, -225f), new List<Architect.Workshop.Types.ConfigType>[6] { Architect.Workshop.Config.ConfigGroup.SceneGroup, Architect.Workshop.Config.ConfigGroup.SceneGroupIcon, Architect.Workshop.Config.ConfigGroup.SceneGroupMap, Architect.Workshop.Config.ConfigGroup.SceneGroupMapPos, Architect.Workshop.Config.ConfigGroup.SceneGroupMapDirIn, Architect.Workshop.Config.ConfigGroup.SceneGroupMapDirOut }); Register<CustomScene>("Scene", new Vector2(-100f, -225f), new List<Architect.Workshop.Types.ConfigType>[3] { Architect.Workshop.Config.ConfigGroup.Scene, Architect.Workshop.Config.ConfigGroup.SceneMap, Architect.Workshop.Config.ConfigGroup.SceneMapColour }); Register<CustomMateriumEntry>("Material", new Vector2(-300f, -262.5f), new List<Architect.Workshop.Types.ConfigType>[2] { Architect.Workshop.Config.ConfigGroup.MateriumEntry, Architect.Workshop.Config.ConfigGroup.SpriteItem }); Register<CustomMapIcon>("Map Icon", new Vector2(-100f, -262.5f), new List<Architect.Workshop.Types.ConfigType>[3] { Architect.Workshop.Config.ConfigGroup.MapIcon, Architect.Workshop.Config.ConfigGroup.SpriteItem, Architect.Workshop.Config.ConfigGroup.MapIconLabel }); CustomConfig.Init(); Register<CustomKeybind>("Keybind", new Vector2(-300f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Keybind }); Register<CustomOption>("Config", new Vector2(-300f, -412.5f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.ConfigOption }); Register<CustomToggle>("Toggle", new Vector2(-100f, -412.5f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Toggle }); Register<CustomCue>("Audio Cue", new Vector2(-300f, -337.5f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Cue }); CustomNeedle.Init(); Register<CustomNeedle>("Needle", new Vector2(-100f, -300f), new List<Architect.Workshop.Types.ConfigType>[2] { Architect.Workshop.Config.ConfigGroup.Needle, Architect.Workshop.Config.ConfigGroup.SpriteItem }); Register<CustomAchievement>("Achievement", new Vector2(-100f, -337.5f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Achievement }); CustomCrest.Init(); Register<CustomCrest>("Crest", new Vector2(-300f, -375f), new List<Architect.Workshop.Types.ConfigType>[3] { Architect.Workshop.Config.ConfigGroup.Crest, Architect.Workshop.Config.ConfigGroup.SpriteItem, Architect.Workshop.Config.ConfigGroup.CrestSprites }); Register<CustomCrest.CrestSlot>("Crest Slot", new Vector2(-100f, -375f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.CrestSlot }); SceneGroup.Init(); typeof(CollectableItemManager).Hook("InternalGetCollectedItems", (Func<Func<CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>>, CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>>)delegate(Func<CollectableItemManager, Func<CollectableItem, bool>, List<CollectableItem>> orig, CollectableItemManager self, Func<CollectableItem, bool> predicate) { if (Application.isPlaying) { RefreshItems(); CollectableItemsData collectables = PlayerData.instance.Collectables; foreach (string item in from item in ((SerializableNamedList<Data, NamedData>)(object)collectables).GetValidNames((Func<Data, bool>)null) where !self.IsItemInMasterList(item) select item) { ((SerializableNamedList<Data, NamedData>)(object)collectables).RuntimeData.Remove(item); CollectableItemManager.IncrementVersion(); } } return orig(self, predicate); }); typeof(HeroController).Hook("ThrowTool", (Action<Action<HeroController, bool>, HeroController, bool>)delegate(Action<HeroController, bool> orig, HeroController self, bool isAutoThrow) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected I4, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)self.willThrowTool)) { if (CustomTool.List.Contains(self.willThrowTool.name)) { ToolItemType type = self.willThrowTool.type; ToolItemType val = type; switch ((int)val) { case 3: HeroController.instance.TakeSilk(PlayerData.instance.SilkSkillCost); break; case 0: { Data savedData = self.willThrowTool.SavedData; savedData.AmountLeft--; self.willThrowTool.SavedData = savedData; ToolItemManager.ReportAllBoundAttackToolsUpdated(); break; } } } ToolBlock.DoBroadcast(self.willThrowTool.name); } orig(self, isAutoThrow); }); static void RefreshItems() { KeyValuePair<string, WorkshopItem>[] array = CustomItems.ToArray(); string key; WorkshopItem value; foreach (KeyValuePair<string, WorkshopItem> keyValuePair in array) { keyValuePair.Deconstruct(out key, out value); string key2 = key; WorkshopItem workshopItem = value; if (!((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).dictionary.ContainsKey(key2)) { workshopItem.Unregister(); workshopItem.Register(); } } KeyValuePair<string, WorkshopItem>[] array2 = CustomEntries.ToArray(); foreach (KeyValuePair<string, WorkshopItem> keyValuePair in array2) { keyValuePair.Deconstruct(out key, out value); string key3 = key; WorkshopItem workshopItem2 = value; if (!((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).dictionary.ContainsKey(key3)) { workshopItem2.Unregister(); workshopItem2.Register(); } } KeyValuePair<string, WorkshopItem>[] array3 = CustomCrests.ToArray(); foreach (KeyValuePair<string, WorkshopItem> keyValuePair in array3) { keyValuePair.Deconstruct(out key, out value); string key4 = key; WorkshopItem workshopItem3 = value; if (!((NamedScriptableObjectList<ToolCrest>)(object)ManagerSingleton<ToolItemManager>.Instance.crestList).dictionary.ContainsKey(key4)) { workshopItem3.Unregister(); workshopItem3.Register(); } } KeyValuePair<string, WorkshopItem>[] array4 = CustomQuests.ToArray(); foreach (KeyValuePair<string, WorkshopItem> keyValuePair in array4) { keyValuePair.Deconstruct(out key, out value); string key5 = key; WorkshopItem workshopItem4 = value; if (!((NamedScriptableObjectList<BasicQuestBase>)(object)QuestManager.Instance.masterList).dictionary.ContainsKey(key5)) { workshopItem4.Unregister(); workshopItem4.Register(); } } KeyValuePair<string, WorkshopItem>[] array5 = CustomTools.ToArray(); foreach (KeyValuePair<string, WorkshopItem> keyValuePair in array5) { keyValuePair.Deconstruct(out key, out value); string key6 = key; WorkshopItem workshopItem5 = value; if (!((NamedScriptableObjectList<ToolItem>)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems).dictionary.ContainsKey(key6)) { workshopItem5.Unregister(); workshopItem5.Register(); } } } } public static void Setup() { CustomAchievement.Init(); SceneUtils.InitQWHook(); StorageManager.LoadWorkshopData(); foreach (WorkshopData extWorkshop in ExtWorkshops) { foreach (WorkshopItem item in extWorkshop.Items.OrderBy((WorkshopItem i) => i.GetPriority())) { if (WorkshopData.Items.Any((WorkshopItem i) => i.Id == item.Id)) { continue; } foreach (Architect.Workshop.Types.ConfigValue value in item.CurrentConfig.Values) { value.Setup(item); } item.ExternalSource = extWorkshop.ExternalSource; item.Register(); } } } public static void LoadExtWorkshop(string name, WorkshopData data) { data.ExternalSource = name; ExtWorkshops.Add(data); } public static void LoadWorkshop(WorkshopData data) { if (data == null) { data = new WorkshopData(); } if (WorkshopData != null) { foreach (WorkshopItem item in WorkshopData.Items) { item.Unregister(); } } WorkshopData = data; foreach (WorkshopItem item2 in WorkshopData.Items.OrderBy((WorkshopItem i) => i.GetPriority())) { foreach (Architect.Workshop.Types.ConfigValue value in item2.CurrentConfig.Values) { value.Setup(item2); } item2.Register(); } WorkshopUI.Refresh(); } private static void Register<T>(string type, Vector2 pos, params List<Architect.Workshop.Types.ConfigType>[] config) where T : WorkshopItem, new() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) pos.y += 5f; WorkshopItems[type] = (pos, (string s) => new T { Id = s, Type = type, Config = config, CurrentConfig = new Dictionary<string, Architect.Workshop.Types.ConfigValue>() }); } } } namespace Architect.Workshop.Types { public class BoolConfigType<T> : ConfigType<T, BoolConfigValue<T>> where T : WorkshopItem { private bool? _defaultValue; public BoolConfigType(string name, string id, Action<T, BoolConfigValue<T>> action) : base(name, id, action) { } public BoolConfigType<T> WithDefaultValue(bool value) { _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { return _defaultValue.HasValue ? new BoolConfigValue<T>(this, _defaultValue.Value) : null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new BoolConfigElement(parent, apply, pos, currentVal); } public override ConfigValue Deserialize(string data) { return new BoolConfigValue<T>(this, Convert.ToBoolean(data, CultureInfo.InvariantCulture)); } } public class BoolConfigValue<T> : ConfigValue<BoolConfigType<T>> where T : WorkshopItem { public BoolConfigValue(BoolConfigType<T> type, bool value) { <value>P = value; base..ctor(type); } public bool GetValue() { return <value>P; } public override string SerializeValue() { return <value>P.ToString(CultureInfo.InvariantCulture); } } public class BoolConfigElement : ConfigElement { private readonly Button _input; private bool _active = true; public BoolConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown BoolConfigElement boolConfigElement = this; UIUtils.Label txt; (_input, txt) = UIUtils.MakeTextButton("Config Input", "Default", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), hasOutline: true, new Vector2(120f, 25f)); if (currentVal != null) { ((Text)txt.textComponent).text = currentVal; _active = Convert.ToBoolean(currentVal, CultureInfo.InvariantCulture); } ((UnityEvent)_input.onClick).AddListener((UnityAction)delegate { boolConfigElement._active = !boolConfigElement._active; ((Text)txt.textComponent).text = boolConfigElement._active.ToString(CultureInfo.InvariantCulture); ((Selectable)apply).interactable = true; }); } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return _active.ToString(CultureInfo.InvariantCulture); } } public class ChoiceConfigType<T> : ConfigType<T, ChoiceConfigValue<T>> where T : WorkshopItem { private int? _defaultValue; private string[] _options = Array.Empty<string>(); public ChoiceConfigType(string name, string id, Action<T, ChoiceConfigValue<T>> action) : base(name, id, action) { } public ChoiceConfigType<T> WithOptions(params string[] options) { _options = options; return this; } public ChoiceConfigType<T> WithDefaultValue(int value) { _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { return _defaultValue.HasValue ? new ChoiceConfigValue<T>(this, _defaultValue.Value) : null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new ChoiceConfigElement(parent, apply, pos, currentVal, _options); } public override ConfigValue Deserialize(string data) { if (1 == 0) { } int num = ((!(data == "False")) ? ((data == "True") ? 1 : Convert.ToInt32(data, CultureInfo.InvariantCulture)) : 0); if (1 == 0) { } int value = num; return new ChoiceConfigValue<T>(this, value); } public string GetOption(int index) { return _options[(index < _options.Length) ? index : 0]; } } public class ChoiceConfigValue<T> : ConfigValue<ChoiceConfigType<T>> where T : WorkshopItem { private readonly ChoiceConfigType<T> _type; public ChoiceConfigValue(ChoiceConfigType<T> type, int value) { <value>P = value; _type = type; base..ctor(type); } public int GetValue() { return <value>P; } public string GetStringValue() { return _type.GetOption(<value>P); } public override string SerializeValue() { return <value>P.ToString(CultureInfo.InvariantCulture); } } public class ChoiceConfigElement : ConfigElement { public class ChoiceButton : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public ChoiceConfigElement Cce; public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown InputButton button = eventData.button; InputButton val = button; switch ((int)val) { default: return; case 0: Cce._active++; break; case 1: if (Cce._active != -1) { Cce._active--; } break; case 2: return; } if (Cce._active < 0) { Cce._active += Cce._options.Length; } Cce._active %= Cce._options.Length; ((Text)Cce._txt.textComponent).text = Cce._options[Cce._active]; ((Selectable)Cce._apply).interactable = true; } } private readonly Button _input; private readonly string[] _options; private readonly Button _apply; private readonly UIUtils.Label _txt; private int _active = -1; public ChoiceConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal, string[] options) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) (Button, UIUtils.Label) tuple = UIUtils.MakeTextButton("Config Input", "Default", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), hasOutline: true, new Vector2(120f, 25f)); _input = tuple.Item1; _txt = tuple.Item2; _options = options; _apply = apply; ChoiceButton choiceButton = ((Component)_input).gameObject.AddComponent<ChoiceButton>(); choiceButton.Cce = this; if (currentVal != null) { _active = Convert.ToInt32(currentVal, CultureInfo.InvariantCulture); ((Text)_txt.textComponent).text = options[_active]; } } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return _active.ToString(CultureInfo.InvariantCulture); } } public class ColourConfigType<T> : ConfigType<T, ColourConfigValue<T>> where T : WorkshopItem { private Color? _defaultValue; public ColourConfigType(string name, string id, Action<T, ColourConfigValue<T>> action, bool alpha) { <alpha>P = alpha; base..ctor(name, id, action); } public ColourConfigType<T> WithDefaultValue(Color value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return _defaultValue.HasValue ? new ColourConfigValue<T>(this, _defaultValue.Value) : null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new ColourConfigElement(parent, apply, pos, currentVal, <alpha>P); } public override ConfigValue Deserialize(string data) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color value; try { value = JsonConvert.DeserializeObject<Color>(data); } catch { value = Color.white; } return new ColourConfigValue<T>(this, value); } } public class ColourConfigValue<T> : ConfigValue<ColourConfigType<T>> where T : WorkshopItem { public ColourConfigValue(ColourConfigType<T> type, Color value) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) <value>P = value; base..ctor(type); } public Color GetValue() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return <value>P; } public override string SerializeValue() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return JsonConvert.SerializeObject((object)<value>P); } } public class ColourConfigElement : ConfigElement { private readonly RectTransform _parent; private readonly InputField _inputR; private readonly InputField _inputG; private readonly InputField _inputB; private readonly InputField _inputA; public ColourConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal, bool alpha) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Config Input"); val.transform.parent = parent.transform; val.transform.localScale = Vector3.one; GameObject val2 = val; _parent = val2.RemoveOffset(); _parent.anchoredPosition = Vector2.op_Implicit(pos); float num = (alpha ? 17.5f : 0f); _inputR = UIUtils.MakeTextbox("R", val2, Vector2.op_Implicit(new Vector3(-35f - num, 0f)), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 80f, 25f).Item1; _inputG = UIUtils.MakeTextbox("G", val2, Vector2.op_Implicit(new Vector3(0f - num, 0f)), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 80f, 25f).Item1; _inputB = UIUtils.MakeTextbox("B", val2, Vector2.op_Implicit(new Vector3(35f - num, 0f)), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 80f, 25f).Item1; if (alpha) { _inputA = UIUtils.MakeTextbox("A", val2, Vector2.op_Implicit(new Vector3(52.5f, 0f)), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 80f, 25f).Item1; } if (currentVal != null) { Color val3 = JsonConvert.DeserializeObject<Color>(currentVal); _inputR.text = val3.r.ToString(CultureInfo.InvariantCulture); _inputG.text = val3.g.ToString(CultureInfo.InvariantCulture); _inputB.text = val3.b.ToString(CultureInfo.InvariantCulture); if (alpha) { _inputA.text = val3.a.ToString(CultureInfo.InvariantCulture); } } string lastR = _inputR.text; string lastG = _inputG.text; string lastB = _inputB.text; InputField inputR = _inputR; InputField inputG = _inputG; InputField inputB = _inputB; CharacterValidation val4 = (CharacterValidation)2; inputB.characterValidation = (CharacterValidation)2; inputR.characterValidation = (inputG.characterValidation = val4); if (alpha) { _inputA.characterValidation = (CharacterValidation)2; } ((UnityEvent<string>)(object)_inputR.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(lastR == s)) { lastR = s; ((Selectable)apply).interactable = true; } }); ((UnityEvent<string>)(object)_inputG.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(lastG == s)) { lastG = s; ((Selectable)apply).interactable = true; } }); ((UnityEvent<string>)(object)_inputB.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(lastB == s)) { lastB = s; ((Selectable)apply).interactable = true; } }); if (!alpha) { return; } string lastA = _inputA.text; ((UnityEvent<string>)(object)_inputA.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(lastA == s)) { lastA = s; ((Selectable)apply).interactable = true; } }); } public override RectTransform GetElement() { return _parent; } public override string GetValue() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!float.TryParse(_inputR.text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { result = 1f; } if (!float.TryParse(_inputG.text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { result2 = 1f; } if (!float.TryParse(_inputB.text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { result3 = 1f; } float result4 = 1f; if (Object.op_Implicit((Object)(object)_inputA)) { float.TryParse(_inputA.text, NumberStyles.Float, CultureInfo.InvariantCulture, out result4); } return JsonConvert.SerializeObject((object)new Color(result, result2, result3, result4)); } } public abstract class ConfigType(string name, string id) { public readonly string Name = name; public readonly string Id = id; public int Priority; public abstract ConfigValue Deserialize(string data); [CanBeNull] public abstract ConfigValue GetDefaultValue(); public abstract ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal); internal abstract void RunAction(WorkshopItem item, ConfigValue value); } public abstract class ConfigType<TType, TValue> : ConfigType where TType : WorkshopItem where TValue : ConfigValue { protected ConfigType(string name, string id, Action<TType, TValue> action) { <action>P = action; base..ctor(name, id); } public ConfigType<TType, TValue> WithPriority(int priority) { Priority = priority; return this; } internal override void RunAction(WorkshopItem item, ConfigValue value) { <action>P(item as TType, value as TValue); } } public abstract class ConfigValue { public abstract string SerializeValue(); public abstract string GetTypeId(); public abstract string GetName(); public abstract int GetPriority(); public abstract void Setup(WorkshopItem item); } public abstract class ConfigValue<TType>(TType type) : ConfigValue() where TType : ConfigType { public override string GetTypeId() { return <type>P.id; } public override string GetName() { return <type>P.name; } public override void Setup(WorkshopItem item) { <type>P.RunAction(item, this); } public override int GetPriority() { return <type>P.Priority; } } public abstract class ConfigElement { public abstract RectTransform GetElement(); public abstract string GetValue(); } public class FloatConfigType<T> : ConfigType<T, FloatConfigValue<T>> where T : WorkshopItem { private float? _defaultValue; public FloatConfigType(string name, string id, Action<T, FloatConfigValue<T>> action) : base(name, id, action) { } public FloatConfigType<T> WithDefaultValue(float value) { _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { return _defaultValue.HasValue ? new FloatConfigValue<T>(this, _defaultValue.Value) : null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new FloatConfigElement(parent, apply, pos, currentVal); } public override ConfigValue Deserialize(string data) { float value; try { value = Convert.ToSingle(data, CultureInfo.InvariantCulture); } catch (FormatException) { value = 9999999f; } return new FloatConfigValue<T>(this, value); } } public class FloatConfigValue<T> : ConfigValue<FloatConfigType<T>> where T : WorkshopItem { public FloatConfigValue(FloatConfigType<T> type, float value) { <value>P = value; base..ctor(type); } public float GetValue() { return <value>P; } public override string SerializeValue() { return <value>P.ToString(CultureInfo.InvariantCulture); } } public class FloatConfigElement : ConfigElement { private readonly InputField _input; public FloatConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) (_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 120f, 25f); if (currentVal != null) { _input.text = currentVal; } string last = _input.text; _input.characterValidation = (CharacterValidation)2; ((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(last == s)) { last = s; ((Selectable)apply).interactable = true; } }); } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return _input.text; } } public class IntConfigType<T> : ConfigType<T, IntConfigValue<T>> where T : WorkshopItem { private int? _defaultValue; public IntConfigType(string name, string id, Action<T, IntConfigValue<T>> action) : base(name, id, action) { } public IntConfigType<T> WithDefaultValue(int value) { _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { return _defaultValue.HasValue ? new IntConfigValue<T>(this, _defaultValue.Value) : null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new IntConfigElement(parent, apply, pos, currentVal); } public override ConfigValue Deserialize(string data) { return new IntConfigValue<T>(this, Convert.ToInt32(data, CultureInfo.InvariantCulture)); } } public class IntConfigValue<T> : ConfigValue<IntConfigType<T>> where T : WorkshopItem { public IntConfigValue(IntConfigType<T> type, int value) { <value>P = value; base..ctor(type); } public int GetValue() { return <value>P; } public override string SerializeValue() { return <value>P.ToString(CultureInfo.InvariantCulture); } } public class IntConfigElement : ConfigElement { private readonly InputField _input; public IntConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) (_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 120f, 25f); if (currentVal != null) { _input.text = currentVal; } string last = _input.text; _input.characterValidation = (CharacterValidation)1; ((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(last == s)) { last = s; ((Selectable)apply).interactable = true; } }); } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return _input.text; } } public class NoteConfigType : ConfigType<WorkshopItem, NoteConfigValue> { public NoteConfigType(string name) : base(name, string.Empty, (Action<WorkshopItem, NoteConfigValue>)delegate { }) { } public override ConfigValue GetDefaultValue() { return null; } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { return new NoteConfigElement(apply); } public override ConfigValue Deserialize(string data) { return new NoteConfigValue(this, data); } public static implicit operator NoteConfigType(string s) { return new NoteConfigType(s); } } public class NoteConfigValue : ConfigValue<NoteConfigType> { public NoteConfigValue(NoteConfigType type, string value) { <value>P = value; base..ctor(type); } public override string SerializeValue() { return <value>P; } } public class NoteConfigElement : ConfigElement { private readonly Button _input; public NoteConfigElement(Button apply) { _input = apply; ((Component)apply).gameObject.SetActive(false); ((Component)((Component)apply).GetComponent<UIUtils.LabelledButton>().label).gameObject.SetActive(false); } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return ""; } } public class StringConfigType<T> : ConfigType<T, StringConfigValue<T>> where T : WorkshopItem { [CanBeNull] private string _defaultValue; public StringConfigType(string name, string id, Action<T, StringConfigValue<T>> action) : base(name, id, action) { } public StringConfigType<T> WithDefaultValue(string value) { _defaultValue = value; return this; } public override ConfigValue GetDefaultValue() { return (_defaultValue == null) ? null : new StringConfigValue<T>(this, _defaultValue); } public override ConfigElement CreateInput(GameObject parent, Button apply, Vector3 pos, string currentVal) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new StringConfigElement(parent, apply, pos, currentVal); } public override ConfigValue Deserialize(string data) { return new StringConfigValue<T>(this, data); } } public class StringConfigValue<T> : ConfigValue<StringConfigType<T>> where T : WorkshopItem { public StringConfigValue(StringConfigType<T> type, string value) { <value>P = value; base..ctor(type); } public string GetValue() { return <value>P; } public override string SerializeValue() { return <value>P; } } public class StringConfigElement : ConfigElement { private readonly InputField _input; public StringConfigElement(GameObject parent, Button apply, Vector3 pos, [CanBeNull] string currentVal) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) (_input, _) = UIUtils.MakeTextbox("Config Input", parent, Vector2.op_Implicit(pos), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), 220f, 25f); if (currentVal != null) { _input.text = currentVal; } string last = _input.text; ((UnityEvent<string>)(object)_input.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(last == s)) { last = s; ((Selectable)apply).interactable = true; } }); } public override RectTransform GetElement() { Transform transform = ((Component)_input).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } public override string GetValue() { return _input.text; } } } namespace Architect.Workshop.Items { public class CustomAchievement : SpriteItem { private static readonly Dictionary<string, CustomAchievement> Achievements = new Dictionary<string, CustomAchievement>(); public string Name = string.Empty; public string Desc = string.Empty; public AchievementType AchievementType = (AchievementType)0; public string InsertBefore = string.Empty; public int Priority; private Achievement _achievement; public override int GetPriority() { return Priority; } public static void Init() { typeof(AchievementHandler).Hook("Start", (Action<Action<AchievementHandler>, AchievementHandler>)delegate(Action<AchievementHandler> orig, AchievementHandler self) { orig(self); CustomAchievement[] array = Achievements.Values.ToArray(); foreach (CustomAchievement customAchievement in array) { customAchievement.Unregister(); customAchievement.Register(); } }); typeof(UIManager).Hook("UIGoToAchievementsMenu", (Action<Action<UIManager>, UIManager>)delegate(Action<UIManager> orig, UIManager self) { orig(self); int num = 0; ICell[] componentsInChildren = ((Component)UIManager.instance.menuAchievementsList).GetComponentsInChildren<ICell>(); foreach (ICell val in componentsInChildren) { UIManager.instance.menuAchievementsList.SetCell(val, num); num++; } }); typeof(Language).Hook("Get", (Func<Func<string, string, string>, string, string, string>)delegate(Func<string, string, string> orig, string key, string sheetTitle) { if (sheetTitle == "Achievements") { foreach (CustomAchievement value in Achievements.Values) { if (key == value._achievement.TitleCell) { return value.Name; } if (key == value._achievement.DescriptionCell) { return value.Desc; } } } return orig(key, sheetTitle); }, typeof(string), typeof(string)); } public override void Register() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown Achievements[Id] = this; if (Object.op_Implicit((Object)(object)GameManager.instance)) { AchievementHandler achievementHandler = GameManager.instance.achievementHandler; _achievement = new Achievement { PlatformKey = Id, Type = AchievementType }; List<Achievement> achievements = achievementHandler.achievementsList.achievements; int num = achievements.FindIndex((Achievement o) => o.PlatformKey == InsertBefore); if (num != -1) { achievements.Insert(num, _achievement); } else { achievements.Add(_achievement); } base.Register(); } } protected override void OnReadySprite() { _achievement.Icon = Sprite; } public override void Unregister() { Achievements.Remove(Id); if (Object.op_Implicit((Object)(object)GameManager.instance)) { GameManager.instance.achievementHandler.achievementsList.achievements.Remove(_achievement); } } } public class CustomCrest : SpriteItem { public class CrestSlot : WorkshopItem { public string CrestId = string.Empty; public ToolItemType ToolType = (ToolItemType)0; public AttackToolBinding Binding = (AttackToolBinding)0; public Vector2 Pos; public bool Lock; public override int GetPriority() { return 2; } public override void Register() { WorkshopUI.RefreshIcon(this); if (Crests.TryGetValue(CrestId, out var value)) { value._slots.Add(this); value.Unregister(); value.Register(); } } public override void Unregister() { if (Crests.TryGetValue(CrestId, out var value)) { value._slots.Remove(this); value.Unregister(); value.Register(); } } public override Sprite GetIcon() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) return Object.op_Implicit((Object)(object)List) ? ((InventoryItemToolBase)List.crests.First().templateSlots[ToolType]).Sprite : SharerManager.Placeholder; } } public class CustomConfigGroup : ConfigGroup { public ToolCrest InheritsDashFrom; } private static readonly Dictionary<string, CustomCrest> Crests = new Dictionary<string, CustomCrest>(); private ToolCrest _crest; public LocalStr Name = string.Empty; public LocalStr Desc = string.Empty; public LocalStr NamePrefix = string.Empty; public LocalStr EquipText = string.Empty; private readonly List<CrestSlot> _slots = new List<CrestSlot>(); public string HIconUrl = string.Empty; public bool HPoint; public float HPpu = 100f; public string GIconUrl = string.Empty; public bool GPoint; public float GPpu = 100f; public string Movement = "Hunter"; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static InventoryToolCrestList <List>k__BackingField; public override (string, string)[] FilesToDownload => new(string, string)[3] { (IconUrl, "png"), (HIconUrl, "png"), (GIconUrl, "png") }; private static InventoryToolCrestList List { get { if (Object.op_Implicit((Object)(object)<List>k__BackingField)) { return <List>k__BackingField; } return <List>k__BackingField = ((IEnumerable<InventoryToolCrestList>)Resources.FindObjectsOfTypeAll<InventoryToolCrestList>()).FirstOrDefault((Func<InventoryToolCrestList, bool>)((InventoryToolCrestList c) => c.crests.Count > 0)); } } public override int GetPriority() { return 1; } public static void Init() { typeof(HeroController).Hook("Start", (Action<Action<HeroController>, HeroController>)delegate(Action<HeroController> orig, HeroController self) { CustomCrest[] array = Crests.Values.ToArray(); foreach (CustomCrest customCrest in array) { customCrest.Unregister(); customCrest.Register(); } orig(self); }); HookUtils.OnHeroAwake = (Action<HeroController>)Delegate.Combine(HookUtils.OnHeroAwake, (Action<HeroController>)delegate(HeroController controller) { PlayMakerFSM fsm = controller.sprintFSM; fsm.fsmTemplate = null; fsm.GetState("Start Attack").AddAction(delegate { if (controller.CurrentConfigGroup is CustomConfigGroup customConfigGroup) { PlayMakerFSM val = fsm; string name = customConfigGroup.InheritsDashFrom.name; if (1 == 0) { } string text = name switch { "Reaper" => "REAPER", "Wanderer" => "WANDERER", "Warrior" => "WARRIOR", "Spell" => "SHAMAN", "Toolmaster" => "TOOLMASTER", _ => string.Empty, }; if (1 == 0) { } val.SendEvent(text); } }, 6, everyFrame: false); }); } public override void Register() { //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) Crests[Id] = this; if (!Object.op_Implicit((Object)(object)HeroController.instance)) { return; } _crest = ScriptableObject.CreateInstance<ToolCrest>(); (HeroControllerConfig, ConfigGroup, ToolCrest) config = GetConfig(Movement); HeroControllerConfig item = config.Item1; ConfigGroup item2 = config.Item2; ToolCrest item3 = config.Item3; HeroControllerConfig val = Object.Instantiate<HeroControllerConfig>(item); CustomConfigGroup customConfigGroup = new CustomConfigGroup { InheritsDashFrom = item3, Config = val, ActiveRoot = item2.ActiveRoot, NormalSlashObject = item2.NormalSlashObject, AlternateSlashObject = item2.AlternateSlashObject, WallSlashObject = item2.WallSlashObject, UpSlashObject = item2.UpSlashObject, AltUpSlashObject = item2.AltUpSlashObject, DownSlashObject = item2.DownSlashObject, AltDownSlashObject = item2.AltDownSlashObject, DashStab = item2.DashStab, DashStabAlt = item2.DashStabAlt, ChargeSlash = item2.ChargeSlash, TauntSlash = item2.TauntSlash }; bool activeSelf = item2.ActiveRoot.activeSelf; ((ConfigGroup)customConfigGroup).Setup(); if (activeSelf) { item2.ActiveRoot.SetActive(true); } List<ConfigGroup> list = HeroController.instance.configs.ToList(); list.Add((ConfigGroup)(object)customConfigGroup); HeroController.instance.configs = list.ToArray(); _crest.heroConfig = val; _crest.name = Id; _crest.displayName = Name; _crest.description = Desc; _crest.getPromptDesc = Desc; _crest.itemNamePrefix = NamePrefix; _crest.equipText = EquipText; _crest.slots = ((IEnumerable<CrestSlot>)_slots).Select((Func<CrestSlot, SlotInfo>)delegate(CrestSlot c) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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) int num = FirstPosMin(_slots, (CrestSlot s) => s.Pos.y - c.Pos.y, Dist); int num2 = FirstPosMin(_slots, (CrestSlot s) => c.Pos.y - s.Pos.y, Dist); int num3 = FirstPosMin(_slots, (CrestSlot s) => c.Pos.x - s.Pos.x, Dist); int num4 = FirstPosMin(_slots, (CrestSlot s) => s.Pos.x - c.Pos.x, Dist); return new SlotInfo { Position = c.Pos, Type = c.ToolType, AttackBinding = c.Binding, NavUpIndex = num, NavDownIndex = num2, NavLeftIndex = num3, NavRightIndex = num4, NavUpFallbackIndex = num, NavDownFallbackIndex = num2, NavLeftFallbackIndex = num3, NavRightFallbackIndex = num4, IsLocked = c.Lock }; float Dist(CrestSlot s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Vector2.Distance(s.Pos, c.Pos); } }).ToArray(); ((NamedScriptableObjectList<ToolCrest>)(object)ManagerSingleton<ToolItemManager>.Instance.crestList).Add(_crest); WorkshopManager.CustomCrests.Add(Id, this); base.Register(); RefreshHSprite(); RefreshGSprite(); if (PlayerData.instance.CurrentCrestID == Id) { ToolItemManager.AutoEquip(_crest, false, false); } } private void RefreshHSprite() { if (Utility.IsNullOrWhiteSpace(HIconUrl)) { return; } CustomAssetManager.DoLoadSprite(HIconUrl, HPoint, HPpu, 1, 1, delegate(Sprite[] sprites) { if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites)) { _crest.crestSilhouette = sprites[0]; } }); } private void RefreshGSprite() { if (Utility.IsNullOrWhiteSpace(GIconUrl)) { return; } CustomAssetManager.DoLoadSprite(GIconUrl, GPoint, GPpu, 1, 1, delegate(Sprite[] sprites) { if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites)) { _crest.crestGlow = sprites[0]; } }); } public override void Unregister() { ((NamedScriptableObjectList<ToolCrest>)(object)ManagerSingleton<ToolItemManager>.Instance.crestList).Remove(_crest); WorkshopManager.CustomCrests.Remove(Id); if (!Object.op_Implicit((Object)(object)List)) { return; } InventoryToolCrest val = ((IEnumerable<InventoryToolCrest>)List.crests).FirstOrDefault((Func<InventoryToolCrest, bool>)((InventoryToolCrest c) => (Object)(object)c.CrestData == (Object)(object)_crest)); if (!Object.op_Implicit((Object)(object)val)) { return; } List.crests.Remove(val); foreach (InventoryToolCrestSlot activeSlot in val.activeSlots) { ((Component)activeSlot).gameObject.SetActive(false); } ((Component)val.crestSprite).gameObject.SetActive(false); ((Component)val.crestGlowSprite).gameObject.SetActive(false); ((Component)val.crestSilhouette).gameObject.SetActive(false); Object.Destroy((Object)(object)val); } protected override void OnReadySprite() { _crest.crestSprite = Sprite; } private static (HeroControllerConfig, ConfigGroup, ToolCrest) GetConfig(string state) { ConfigGroup val = HeroController.instance.configs.First((ConfigGroup c) => ((Object)c.Config).name == "Default"); if (1 == 0) { } (HeroControllerConfig, ToolCrest) tuple = state switch { "Reaper" => (Gameplay.ReaperCrest.heroConfig, Gameplay.ReaperCrest), "Wanderer" => (Gameplay.WandererCrest.heroConfig, Gameplay.WandererCrest), "Beast" => (Gameplay.WarriorCrest.heroConfig, Gameplay.WarriorCrest), "Cloakless" => (Gameplay.CloaklessCrest.heroConfig, Gameplay.CloaklessCrest), "Architect" => (Gameplay.ToolmasterCrest.heroConfig, Gameplay.ToolmasterCrest), "Shaman" => (Gameplay.SpellCrest.heroConfig, Gameplay.SpellCrest), "Cursed" => (Gameplay.CursedCrest.heroConfig, Gameplay.CursedCrest), "Witch" => (Gameplay.WitchCrest.heroConfig, Gameplay.WitchCrest), _ => (val.Config, Gameplay.HunterCrest), }; if (1 == 0) { } var (s, item) = tuple; return (s, ((IEnumerable<ConfigGroup>)HeroController.instance.configs).FirstOrDefault((Func<ConfigGroup, bool>)((ConfigGroup c) => (Object)(object)c.Config == (Object)(object)s)) ?? val, item); } public static int FirstPosMin<T>(IEnumerable<T> enumerable, Func<T, float> rule, Func<T, float> backupRule) { float num = float.MaxValue; float num2 = float.MaxValue; int result = -1; int num3 = -1; foreach (T item in enumerable) { num3++; float num4 = rule(item); float num5 = backupRule(item); if (!(num4 <= 0f) && (num4 < num || (Mathf.Approximately(num4, num) && num5 < num2))) { num = num4; num2 = num5; result = num3; } } return result; } } public class CustomCue : WorkshopItem { private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("audio_player", (FilterMode)1); private MusicCue _mcue; private AtmosCue _acue; private MusicChannelInfo _mci; private AtmosChannelInfo _aci; public string WavUrl = string.Empty; public bool IsAtmos; public override (string, string)[] FilesToDownload => new(string, string)[1] { (WavUrl, "wav") }; public override void Register() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown if (IsAtmos) { _acue = ScriptableObject.CreateInstance<AtmosCue>(); _aci = new AtmosChannelInfo(); _acue.alternatives = Array.Empty<Alternative>(); _acue.channelInfos = (AtmosChannelInfo[])(object)new AtmosChannelInfo[5] { _aci, new AtmosChannelInfo(), new AtmosChannelInfo(), new AtmosChannelInfo(), new AtmosChannelInfo() }; ((Object)_acue).name = Id; AudioPlayer.CustomAtmosCues.Add(Id, _acue); } else { _mcue = ScriptableObject.CreateInstance<MusicCue>(); _mci = new MusicChannelInfo(); _mcue.alternatives = Array.Empty<Alternative>(); _mcue.channelInfos = (MusicChannelInfo[])(object)new MusicChannelInfo[6] { _mci, new MusicChannelInfo(), new MusicChannelInfo(), new MusicChannelInfo(), new MusicChannelInfo(), new MusicChannelInfo() }; ((Object)_mcue).name = Id; _mcue.originalMusicEventName = string.Empty; AudioPlayer.CustomMusicCues.Add(Id, _mcue); } RefreshSound(); } private void RefreshSound() { if (Utility.IsNullOrWhiteSpace(WavUrl)) { return; } CustomAssetManager.DoLoadSound(WavUrl, delegate(AudioClip wav) { wav.LoadAudioData(); if (IsAtmos) { _aci.clip = wav; } else { _mci.clip = wav; } }); } public override void Unregister() { if (Object.op_Implicit((Object)(object)_acue)) { Object.Destroy((Object)(object)_acue); } if (Object.op_Implicit((Object)(object)_mcue)) { Object.Destroy((Object)(object)_mcue); } AudioPlayer.CustomMusicCues.Remove(Id); AudioPlayer.CustomAtmosCues.Remove(Id); } public override Sprite GetIcon() { return Icon; } } public class CustomItem : SpriteItem { public interface ICustomItem { void Register(CustomItem item); void Unregister(); void SetSprite(Sprite sprite) { } void SetAudio1(AudioClip clip) { } void SetAudio2(AudioClip clip) { } } public enum CustomItemType { Normal, Usable, Memento, Courier } public class CustomCollectable : CollectableItemMemento, ICustomItem { public string consumeEvent; public bool consume; private CustomItem _item; public override bool TakeItemOnConsume => consume; public override void ConsumeItemResponse() { if (!Utility.IsNullOrWhiteSpace(consumeEvent)) { BroadcastBlock.DoBroadcast(consumeEvent); } } public void Register(CustomItem item) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) _item = item; ((Object)this).name = item.Id; ((CollectableItemBasic)this).displayName = item.ItemName; ((CollectableItemBasic)this).description = item.ItemDesc; ((CollectableItem)this).useResponseTextOverride = item.UseType; ((CollectableItem)this).useResponses = (UseResponse[])(object)new UseResponse[1] { new UseResponse { UseType = (UseTypes)(item.ItemType == CustomItemType.Usable), Description = item.UseDesc } }; ((CollectableItem)this).customMaxAmount = item.MaxAmount; ((CollectableItemBasic)this).setExtraPlayerDataBools = Array.Empty<PlayerDataBoolOperation>(); ((CollectableItemBasic)this).setExtraPlayerDataInts = Array.Empty<PlayerDataIntOperation>(); ((CollectableItem)this).isHidden = item.Hidden; consumeEvent = item.UseEvent; consume = item.Consume; ((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Add((CollectableItem)(object)this); if (Object.op_Implicit((Object)(object)MementoList) && _item.ItemType == CustomItemType.Memento) { ((NamedScriptableObjectList<CollectableItemMemento>)(object)MementoList).Add((CollectableItemMemento)(object)this); } } public void SetSprite(Sprite sprite) { ((CollectableItemBasic)this).icon = sprite; } public void SetAudio1(AudioClip clip) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) ((CollectableItem)this).useSounds = new AudioEventRandom { Volume = _item.Volume1, PitchMax = _item.MaxPitch1, PitchMin = _item.MinPitch1, Clips = (AudioClip[])(object)new AudioClip[1] { clip } }; } public void SetAudio2(AudioClip clip) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) ((CollectableItem)this).instantUseSounds = new AudioEventRandom { Volume = _item.Volume2, PitchMax = _item.MaxPitch2, PitchMin = _item.MinPitch2, Clips = (AudioClip[])(object)new AudioClip[1] { clip } }; } public override bool IsVisibleInCollection() { if (_item.ItemType == CustomItemType.Memento) { return ((CollectableItemMemento)this).IsVisibleInCollection(); } return ((CollectableItem)this).CollectedAmount > 0; } public override string GetDescription(ReadSource readSource) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return LocalisedString.op_Implicit(((CollectableItemBasic)this).description); } public void Unregister() { ((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Remove((CollectableItem)(object)this); if (Object.op_Implicit((Object)(object)MementoList)) { ((NamedScriptableObjectList<CollectableItemMemento>)(object)MementoList).Remove((CollectableItemMemento)(object)this); } Object.Destroy((Object)(object)this); } } public class CustomCourierItem : DeliveryQuestItem, ICustomItem { public string consumeEvent; public bool consume; public int reward; public override bool TakeItemOnConsume => consume; public override void ConsumeItemResponse() { if (!Utility.IsNullOrWhiteSpace(consumeEvent)) { BroadcastBlock.DoBroadcast(consumeEvent); } } public void Register(CustomItem item) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = item.Id; base.displayName = item.ItemName; base.description = item.ItemDesc; ((CollectableItem)this).useResponseTextOverride = item.UseType; ((CollectableItem)this).useResponses = (UseResponse[])(object)new UseResponse[1] { new UseResponse { UseType = (UseTypes)0, Description = item.UseDesc } }; ((CollectableItem)this).customMaxAmount = item.MaxAmount; ((CollectableItem)this).isHidden = item.Hidden; consumeEvent = item.UseEvent; consume = item.Consume; int courierEffects = item.CourierEffects; if (1 == 0) { } SavedItem val = (SavedItem)(courierEffects switch { 0 => null, 1 => MiscUtils.GetSavedItem("Courier Supplies"), 2 => MiscUtils.GetSavedItem("Courier Supplies Slave"), _ => MiscUtils.GetSavedItem("Courier Supplies Gourmand"), }); if (1 == 0) { } DeliveryQuestItem val2 = (DeliveryQuestItem)(object)((val is DeliveryQuestItem) ? val : null); if (Object.op_Implicit((Object)(object)val2)) { base.breakHeroEffect = val2.breakHeroEffect; base.breakUIEffect = val2.breakUIEffect; base.heroLoopEffect = val2.heroLoopEffect; base.hitHeroEffect = val2.hitHeroEffect; base.hitUIEffect = val2.hitUIEffect; base.uiLoopEffect = val2.uiLoopEffect; } base.barColour = item.BarColour; base.totalTimer = item.Time; reward = item.RewardCost; ((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Add((CollectableItem)(object)this); } public void SetSprite(Sprite sprite) { base.icon = sprite; } public override bool IsVisibleInCollection() { return ((CollectableItem)this).CollectedAmount > 0; } public override string GetDescription(ReadSource readSource) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return LocalisedString.op_Implicit(base.description); } public void Unregister() { ((NamedScriptableObjectList<CollectableItem>)(object)ManagerSingleton<CollectableItemManager>.Instance.masterList).Remove((CollectableItem)(object)this); Object.Destroy((Object)(object)this); } } private ICustomItem _item; public CustomItemType ItemType = CustomItemType.Normal; public LocalStr ItemName = string.Empty; public LocalStr ItemDesc = string.Empty; public LocalStr UseDesc = string.Empty; public int MaxAmount = int.MaxValue; public bool Hidden; public LocalStr UseType = "Break"; public bool Consume; public string UseEvent; public int CourierEffects; public Color BarColour = Color.white; public int Time = 0; public int RewardCost = 0; public string WavURL1; public float Volume1 = 1f; public float MaxPitch1 = 1.2f; public float MinPitch1 = 0.8f; public string WavURL2; public float Volume2 = 1f; public float MaxPitch2 = 1.2f; public float MinPitch2 = 0.8f; private static CollectableItemMementoList _mementoList; public override (string, string)[] FilesToDownload => new(string, string)[3] { (IconUrl, "png"), (WavURL1, "wav"), (WavURL2, "wav") }; public static CollectableItemMementoList MementoList { get { if (!Object.op_Implicit((Object)(object)_mementoList)) { _mementoList = Resources.FindObjectsOfTypeAll<CollectableItemMementoList>().FirstOrDefault(); } return _mementoList; } } public override void Register() { if (ItemType == CustomItemType.Courier) { _item = ScriptableObject.CreateInstance<CustomCourierItem>(); } else { _item = ScriptableObject.CreateInstance<CustomCollectable>(); } _item.Register(this); WorkshopManager.CustomItems.Add(Id, this); base.Register(); RefreshAudio1(); RefreshAudio2(); CollectableItemManager.IncrementVersion(); } public override void Unregister() { WorkshopManager.CustomItems.Remove(Id); _item.Unregister(); CollectableItemManager.IncrementVersion(); } protected override void OnReadySprite() { _item.SetSprite(Sprite); } public void RefreshAudio1() { if (!Utility.IsNullOrWhiteSpace(WavURL1)) { CustomAssetManager.DoLoadSound(WavURL1, delegate(AudioClip clip) { _item.SetAudio1(clip); }); } } public void RefreshAudio2() { if (!Utility.IsNullOrWhiteSpace(WavURL2)) { CustomAssetManager.DoLoadSound(WavURL2, delegate(AudioClip clip) { _item.SetAudio2(clip); }); } } } public class CustomJournalEntry : SpriteItem { private EnemyJournalRecord _record; public string LIconUrl = string.Empty; public bool LPoint; public float LPpu = 100f; public LocalStr ItemName = string.Empty; public LocalStr ItemDesc = string.Empty; public LocalStr ItemHDesc = string.Empty; public string InsertBefore = string.Empty; public RequiredTypes Required = (RequiredTypes)1; public int KillsRequired = 1; public int Priority; public override int GetPriority() { return Priority; } public override void Register() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) _record = ScriptableObject.CreateInstance<EnemyJournalRecord>(); ((Object)_record).name = Id; _record.altNotesTest = new PlayerDataTest(); _record.completeOthers = Array.Empty<EnemyJournalRecord>(); _record.recordType = (RecordTypes)0; _record.killsRequired = KillsRequired; _record.displayName = ItemName; _record.description = ItemDesc; _record.notes = ItemHDesc; _record.requiredType = Required; List<EnemyJournalRecord> list = ((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).List; int num = list.FindIndex((EnemyJournalRecord o) => ((Object)o).name == InsertBefore); if (num != -1) { list.Insert(num, _record); } else { list.Add(_record); } base.Register(); RefreshLSprite(); EnemyJournalRecord byName = ((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).GetByName(Id); if (Object.op_Implicit((Object)(object)byName)) { ((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).Remove(byName); } WorkshopManager.CustomEntries.Add(Id, this); } public void RefreshLSprite() { if (Utility.IsNullOrWhiteSpace(LIconUrl)) { return; } CustomAssetManager.DoLoadSprite(LIconUrl, LPoint, LPpu, 1, 1, delegate(Sprite[] sprites) { if (!Extensions.IsNullOrEmpty<Sprite>((ICollection<Sprite>)sprites)) { _record.enemySprite = sprites[0]; } }); } protected override void OnReadySprite() { _record.iconSprite = Sprite; } public override void Unregister() { ((NamedScriptableObjectList<EnemyJournalRecord>)(object)EnemyJournalManager.Instance.recordList).Remove(_record); WorkshopManager.CustomEntries.Remove(Id); Object.Destroy((Object)(object)_record); } } public abstract class CustomConfig : WorkshopItem { public static readonly Dictionary<string, CustomConfig> Configs = new Dictionary<string, CustomConfig>(); private static readonly Dictionary<string, Dictionary<string, CustomConfig>> ExtConfigs = new Dictionary<string, Dictionary<string, CustomConfig>>(); public string Name = string.Empty; public static void Init() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) MakeScreen(LocalizedText.Key(new LocalisedString("ArchitectMap", "ArchitectMap")), Configs, () => GlobalArchitectData.Instance.MapLabel); } private static void MakeScreen(LocalizedText text, Dictionary<string, CustomConfig> configs, Func<string> mapLabel) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown SimpleMenuScreen mapKeybinds = null; List<SelectableElement> keyButtons = new List<SelectableElement>(); Registry.AddModMenu("Architect Map", (MenuElementGenerator)delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown TextButton val = new TextButton(text); val.OnSubmit = (Action)Delegate.Combine(val.OnSubmit, (Action)delegate { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown SimpleMenuScreen obj = mapKeybinds; if (obj != null) { ((MenuDisposable)obj).Dispose(); } foreach (SelectableElement item in keyButtons) { ((MenuDisposable)item).Dispose(); } keyButtons.Clear(); mapKeybinds = new SimpleMenuScreen(mapLabel()); MenuScreenNavigation.Show((AbstractMenuScreen)(object)mapKeybinds, (HistoryMode)0); foreach (SelectableElement item2 in configs.Values.Select((CustomConfig cc) => cc.GetElement())) { keyButtons.Add(item2); mapKeybinds.Add((MenuElement)(object)item2); } }); return (SelectableElement)(object)val; }); } public override void Register() { if (ExternalSource == null) { Configs.Add(Id, this); return; } if (!ExtConfigs.TryGetValue(ExternalSource, out var value)) { Dictionary<string, CustomConfig> dictionary = (ExtConfigs[ExternalSource] = new Dictionary<string, CustomConfig>()); value = dictionary; MakeScreen(LocalizedText.Raw(ExternalSource), value, () => ExternalSource); } value.Add(Id, this); } public override void Unregister() { Dictionary<string, CustomConfig> value; if (ExternalSource == null) { Configs.Remove(Id); } else if (ExtConfigs.TryGetValue(ExternalSource, out value)) { value.Remove(Id); } } protected abstract SelectableElement GetElement(); } public class CustomKeybind : CustomConfig { private class CustomKeyBindElement : KeyBindElement { public CustomKeybind Keybind; public CustomKeyBindElement(string label, [NotNull] IValueModel<KeyCode> model) : base(LocalizedText.op_Implicit(label), model) { ((SelectableValueElement<KeyCode>)this).OnValueChanged += DoChange; ((MenuDisposable)this).OnDispose += DoDispose; } private void DoChange(KeyCode code) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) GlobalArchitectData.Instance.Keybinds[Keybind.Id] = code; } private void DoDispose() { ((SelectableValueElement<KeyCode>)this).OnValueChanged -= DoChange; ((MenuDisposable)this).OnDispose -= DoDispose; } } private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("key_listener", (FilterMode)0); public KeyCode Default = (KeyCode)0; public override void Register() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) base.Register(); if (!GlobalArchitectData.Instance.Keybinds.ContainsKey(Id) || Settings.TestMode.Value) { GlobalArchitectData.Instance.Keybinds[Id] = Default; } } public override void Unregister() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 base.Unregister(); if (GlobalArchitectData.Instance.Keybinds.TryGetValue(Id, out var value) && (int)value == 0) { GlobalArchitectData.Instance.Keybinds.Remove(Id); } } protected override SelectableElement GetElement() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return (SelectableElement)(object)new CustomKeyBindElement(Name, (IValueModel<KeyCode>)(object)new ValueModel<KeyCode>(GlobalArchitectData.Instance.Keybinds[Id])) { Keybind = this }; } public override Sprite GetIcon() { return Icon; } } public class CustomOption : CustomConfig { private class CustomOptionElement<T> : TextInput<T> { private readonly CustomOption _option; public CustomOptionElement(string label, string desc, ParserTextModel<T> parser, T def, CustomOption opt) : base(LocalizedText.op_Implicit(label), (ITextModel<T>)(object)parser, LocalizedText.op_Implicit(desc)) { ((SelectableValueElement<T>)(object)this).OnValueChanged += DoChange; ((MenuDisposable)this).OnDispose += DoDispose; _option = opt; base.InputField.text = def.ToString(); } private void DoChange(T val) { if (!(val is string value)) { if (!(val is float value2)) { if (!(val is int num)) { if (val is bool value3) { GlobalArchitectData.Instance.BoolVariables[_option.Id] = value3; } } else { GlobalArchitectData.Instance.FloatVariables[_option.Id] = num; } } else { GlobalArchitectData.Instance.FloatVariables[_option.Id] = value2; } } else { GlobalArchitectData.Instance.StringVariables[_option.Id] = value; } } private void DoDispose() { ((SelectableValueElement<T>)(object)this).OnValueChanged -= DoChange; ((MenuDisposable)this).OnDispose -= DoDispose; } } public enum OptionType { Text, Int, Float } private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("choice_display", (FilterMode)0); public OptionType OType; public string Default = string.Empty; public string Desc = string.Empty; public override void Register() { base.Register(); switch (OType) { case OptionType.Text: if (!GlobalArchitectData.Instance.StringVariables.ContainsKey(Id) || Settings.TestMode.Value) { GlobalArchitectData.Instance.StringVariables[Id] = Default; } break; case OptionType.Int: case OptionType.Float: { if ((!GlobalArchitectData.Instance.FloatVariables.ContainsKey(Id) || Settings.TestMode.Value) && float.TryParse(Default, out var result)) { GlobalArchitectData.Instance.FloatVariables[Id] = result; } break; } default: throw new ArgumentOutOfRangeException(); } } protected override SelectableElement GetElement() { OptionType oType = OType; if (1 == 0) { } int result2; float result3; SelectableElement result = (SelectableElement)(oType switch { OptionType.Text => new CustomOptionElement<string>(Name, Desc, new ParserTextModel<string>((Parse<string>)delegate(string t, out string v) { v = t; return true; }, (Unparse<string>)delegate(string value, out string text) { text = value; return true; }, (string)null), GlobalArchitectData.Instance.StringVariables.GetValueOrDefault(Id, Default), this), OptionType.Int => new CustomOptionElement<int>(Name, Desc, new ParserTextModel<int>((Parse<int>)delegate(string t, out int v) { return int.TryParse(t, out v); }, (Unparse<int>)delegate(int value, out string text) { text = value.ToString(); return true; }, 0), Mathf.RoundToInt(GlobalArchitectData.Instance.FloatVariables.GetValueOrDefault(Id, int.TryParse(Default, out result2) ? result2 : 0)), this), OptionType.Float => new CustomOptionElement<float>(Name, Desc, new ParserTextModel<float>((Parse<float>)delegate(string t, out float v) { return float.TryParse(t, out v); }, (Unparse<float>)delegate(float value, out string text) { text = value.ToString(CultureInfo.InvariantCulture); return true; }, 0f), GlobalArchitectData.Instance.FloatVariables.GetValueOrDefault(Id, float.TryParse(Default, out result3) ? result3 : 0f), this), _ => throw new ArgumentOutOfRangeException(), }); if (1 == 0) { } return result; } public override Sprite GetIcon() { return Icon; } } public class CustomToggle : CustomConfig { private class CustomOptionElement : ChoiceElement<bool> { private readonly CustomToggle _option; public CustomOptionElement(string label, string desc, CustomToggle opt) : base(LocalizedText.op_Implicit(label), new List<bool>(2) { false, true }, LocalizedText.op_Implicit(desc)) { ((SelectableValueElement<bool>)(object)this).OnValueChanged += DoChange; ((MenuDisposable)this).OnDispose += DoDispose; _option = opt; ((SelectableValueElement<bool>)(object)this).Value = (GlobalArchitectData.Instance.BoolVariables.TryGetValue(_option.Id, out var value) ? value : _option.Default); } private void DoChange(bool val) { GlobalArchitectData.Instance.BoolVariables[_option.Id] = val; } private void DoDispose() { ((SelectableValueElement<bool>)(object)this).OnValueChanged -= DoChange; ((MenuDisposable)this).OnDispose -= DoDispose; } } private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("choice_display", (FilterMode)0); public bool Default = false; public string Desc = string.Empty; public override void Register() { base.Register(); if (!GlobalArchitectData.Instance.BoolVariables.ContainsKey(Id) || Settings.TestMode.Value) { GlobalArchitectData.Instance.BoolVariables[Id] = Default; } } protected override SelectableElement GetElement() { return (SelectableElement)(object)new CustomOptionElement(Name, Desc, this); } public override Sprite GetIcon() { return Icon; } } public class CustomMapIcon : SpriteIt