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 ArcadeTrophyVault v1.2.0
ArcadeTrophyVault.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using ArcadeTrophyVault.UI; using ArcadeTrophyVault.Visuals; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ArcadeTrophyVault { [BepInPlugin("arcade.valheim.arcadetrophyvault", "ArcadeTrophyVault", "1.2.0")] [BepInProcess("valheim.exe")] [BepInProcess("valheim_server.exe")] public class ArcadeTrophyVaultPlugin : BaseUnityPlugin { public const string PluginGuid = "arcade.valheim.arcadetrophyvault"; public const string PluginName = "ArcadeTrophyVault"; public const string PluginVersion = "1.2.0"; private Harmony _harmony; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("arcade.valheim.arcadetrophyvault"); try { ModConfig.Init(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(ArcadeTrophyVaultPlugin).Assembly); Log.LogInfo((object)"ArcadeTrophyVault v1.2.0 loaded and patches applied!"); } catch (Exception arg) { Log.LogError((object)$"ArcadeTrophyVault failed to patch: {arg}"); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } public static class ModConfig { public static ConfigEntry<bool> CraftFromVault; public static ConfigEntry<float> CraftRange; public static ConfigEntry<bool> PickupEnabled; public static ConfigEntry<float> PickupRange; public static ConfigEntry<float> PickupInterval; public static ConfigEntry<bool> PickupNotify; public static ConfigFile Config { get; private set; } public static void Init(ConfigFile config) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Config = config; CraftFromVault = config.Bind<bool>("1 - Crafting", "CraftFromVault", true, "Workbenches, forges, cauldrons and the hammer automatically craft using trophies stored in nearby Trophy Vaults."); CraftRange = config.Bind<float>("1 - Crafting", "Range", 20f, new ConfigDescription("Distance in meters from the player to nearby Trophy Vaults for crafting stations and hammer.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 500f), Array.Empty<object>())); PickupEnabled = config.Bind<bool>("2 - Ground Pickup", "Enabled", true, "Trophies lying or dropped on the ground near a Trophy Vault are automatically pulled into the vault."); PickupRange = config.Bind<float>("2 - Ground Pickup", "Range", 20f, new ConfigDescription("Distance in meters from a Trophy Vault to pull in dropped trophies on the ground.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); PickupInterval = config.Bind<float>("2 - Ground Pickup", "Interval", 1f, new ConfigDescription("Seconds between scans for trophies lying on the ground.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), Array.Empty<object>())); PickupNotify = config.Bind<bool>("2 - Ground Pickup", "ShowNotification", true, "Show a top-left HUD message when a dropped trophy is absorbed into the vault."); } } public class TrophyEntry { public string PrefabName; public string SharedName; public string LocalizedName; public Sprite Icon; public ItemDrop Drop; public int BiomeOrder = 9999; public string BiomeName = "Modded"; } public static class TrophyDatabase { private static readonly List<TrophyEntry> _allTrophies = new List<TrophyEntry>(); private static readonly Dictionary<string, string> _aliasToCanonical = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, List<string>> _canonicalToAliases = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, TrophyEntry> _byPrefab = new Dictionary<string, TrophyEntry>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, int> OfficialWikiOrder = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase) { { "TrophyBoar", 1 }, { "TrophyDeer", 2 }, { "TrophyNeck", 3 }, { "TrophyEikthyr", 4 }, { "TrophyGreyling", 10 }, { "TrophyGreydwarf", 11 }, { "TrophyGreydwarfBrute", 12 }, { "TrophyGreydwarfShaman", 13 }, { "TrophySkeletonPoison", 14 }, { "TrophySkeleton", 15 }, { "TrophyGhost", 16 }, { "TrophyFrostTroll", 17 }, { "TrophyTroll", 17 }, { "TrophyForestTroll", 17 }, { "TrophyBjorn", 18 }, { "TrophyBear", 18 }, { "Trophy_Bear", 18 }, { "TrophySkeletonHildir", 19 }, { "TrophyBrenna", 19 }, { "TrophyTheElder", 20 }, { "TrophyWrithan", 21 }, { "TrophyAbomination", 22 }, { "TrophyBlob", 23 }, { "TrophyDraugr", 24 }, { "TrophyDraugrFem", 24 }, { "TrophyDraugrElite", 25 }, { "TrophyLeech", 26 }, { "TrophySurtling", 27 }, { "TrophyWraith", 28 }, { "TrophyKvastur", 29 }, { "TrophyBonemass", 30 }, { "TrophyCultist", 31 }, { "TrophyHatchling", 32 }, { "TrophyFenring", 33 }, { "TrophySGolem", 34 }, { "TrophyUlv", 35 }, { "TrophyWolf", 36 }, { "TrophyBat", 37 }, { "TrophyCultist_Hildir", 38 }, { "TrophyGeirrhafa", 38 }, { "TrophyDragonQueen", 39 }, { "TrophyDeathsquito", 40 }, { "TrophyGoblin", 41 }, { "TrophyGoblinBrute", 42 }, { "TrophyGoblinShaman", 43 }, { "TrophyGrowth", 44 }, { "TrophyLox", 45 }, { "TrophyBjornUndead", 46 }, { "TrophyVile", 46 }, { "TrophyGoblinBruteBrosShaman", 47 }, { "TrophyZil", 47 }, { "TrophyGoblinBruteBrosBrute", 48 }, { "TrophyThungr", 48 }, { "TrophyGoblinKing", 49 }, { "TrophySerpent", 50 }, { "TrophyDvergr", 60 }, { "TrophyHare", 61 }, { "TrophyGjall", 62 }, { "TrophySeeker", 63 }, { "TrophySeekerBrute", 64 }, { "TrophyTick", 65 }, { "TrophySeekerQueen", 69 }, { "TrophyAsksvin", 70 }, { "TrophyBonemawSerpent", 71 }, { "TrophyBonemaw", 71 }, { "TrophyFallenValkyrie", 72 }, { "TrophyCharredArcher", 73 }, { "TrophyMorgen", 74 }, { "TrophyVolture", 75 }, { "TrophyCharredMage", 76 }, { "TrophyCharredMelee", 77 }, { "TrophyFader", 79 }, { "TrophyBarka", 90 }, { "TrophyElaking", 91 }, { "TrophyEyeless", 92 }, { "TrophyPolarBear", 93 }, { "TrophyMammoth", 94 } }; public static IReadOnlyList<TrophyEntry> AllTrophies { get { if (_allTrophies.Count == 0) { Refresh(); } return _allTrophies; } } public static void Refresh() { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Invalid comparison between Unknown and I4 if ((Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items == null || ObjectDB.instance.m_items.Count == 0) { return; } _allTrophies.Clear(); _aliasToCanonical.Clear(); _canonicalToAliases.Clear(); _byPrefab.Clear(); RegisterAlias("TrophyBear", "TrophyBjorn"); RegisterAlias("Trophy_Bear", "TrophyBjorn"); RegisterAlias("TrophyBlackBear", "TrophyBjorn"); RegisterAlias("TrophyGrizzlyBear", "TrophyBjorn"); RegisterAlias("TrophyBrownBear", "TrophyBjorn"); RegisterAlias("TrophyVile", "TrophyBjornUndead"); RegisterAlias("TrophyBrenna", "TrophySkeletonHildir"); RegisterAlias("TrophyGeirrhafa", "TrophyCultist_Hildir"); RegisterAlias("TrophyZil", "TrophyGoblinBruteBrosShaman"); RegisterAlias("TrophyThungr", "TrophyGoblinBruteBrosBrute"); RegisterAlias("TrophyBonemaw", "TrophyBonemawSerpent"); RegisterAlias("TrophyTroll", "TrophyFrostTroll"); RegisterAlias("TrophyForestTroll", "TrophyFrostTroll"); RegisterAlias("TrophyDraugrFem", "TrophyDraugr"); RegisterAlias("trophy_horse", "trophy_horse"); RegisterAlias("TrophyHorse", "trophy_horse"); HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); HashSet<string> hashSet2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (GameObject item in ObjectDB.instance.m_items) { if ((Object)(object)item == (Object)null) { continue; } ItemDrop component = item.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { continue; } SharedData shared = component.m_itemData.m_shared; if ((int)shared.m_itemType != 13 && ((Object)item).name.IndexOf("trophy", StringComparison.OrdinalIgnoreCase) < 0 && (shared.m_name == null || shared.m_name.IndexOf("trophy", StringComparison.OrdinalIgnoreCase) < 0)) { continue; } Sprite icon = component.m_itemData.GetIcon(); if ((Object)(object)icon == (Object)null) { continue; } string name = ((Object)item).name; if (hashSet2.Contains(name)) { continue; } hashSet2.Add(name); string text = ((Localization.instance != null) ? Localization.instance.Localize(shared.m_name) : shared.m_name); if (string.IsNullOrEmpty(text) || text.Trim().Length == 0 || text.StartsWith("[") || text.EndsWith("]") || text.Contains("item_trophy_")) { continue; } string text2 = shared.m_name; if (string.IsNullOrEmpty(text2)) { text2 = text; } if (hashSet.Contains(text2)) { foreach (TrophyEntry allTrophy in _allTrophies) { if (string.Equals(allTrophy.SharedName, text2, StringComparison.OrdinalIgnoreCase)) { RegisterAlias(name, allTrophy.PrefabName); break; } } continue; } hashSet.Add(text2); int officialWikiOrder = GetOfficialWikiOrder(name, shared.m_name, text); string biomeName = GetBiomeName(officialWikiOrder); TrophyEntry trophyEntry = new TrophyEntry { PrefabName = name, SharedName = shared.m_name, LocalizedName = text, Icon = icon, Drop = component, BiomeOrder = officialWikiOrder, BiomeName = biomeName }; _allTrophies.Add(trophyEntry); _byPrefab[name] = trophyEntry; RegisterAlias(name, name); if (!string.IsNullOrEmpty(shared.m_name)) { RegisterAlias(shared.m_name, name); } if (!string.IsNullOrEmpty(text)) { RegisterAlias(text, name); } } _allTrophies.Sort((TrophyEntry a, TrophyEntry b) => (a.BiomeOrder != b.BiomeOrder) ? a.BiomeOrder.CompareTo(b.BiomeOrder) : string.Compare(a.LocalizedName, b.LocalizedName, StringComparison.CurrentCultureIgnoreCase)); ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogInfo((object)$"TrophyDatabase refreshed: {_allTrophies.Count} trophies strictly ordered by official Wiki Biome progression."); } } public static void RegisterAlias(string alias, string canonical) { if (!string.IsNullOrEmpty(alias) && !string.IsNullOrEmpty(canonical)) { _aliasToCanonical[alias] = canonical; if (!_canonicalToAliases.TryGetValue(canonical, out var value)) { value = new List<string>(); _canonicalToAliases[canonical] = value; } if (!value.Exists((string x) => string.Equals(x, alias, StringComparison.OrdinalIgnoreCase))) { value.Add(alias); } } } public static string GetBiomeName(int order) { if (order >= 1 && order <= 9) { return "Meadows"; } if (order >= 10 && order <= 20) { return "Black Forest"; } if (order >= 21 && order <= 30) { return "Swamp"; } if (order >= 31 && order <= 39) { return "Mountain"; } if (order >= 40 && order <= 49) { return "Plains"; } if (order >= 50 && order <= 59) { return "Ocean"; } if (order >= 60 && order <= 69) { return "Mistlands"; } if (order >= 70 && order <= 79) { return "Ashlands"; } if (order >= 90 && order <= 99) { return "Deep North"; } return "Modded"; } public static int GetOfficialWikiOrder(string prefab, string sharedName = null, string locName = null) { if (!string.IsNullOrEmpty(prefab) && OfficialWikiOrder.TryGetValue(prefab, out var value)) { return value; } string text = (prefab + " " + sharedName + " " + locName).ToLowerInvariant(); if (text.Contains("eikthyr")) { return 4; } if (text.Contains("boar")) { return 1; } if (text.Contains("deer")) { return 2; } if (text.Contains("neck")) { return 3; } if (text.Contains("elder")) { return 20; } if (text.Contains("greyling")) { return 10; } if (text.Contains("greydwarfbrute")) { return 12; } if (text.Contains("greydwarfshaman")) { return 13; } if (text.Contains("greydwarf")) { return 11; } if (text.Contains("skeletonpoison") || text.Contains("rancid")) { return 14; } if (text.Contains("skeletonhildir") || text.Contains("brenna")) { return 19; } if (text.Contains("skeleton")) { return 15; } if (text.Contains("troll")) { return 17; } if (text.Contains("ghost")) { return 16; } if (text.Contains("bjornundead") || text.Contains("vile")) { return 46; } if (text.Contains("bjorn") || text.Contains("bear") || text.Contains("grizzly") || text.Contains("ursus")) { return 18; } if (text.Contains("bonemass")) { return 30; } if (text.Contains("writhan")) { return 21; } if (text.Contains("abomination")) { return 22; } if (text.Contains("blob")) { return 23; } if (text.Contains("draugrelite")) { return 25; } if (text.Contains("draugr")) { return 24; } if (text.Contains("leech")) { return 26; } if (text.Contains("surtling")) { return 27; } if (text.Contains("wraith")) { return 28; } if (text.Contains("kvastur")) { return 29; } if (text.Contains("dragonqueen") || text.Contains("moder")) { return 39; } if (text.Contains("wolf")) { return 36; } if (text.Contains("hatchling") || text.Contains("drake")) { return 32; } if (text.Contains("fenring")) { return 33; } if (text.Contains("cultist_hildir") || text.Contains("geirrhafa")) { return 38; } if (text.Contains("cultist")) { return 34; } if (text.Contains("ulv")) { return 35; } if (text.Contains("bat")) { return 37; } if (text.Contains("sgolem") || text.Contains("stonegolem") || text.Contains("golem")) { return 34; } if (text.Contains("goblinking") || text.Contains("yagluth")) { return 49; } if (text.Contains("deathsquito")) { return 40; } if (text.Contains("lox")) { return 45; } if (text.Contains("goblinbrutebrosshaman") || text.Contains("zil")) { return 47; } if (text.Contains("goblinbrutebrosbrute") || text.Contains("thungr")) { return 48; } if (text.Contains("goblinbrute") || text.Contains("berserker")) { return 42; } if (text.Contains("goblinshaman")) { return 43; } if (text.Contains("goblin") || text.Contains("fuling")) { return 41; } if (text.Contains("growth")) { return 44; } if (text.Contains("serpent")) { return 50; } if (text.Contains("seekerqueen")) { return 69; } if (text.Contains("seekerbrute") || text.Contains("soldiers")) { return 64; } if (text.Contains("seeker")) { return 63; } if (text.Contains("gjall")) { return 62; } if (text.Contains("tick")) { return 65; } if (text.Contains("hare")) { return 61; } if (text.Contains("dvergr")) { return 60; } if (text.Contains("fader")) { return 79; } if (text.Contains("asksvin")) { return 70; } if (text.Contains("bonemaw")) { return 71; } if (text.Contains("fallenvalkyrie") || text.Contains("valkyrie")) { return 72; } if (text.Contains("charredarcher")) { return 73; } if (text.Contains("morgen")) { return 74; } if (text.Contains("volture")) { return 75; } if (text.Contains("charredwarlock") || text.Contains("charredmage")) { return 76; } if (text.Contains("charred")) { return 77; } if (text.Contains("barka")) { return 90; } if (text.Contains("elaking")) { return 91; } if (text.Contains("eyeless")) { return 92; } if (text.Contains("polarbear") || text.Contains("polar_bear")) { return 93; } if (text.Contains("mammoth")) { return 94; } return 9999; } public static bool IsTrophyItem(string sharedName, string prefabName) { if (Find(prefabName) != null || Find(sharedName) != null) { return true; } if (sharedName != null && (sharedName.IndexOf("trophy", StringComparison.OrdinalIgnoreCase) >= 0 || sharedName.IndexOf("bjorn", StringComparison.OrdinalIgnoreCase) >= 0 || sharedName.IndexOf("horse", StringComparison.OrdinalIgnoreCase) >= 0)) { return true; } if (prefabName != null && (prefabName.IndexOf("trophy", StringComparison.OrdinalIgnoreCase) >= 0 || prefabName.IndexOf("bjorn", StringComparison.OrdinalIgnoreCase) >= 0 || prefabName.IndexOf("horse", StringComparison.OrdinalIgnoreCase) >= 0)) { return true; } return false; } public static string GetCanonicalPrefab(string prefabOrItemName) { if (string.IsNullOrEmpty(prefabOrItemName)) { return prefabOrItemName; } if (_aliasToCanonical.TryGetValue(prefabOrItemName, out var value)) { return value; } return prefabOrItemName; } public static List<string> GetAliasesFor(string canonicalPrefab) { if (string.IsNullOrEmpty(canonicalPrefab)) { return null; } if (_canonicalToAliases.TryGetValue(canonicalPrefab, out var value)) { return value; } return null; } public static TrophyEntry Find(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } string canonicalPrefab = GetCanonicalPrefab(prefabName); if (_byPrefab.TryGetValue(canonicalPrefab, out var value)) { return value; } return null; } } public class TrophyVault : MonoBehaviour, Hoverable, Interactable { public static readonly List<TrophyVault> All = new List<TrophyVault>(); private ZNetView _nview; private Piece _piece; private const string CountKeyPrefix = "tv_cnt_"; public bool IsValid => (Object)(object)_nview != (Object)null && _nview.IsValid(); private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>(); _piece = ((Component)this).GetComponent<Piece>(); if ((Object)(object)_nview != (Object)null && _nview.GetZDO() != null) { All.Add(this); _nview.Register<string, int>("RPC_AddTrophy", (Action<long, string, int>)RPC_AddTrophy); _nview.Register<string, int>("RPC_TakeTrophy", (Action<long, string, int>)RPC_TakeTrophy); } } private void OnDestroy() { All.Remove(this); } public string GetHoverText() { if (!IsValid) { return string.Empty; } string text = (((Object)(object)_piece != (Object)null) ? _piece.m_name : "Trophy Vault"); int totalTrophiesStored = GetTotalTrophiesStored(); int distinctTrophiesStored = GetDistinctTrophiesStored(); string text2 = "<color=#ffcc00><b>" + text + "</b></color>"; string text3 = $"<color=#88ccff>Trophies: <b>{totalTrophiesStored}</b> ({distinctTrophiesStored} types)</color>"; string text4 = "[<color=yellow><b>E</b></color>] Open Trophy Vault"; string text5 = "[<color=yellow><b>1-8</b></color>] Quick Deposit Trophy"; return text2 + "\n" + text3 + "\n" + text4 + "\n" + text5; } public string GetHoverName() { return ((Object)(object)_piece != (Object)null) ? _piece.m_name : "Trophy Vault"; } public float GetHoverOffset() { return 0f; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (hold || !IsValid) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return false; } TrophyVaultUI.Open(this); return true; } public bool UseItem(Humanoid user, ItemData item) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 if (item == null || !IsValid) { return false; } if ((int)item.m_shared.m_itemType != 13 && !((Object)item.m_dropPrefab).name.StartsWith("Trophy", StringComparison.OrdinalIgnoreCase)) { ((Character)user).Message((MessageType)2, "Only trophies can be placed in the Trophy Vault!", 0, (Sprite)null, false); return false; } DepositTrophy(((Object)item.m_dropPrefab).name, item.m_stack); user.GetInventory().RemoveItem(item); ((Character)user).Message((MessageType)2, $"Stored {item.m_stack}x {item.m_shared.m_name}", 0, (Sprite)null, false); return true; } public int GetTrophyCount(string prefabName) { if (!IsValid || string.IsNullOrEmpty(prefabName)) { return 0; } string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(prefabName); int num = _nview.GetZDO().GetInt("tv_cnt_" + canonicalPrefab, 0); List<string> aliasesFor = TrophyDatabase.GetAliasesFor(canonicalPrefab); if (aliasesFor != null) { for (int i = 0; i < aliasesFor.Count; i++) { string text = aliasesFor[i]; if (!string.Equals(text, canonicalPrefab, StringComparison.OrdinalIgnoreCase)) { num += _nview.GetZDO().GetInt("tv_cnt_" + text, 0); } } } return num; } public void DepositTrophy(string prefabName, int amount) { if (IsValid && amount > 0 && !string.IsNullOrEmpty(prefabName)) { string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(prefabName); if (_nview.IsOwner()) { RPC_AddTrophy(0L, canonicalPrefab, amount); return; } _nview.InvokeRPC("RPC_AddTrophy", new object[2] { canonicalPrefab, amount }); } } public void WithdrawTrophy(string prefabName, int amount) { if (IsValid && amount > 0 && !string.IsNullOrEmpty(prefabName)) { string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(prefabName); if (_nview.IsOwner()) { RPC_TakeTrophy(0L, canonicalPrefab, amount); return; } _nview.InvokeRPC("RPC_TakeTrophy", new object[2] { canonicalPrefab, amount }); } } private void RPC_AddTrophy(long sender, string prefabName, int amount) { if (IsValid && _nview.IsOwner()) { string text = "tv_cnt_" + prefabName; int num = _nview.GetZDO().GetInt(text, 0); _nview.GetZDO().Set(text, num + amount); } } private void RPC_TakeTrophy(long sender, string prefabName, int amount) { if (!IsValid || !_nview.IsOwner()) { return; } string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(prefabName); string text = "tv_cnt_" + canonicalPrefab; int num = _nview.GetZDO().GetInt(text, 0); if (num >= amount) { _nview.GetZDO().Set(text, num - amount); return; } int num2 = amount - num; _nview.GetZDO().Set(text, 0); List<string> aliasesFor = TrophyDatabase.GetAliasesFor(canonicalPrefab); if (aliasesFor == null) { return; } for (int i = 0; i < aliasesFor.Count; i++) { if (num2 <= 0) { break; } string text2 = aliasesFor[i]; if (!string.Equals(text2, canonicalPrefab, StringComparison.OrdinalIgnoreCase)) { string text3 = "tv_cnt_" + text2; int num3 = _nview.GetZDO().GetInt(text3, 0); if (num3 > 0) { int num4 = Mathf.Min(num3, num2); _nview.GetZDO().Set(text3, num3 - num4); num2 -= num4; } } } } public int GetTotalTrophiesStored() { if (!IsValid) { return 0; } int num = 0; foreach (TrophyEntry allTrophy in TrophyDatabase.AllTrophies) { num += GetTrophyCount(allTrophy.PrefabName); } return num; } public int GetDistinctTrophiesStored() { if (!IsValid) { return 0; } int num = 0; foreach (TrophyEntry allTrophy in TrophyDatabase.AllTrophies) { if (GetTrophyCount(allTrophy.PrefabName) > 0) { num++; } } return num; } } public static class TrophyVaultCrafting { private static int _contextDepth; public static float CraftRange => (ModConfig.CraftRange != null) ? ModConfig.CraftRange.Value : 20f; public static bool IsActive => _contextDepth > 0; public static void Enter() { _contextDepth++; } public static void Exit() { if (_contextDepth > 0) { _contextDepth--; } } public static int GetNearbyVaultTrophyCount(string sharedOrPrefabName) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || string.IsNullOrEmpty(sharedOrPrefabName)) { return 0; } if (ModConfig.CraftFromVault != null && !ModConfig.CraftFromVault.Value) { return 0; } string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(sharedOrPrefabName); int num = 0; float craftRange = CraftRange; float num2 = craftRange * craftRange; Vector3 position = ((Component)localPlayer).transform.position; for (int i = 0; i < TrophyVault.All.Count; i++) { TrophyVault trophyVault = TrophyVault.All[i]; if (!((Object)(object)trophyVault == (Object)null) && trophyVault.IsValid) { Vector3 val = ((Component)trophyVault).transform.position - position; if (!(((Vector3)(ref val)).sqrMagnitude > num2) && PrivateArea.CheckAccess(((Component)trophyVault).transform.position, 0f, false, false)) { num += trophyVault.GetTrophyCount(canonicalPrefab); } } } return num; } public static int WithdrawForCraft(string sharedOrPrefabName, int amount) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || amount <= 0 || string.IsNullOrEmpty(sharedOrPrefabName)) { return 0; } if (ModConfig.CraftFromVault != null && !ModConfig.CraftFromVault.Value) { return 0; } string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(sharedOrPrefabName); int num = 0; float craftRange = CraftRange; float num2 = craftRange * craftRange; Vector3 position = ((Component)localPlayer).transform.position; for (int i = 0; i < TrophyVault.All.Count; i++) { if (num >= amount) { break; } TrophyVault trophyVault = TrophyVault.All[i]; if ((Object)(object)trophyVault == (Object)null || !trophyVault.IsValid) { continue; } Vector3 val = ((Component)trophyVault).transform.position - position; if (!(((Vector3)(ref val)).sqrMagnitude > num2) && PrivateArea.CheckAccess(((Component)trophyVault).transform.position, 0f, false, false)) { int trophyCount = trophyVault.GetTrophyCount(canonicalPrefab); if (trophyCount > 0) { int num3 = Mathf.Min(trophyCount, amount - num); trophyVault.WithdrawTrophy(canonicalPrefab, num3); num += num3; } } } if (num > 0) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogInfo((object)$"Craft from Vault: consumed {num}x {canonicalPrefab} from nearby Trophy Vault."); } } return num; } } [HarmonyPatch(typeof(Player), "HaveRequirementItems")] internal static class Player_HaveRequirementItems_Patch { private static void Prefix(Player __instance, out bool __state) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { TrophyVaultCrafting.Enter(); __state = true; } else { __state = false; } } private static Exception Finalizer(Exception __exception, bool __state) { if (__state) { TrophyVaultCrafting.Exit(); } return __exception; } } [HarmonyPatch(typeof(Player), "HaveRequirements", new Type[] { typeof(Piece), typeof(RequirementMode) })] internal static class Player_HaveRequirementsPiece_Patch { private static void Prefix(Player __instance, out bool __state) { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { TrophyVaultCrafting.Enter(); __state = true; } else { __state = false; } } private static Exception Finalizer(Exception __exception, bool __state) { if (__state) { TrophyVaultCrafting.Exit(); } return __exception; } } [HarmonyPatch(typeof(InventoryGui), "SetupRequirement")] internal static class InventoryGui_SetupRequirement_Patch { private static void Prefix(Player player, out bool __state) { if ((Object)(object)player != (Object)null && (Object)(object)player == (Object)(object)Player.m_localPlayer) { TrophyVaultCrafting.Enter(); __state = true; } else { __state = false; } } private static Exception Finalizer(Exception __exception, bool __state) { if (__state) { TrophyVaultCrafting.Exit(); } return __exception; } } [HarmonyPatch(typeof(Inventory), "CountItems", new Type[] { typeof(string), typeof(int), typeof(bool) })] internal static class Inventory_CountItems_Patch { private static void Postfix(Inventory __instance, string name, int quality, ref int __result) { if (TrophyVaultCrafting.IsActive && name != null && quality <= 1 && (Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory()) { __result += TrophyVaultCrafting.GetNearbyVaultTrophyCount(name); } } } [HarmonyPatch(typeof(Inventory), "HaveItem", new Type[] { typeof(string), typeof(bool) })] internal static class Inventory_HaveItem_Patch { private static void Postfix(Inventory __instance, string name, ref bool __result) { if (!__result && TrophyVaultCrafting.IsActive && name != null && (Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory() && TrophyVaultCrafting.GetNearbyVaultTrophyCount(name) > 0) { __result = true; } } } [HarmonyPatch(typeof(Player), "ConsumeResources")] internal static class Player_ConsumeResources_Patch { private static void Prefix(Player __instance, Requirement[] requirements, int qualityLevel, int multiplier, out Dictionary<string, int> __state) { __state = new Dictionary<string, int>(); if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || requirements == null) { return; } Inventory inventory = ((Humanoid)__instance).GetInventory(); if (inventory == null) { return; } foreach (Requirement val in requirements) { if (val != null && (Object)(object)val.m_resItem != (Object)null) { string name = val.m_resItem.m_itemData.m_shared.m_name; if (TrophyDatabase.IsTrophyItem(name, ((Object)((Component)val.m_resItem).gameObject).name)) { __state[name] = inventory.CountItems(name, -1, true); } } } } private static void Postfix(Player __instance, Requirement[] requirements, int qualityLevel, int multiplier, Dictionary<string, int> __state) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || requirements == null || __state == null) { return; } CraftingStation currentCraftingStation = __instance.GetCurrentCraftingStation(); foreach (Requirement val in requirements) { if (val == null || (Object)(object)val.m_resItem == (Object)null || ((Object)(object)currentCraftingStation != (Object)null && currentCraftingStation.m_upgrader != val.m_upgraderResource) || ((Object)(object)currentCraftingStation == (Object)null && val.m_upgraderResource)) { continue; } int num = val.GetAmount(qualityLevel) * multiplier; if (num <= 0) { continue; } string name = val.m_resItem.m_itemData.m_shared.m_name; if (__state.TryGetValue(name, out var value)) { int num2 = Mathf.Min(value, num); int num3 = num - num2; if (num3 > 0) { TrophyVaultCrafting.WithdrawForCraft(name, num3); } } } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] internal static class ZNetScene_Awake_Patch { [HarmonyPostfix] private static void Postfix(ZNetScene __instance) { if ((Object)(object)__instance == (Object)null) { return; } try { TrophyVaultPrefabs.Init(__instance); } catch (Exception arg) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)$"Failed to init Trophy Vault prefab in ZNetScene: {arg}"); } } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] internal static class ObjectDB_Awake_Patch { [HarmonyPostfix] private static void Postfix(ObjectDB __instance) { if ((Object)(object)__instance == (Object)null || __instance.m_items.Count == 0) { return; } try { TrophyDatabase.Refresh(); TrophyVaultPrefabs.TryFinalize(); } catch (Exception arg) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)$"Failed to refresh TrophyDatabase in ObjectDB: {arg}"); } } } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] internal static class ObjectDB_CopyOtherDB_Patch { [HarmonyPostfix] private static void Postfix() { try { TrophyDatabase.Refresh(); TrophyVaultPrefabs.TryFinalize(); } catch (Exception arg) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)$"Failed in ObjectDB.CopyOtherDB: {arg}"); } } } } [HarmonyPatch(typeof(InventoryGui), "Hide")] internal static class InventoryGui_Hide_Patch { [HarmonyPostfix] private static void Postfix() { TrophyVaultUI.Close(); } } [HarmonyPatch(typeof(Player), "UpdateKnownRecipesList")] internal static class Player_UpdateKnownRecipesList_Patch { private static readonly FieldInfo KnownRecipesField = AccessTools.Field(typeof(Player), "m_knownRecipes"); [HarmonyPostfix] private static void Postfix(Player __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)TrophyVaultPrefabs.VaultPrefab == (Object)null || KnownRecipesField == null) { return; } try { Piece component = TrophyVaultPrefabs.VaultPrefab.GetComponent<Piece>(); if ((Object)(object)component != (Object)null && KnownRecipesField.GetValue(__instance) is HashSet<string> hashSet && !hashSet.Contains(component.m_name)) { hashSet.Add(component.m_name); } } catch { } } } [HarmonyPatch(typeof(Player), "TakeInput")] internal static class Player_TakeInput_Patch { [HarmonyPostfix] private static void Postfix(ref bool __result) { if (TrophyVaultUI.IsOpen) { __result = false; } } } [HarmonyPatch(typeof(StoreGui), "IsVisible")] internal static class StoreGui_IsVisible_Patch { [HarmonyPostfix] private static void Postfix(ref bool __result) { if (TrophyVaultUI.IsOpen) { __result = true; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class GameCamera_UpdateMouseCapture_Patch { [HarmonyPostfix] private static void Postfix() { if (TrophyVaultUI.IsOpen) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } } } [HarmonyPatch(typeof(Game), "Start")] internal static class Game_Start_Patch { [HarmonyPostfix] private static void Postfix(Game __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject.GetComponent<TrophyVaultPickup>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<TrophyVaultPickup>(); ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogInfo((object)"TrophyVaultPickup component attached to Game."); } } } } public class TrophyVaultPickup : MonoBehaviour { private static readonly FieldInfo InstancesField = AccessTools.Field(typeof(ItemDrop), "s_instances"); private static TrophyVaultPickup _instance; private float _timer; private static bool _loggedError; private void Awake() { _instance = this; } private void OnDestroy() { if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } public static void CheckAllNow() { if ((Object)(object)_instance != (Object)null) { _instance.ScanAndPickup(); } } private void Update() { _timer -= Time.deltaTime; if (!(_timer > 0f)) { float num = ((ModConfig.PickupInterval != null) ? ModConfig.PickupInterval.Value : 1f); _timer = Mathf.Max(0.25f, num); ScanAndPickup(); } } private void ScanAndPickup() { if ((ModConfig.PickupEnabled != null && !ModConfig.PickupEnabled.Value) || TrophyVault.All.Count == 0 || (Object)(object)Player.m_localPlayer == (Object)null || !(InstancesField?.GetValue(null) is List<ItemDrop> { Count: not 0 } list)) { return; } List<ItemDrop> list2 = list.ToList(); for (int i = 0; i < list2.Count; i++) { ItemDrop val = list2[i]; if ((Object)(object)val == (Object)null) { continue; } try { TryAbsorb(val); } catch (Exception arg) { if (!_loggedError) { _loggedError = true; ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)$"[ArcadeTrophyVault] Pickup error for '{((Object)val).name}': {arg}"); } } } } } public static bool TryAbsorb(ItemDrop drop) { //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)drop == (Object)null || drop.IsPiece()) { return false; } ZNetView component = ((Component)drop).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return false; } drop.Load(); ItemData itemData = drop.m_itemData; if (itemData == null || itemData.m_stack <= 0) { return false; } if (!IsTrophy(drop, itemData)) { return false; } float num = ((ModConfig.PickupRange != null) ? ModConfig.PickupRange.Value : 20f); float num2 = num * num; TrophyVault trophyVault = null; float num3 = float.MaxValue; Vector3 position = ((Component)drop).transform.position; for (int i = 0; i < TrophyVault.All.Count; i++) { TrophyVault trophyVault2 = TrophyVault.All[i]; if (!((Object)(object)trophyVault2 == (Object)null) && trophyVault2.IsValid) { Vector3 val = ((Component)trophyVault2).transform.position - position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num2 && sqrMagnitude < num3 && PrivateArea.CheckAccess(((Component)trophyVault2).transform.position, 0f, false, false)) { num3 = sqrMagnitude; trophyVault = trophyVault2; } } } if ((Object)(object)trophyVault == (Object)null) { return false; } if (!component.IsOwner()) { component.ClaimOwnership(); } string text = (((Object)(object)itemData.m_dropPrefab != (Object)null) ? ((Object)itemData.m_dropPrefab).name : ((Object)((Component)drop).gameObject).name); if (text.EndsWith("(Clone)")) { text = text.Substring(0, text.Length - 7); } string canonicalPrefab = TrophyDatabase.GetCanonicalPrefab(text); int stack = itemData.m_stack; trophyVault.DepositTrophy(canonicalPrefab, stack); if ((Object)(object)Player.m_localPlayer != (Object)null) { try { EffectList pickupEffects = ((Humanoid)Player.m_localPlayer).m_pickupEffects; if (pickupEffects != null) { pickupEffects.Create(position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } } catch { } if (ModConfig.PickupNotify != null && ModConfig.PickupNotify.Value) { float num4 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, position); if (num4 <= num * 1.5f) { string arg = ((Localization.instance != null && !string.IsNullOrEmpty(itemData.m_shared?.m_name)) ? Localization.instance.Localize(itemData.m_shared.m_name) : canonicalPrefab); ((Character)Player.m_localPlayer).Message((MessageType)1, $"Trophy Vault absorbed {stack}x {arg}", 0, (Sprite)null, false); } } } ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogInfo((object)$"[ArcadeTrophyVault] Vacuum absorbed {stack}x '{canonicalPrefab}' into Trophy Vault!"); } component.Destroy(); return true; } private static bool IsTrophy(ItemDrop drop, ItemData itemData) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if (itemData == null) { return false; } if (itemData.m_shared != null && (int)itemData.m_shared.m_itemType == 13) { return true; } string prefabName = (((Object)(object)itemData.m_dropPrefab != (Object)null) ? ((Object)itemData.m_dropPrefab).name : ((Object)((Component)drop).gameObject).name); string sharedName = ((itemData.m_shared != null) ? itemData.m_shared.m_name : null); return TrophyDatabase.IsTrophyItem(sharedName, prefabName); } } public static class TrophyVaultPrefabs { public const string PrefabName = "arcade_trophy_vault"; private static GameObject _holder; private static Sprite _customPieceIcon; private const string EmbeddedPieceIconBase64 = "iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAM10lEQVR4nO1dXYhdRx3/z/3Yu7vZTbI2CFJJYoPED6IkRVqqYlSsQh40RLDk7hL0wReLL6GKL33IiyjkRdKXvpXkRkHTT6NQak1prQ3Y2BIVrKS2BRVETTbZ3M+9Z+T3n4875/Tu5m66u/fMnPnByd5zz5zZ3P395j//mTPzu0QRERERERERERERERERERERERERERERERERERERERERoUFQzrFtZlpS4Fhcao6NhwrlnPj7D95HoeLZCy+P+7+QTwGA/CIQP7d9G129tjjW/0vuBFAE8ue2b6O8IDcCKErIn8sR+blJAovQ6gGXfBP6x5kA5kIARcjyR8U4xJCbLmC1COBmy3t27yRfcOWtd9b02caBSt5DP/5As9OT/PpGs00+kX+/B5+tkteEz7QM8wcKsdXP5uCzbWqfc+LYzjX194/+eil1nucIcPzIDnqvn60QOcDx735mpHInf/LS0PfzNoxaz882DpTG/R+IGC+iAAqOTe8CxhH+OPEYln2I9U2C8hTaR4UYxwjgzve/b9Uy//j3/4ZmyEiU1poDSId4ucIHF+v0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NEtHRy1cGriEaAU8EejgMzI4GrXl0Qmc/unOwC9i08pQngPrJy7+Mgwjhusryf/oR5TRmJnxCNoj0XgAMl0j+mtf0fK0hP0ski0ffyxjyPQChh/7gXMIGrTl93bzIEmlEAAx1AQ806RurAEb3CNph/QFGdQlbiUTnx0qXKfugZ6OIV1vfdwz1CCpMBBh16/fJc0+OXKdYBxIFbRzgDfDPF76Wy82vXncBWeQtZHe6amThkp83BCWAPKGTafUr4Xas7wrhEeQ7+ceP7LjlZwX5c9u38eur1xZpHMidRxDgqz+AwWqfz3w2wJB/KwEsLjVFUAKggmNuCPH3HNiXKnPx0uUwBeAKYc/unVQUXHnrnRTxhvws8Yb8Kpa1Y1a719tQAcQkcAxYqdVnyd8MRAHkiHhgM8kfWxdQ1DzgniHE36rVB9UFGOJX+kMUDRfH1OrHEgGK2upXwyjEBxUBsllwkXF1TBM/WcQkMKdAywc2svUDUQA5xEaH/bDWBAaG3iaSD8QIULCQn0UUQAFbvYsogAK2ehdxHmCMGCfxEREREREREREREREREREREREFw/8Bkdxl0ahFQ54AAAAASUVORK5CYII="; public static GameObject VaultPrefab { get; private set; } public static void Init(ZNetScene scene) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scene == (Object)null) { return; } GameObject prefab = scene.GetPrefab("piece_chest_wood"); if ((Object)(object)prefab == (Object)null) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)"Base piece_chest_wood not found in ZNetScene!"); } return; } if ((Object)(object)_holder != (Object)null) { Object.Destroy((Object)(object)_holder); } _holder = new GameObject("ArcadeTrophyVault_Holder"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); VaultPrefab = Object.Instantiate<GameObject>(prefab, _holder.transform, false); ((Object)VaultPrefab).name = "arcade_trophy_vault"; MonoBehaviour[] components = VaultPrefab.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val in components) { if (!(val is ZNetView) && !(val is Piece) && !(val is WearNTear)) { Object.DestroyImmediate((Object)(object)val); } } Piece component = VaultPrefab.GetComponent<Piece>(); component.m_enabled = true; component.m_name = "Trophy Vault"; component.m_description = "Ancient runic cabinet holding and displaying all monster and boss trophies."; component.m_category = (PieceCategory)4; component.m_canBeRemoved = true; ((StaticTarget)component).m_primaryTarget = false; component.m_icon = prefab.GetComponent<Piece>()?.m_icon; VaultPrefab.AddComponent<TrophyVault>(); TrophyVaultModel.Build(VaultPrefab, scene); try { Sprite customPieceIcon = GetCustomPieceIcon(); if ((Object)(object)customPieceIcon != (Object)null) { component.m_icon = customPieceIcon; } } catch (Exception ex) { ManualLogSource log2 = ArcadeTrophyVaultPlugin.Log; if (log2 != null) { log2.LogWarning((object)("Icon loading skipped: " + ex.Message)); } } RegisterInScene(scene, VaultPrefab); ManualLogSource log3 = ArcadeTrophyVaultPlugin.Log; if (log3 != null) { log3.LogInfo((object)"Trophy Vault prefab created and registered!"); } TryFinalize(); } public static Sprite GetCustomPieceIcon() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_customPieceIcon != (Object)null) { return _customPieceIcon; } try { byte[] array = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAM10lEQVR4nO1dXYhdRx3/z/3Yu7vZTbI2CFJJYoPED6IkRVqqYlSsQh40RLDk7hL0wReLL6GKL33IiyjkRdKXvpXkRkHTT6NQak1prQ3Y2BIVrKS2BRVETTbZ3M+9Z+T3n4875/Tu5m66u/fMnPnByd5zz5zZ3P395j//mTPzu0QRERERERERERERERERERERERERERERERERERERERERoUFQzrFtZlpS4Fhcao6NhwrlnPj7D95HoeLZCy+P+7+QTwGA/CIQP7d9G129tjjW/0vuBFAE8ue2b6O8IDcCKErIn8sR+blJAov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D/Q+j/3aUU0u4O1SHRb2jVEH2wseZPLNO77lPUNQthXW8cRUfrpmcEAZwS9EwCQJkF91ZsK/12qv/h79Xa7SQKWMLB/gWVMf5lKSZ9KEp4AfdW6e0YIargw/9JFZR3DrV97BJrdwwGS760AsjZxTBSe76P/xxj/7o8rYtn3R4dx05L5GNwjkBz22tT4xIdVtSwW7Q7qbB0PkXy/BZB9MJAkVH9db8PWjp+2D9dEployCyEhkcBvWNvNEtHRy1cGriEaAU8EejgMzI4GrXl0Qmc/unOwC9i08pQngPrJy7+Mgwjhusryf/oR5TRmJnxCNoj0XgAMl0j+mtf0fK0hP0ski0ffyxjyPQChh/7gXMIGrTl93bzIEmlEAAx1AQ806RurAEb3CNph/QFGdQlbiUTnx0qXKfugZ6OIV1vfdwz1CCpMBBh16/fJc0+OXKdYBxIFbRzgDfDPF76Wy82vXncBWeQtZHe6amThkp83BCWAPKGTafUr4Xas7wrhEeQ7+ceP7LjlZwX5c9u38eur1xZpHMidRxDgqz+AwWqfz3w2wJB/KwEsLjVFUAKggmNuCPH3HNiXKnPx0uUwBeAKYc/unVQUXHnrnRTxhvws8Yb8Kpa1Y1a719tQAcQkcAxYqdVnyd8MRAHkiHhgM8kfWxdQ1DzgniHE36rVB9UFGOJX+kMUDRfH1OrHEgGK2upXwyjEBxUBsllwkXF1TBM/WcQkMKdAywc2svUDUQA5xEaH/bDWBAaG3iaSD8QIULCQn0UUQAFbvYsogAK2ehdxHmCMGCfxEREREREREREREREREREREREFw/8Bkdxl0ahFQ54AAAAASUVORK5CYII="); Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, array)) { _customPieceIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); return _customPieceIcon; } } catch (Exception ex) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogError((object)("Failed to load custom piece icon: " + ex.Message)); } } return null; } private static void RegisterInScene(ZNetScene scene, GameObject prefab) { if (!((Object)(object)scene == (Object)null) && !((Object)(object)prefab == (Object)null)) { scene.m_prefabs.RemoveAll((GameObject p) => (Object)(object)p == (Object)null || ((Object)(object)p != (Object)(object)prefab && ((Object)p).name == ((Object)prefab).name)); if (!scene.m_prefabs.Contains(prefab)) { scene.m_prefabs.Add(prefab); } int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)prefab).name); if (typeof(ZNetScene).GetField("m_namedPrefabs", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(scene) is Dictionary<int, GameObject> dictionary) { dictionary[stableHashCode] = prefab; } } } public static void TryFinalize() { //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0160: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown if ((Object)(object)VaultPrefab == (Object)null || (Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items.Count == 0) { return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Hammer"); if ((Object)(object)itemPrefab == (Object)null) { return; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { return; } PieceTable buildPieces = component.m_itemData.m_shared.m_buildPieces; if ((Object)(object)buildPieces == (Object)null) { return; } Piece component2 = VaultPrefab.GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { List<Requirement> list = new List<Requirement>(); GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab("Wood"); ItemDrop val = ((itemPrefab2 != null) ? itemPrefab2.GetComponent<ItemDrop>() : null); GameObject itemPrefab3 = ObjectDB.instance.GetItemPrefab("FineWood"); ItemDrop val2 = ((itemPrefab3 != null) ? itemPrefab3.GetComponent<ItemDrop>() : null); GameObject itemPrefab4 = ObjectDB.instance.GetItemPrefab("Iron"); ItemDrop val3 = ((itemPrefab4 != null) ? itemPrefab4.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 != (Object)null) { list.Add(new Requirement { m_resItem = val2, m_amount = 10, m_recover = true }); } else if ((Object)(object)val != (Object)null) { list.Add(new Requirement { m_resItem = val, m_amount = 10, m_recover = true }); } if ((Object)(object)val3 != (Object)null) { list.Add(new Requirement { m_resItem = val3, m_amount = 2, m_recover = true }); } GameObject itemPrefab5 = ObjectDB.instance.GetItemPrefab("BoneFragments"); ItemDrop val4 = ((itemPrefab5 != null) ? itemPrefab5.GetComponent<ItemDrop>() : null); if ((Object)(object)val4 != (Object)null) { list.Add(new Requirement { m_resItem = val4, m_amount = 5, m_recover = true }); } component2.m_resources = list.ToArray(); component2.m_category = (PieceCategory)4; GameObject itemPrefab6 = ObjectDB.instance.GetItemPrefab("piece_workbench"); if ((Object)(object)itemPrefab6 != (Object)null) { component2.m_craftingStation = itemPrefab6.GetComponent<CraftingStation>(); } } buildPieces.m_pieces.RemoveAll((GameObject p) => (Object)(object)p == (Object)null || ((Object)p).name == "arcade_trophy_vault"); int num = buildPieces.m_pieces.FindIndex((GameObject p) => (Object)(object)p != (Object)null && ((Object)p).name == "piece_chest_wood"); if (num >= 0) { buildPieces.m_pieces.Insert(num + 1, VaultPrefab); } else { buildPieces.m_pieces.Add(VaultPrefab); } ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogInfo((object)"Trophy Vault successfully inserted into Hammer table!"); } } } } namespace ArcadeTrophyVault.Visuals { internal static class IconRenderer { private const int Size = 128; private const float FieldOfView = 30f; private static readonly Vector3 StudioPosition = new Vector3(0f, 7500f, 0f); internal static Sprite Render(GameObject prefab) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) if ((int)SystemInfo.graphicsDeviceType == 4) { return null; } int num = FreeLayer(); if (num < 0) { return null; } GameObject val = null; GameObject val2 = null; GameObject val3 = null; RenderTexture val4 = null; RenderTexture active = RenderTexture.active; try { val = new GameObject("ArcadeDrawers_IconStudio"); val.transform.position = StudioPosition; Matrix4x4 worldToLocalMatrix = prefab.transform.worldToLocalMatrix; MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val5 in array) { MeshFilter component = ((Component)val5).GetComponent<MeshFilter>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null) && ((Renderer)val5).enabled && !IsHidden(((Component)val5).transform, prefab.transform) && !(((Object)val5).name == "watermask")) { Matrix4x4 val6 = worldToLocalMatrix * ((Component)val5).transform.localToWorldMatrix; GameObject val7 = new GameObject(((Object)val5).name); val7.layer = num; val7.transform.SetParent(val.transform, false); val7.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val6)).GetColumn(3)); val7.transform.localRotation = ((Matrix4x4)(ref val6)).rotation; val7.transform.localScale = ((Matrix4x4)(ref val6)).lossyScale; val7.AddComponent<MeshFilter>().sharedMesh = component.sharedMesh; ((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)val5).sharedMaterials; } } Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(); if (componentsInChildren2.Length == 0) { return null; } Bounds bounds = componentsInChildren2[0].bounds; foreach (Renderer item in componentsInChildren2.Skip(1)) { ((Bounds)(ref bounds)).Encapsulate(item.bounds); } val4 = new RenderTexture(128, 128, 24, (RenderTextureFormat)0) { antiAliasing = 4 }; val2 = new GameObject("ArcadeDrawers_IconCamera"); Camera val8 = val2.AddComponent<Camera>(); ((Behaviour)val8).enabled = false; val8.clearFlags = (CameraClearFlags)2; val8.backgroundColor = new Color(0f, 0f, 0f, 0f); val8.cullingMask = 1 << num; val8.fieldOfView = 30f; val8.targetTexture = val4; Vector3 val9 = Quaternion.Euler(20f, 205f, 0f) * Vector3.forward; Vector3 extents = ((Bounds)(ref bounds)).extents; float num2 = ((Vector3)(ref extents)).magnitude / Mathf.Sin((float)Math.PI / 12f); ((Component)val8).transform.position = ((Bounds)(ref bounds)).center - val9 * num2; ((Component)val8).transform.rotation = Quaternion.LookRotation(val9); extents = ((Bounds)(ref bounds)).extents; val8.nearClipPlane = Mathf.Max(0.05f, num2 - ((Vector3)(ref extents)).magnitude * 2f); extents = ((Bounds)(ref bounds)).extents; val8.farClipPlane = num2 + ((Vector3)(ref extents)).magnitude * 2f; val3 = new GameObject("ArcadeTrophyVault_IconLight"); Light val10 = val3.AddComponent<Light>(); val10.type = (LightType)1; val10.intensity = 1.15f; val10.cullingMask = 1 << num; ((Component)val10).transform.rotation = Quaternion.Euler(35f, 160f, 0f); val8.Render(); RenderTexture.active = val4; Texture2D val11 = new Texture2D(128, 128, (TextureFormat)5, false) { name = ((Object)prefab).name + "_icon" }; val11.ReadPixels(new Rect(0f, 0f, 128f, 128f), 0, 0); val11.Apply(); if (val11.GetPixels32().Count((Color32 p) => p.a > 16) <= 327) { ManualLogSource log = ArcadeTrophyVaultPlugin.Log; if (log != null) { log.LogWarning((object)("Icon for '" + ((Object)prefab).name + "' came out empty: keeping the previous icon.")); } Object.Destroy((Object)(object)val11); return null; } return Sprite.Create(val11, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } catch (Exception ex) { ManualLogSource log2 = ArcadeTrophyVaultPlugin.Log; if (log2 != null) { log2.LogWarning((object)("Icon for '" + ((Object)prefab).name + "' not rendered: " + ex.Message)); } return null; } finally { RenderTexture.active = active; if ((Object)(object)val4 != (Object)null) { val4.Release(); Object.DestroyImmediate((Object)(object)val4); } if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)val); } if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)val2); } if ((Object)(object)val3 != (Object)null) { Object.DestroyImmediate((Object)(object)val3); } } } private static bool IsHidden(Transform part, Transform root) { Transform val = part; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) { if (!((Component)val).gameObject.activeSelf) { return true; } val = val.parent; } return false; } private static int FreeLayer() { for (int num = 31; num >= 8; num--) { if (string.IsNullOrEmpty(LayerMask.LayerToName(num))) { return num; } } return -1; } } internal sealed class MeshBuilder { private readonly List<Vector3> _vertices = new List<Vector3>(); private readonly List<Vector3> _normals = new List<Vector3>(); private readonly List<Vector2> _uvs = new List<Vector2>(); private readonly List<int> _triangles = new List<int>(); internal bool IsEmpty => _triangles.Count == 0; internal void Box(Vector3 center, Vector3 ax, Vector3 ay, Vector3 az, Vector3 half) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_004c: 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_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_005e: 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) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) Quad(center + az * half.z, ax * half.x, ay * half.y); Quad(center - az * half.z, -ax * half.x, ay * half.y); Quad(center + ax * half.x, -az * half.z, ay * half.y); Quad(center - ax * half.x, az * half.z, ay * half.y); Quad(center + ay * half.y, ax * half.x, -az * half.z); Quad(center - ay * half.y, ax * half.x, az * half.z); } internal void Box(Vector3 center, Vector3 size) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Box(center, Vector3.right, Vector3.up, Vector3.forward, size * 0.5f); } internal void Beam(Vector3 from, Vector3 to, float width, float depth, Vector3 depthHint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003f: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0072: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(from, to); if (!(num < 0.0001f)) { Vector3 val = (to - from) / num; Vector3 val2 = depthHint - Vector3.Dot(depthHint, val) * val; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude < 1E-06f) { val2 = Vector3.Cross(val, Vector3.right); normalized = ((Vector3)(ref val2)).normalized; } Vector3 ax = Vector3.Cross(val, normalized); Box((from + to) * 0.5f, ax, val, normalized, new Vector3(width * 0.5f, num * 0.5f, depth * 0.5f)); } } internal void Ring(Vector3 center, float inner, float outer, float depth, int segments) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_002d: 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_0041: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.forward * (depth * 0.5f); for (int i = 0; i < segments; i++) { Vector3 val2 = Radial((float)Math.PI * 2f * (float)i / (float)segments); Vector3 val3 = Radial((float)Math.PI * 2f * (float)(i + 1) / (float)segments); Vector3 val4 = val2 + val3; Vector3 inside = center + ((Vector3)(ref val4)).normalized * ((inner + outer) * 0.5f); Vector3 val5 = center + val2 * inner; Vector3 val6 = center + val3 * inner; Vector3 val7 = center + val2 * outer; Vector3 val8 = center + val3 * outer; QuadPoints(val5 + val, val7 + val, val8 + val, val6 + val, inside); QuadPoints(val5 - val, val7 - val, val8 - val, val6 - val, inside); QuadPoints(val7 - val, val7 + val, val8 + val, val8 - val, inside); QuadPoints(val5 - val, val5 + val, val6 + val, val6 - val, inside); } } private static Vector3 Radial(float a) { //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_001a: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Mathf.Cos(a), Mathf.Sin(a), 0f); } internal void Annulus(Vector3 center, float inner, float outer, float bottom, float top, int segments) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0037: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0063: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) //IL_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < segments; i++) { Vector3 val = Horizontal((float)Math.PI * 2f * (float)i / (float)segments); Vector3 val2 = Horizontal((float)Math.PI * 2f * (float)(i + 1) / (float)segments); Vector3 val3 = val + val2; Vector3 inside = center + ((Vector3)(ref val3)).normalized * ((inner + outer) * 0.5f) + Vector3.up * ((bottom + top) * 0.5f); Vector3 val4 = center + val * inner + Vector3.up * bottom; Vector3 val5 = center + val2 * inner + Vector3.up * bottom; Vector3 val6 = center + val * outer + Vector3.up * bottom; Vector3 val7 = center + val2 * outer + Vector3.up * bottom; Vector3 val8 = Vector3.up * (top - bottom); QuadPoints(val4 + val8, val6 + val8, val7 + val8, val5 + val8, inside); QuadPoints(val6, val7, val7 + val8, val6 + val8, inside); QuadPoints(val4, val5, val5 + val8, val4 + val8, inside); } } internal void Ribbon(IList<Vector3> points, IList<Vector3> sides, float width, float tileLength) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0072: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to inv