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.28.0
Architect/Architect.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.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 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.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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Architect")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.28.0.0")] [assembly: AssemblyInformationalVersion("3.28.0+e580782e34ca3b99fa47182fbf9ff38785592697")] [assembly: AssemblyProduct("Architect")] [assembly: AssemblyTitle("Architect")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.28.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } 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; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } 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 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 Keybinds" : CurrentMap; } [BepInPlugin("com.cometcake575.architect", "Architect", "3.28.0")] [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(); CursorManager.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); WorkshopManager.LoadExtWorkshop(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 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: 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 }); CustomKeybind.Init(); Register<CustomKeybind>("Keybind", new Vector2(-300f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Keybind }); Register<CustomCue>("Audio Cue", new Vector2(-100f, -300f), new List<Architect.Workshop.Types.ConfigType>[1] { Architect.Workshop.Config.ConfigGroup.Cue }); CustomNeedle.Init(); Register<CustomNeedle>("Needle", new Vector2(-300f, -337.5f), 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 (WorkshopItem item in from i in ExtWorkshops.SelectMany((WorkshopData data) => data.Items) orderby i.GetPriority() select i) { 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.Register(); } } public static void LoadExtWorkshop(WorkshopData data) { 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool <value>P; 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int <value>P; 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 abstract class ConfigType { public readonly string Name; public readonly string Id; public int Priority; protected ConfigType(string name, string id) { Name = name; Id = id; base..ctor(); } 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private Action<TType, TValue> <action>P; 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> : ConfigValue where TType : ConfigType { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private TType <type>P; protected ConfigValue(TType type) { <type>P = type; base..ctor(); } 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private float <value>P; 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int <value>P; 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> { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string <value>P; 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 { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string <value>P; 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; private Achievement _achievement; 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 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 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 = _slots.FirstPosMin((CrestSlot s) => s.Pos.y - c.Pos.y, Dist); int num2 = _slots.FirstPosMin((CrestSlot s) => c.Pos.y - s.Pos.y, Dist); int num3 = _slots.FirstPosMin((CrestSlot s) => c.Pos.x - s.Pos.x, Dist); int num4 = _slots.FirstPosMin((CrestSlot s) => s.Pos.x - c.Pos.x, Dist); SlotInfo result = default(SlotInfo); result.Position = c.Pos; result.Type = c.ToolType; result.AttackBinding = c.Binding; result.NavUpIndex = num; result.NavDownIndex = num2; result.NavLeftIndex = num3; result.NavRightIndex = num4; result.NavUpFallbackIndex = num; result.NavDownFallbackIndex = num2; result.NavLeftFallbackIndex = num3; result.NavRightFallbackIndex = num4; result.IsLocked = c.Lock; return result; 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 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 class CustomKeybind : WorkshopItem { public 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; } public void DoChange(KeyCode code) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) GlobalArchitectData.Instance.Keybinds[Keybind.Id] = code; } public void DoDispose() { ((SelectableValueElement<KeyCode>)this).OnValueChanged -= DoChange; ((MenuDisposable)this).OnDispose -= DoDispose; } } private static readonly Sprite Icon = ResourceUtils.LoadSpriteResource("key_listener", (FilterMode)0); public static readonly Dictionary<string, CustomKeybind> Keybinds = new Dictionary<string, CustomKeybind>(); public string Name = string.Empty; public KeyCode Default = (KeyCode)0; public override void Register() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!GlobalArchitectData.Instance.Keybinds.ContainsKey(Id) || Settings.TestMode.Value) { GlobalArchitectData.Instance.Keybinds[Id] = Default; } Keybinds.Add(Id, this); } public override void Unregister() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 Keybinds.Remove(Id); if (GlobalArchitectData.Instance.Keybinds.TryGetValue(Id, out var value) && (int)value == 0) { GlobalArchitectData.Instance.Keybinds.Remove(Id); } } public override Sprite GetIcon() { return Icon; } public static void Init() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown SimpleMenuScreen mapKeybinds = null; List<CustomKeyBindElement> keyButtons = new List<CustomKeyBindElement>(); Registry.AddModMenu("Architect Map", (MenuElementGenerator)delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown TextButton val = new TextButton(LocalizedText.Key(new LocalisedString("ArchitectMap", "ArchitectMap"))); val.OnSubmit = (Action)Delegate.Combine(val.OnSubmit, (Action)delegate { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) SimpleMenuScreen obj = mapKeybinds; if (obj != null) { ((MenuDisposable)obj).Dispose(); } foreach (CustomKeyBindElement item in keyButtons) { ((MenuDisposable)item).Dispose(); } keyButtons.Clear(); mapKeybinds = new SimpleMenuScreen(GlobalArchitectData.Instance.MapLabel); MenuScreenNavigation.Show((AbstractMenuScreen)(object)mapKeybinds, (HistoryMode)0); foreach (KeyValuePair<string, CustomKeybind> keybind in Keybinds) { keybind.Deconstruct(out var key, out var value); string key2 = key; CustomKeybind customKeybind = value; CustomKeyBindElement customKeyBindElement = new CustomKeyBindElement(customKeybind.Name, (IValueModel<KeyCode>)(object)new ValueModel<KeyCode>(GlobalArchitectData.Instance.Keybinds[key2])) { Keybind = customKeybind }; keyButtons.Add(customKeyBindElement); mapKeybinds.Add((MenuElement)(object)customKeyBindElement); } }); return (SelectableElement)(object)val; }); } } public class CustomMapIcon : SpriteItem { public class MapDisplayHandler : MonoBehaviour { public int mode; public string reqVar; public GameMapScene gms; private GameMap _gameMap; private Renderer _renderer; private void Reset() { _gameMap = ((Component)this).GetComponentInParent<GameMap>(true); } private void Awake() { _gameMap = ((Component)this).GetComponentInParent<GameMap>(); _gameMap.UpdateQuickMapDisplay += Refresh; _renderer = ((Component)this).GetComponent<Renderer>(); } private void Start() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if ((int)DisplayOnWorldMapOnly.updateState != 0) { Refresh((int)DisplayOnWorldMapOnly.updateState == 2, (MapZone)0); } } private void OnDestroy() { _gameMap.UpdateQuickMapDisplay -= Refresh; } private void Refresh(bool isQuickMap, MapZone _) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) DisplayOnWorldMapOnly.updateState = (UpdateState)((!isQuickMap) ? 1 : 2); if (Object.op_Implicit((Object)(object)_renderer)) { _renderer.enabled = (mode == 0 || mode == 1 == isQuickMap) && ShouldBeVisible(); } } private bool ShouldBeVisible() { if (!gms.IsMapped) { return false; } if (Utility.IsNullOrWhiteSpace(reqVar)) { return true; } bool value; return ArchitectData.Instance.BoolVariables.TryGetValue(reqVar, out value) && value; } } public static readonly List<CustomMapIcon> Icons = new List<CustomMapIcon>(); public string Scene = string.Empty; public Vector2 Pos = Vector2.zero; public int Mode; public string Text = string.Empty; public float FontSize = 6.2f; public Vector2 Offset = Vector2.zero; public Color Colour = Color.white; public string ReqVar; private GameObject _iconObj; private SpriteRenderer _renderer; public override void Register() { Icons.Add(this); Setup(); base.Register(); } public override void Unregister() { Icons.Remove(this); if (Object.op_Implicit((Object)(object)_iconObj)) { Object.Destroy((Object)(object)_iconObj); } } public void Setup() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0095: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (SceneUtils.CustomScenes.TryGetValue(Scene, out var value) && Object.op_Implicit((Object)(object)value.Map)) { _iconObj = Object.Instantiate<GameObject>(SceneGroup.MapIconPrefab, value.Map.transform); _iconObj.transform.localPosition = Vector2.op_Implicit(Pos); Extensions.SetLocalPositionZ(_iconObj.transform, -0.2f); _iconObj.transform.GetChild(0).localPosition = Vector2.op_Implicit(Offset); ((Renderer)_iconObj.GetComponentInChildren<MeshRenderer>()).sortingOrder = 11; _renderer = _iconObj.GetComponentInChildren<SpriteRenderer>(); ((Renderer)_renderer).sortingOrder = 11; _iconObj.GetComponentInChildren<SetTextMeshProGameText>().text = (LocalStr)Text; TextMeshPro componentInChildren = _iconObj.GetComponentInChildren<TextMeshPro>(); ((TMP_Text)componentInChildren).fontSize = FontSize; ((Graphic)componentInChildren).color = Colour; MapDisplayHandler mapDisplayHandler = ((Component)_iconObj.transform.GetChild(0)).gameObject.AddComponent<MapDisplayHandler>(); MapDisplayHandler mapDisplayHandler2 = ((Component)_iconObj.transform.GetChild(1)).gameObject.AddComponent<MapDisplayHandler>(); mapDisplayHandler.mode = Mode; mapDisplayHandler.reqVar = (mapDisplayHandler2.reqVar = ReqVar); mapDisplayHandler.gms = (mapDisplayHandler2.gms = value.Gms); _renderer.sprite = Sprite; _iconObj.SetActive(true); } } protected override void OnReadySprite() { if (Object.op_Implicit((Object)(object)_renderer)) { _renderer.sprite = Sprite; } } } public class CustomMateriumEntry : SpriteItem { private MateriumItem _item; public LocalStr ItemName = string.Empty; public LocalStr Desc = string.Empty; public string InsertBefore = string.Empty; public override void Register() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) _item = ScriptableObject.CreateInstance<MateriumItem>(); ((Object)_item).name = Id; _item.itemQuests = new List<Quest>(); _item.playerDataCondition = new PlayerDataTest(); _item.displayName = ItemName; _item.description = Desc; List<MateriumItem> list = ((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).List; int num = list.FindIndex((MateriumItem o) => ((Object)o).name == InsertBefore); if (num != -1) { list.Insert(num, _item); } else { list.Add(_item); } ((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).UpdateDictionary(); base.Register(); } public override void Unregister() { ((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).Remove(_item); ((NamedScriptableObjectList<MateriumItem>)(object)ManagerSingleton<MateriumItemManager>.Instance.masterList).UpdateDictionary(); Object.Destroy((Object)(object)_item); } protected override void OnReadySprite() { _item.icon = Sprite; } } public class CustomMenuStyle : WorkshopItem { public class FakePlayer : MonoBehaviour { private HeroController _hc; private void Start() { _hc = ((Component)this).GetComponent<HeroController>(); } private void Update() { _hc.ResetHardLandingTimer(); _hc.RelinquishControl(); Extensions.SetPosition2D(((Component)this).transform, 9999999f, 9999999f); } } public class LoadSceneContents : MonoBehaviour { public string id; private Scene _scene; public void OnEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0076: Unknown result type (might be due to invalid IL or missing references) _scene = SceneManager.CreateScene(id + "_Title"); LevelData levelData = StorageManager.LoadScene(id + "_Title"); foreach (ObjectPlacement placement in levelData.Placements) { GameObject val = placement.SpawnObject(); if (Object.op_Implicit((Object)(object)val)) { SceneManager.MoveGameObjectToScene(val, _scene); PlacementManager.Objects[placement.GetId()] = val; PlacementManager.OnPlace?.Invoke(placement.GetPlacementType().GetId(), placement.GetId(), val); } } foreach (ScriptBlock scriptBlock in levelData.ScriptBlocks) { scriptBlock.Setup(visual: false); } foreach (ScriptBlock scriptBlock2 in levelData.ScriptBlocks) { scriptBlock2.LateSetup(); } } private void OnDisable() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SceneManager.UnloadSceneAsync(_scene); } } [CompilerGenerated] private sealed class <LoadHero>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject obj; private AsyncOperationHandle<GameObject> <hero>5__1; private GameObject <player>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadHero>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) <hero>5__1 = default(AsyncOperationHandle<GameObject>); <player>5__2 = null; <>1__state = -2; } private bool MoveNext() { //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_0032: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <hero>5__1 = GameManager.instance.LoadHeroPrefab(); <>2__current = <hero>5__1; <>1__state = 1; return true; case 1: <>1__state = -1; <player>5__2 = Object.Instantiate<GameObject>(<hero>5__1.Result, obj.transform); <player>5__2.AddComponent<FakePlayer>(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly List<CustomMenuStyle> Styles = new List<CustomMenuStyle>(); private static GameObject _ms; private GameObject _parent; public static void Init() { typeof(MenuStyles).Hook("Start", (Action<Action<MenuStyles>, MenuStyles>)delegate(Action<MenuStyles> orig, MenuStyles self) { orig(self); _ms = ((Component)self).gameObject; ((MonoBehaviour)ArchitectPlugin.Instance).StartCoroutine(LoadHero(((Component)self).gameObject)); CustomMenuStyle[] array = Styles.ToArray(); foreach (CustomMenuStyle customMenuStyle in array) { customMenuStyle.Unregister(); customMenuStyle.Register(); } }); typeof(GameManager).Hook("LoadHeroPrefab", (Func<Func<GameManager, AsyncOperationHandle<GameObject>>, GameManager, AsyncOperationHandle<GameObject>>)delegate(Func<GameManager, AsyncOperationHandle<GameObject>> orig, GameManager self) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) if (Object.op_Implicit((Object)(object)HeroController._instance)) { ((Component)HeroController._instance).gameObject.RemoveComponent<FakePlayer>(); } return orig(self); }); } [IteratorStateMachine(typeof(<LoadHero>d__4))] private static IEnumerator LoadHero(GameObject obj) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadHero>d__4(0) { obj = obj }; } public override void Register() { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown Styles.Add(this); if (Object.op_Implicit((Object)(object)_ms)) { GameObject val = new GameObject(Id); val.transform.parent = _ms.transform; val.transform.localPosition = new Vector3(-5f, -7.8454f, 3.5469f); _parent = val; _parent.SetActive(false); LoadSceneContents loadSceneContents = _parent.AddComponent<LoadSceneContents>(); loadSceneContents.id = Id; } } public override void Unregister() { Styles.Remove(this); if (Object.op_Implicit((Object)(object)_parent)) { Object.Destroy((Object)(object)_parent); } } public override Sprite GetIcon() { return ArchitectPlugin.BlankSprite; } } public class CustomNeedle : SpriteItem { public static readonly Dictionary<string, CustomNeedle> Needles = new Dictionary<string, CustomNeedle>(); private static InventoryItemNail _nail; private static GameObject _nailPrefab; private DisplayState _displayState; public int Damage; public LocalStr Name = string.Empty; public LocalStr Desc = string.Empty; public float NeedleRangeMult = 1f; public int NeedleColourActive = 0; public Color NeedleColour = Color.white; public static void Init() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) typeof(InventoryItemNail).Hook("Awake", (Action<Action<InventoryItemNail>, InventoryItemNail>)delegate(Action<InventoryItemNail> orig, InventoryItemNail self) { orig(self); _nail = self; _nailPrefab = _nail.displayStates[4].DisplayObject; foreach (CustomNeedle value5 in Needles.Values) { value5.Register(); } }); typeof(InventoryItemNail).Hook("UpdateState", (Action<Action<InventoryItemNail>, InventoryItemNail>)delegate(Action<InventoryItemNail> orig, InventoryItemNail self) { orig(self); string customNeedle4 = ArchitectData.Instance.CustomNeedle; if (!Utility.IsNullOrWhiteSpace(customNeedle4) && Needles.TryGetValue(customNeedle4, out var value4)) { DisplayState[] displayStates = self.displayStates; foreach (DisplayState val5 in displayStates) { if (Object.op_Implicit((Object)(object)val5.DisplayObject)) { val5.DisplayObject.SetActive(false); } } self.currentState = value4._displayState; value4._displayState.DisplayObject.SetActive(true); } }); new Hook((MethodBase)typeof(PlayerData).GetProperty("nailDamage").GetGetMethod(), (Delegate)(Func<Func<PlayerData, int>, PlayerData, int>)delegate(Func<PlayerData, int> orig, PlayerData self) { string customNeedle3 = ArchitectData.Instance.CustomNeedle; CustomNeedle value3; return (!Utility.IsNullOrWhiteSpace(customNeedle3) && Needles.TryGetValue(customNeedle3, out value3)) ? value3.Damage : orig(self); }); typeof(NailAttackBase).Hook("OnSlashStarting", (Action<Action<NailAttackBase>, NailAttackBase>)delegate(Action<NailAttackBase> orig, NailAttackBase self) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) //IL_00ce: 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_00f1: Unknown result type (might be due to invalid IL or missing references) string customNeedle2 = ArchitectData.Instance.CustomNeedle; if (!Utility.IsNullOrWhiteSpace(customNeedle2) && Needles.TryGetValue(customNeedle2, out var value2)) { if (value2.NeedleColourActive == 1) { if (Object.op_Implicit((Object)(object)self.slashSprite)) { ((tk2dBaseSprite)self.slashSprite).color = value2.NeedleColour; } if (Object.op_Implicit((Object)(object)self.imbuedSlashAnim)) { ((tk2dBaseSprite)self.imbuedSlashSprite).color = value2.NeedleColour; } } orig(self); Transform trans