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 TotemOfSongs v1.2.0
TotemOfSongs.dll
Decompiled a week 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; using Valheim.SettingsGui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: AssemblyVersion("0.0.0.0")] namespace VKTR.TotemOfSongs; internal class OstCatalog { public class Track { public string Label; public string Name; public AudioClip[] Clips; public float Volume; } public enum CondKind { Key, Biome, Material, Recipe, Always } public class Cond { public CondKind Kind; public string Value; } public class Entry { public string Id; public string Short; public string Title; public string Where; public string Location; public string Clip; public Biome Biome; public Track Track; public Sprite Icon; public bool Failed; public List<Cond> Conds; } private class Row { public Biome Biome; public string Clip; public string Short; public string Title; public string Where; public string Unlock; public string Icon; public string Location; } public readonly Dictionary<Biome, List<Track>> BiomeTracks = new Dictionary<Biome, List<Track>>(); public readonly Dictionary<Biome, List<KeyValuePair<string, Track>>> Bosses = new Dictionary<Biome, List<KeyValuePair<string, Track>>>(); public readonly List<KeyValuePair<string, Track>> Hildir = new List<KeyValuePair<string, Track>>(); public readonly Dictionary<string, Track> HildirByChest = new Dictionary<string, Track>(StringComparer.OrdinalIgnoreCase); public readonly HashSet<string> HildirMusicNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public readonly Dictionary<string, string> BossKeyByPrefab = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); public readonly HashSet<string> BossEventNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public readonly Dictionary<string, KeyValuePair<string, Track>> BossByPrefab = new Dictionary<string, KeyValuePair<string, Track>>(); public readonly Dictionary<Biome, Track> BiomeMusic = new Dictionary<Biome, Track>(); public readonly Dictionary<Biome, List<string>> BiomeBossKeys = new Dictionary<Biome, List<string>>(); public Track MistNight; public bool Done; public readonly List<Entry> Entries = new List<Entry>(); public readonly Dictionary<Biome, Sprite> BiomeIcons = new Dictionary<Biome, Sprite>(); public readonly Dictionary<Biome, Sprite> EnemyIcons = new Dictionary<Biome, Sprite>(); private Dictionary<string, string> _chestKeys = new Dictionary<string, string>(); private readonly Dictionary<Track, string> _bossNames = new Dictionary<Track, string>(); private readonly Dictionary<string, string> _bossNameByPrefab = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private readonly Dictionary<Track, Sprite> _bossIcons = new Dictionary<Track, Sprite>(); private readonly Dictionary<Track, string> _hildirChest = new Dictionary<Track, string>(); public static readonly Biome[] BiomeOrder; private static readonly Dictionary<string, Biome> HildirBiome; private const Biome Me = (Biome)1; private const Biome Bf = (Biome)8; private const Biome Sw = (Biome)2; private const Biome Mo = (Biome)4; private const Biome Pl = (Biome)16; private const Biome Mi = (Biome)512; private const Biome As = (Biome)32; private const Biome Dn = (Biome)64; private const Biome Oc = (Biome)256; internal const string GameHomeClip = "HomeBase"; private static readonly Row[] HomeTracks; private static readonly Dictionary<Biome, string> BiomeEnemy; private static readonly Dictionary<Biome, string> BossMark; private readonly Dictionary<string, Track> _byClip = new Dictionary<string, Track>(StringComparer.OrdinalIgnoreCase); public static string MistNightMusic; public static string BiomeCombatMusic; public static string HildirMusic; private static readonly Dictionary<string, Biome> BossPrefabs; private readonly Action<string> _log; private ZoneSystem _zs; private static Row R(Biome b, string clip, string shortTitle, string title, string where, string unlock, string icon, string location = null) { //IL_0006: 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) return new Row { Biome = b, Clip = clip, Short = shortTitle, Title = title, Where = where, Unlock = unlock, Icon = icon, Location = location }; } public OstCatalog(Action<string> log) { _log = log; } public bool IsFor(ZoneSystem zs) { return (Object)(object)_zs == (Object)(object)zs; } public void Begin(ZoneSystem zs) { _zs = zs; } public void Step(int unused) { if (!Done && !((Object)(object)_zs == (Object)null)) { Done = true; Build(); } } private unsafe void Build() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<string, Biome> bossPrefab in BossPrefabs) { GameObject prefab = ZNetScene.instance.GetPrefab(bossPrefab.Key); Character val = (Character)(((Object)(object)prefab != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null || string.IsNullOrEmpty(val.m_bossEvent)) { _log("boss " + bossPrefab.Key + ": prefab/event not found"); continue; } BossEventNames.Add(val.m_bossEvent); if (!BiomeIcons.ContainsKey(bossPrefab.Value)) { Sprite val2 = TrophyIcon(prefab); if ((Object)(object)val2 != (Object)null) { BiomeIcons[bossPrefab.Value] = val2; } } string defeatSetGlobalKey = val.m_defeatSetGlobalKey; if (!string.IsNullOrEmpty(defeatSetGlobalKey)) { BossKeyByPrefab[bossPrefab.Key] = defeatSetGlobalKey; if (!BiomeBossKeys.TryGetValue(bossPrefab.Value, out var value)) { value = (BiomeBossKeys[bossPrefab.Value] = new List<string>()); } value.Add(defeatSetGlobalKey); } Track track = MusicTrack(val.m_bossEvent, bossPrefab.Key); if (track == null) { RandomEvent val3 = FindEvent(val.m_bossEvent); if (val3 != null) { track = MusicTrack(val3.m_forceMusic, bossPrefab.Key); } } if (track == null) { _log("boss " + bossPrefab.Key + ": no music for event '" + val.m_bossEvent + "'"); continue; } if (Localization.instance != null && !string.IsNullOrEmpty(val.m_name)) { Dictionary<Track, string> bossNames = _bossNames; Track key = track; string value2 = (_bossNameByPrefab[bossPrefab.Key] = Localization.instance.Localize(val.m_name)); bossNames[key] = value2; } Sprite val4 = TrophyIcon(prefab); if ((Object)(object)val4 != (Object)null) { _bossIcons[track] = val4; } if (!Bosses.TryGetValue(bossPrefab.Value, out var value3)) { value3 = (Bosses[bossPrefab.Value] = new List<KeyValuePair<string, Track>>()); } value3.Add(new KeyValuePair<string, Track>(defeatSetGlobalKey, track)); BossByPrefab[bossPrefab.Key] = new KeyValuePair<string, Track>(defeatSetGlobalKey, track); } foreach (BiomeEnvSetup biome in EnvMan.instance.m_biomes) { if (biome != null && !BiomeMusic.ContainsKey(biome.m_biome)) { Track track2 = MusicTrack(biome.m_musicDay, "biome " + ((object)Unsafe.As<Biome, Biome>(ref biome.m_biome)/*cast due to .constrained prefix*/).ToString()) ?? MusicTrack(biome.m_musicMorning, "biome " + ((object)Unsafe.As<Biome, Biome>(ref biome.m_biome)/*cast due to .constrained prefix*/).ToString()) ?? MusicTrack(biome.m_musicEvening, "biome " + ((object)Unsafe.As<Biome, Biome>(ref biome.m_biome)/*cast due to .constrained prefix*/).ToString()); if (track2 != null) { BiomeMusic[biome.m_biome] = track2; } } } foreach (KeyValuePair<string, List<string>> item in ParseMap(BiomeCombatMusic)) { if (!TryBiome(item.Key, out var b)) { _log("biome tracks: unknown biome '" + item.Key + "'"); continue; } foreach (string item2 in item.Value) { Track track3 = (item2.StartsWith("@") ? LocationTrack(item2.Substring(1)) : MusicTrack(item2, "biome " + ((object)(*(Biome*)(&b))/*cast due to .constrained prefix*/).ToString())); if (track3 == null) { _log("biome tracks [" + ((object)(*(Biome*)(&b))/*cast due to .constrained prefix*/).ToString() + "]: '" + item2 + "' not found"); } else { if (!BiomeTracks.TryGetValue(b, out var value4)) { value4 = (BiomeTracks[b] = new List<Track>()); } value4.Add(track3); } } } Dictionary<string, string> dictionary = (_chestKeys = HildirChestKeys()); foreach (KeyValuePair<string, List<string>> item3 in ParseMap(HildirMusic)) { foreach (string item4 in item3.Value) { HildirMusicNames.Add(item4); } if (!HildirByChest.ContainsKey(item3.Key) && item3.Value.Count > 0) { Track track4 = MusicTrack(item3.Value[0], "hildir " + item3.Key); if (track4 != null) { HildirByChest[item3.Key] = track4; } } if (!dictionary.TryGetValue(item3.Key, out var value5) || string.IsNullOrEmpty(value5)) { _log("hildir " + item3.Key + ": no quest key found"); continue; } foreach (string item5 in item3.Value) { Track track5 = MusicTrack(item5, "hildir " + item3.Key); if (track5 == null) { _log("hildir " + item3.Key + ": music '" + item5 + "' not found"); } else { Hildir.Add(new KeyValuePair<string, Track>(value5, track5)); _hildirChest[track5] = item3.Key; } } } MistNight = MusicTrack(MistNightMusic, "mistlands night"); if (MistNight == null) { _log("mistlands night: music '" + MistNightMusic + "' not found"); } BuildEntries(); } private void BuildEntries() { //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) foreach (NamedMusic item in MusicMan.instance.m_music) { if (item == null || item.m_clips == null) { continue; } AudioClip[] clips = item.m_clips; foreach (AudioClip val in clips) { if ((Object)(object)val != (Object)null && !_byClip.ContainsKey(((Object)val).name)) { _byClip[((Object)val).name] = new Track { Label = "music=" + item.m_name, Name = item.m_name, Clips = (AudioClip[])(object)new AudioClip[1] { val }, Volume = item.m_volume }; } } } foreach (List<Track> value9 in BiomeTracks.Values) { foreach (Track item2 in value9) { if ((Object)(object)item2.Clips[0] != (Object)null && !_byClip.ContainsKey(((Object)item2.Clips[0]).name)) { _byClip[((Object)item2.Clips[0]).name] = item2; } } } foreach (KeyValuePair<Biome, string> item3 in BiomeEnemy) { Sprite val2 = null; string[] array = item3.Value.Split('|'); for (int i = 0; i < array.Length; i++) { if ((Object)(object)(val2 = TrophyIcon(Creature(array[i].Trim()))) != (Object)null) { break; } } if ((Object)(object)val2 != (Object)null) { EnemyIcons[item3.Key] = val2; continue; } _log("biome " + ((object)item3.Key/*cast due to .constrained prefix*/).ToString() + ": no trophy for '" + item3.Value + "'"); } foreach (KeyValuePair<Biome, string> item4 in BossMark) { Sprite val3 = IconOf(item4.Value, item4.Key); if ((Object)(object)val3 != (Object)null) { BiomeIcons[item4.Key] = val3; continue; } _log("biome " + ((object)item4.Key/*cast due to .constrained prefix*/).ToString() + ": no icon for '" + item4.Value + "'"); } HashSet<string> ids = new HashSet<string>(StringComparer.OrdinalIgnoreCase); HashSet<string> clips2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); Row[] homeTracks = HomeTracks; foreach (Row row in homeTracks) { if ((int)row.Biome == 0) { AddRow(ids, clips2, row); } } Biome[] biomeOrder = BiomeOrder; foreach (Biome val4 in biomeOrder) { homeTracks = HomeTracks; foreach (Row row2 in homeTracks) { if (row2.Biome == val4) { AddRow(ids, clips2, row2); } } if (BiomeBossKeys.TryGetValue(val4, out var value)) { List<Cond> conds = KeyConds(value); if (BiomeMusic.TryGetValue(val4, out var value2)) { AddEntry(ids, clips2, val4, value2, conds, Prettify(value2.Name), "The biome's own music.", null); } if (BiomeTracks.TryGetValue(val4, out var value3)) { foreach (Track item5 in value3) { AddEntry(ids, clips2, val4, item5, conds, Prettify(item5.Name), "Combat music of this mod.", null); } } } foreach (KeyValuePair<string, Track> item6 in Hildir) { if (_hildirChest.TryGetValue(item6.Value, out var value4) && HildirBiome.TryGetValue(value4, out var value5) && value5 == val4) { AddEntry(ids, clips2, val4, item6.Value, KeyConds(new List<string> { item6.Key }), Prettify(item6.Value.Name), "Plays in one of Hildir's quest dungeons.", null); } } if (!Bosses.TryGetValue(val4, out var value6)) { continue; } foreach (KeyValuePair<string, Track> item7 in value6) { if (!_bossNames.TryGetValue(item7.Value, out var value7)) { value7 = Prettify(item7.Value.Name); } _bossIcons.TryGetValue(item7.Value, out var value8); AddEntry(ids, clips2, val4, item7.Value, KeyConds(new List<string> { item7.Key }), value7, "The fight against " + value7 + ".", value8); } } } private void AddRow(HashSet<string> ids, HashSet<string> clips, Row row) { //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) if (clips.Contains(row.Clip)) { return; } _byClip.TryGetValue(row.Clip, out var value); if (value == null && (row.Location == null || !HasLocation(row.Location))) { _log("home track '" + row.Clip + "' not found"); return; } string text = ((value != null) ? value.Name : row.Clip); if (ids.Contains(text)) { return; } ids.Add(text); clips.Add(row.Clip); string value2 = row.Short; string title = row.Title; string text2 = row.Where; if (value2 == null) { string key = (row.Unlock.StartsWith("boss:") ? row.Unlock.Substring(5) : ""); if (!_bossNameByPrefab.TryGetValue(key, out value2)) { value2 = Prettify((value != null) ? value.Name : row.Clip); } title = value2; text2 = "The fight against " + value2 + "."; } Entries.Add(new Entry { Id = text, Short = value2, Title = title, Where = text2, Biome = row.Biome, Track = value, Location = ((value == null) ? row.Location : null), Clip = row.Clip, Conds = Conds(row), Icon = Icon(row) }); } private void AddEntry(HashSet<string> ids, HashSet<string> clips, Biome b, Track t, List<Cond> conds, string title, string where, Sprite icon) { //IL_008b: 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) if (t != null && !string.IsNullOrEmpty(t.Name) && conds.Count != 0) { string name = ((Object)t.Clips[0]).name; if (!ids.Contains(t.Name) && !clips.Contains(name)) { ids.Add(t.Name); clips.Add(name); Entries.Add(new Entry { Id = t.Name, Short = title, Title = title, Where = where, Biome = b, Track = t, Clip = name, Conds = conds, Icon = icon }); } } } private static List<Cond> KeyConds(List<string> keys) { List<Cond> list = new List<Cond>(); foreach (string key in keys) { if (!string.IsNullOrEmpty(key)) { list.Add(new Cond { Kind = CondKind.Key, Value = key }); } } return list; } private static Cond BiomeCond(Biome b) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return new Cond { Kind = CondKind.Biome, Value = BiomeSector.GetBiomeName(b) }; } private List<Cond> Conds(Row row) { //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) List<Cond> list = new List<Cond>(); string[] array = row.Unlock.Split('|'); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); int num = text.IndexOf(':'); string text2 = ((num < 0) ? text : text.Substring(0, num)); string text3 = ((num < 0) ? "" : text.Substring(num + 1)); int count = list.Count; string value; switch (text2) { case "biome": list.Add(BiomeCond(row.Biome)); break; case "always": list.Add(new Cond { Kind = CondKind.Always, Value = "" }); break; case "boss": if (BossKeyByPrefab.TryGetValue(text3, out value)) { list.Add(new Cond { Kind = CondKind.Key, Value = value }); } break; case "hildir": if (_chestKeys.TryGetValue(text3, out value) && !string.IsNullOrEmpty(value)) { list.Add(new Cond { Kind = CondKind.Key, Value = value }); } break; case "item": value = ItemName(text3); if (value != null) { list.Add(new Cond { Kind = CondKind.Material, Value = value }); } break; case "recipe": value = ItemName(text3); if (value != null) { list.Add(new Cond { Kind = CondKind.Recipe, Value = value }); } break; case "piece": value = PieceName(text3); if (value != null) { list.Add(new Cond { Kind = CondKind.Recipe, Value = value }); } break; case "uses": foreach (string item in UsedBy(text3)) { list.Add(new Cond { Kind = CondKind.Recipe, Value = item }); } break; case "trader": foreach (ItemDrop item2 in TraderItems(text3)) { if (item2.m_itemData != null && item2.m_itemData.m_shared != null) { list.Add(new Cond { Kind = CondKind.Material, Value = item2.m_itemData.m_shared.m_name }); } } break; } if (list.Count == count) { _log("home track '" + row.Clip + "': unlock '" + text + "' not found"); } } if (list.Count == 0) { list.Add(BiomeCond(row.Biome)); } return list; } private Sprite Icon(Row row) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Sprite val = IconOf(row.Icon, row.Biome); if ((Object)(object)val == (Object)null) { _log("home track '" + row.Clip + "': icon '" + row.Icon + "' not found"); } return val; } private Sprite IconOf(string specs, Biome biome) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) string[] array = specs.Split('|'); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); Sprite value = null; if (text == "enemy") { EnemyIcons.TryGetValue(biome, out value); } else if (text.StartsWith("@")) { value = TrophyIcon(Creature(text.Substring(1))); } else if (text.StartsWith("pin:")) { value = PinIcon(text.Substring(4)); } else if (!text.StartsWith("trader:")) { value = ((!text.StartsWith("~")) ? ItemIcon(((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(text) : null) : ItemIcon(FindItem(text.Substring(1)))); } else { using List<ItemDrop>.Enumerator enumerator = TraderItems(text.Substring(7)).GetEnumerator(); while (enumerator.MoveNext() && !((Object)(object)(value = ItemIcon(((Component)enumerator.Current).gameObject)) != (Object)null)) { } } if ((Object)(object)value != (Object)null) { return value; } } return null; } private static Sprite ItemIcon(GameObject go) { ItemDrop val = (ItemDrop)(((Object)(object)go != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val != (Object)null) || val.m_itemData == null || val.m_itemData.m_shared == null) { return null; } return val.m_itemData.GetIcon(); } private static GameObject FindItem(string text) { if ((Object)(object)ObjectDB.instance == (Object)null || string.IsNullOrEmpty(text)) { return null; } foreach (GameObject item in ObjectDB.instance.m_items) { if (!((Object)(object)item == (Object)null)) { if (((Object)item).name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { return item; } Component component = item.GetComponent(typeof(ItemDrop)); ItemDrop val = (ItemDrop)(object)((component is ItemDrop) ? component : null); string text2 = (((Object)(object)val != (Object)null && val.m_itemData != null && val.m_itemData.m_shared != null) ? val.m_itemData.m_shared.m_name : null); if (text2 != null && text2.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { return item; } } } return null; } private static Sprite PinIcon(string type) { //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_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_0054: 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_005a: 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) if ((Object)(object)Minimap.instance == (Object)null || Minimap.instance.m_icons == null) { return null; } PinType val; try { val = (PinType)Enum.Parse(typeof(PinType), type, ignoreCase: true); } catch (Exception) { return null; } foreach (SpriteData icon in Minimap.instance.m_icons) { if (icon.m_name == val) { return icon.m_icon; } } return null; } private static string ItemName(string prefab) { GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(prefab) : null); ItemDrop val2 = (ItemDrop)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val2 != (Object)null) || val2.m_itemData == null || val2.m_itemData.m_shared == null) { return null; } return val2.m_itemData.m_shared.m_name; } private static List<string> UsedBy(string itemPrefab) { HashSet<string> hashSet = new HashSet<string>(); if ((Object)(object)ObjectDB.instance != (Object)null) { foreach (Recipe recipe in ObjectDB.instance.m_recipes) { if ((Object)(object)recipe != (Object)null && recipe.m_enabled && (Object)(object)recipe.m_item != (Object)null && recipe.m_item.m_itemData != null && recipe.m_item.m_itemData.m_shared != null && Needs(recipe.m_resources, itemPrefab)) { hashSet.Add(recipe.m_item.m_itemData.m_shared.m_name); } } } if ((Object)(object)ZNetScene.instance != (Object)null) { foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { Piece val = (Piece)(((Object)(object)prefab != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null && val.m_enabled && !string.IsNullOrEmpty(val.m_name) && Needs(val.m_resources, itemPrefab)) { hashSet.Add(val.m_name); } } } return new List<string>(hashSet); } private static bool Needs(Requirement[] resources, string itemPrefab) { if (resources == null) { return false; } foreach (Requirement val in resources) { if (val != null && (Object)(object)val.m_resItem != (Object)null && ((Object)val.m_resItem).name == itemPrefab) { return true; } } return false; } private static string PieceName(string prefab) { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(prefab) : null); Piece val2 = (Piece)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val2 != (Object)null) || string.IsNullOrEmpty(val2.m_name)) { return null; } return val2.m_name; } private static List<ItemDrop> TraderItems(string name) { List<ItemDrop> list = new List<ItemDrop>(); GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(name) : null); Trader val2 = (Trader)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 == (Object)null || val2.m_items == null) { return list; } foreach (TradeItem item in val2.m_items) { if (item != null && (Object)(object)item.m_prefab != (Object)null) { list.Add(item.m_prefab); } } return list; } private static GameObject Creature(string name) { if ((Object)(object)ZNetScene.instance == (Object)null || string.IsNullOrEmpty(name)) { return null; } if (!name.StartsWith("~")) { return ZNetScene.instance.GetPrefab(name); } string value = name.Substring(1); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if ((Object)(object)prefab != (Object)null && ((Object)prefab).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0 && (Object)(object)prefab.GetComponent(typeof(Character)) != (Object)null) { return prefab; } } return null; } public Track Resolve(Entry e) { if (e.Track != null || e.Failed || e.Location == null) { return e.Track; } try { e.Track = LocationTrack(e.Location); } catch (Exception ex) { e.Track = null; _log("poi " + e.Clip + ": " + ex.GetType().Name + ": " + ex.Message); } if (e.Track == null) { e.Failed = true; _log("poi " + e.Clip + ": no music found at location '" + e.Location + "'"); } else if (!string.Equals(((Object)e.Track.Clips[0]).name, e.Clip, StringComparison.OrdinalIgnoreCase)) { _log("poi " + e.Clip + ": location '" + e.Location + "' plays '" + ((Object)e.Track.Clips[0]).name + "'"); } return e.Track; } private bool HasLocation(string prefabName) { foreach (ZoneLocation location in _zs.m_locations) { if (location != null && location.m_prefabName == prefabName) { return true; } } return false; } private static string Prettify(string name) { if (string.IsNullOrEmpty(name)) { return ""; } string text = name.TrimStart('@').Replace('_', ' '); if (text.Length <= 0) { return text; } return char.ToUpperInvariant(text[0]) + text.Substring(1); } private static Sprite TrophyIcon(GameObject creature) { if ((Object)(object)creature == (Object)null) { return null; } Component component = creature.GetComponent(typeof(CharacterDrop)); CharacterDrop val = (CharacterDrop)(object)((component is CharacterDrop) ? component : null); if ((Object)(object)val != (Object)null && val.m_drops != null) { foreach (Drop drop in val.m_drops) { if (drop != null && !((Object)(object)drop.m_prefab == (Object)null) && ((Object)drop.m_prefab).name.StartsWith("Trophy", StringComparison.OrdinalIgnoreCase)) { Sprite val2 = ItemIcon(drop.m_prefab); if ((Object)(object)val2 != (Object)null) { return val2; } } } } return ItemIcon(((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab("Trophy" + ((Object)creature).name) : null); } private static Dictionary<string, List<string>> ParseMap(string raw) { Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); string[] array = (raw ?? "").Split(';'); foreach (string text in array) { int num = text.IndexOf(':'); if (num <= 0) { continue; } string key = text.Substring(0, num).Trim(); if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List<string>()); } string[] array2 = text.Substring(num + 1).Split(','); foreach (string text2 in array2) { if (text2.Trim().Length > 0) { value.Add(text2.Trim()); } } } return dictionary; } private static bool TryBiome(string s, out Biome b) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown try { b = (Biome)(int)(Biome)Enum.Parse(typeof(Biome), s, ignoreCase: true); return true; } catch (Exception) { b = (Biome)0; return false; } } private static Dictionary<string, string> HildirChestKeys() { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if ((Object)(object)prefab == (Object)null) { continue; } Component component = prefab.GetComponent(typeof(Trader)); Trader val = (Trader)(object)((component is Trader) ? component : null); if ((Object)(object)val == (Object)null || val.m_useItems == null) { continue; } foreach (TraderUseItem useItem in val.m_useItems) { if (useItem != null && (Object)(object)useItem.m_prefab != (Object)null && !string.IsNullOrEmpty(useItem.m_setsGlobalKey)) { dictionary[((Object)useItem.m_prefab).name] = useItem.m_setsGlobalKey; } } } return dictionary; } public static Track Find(string musicName) { return MusicTrack(musicName, "music"); } private static Track MusicTrack(string musicName, string label) { if (string.IsNullOrEmpty(musicName) || (Object)(object)MusicMan.instance == (Object)null) { return null; } foreach (NamedMusic item in MusicMan.instance.m_music) { if (item != null && !(item.m_name != musicName) && item.m_clips != null && item.m_clips.Length != 0 && !((Object)(object)item.m_clips[0] == (Object)null)) { return new Track { Label = label + " music=" + musicName, Name = musicName, Clips = item.m_clips, Volume = item.m_volume }; } } return null; } private Track LocationTrack(string prefabName) { foreach (ZoneLocation location in _zs.m_locations) { if (location != null && !(location.m_prefabName != prefabName)) { object value = typeof(ZoneLocation).GetField("m_prefab").GetValue(location); if (value == null) { return null; } Type type = value.GetType(); MethodInfo method = type.GetMethod("Load", Type.EmptyTypes); PropertyInfo property = type.GetProperty("Asset"); if (method == null || property == null) { return null; } method.Invoke(value, null); object? value2 = property.GetValue(value, null); GameObject val = (GameObject)((value2 is GameObject) ? value2 : null); MusicLocation val2 = (MusicLocation)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); AudioSource val3 = (AudioSource)(((Object)(object)val2 != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.clip != (Object)null) { Track track = new Track(); track.Label = "location " + prefabName; track.Name = "@" + prefabName; track.Clips = (AudioClip[])(object)new AudioClip[1] { val3.clip }; track.Volume = 1f; return track; } MusicVolume val4 = (MusicVolume)(((Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); return ((Object)(object)val4 != (Object)null) ? MusicTrack(val4.m_musicName, "location " + prefabName) : null; } } return null; } private static RandomEvent FindEvent(string name) { foreach (RandomEvent @event in RandEventSystem.instance.m_events) { if (@event != null && @event.m_name == name) { return @event; } } return null; } static OstCatalog() { Biome[] array = new Biome[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); BiomeOrder = (Biome[])(object)array; HildirBiome = new Dictionary<string, Biome>(StringComparer.OrdinalIgnoreCase) { { "chest_hildir1", (Biome)8 }, { "chest_hildir2", (Biome)4 }, { "chest_hildir3", (Biome)16 } }; HomeTracks = new Row[48] { R((Biome)0, "HomeBase", "Home - A place to enjoy", "Home - A place to enjoy", "The game plays it when you are safe at home.", "always", "pin:Icon1"), R((Biome)1, "Meadows(day)", "A place to rest", "The Meadows - A place to rest", "Plays in the Meadows.", "biome", "enemy"), R((Biome)1, "Meadows - Village & Farm", "Village & Farm - A sigh of human life", "Meadows - Village & Farm - A sigh of human life", "Plays at the villages and farms of the Meadows.", "item:QueenBee", "QueenBee", "WoodVillage1"), R((Biome)1, "Meadows - Hildir", "Hildir's tiny emporium of costume changes", "Hildir's tiny emporium of costume changes", "Plays at Hildir's camp.", "trader:Hildir", "chest_hildir1|trader:Hildir", "Hildir_camp"), R((Biome)1, "ForestIsMovingLv1", "The Forest is moving (level 1)", "The Forest is moving (level 1)", "Raid music, level 1 of 4.", "boss:Eikthyr", "@Greydwarf"), R((Biome)1, "Battle 1 - Eikthyr", "Eikthyr rides", "Eikthyr rides", "The fight against Eikthyr.", "boss:Eikthyr", "@Eikthyr"), R((Biome)8, "Black Forest(day)", "The darkness", "Black Forest - The darkness", "Plays in the Black Forest.", "biome", "enemy"), R((Biome)8, "ForestCrypt", "The Forest Crypt", "The Forest Crypt", "Plays in the Burial Chambers of the Black Forest.", "uses:SurtlingCore", "SurtlingCore"), R((Biome)8, "Black Forest - Greydwarf Camp", "Greydwarf Camp - Smoking soil, moss and bones", "Greydwarf Camp - Smoking soil, moss and bones", "Plays at Greydwarf camps.", "item:AncientSeed", "AncientSeed", "Greydwarf_camp1"), R((Biome)8, "Black Forest - Haldor", "The wandering adventures of Haldor and Halstein", "The wandering adventures of Haldor and Halstein", "Plays at Haldor's camp.", "trader:Haldor", "BeltStrength|Coins", "Vendor_BlackForest"), R((Biome)8, "ForestIsMovingLv2", "The Forest is moving (level 2)", "The Forest is moving (level 2)", "Raid music, level 2 of 4.", "boss:gd_king", "@Skeleton"), R((Biome)8, "Black Forest - Smouldering Tomb", "Smouldering Tomb", "Black Forest - Smouldering Tomb", "Plays in the Smouldering Tomb, Hildir's Black Forest dungeon.", "hildir:chest_hildir1", "@Skeleton_Hildir"), R((Biome)8, "Battle 2 - Elder", "Elder Awakens", "Elder Awakens", "The fight against The Elder.", "boss:gd_king", "@gd_king"), R((Biome)2, "Swamps", "Sunken Water", "The Swamps - Sunken Water", "Plays in the Swamp.", "biome", "enemy"), R((Biome)2, "Swamps - Bogwitch v2", "The Dance of the Witch in the Bog", "The Dance of the Witch in the Bog", "Plays at the Bog Witch's camp.", "trader:BogWitch", "@Kvastur|trader:BogWitch", "BogWitch_Camp"), R((Biome)2, "ForestIsMovingLv3", "The Forest is moving (level 3)", "The Forest is moving (level 3)", "Raid music, level 3 of 4.", "boss:Bonemass", "@Draugr"), R((Biome)2, "Boss 3 Bonemass", "Bonemass Defiles", "Bonemass Defiles", "The fight against Bonemass.", "boss:Bonemass", "@Bonemass"), R((Biome)4, "Mountains", "High Territory", "The Mountains - High Territory", "Plays in the Mountains.", "biome", "enemy"), R((Biome)4, "Mountains - Abandoned cottages", "Abandoned Cottages", "Mountains - Abandoned Cottages", "Plays at the abandoned cabins of the Mountains.", "item:Onion", "@Wolf", "AbandonedLogCabin02"), R((Biome)4, "Mountain Cave Sanctum", "The red inner sanctum", "Mountains - The red inner sanctum", "Plays in the shrine rooms of the Frost Caves.", "hildir:chest_hildir2", "@Fenring_Cultist_Hildir"), R((Biome)4, "Mountains - Howling cavern", "Howling Cavern", "Mountains - Howling Cavern", "Plays in the Howling Cavern, Hildir's Mountain dungeon.", "item:JuteRed", "@Fenring_Cultist|@Fenring_Cultist_Hildir"), R((Biome)4, "Boss 4 Mother", "Moder Protects", "Moder Protects", "The fight against Moder.", "boss:Dragon", "@Dragon"), R((Biome)16, "Plains", "Farmstead", "The Plains - Farmstead", "Plays in the Plains.", "biome", "enemy"), R((Biome)16, "Plains - Fuling Camp", "Fuling Encampment - The horde under attack", "Fuling Encampment - The horde under attack", "Plays at Fuling villages.", "recipe:BreadDough|recipe:Bread", "@Goblin", "GoblinCamp2"), R((Biome)16, "Plains - Stone Henges", "Stone Henges - Stones of Morning Darkness", "Plains - Stone Henges - Stones of Morning Darkness", "Plays at the stone circles of the Plains.", "biome", "Flax", "StoneHenge1"), R((Biome)16, "ForestIsMovingLv4", "The Forest is moving (level 4)", "The Forest is moving (level 4)", "Raid music, level 4 of 4.", "boss:GoblinKing", "@GoblinBrute|@Goblin"), R((Biome)16, "Plains - Sealed Tower", "Sealed Tower", "Plains - Sealed Tower", "Plays in the Sealed Tower, Hildir's Plains dungeon.", "hildir:chest_hildir3", "@GoblinShaman_Hildir|@GoblinBrute_Hildir"), R((Biome)16, "Boss 5 Yagluth", "Yagluth Reigns", "Yagluth Reigns", "The fight against Yagluth.", "boss:GoblinKing", "@GoblinKing"), R((Biome)512, "Mistlands", "Unveiling distant memories", "Mistlands - Unveiling distant memories", "Plays in the Mistlands.", "biome", "enemy"), R((Biome)512, "Mistlands - Dvergr Excavation Site", "Dvergr Excavation Site - Unearthing the past", "Mistlands - Dvergr Excavation Site - Unearthing the past", "Plays at Dvergr excavation sites.", "piece:piece_sapcollector", "@Dverger|@DvergerMage|DvergrNeedle", "Mistlands_Excavation1"), R((Biome)512, "Mistlands - Dvergr Tower", "Dvergr Tower - Magic brewing", "Mistlands - Dvergr Tower - Magic brewing", "Plays at Dvergr towers and lighthouses.", "piece:piece_sapcollector", "@Dverger|@DvergerMage|DvergrNeedle", "Mistlands_GuardTower1_new"), R((Biome)512, "Boss 6 Queen Ambience", "Kneel to The Seeker Queen (ambient)", "Mistlands - Kneel to The Seeker Queen (ambient)", "The quiet version of The Queen's theme.", "boss:SeekerQueen", "@Seeker"), R((Biome)512, "Boss 6 Queen", "Kneel to The Seeker Queen", "Mistlands - Kneel to The Seeker Queen", "The fight against The Queen.", "boss:SeekerQueen", "@SeekerQueen"), R((Biome)32, "Ashlands", "Transformed by Fire", "Ashlands - Transformed by Fire", "Plays in the Ashlands.", "biome", "enemy"), R((Biome)32, "Sailing Ashlands", "The Dangers of sailing", "The Dangers of sailing to Ashlands", "Plays while sailing to the Ashlands.", "biome", "@BonemawSerpent"), R((Biome)32, "Ashlands - Ruins 1", "Ruins 1 - Where every choice was made of stone", "Ashlands' Ruins 1 - Where every choice was made of stone", "Plays at charred ruins.", "uses:Vineberry", "Vineberry", "CharredRuins1"), R((Biome)32, "Ashlands - Ruins 2", "Ruins 2 - Soaring high, come laying low", "Ashlands' Ruins 2 - Soaring high, come laying low", "Plays at ruined towers.", "uses:Vineberry", "Vineberry", "CharredTowerRuins2"), R((Biome)32, "Ashlands - Ruins 3", "Ruins 3 - For all who lived here", "Ashlands' Ruins 3 - For all who lived here", "Plays at the large ruins and fortress ruins.", "uses:Vineberry", "Vineberry", "FortressRuins"), R((Biome)32, "Ashland - Fortress", "Fortress - These stones have witnessed more than most ever will", "Ashlands' Fortress - These stones have witnessed more than most ever will", "Plays at the Charred Fortress.", "item:GemstoneBlue|item:GemstoneGreen|item:GemstoneRed", "GemstoneRed|GemstoneBlue", "CharredFortress"), R((Biome)32, "Boss 7 Fader", "Fader Beckons", "Fader Beckons", "The fight against Fader.", "boss:Fader", "@Fader"), R((Biome)64, "Deep North", "Deep North", "Deep North", "Plays in the Deep North.", "biome", "enemy"), R((Biome)64, "Deep North - Timberhall Village", "Timberhall Village", "Deep North - Timberhall Village", "Plays at Timberhall villages.", "biome", "enemy", "NorthVillage"), R((Biome)64, "Deep North - MemorialSite", "Memorial Site", "Deep North - Memorial Site", "Plays at the memorial sites.", "biome", "enemy", "NorthMemorialPlace"), R((Biome)64, "Deep North - Morkhalla", "Mörkhalla", "Deep North - Mörkhalla", "Plays in Mörkhalla.", "biome", "enemy"), R((Biome)64, "Deep North - WindingTunnels", "Winding Tunnels", "Deep North - Winding Tunnels", "Plays in the winding tunnels of the Deep North.", "biome", "enemy"), R((Biome)64, "JotunInvasion", "Jotun Invasion", "Deep North - Jotun Invasion", "Plays during the Jotun invasion of Mörkhalla.", "biome", "enemy"), R((Biome)64, "Boss 8 FrozenKing", null, null, null, "boss:FrozenKing", "~crownofvalheim|~crown|@FrozenKing"), R((Biome)256, "Sailing4", "Out for a sailing adventure", "Out for a sailing adventure", "Plays while sailing.", "biome", "enemy") }; BiomeEnemy = new Dictionary<Biome, string> { { (Biome)1, "Deer" }, { (Biome)8, "Greydwarf_Elite" }, { (Biome)2, "Blob" }, { (Biome)4, "Hatchling" }, { (Biome)16, "GoblinShaman" }, { (Biome)512, "SeekerBrute" }, { (Biome)32, "Charred_Melee" }, { (Biome)64, "Moose|~moose" }, { (Biome)256, "Serpent" } }; BossMark = new Dictionary<Biome, string> { { (Biome)64, "~crownofvalheim|~crown" } }; MistNightMusic = "boss_queen_ambience"; BiomeCombatMusic = "Meadows:CombatEventL1;BlackForest:forestcrypt,CombatEventL2;Swamp:CombatEventL3;Mountain:frostcaves;Plains:@GoblinCamp2,CombatEventL4;Mistlands:boss_queen_ambience;AshLands:@CharredFortress,sailing_ashlands;DeepNorth:deepnorth_windingtunnels,deepnorth_morkhalla,JotunInvasion"; HildirMusic = "chest_hildir1:forestcrypthildir;chest_hildir2:frostcaveshildir;chest_hildir3:plainstower"; BossPrefabs = new Dictionary<string, Biome> { { "Eikthyr", (Biome)1 }, { "gd_king", (Biome)8 }, { "Bonemass", (Biome)2 }, { "Dragon", (Biome)4 }, { "GoblinKing", (Biome)16 }, { "SeekerQueen", (Biome)512 }, { "Fader", (Biome)32 }, { "FrozenKing", (Biome)64 } }; } } internal class Glows { private class Mat { public Material M; public bool EmissionOnly; public Color[] Colors = (Color[])(object)new Color[ColorProps.Length]; public Texture[] Maps = (Texture[])(object)new Texture[MapProps.Length]; } private static readonly int[] ColorProps = new int[3] { Shader.PropertyToID("_Color"), Shader.PropertyToID("_TintColor"), Shader.PropertyToID("_EmissionColor") }; private static readonly int[] MapProps = new int[2] { Shader.PropertyToID("_MainTex"), Shader.PropertyToID("_EmissionMap") }; private const int EmissionColor = 2; private const int EmissionMap = 1; private readonly bool m_dim; private readonly List<Mat> m_mats = new List<Mat>(); private readonly List<Light> m_lights = new List<Light>(); private readonly List<Color> m_lightColors = new List<Color>(); private readonly List<ParticleSystem> m_particles = new List<ParticleSystem>(); private readonly List<MinMaxGradient> m_particleColors = new List<MinMaxGradient>(); internal Glows(bool dimParticles) { m_dim = dimParticles; } internal void Add(Material m, bool emissionOnly) { //IL_0040: 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) if ((Object)(object)m == (Object)null) { return; } Mat mat = new Mat { M = m, EmissionOnly = emissionOnly }; for (int i = 0; i < ColorProps.Length; i++) { if (m.HasProperty(ColorProps[i])) { mat.Colors[i] = m.GetColor(ColorProps[i]); } } for (int j = 0; j < MapProps.Length; j++) { if (m.HasProperty(MapProps[j])) { mat.Maps[j] = m.GetTexture(MapProps[j]); } } m_mats.Add(mat); } internal void Add(Light l) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)l == (Object)null)) { m_lights.Add(l); m_lightColors.Add(l.color); } } internal void Add(ParticleSystem ps) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ps == (Object)null)) { m_particles.Add(ps); List<MinMaxGradient> particleColors = m_particleColors; MainModule main = ps.main; particleColors.Add(((MainModule)(ref main)).startColor); } } internal void Emission(bool on) { foreach (Mat mat in m_mats) { if (on) { mat.M.EnableKeyword("_EMISSION"); } else { mat.M.DisableKeyword("_EMISSION"); } } } internal void Emit(bool on) { //IL_002b: 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) foreach (ParticleSystem particle in m_particles) { if ((Object)(object)particle == (Object)null) { continue; } if (on && !particle.isEmitting) { MainModule main = particle.main; if (((MainModule)(ref main)).loop && ((Component)particle).gameObject.activeInHierarchy) { particle.Play(true); continue; } } if (!on && particle.isEmitting) { particle.Stop(true, (ParticleSystemStopBehavior)1); } } } internal void Apply(Color? c, float light = 1f) { //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b7: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022e: 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_0070: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Invalid comparison between Unknown and I4 //IL_007a: 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_0093: 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_00a7: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: 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_0281: 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) foreach (Mat mat in m_mats) { for (int i = 0; i < ColorProps.Length; i++) { if ((!mat.EmissionOnly || i == 2) && mat.M.HasProperty(ColorProps[i])) { Color val = mat.Colors[i]; float num = (c.HasValue ? (((Color)(ref val)).maxColorComponent * light) : light); Color val2 = (c.HasValue ? c.Value : val); mat.M.SetColor(ColorProps[i], new Color(val2.r * num, val2.g * num, val2.b * num, val.a)); } } for (int j = 0; j < MapProps.Length; j++) { Texture val3 = mat.Maps[j]; if (!((Object)(object)val3 == (Object)null) && (!mat.EmissionOnly || j == 1)) { Texture val4 = (Texture)(object)(c.HasValue ? Textures.Grey(val3, luma: false) : null); mat.M.SetTexture(MapProps[j], ((Object)(object)val4 != (Object)null) ? val4 : val3); } } } for (int k = 0; k < m_lights.Count; k++) { if (!((Object)(object)m_lights[k] == (Object)null)) { Color val5 = (Color)(((??)c) ?? m_lightColors[k]); m_lights[k].color = new Color(val5.r * light, val5.g * light, val5.b * light, val5.a); } } for (int l = 0; l < m_particles.Count; l++) { if (!((Object)(object)m_particles[l] == (Object)null)) { MainModule main = m_particles[l].main; MinMaxGradient val6 = m_particleColors[l]; float num2 = (((int)((MinMaxGradient)(ref val6)).mode == 0 || (int)((MinMaxGradient)(ref val6)).mode == 2) ? ((MinMaxGradient)(ref val6)).colorMax.a : 1f); float num3 = (m_dim ? Bright(val6) : 1f) * light; ((MainModule)(ref main)).startColor = (MinMaxGradient)(c.HasValue ? new MinMaxGradient(new Color(c.Value.r * num3, c.Value.g * num3, c.Value.b * num3, num2)) : ((light >= 1f) ? val6 : Scaled(val6, light))); } } } private static MinMaxGradient Scaled(MinMaxGradient g, float k) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0026: 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_0033: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode; if ((int)mode != 0) { if ((int)mode == 2) { return new MinMaxGradient(Times(((MinMaxGradient)(ref g)).colorMin, k), Times(((MinMaxGradient)(ref g)).colorMax, k)); } return g; } return new MinMaxGradient(Times(((MinMaxGradient)(ref g)).color, k)); } private static Color Times(Color c, float k) { //IL_0000: 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_0010: 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) //IL_001e: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r * k, c.g * k, c.b * k, c.a); } private static float Bright(MinMaxGradient g) { //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_001e: Expected I4, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0079: 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_0050: Unknown result type (might be due to invalid IL or missing references) ParticleSystemGradientMode mode = ((MinMaxGradient)(ref g)).mode; Color val; switch ((int)mode) { case 0: case 2: val = ((MinMaxGradient)(ref g)).colorMax; return ((Color)(ref val)).maxColorComponent; case 3: if (((MinMaxGradient)(ref g)).gradientMax == null) { return 1f; } val = ((MinMaxGradient)(ref g)).gradientMax.Evaluate(0.5f); return ((Color)(ref val)).maxColorComponent; default: if (((MinMaxGradient)(ref g)).gradient == null) { return 1f; } val = ((MinMaxGradient)(ref g)).gradient.Evaluate(0.5f); return ((Color)(ref val)).maxColorComponent; } } } public enum BiomeMode { Vanilla, Silent, SilentNight, SilentDay, Dramatic, CreepyMix } public enum HomePlays { DayOnly, Always, DayNight, NightOnly } public enum Soundtrack { Vanilla, Silent, SilentNight, SilentDay, Dramatic, Remixed } internal static class Modes { private static readonly BiomeMode[] Mist = new BiomeMode[6] { BiomeMode.Vanilla, BiomeMode.Silent, BiomeMode.SilentNight, BiomeMode.SilentDay, BiomeMode.Dramatic, BiomeMode.CreepyMix }; private static readonly BiomeMode[] Common = new BiomeMode[5] { BiomeMode.Vanilla, BiomeMode.Silent, BiomeMode.SilentNight, BiomeMode.SilentDay, BiomeMode.Dramatic }; private static readonly BiomeMode[] Ash = new BiomeMode[4] { BiomeMode.Vanilla, BiomeMode.Silent, BiomeMode.SilentNight, BiomeMode.SilentDay }; internal static readonly HomePlays[] PlaysOrder = new HomePlays[4] { HomePlays.Always, HomePlays.DayOnly, HomePlays.NightOnly, HomePlays.DayNight }; private static readonly Dictionary<Biome, Color> Palette = new Dictionary<Biome, Color> { { (Biome)1, new Color(0.16f, 0.32f, 0.1f) }, { (Biome)8, new Color(0.08f, 0.13f, 0.34f) }, { (Biome)2, new Color(0.33f, 0.07f, 0.13f) }, { (Biome)4, new Color(0.08f, 0.32f, 0.38f) }, { (Biome)16, new Color(0.4f, 0.26f, 0.1f) }, { (Biome)512, new Color(0.3f, 0.23f, 0.42f) }, { (Biome)32, new Color(0.24f, 0.24f, 0.24f) }, { (Biome)64, new Color(0.16f, 0.28f, 0.46f) }, { (Biome)256, new Color(0.04f, 0.22f, 0.26f) } }; internal static BiomeMode[] For(Biome b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)b == 512) { return Mist; } if ((int)b != 32) { return Common; } return Ash; } internal static BiomeMode Clamp(Biome b, BiomeMode m) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (Array.IndexOf(For(b), m) >= 0) { return m; } if (m != BiomeMode.CreepyMix) { return BiomeMode.Silent; } return BiomeMode.SilentDay; } internal static string Label(BiomeMode m) { return m switch { BiomeMode.SilentNight => "Silent night", BiomeMode.SilentDay => "Silent day", BiomeMode.CreepyMix => "Creepy mix", _ => m.ToString(), }; } internal static string Label(Soundtrack s) { return s switch { Soundtrack.SilentNight => "Silent night", Soundtrack.SilentDay => "Silent day", _ => s.ToString(), }; } internal static string Label(HomePlays p) { return p switch { HomePlays.DayOnly => "Day only", HomePlays.NightOnly => "Night only", HomePlays.DayNight => "Day/Night", _ => p.ToString(), }; } internal static Dictionary<Biome, Color> Shades(float alpha) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) Dictionary<Biome, Color> dictionary = new Dictionary<Biome, Color>(); foreach (KeyValuePair<Biome, Color> item in Palette) { dictionary[item.Key] = new Color(item.Value.r, item.Value.g, item.Value.b, alpha); } return dictionary; } internal static Color? Light(Biome b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0077: 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) if ((int)b == 32) { return new Color(1f, 0.35f, 0.12f); } if (!Palette.TryGetValue(b, out var value)) { return null; } float num = Mathf.Max(value.r, Mathf.Max(value.g, value.b)); if (!(num > 0f)) { return null; } return new Color(value.r / num, value.g / num, value.b / num); } internal static BiomeMode Remixed(Biome b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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)b == 2) { return BiomeMode.SilentDay; } if ((int)b == 512) { return BiomeMode.CreepyMix; } if ((int)b != 256) { return BiomeMode.Silent; } return BiomeMode.Dramatic; } internal static BiomeMode Of(Soundtrack s, Biome b) { //IL_0024: 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) return s switch { Soundtrack.Vanilla => BiomeMode.Vanilla, Soundtrack.Silent => BiomeMode.Silent, Soundtrack.SilentNight => BiomeMode.SilentNight, Soundtrack.SilentDay => BiomeMode.SilentDay, Soundtrack.Dramatic => Clamp(b, BiomeMode.Dramatic), _ => Remixed(b), }; } } [HarmonyPatch(typeof(Player), "TakeInput")] internal static class PlayerTakeInput_Patch { private static void Postfix(ref bool __result) { if (MusicMenu.Blocking) { __result = false; } } } [HarmonyPatch(typeof(PlayerController), "TakeInput")] internal static class ControllerTakeInput_Patch { private static void Postfix(ref bool __result) { if (MusicMenu.Blocking) { __result = false; } } } [HarmonyPatch(typeof(Menu), "Update")] internal static class MenuUpdate_Patch { private static bool Prefix() { return !MusicMenu.Blocking; } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class MouseCapture_Patch { private static void Postfix() { if (MusicMenu.IsOpen && ZInput.IsMouseActive()) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } } } [HarmonyPatch(typeof(StoreGui), "IsVisible")] internal static class StoreVisible_Patch { private static void Postfix(ref bool __result) { if (MusicMenu.Blocking) { __result = true; } } } internal class RowHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler { internal int Col; internal int Index; public void OnPointerEnter(PointerEventData eventData) { MusicMenu.Hover(Col, Index); } } internal static class MusicMenu { private class Row { public GameObject Cursor; public TMP_Text Name; public Color BaseColor; public TMP_Dropdown Drop; public Toggle Tog; public Action Click; public Action Refresh; public Func<bool> Chosen; public Toggle Night; public Action ClickNight; public Func<bool> ChosenNight; public string Desc; public bool InList; public bool Locked; public Action<int> Step; public float Y; public float Top; } private class Kit { public InventoryGui Ig; public TMP_Text Title; public TMP_Text Head; public TMP_Text Body; public TMP_Text RowText; public Image Bar; public GameObject Toggle; public GameObject Drop; public GameObject Slider; public Vector2 ToggleSize; public Vector2 DropSize; public Vector2 SliderSize; } private const float PanelW = 1000f; private const float Pad = 30f; private const float LeftW = 390f; private const float ColGap = 44f; private const float SetH = 36f; private const float SetPitch = 40f; private const float DropW = 160f; private const float IconSize = 30f; private const float GroupH = 34f; private const float PanelLift = 0.5f; private const float PanelShade = 0.7f; private static readonly Color ChosenColor = new Color(1f, 0.78f, 0.25f); private static readonly Color NightColor = new Color(0.45f, 0.68f, 1f); private static readonly Color RuleDark = new Color(0.1f, 0.1f, 0.1f, 0.6f); private static readonly Color RuleLight = new Color(1f, 1f, 1f, 0.18f); private static readonly Color DescShade = new Color(0f, 0f, 0f, 0.55f); private static readonly Color RowShade = new Color(0f, 0f, 0f, 0.4f); private static readonly Color SlotShade = new Color(0f, 0f, 0f, 0.3f); private static readonly Color GroupText = new Color(0.96f, 0.92f, 0.84f); private static readonly Dictionary<Biome, Color> BiomeShade = Modes.Shades(0.85f); private static GameObject s_root; private static Totem s_totem; private static bool s_canEdit; private static uint s_rev; private static readonly List<Row>[] s_cols = new List<Row>[2] { new List<Row>(), new List<Row>() }; private static readonly List<TMP_Dropdown> s_drops = new List<TMP_Dropdown>(); private static readonly int[] s_idx = new int[2]; private static int s_col; private static RectTransform s_content; private static float s_scroll; private static float s_contentH; private static float s_viewH; private static float s_pitch; private static float s_rowH; private static TMP_Text s_desc; private static TMP_Text s_hint; private static int s_viewKey = -1; private static int s_closedFrame = -10; private static TMP_Dropdown s_showNext; private static Image s_slotFrame; private static int s_showFrame; private static float s_busyUntil; private static FieldInfo s_tooltipBox; private static bool s_volumeChanged; private static int s_stepDir; private static float s_stepNext; private static bool s_soundtrack; private static readonly Soundtrack[] Soundtracks = new Soundtrack[6] { Soundtrack.Vanilla, Soundtrack.Silent, Soundtrack.SilentNight, Soundtrack.SilentDay, Soundtrack.Dramatic, Soundtrack.Remixed }; internal static bool IsOpen => (Object)(object)s_root != (Object)null; internal static Totem CurrentTotem { get { if (!((Object)(object)s_root != (Object)null) || s_soundtrack) { return null; } return s_totem; } } private static bool DayNight { get { if ((Object)(object)s_totem != (Object)null) { return s_totem.Plays == HomePlays.DayNight; } return false; } } internal static bool Blocking { get { if (!((Object)(object)s_root != (Object)null)) { return Time.frameCount - s_closedFrame <= 1; } return true; } } private static Plugin P => Plugin.Instance; internal static void Show(Totem totem) { if (IsOpen || (Object)(object)P == (Object)null || (Object)(object)totem == (Object)null) { return; } InventoryGui instance = InventoryGui.instance; Player localPlayer = Player.m_localPlayer; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_recipeElementPrefab == (Object)null || (Object)(object)localPlayer == (Object)null) { return; } List<OstCatalog.Entry> list = P.HomeChoices(localPlayer, totem); if (list == null) { return; } s_totem = totem; s_canEdit = totem.CanEdit(localPlayer); s_rev = totem.Revision; P.PreviewSide = -1; try { Build(instance, list); } catch (Exception e) { P.Warn("menu build", e); Close(); } } internal static void ShowSoundtrack() { if (IsOpen || (Object)(object)P == (Object)null) { return; } InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_recipeElementPrefab == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null) { return; } s_soundtrack = true; try { BuildSoundtrack(instance); } catch (Exception e) { P.Warn("soundtrack build", e); Close(); } } internal static void Close() { bool flag = (Object)(object)s_root != (Object)null; if (s_volumeChanged && (Object)(object)s_totem != (Object)null && s_totem.On) { s_totem.SwitchOffOthers(Player.m_localPlayer); } s_volumeChanged = false; foreach (TMP_Dropdown s_drop in s_drops) { if ((Object)(object)s_drop != (Object)null && s_drop.IsExpanded) { s_drop.Hide(); } } if (flag) { Object.Destroy((Object)(object)s_root); } s_root = null; s_totem = null; s_soundtrack = false; s_content = null; s_desc = (s_hint = null); s_showNext = null; s_drops.Clear(); s_cols[0].Clear(); s_cols[1].Clear(); if (flag) { s_closedFrame = Time.frameCount; EventSystem current2 = EventSystem.current; if ((Object)(object)current2 != (Object)null) { current2.SetSelectedGameObject((GameObject)null); } } } internal static void Update() { //IL_0054: 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) if ((Object)(object)s_root == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || (!s_soundtrack && ((Object)(object)s_totem == (Object)null || InventoryGui.IsVisible() || Menu.IsVisible() || Minimap.IsOpen() || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)s_totem).transform.position) > 5f))) { Close(); return; } if (!s_soundtrack && s_totem.Revision != s_rev) { s_rev = s_totem.Revision; RefreshValues(); } if ((Object)(object)s_showNext != (Object)null && Time.frameCount > s_showFrame) { TMP_Dropdown val = s_showNext; s_showNext = null; if ((Object)(object)val != (Object)null) { val.Show(); } s_busyUntil = Time.unscaledTime + 0.25f; return; } bool flag = false; foreach (TMP_Dropdown s_drop in s_drops) { if ((Object)(object)s_drop != (Object)null && s_drop.IsExpanded) { flag = true; break; } } if (flag) { s_busyUntil = Time.unscaledTime + 0.25f; } if (flag || Time.unscaledTime < s_busyUntil) { if (!flag || (!ZInput.GetButtonDown("JoyButtonB") && !ZInput.GetKeyDown((KeyCode)27, false))) { return; } { foreach (TMP_Dropdown s_drop2 in s_drops) { if ((Object)(object)s_drop2 != (Object)null && s_drop2.IsExpanded) { s_drop2.Hide(); } } return; } } ReleaseSelection(); if (ZInput.GetButtonDown("JoyButtonB") || ZInput.GetKeyDown((KeyCode)27, false) || (!s_soundtrack && ZInput.GetButtonDown("Use"))) { if (s_soundtrack) { P.ChooseSoundtrack(null); } Close(); return; } if (ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyLStickUp")) { Move(-1); } if (ZInput.GetButtonDown("JoyDPadDown") || ZInput.GetButtonDown("JoyLStickDown")) { Move(1); } Row row = Cursor(); if (row != null && row.Step != null) { int num = StepInput(); if (num != 0 && !row.Locked) { row.Step(num); RefreshValues(); } } else { s_stepDir = 0; if (ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyLStickLeft")) { SetColumn(0); } if (ZInput.GetButtonDown("JoyDPadRight") || ZInput.GetButtonDown("JoyLStickRight")) { SetColumn(1); } } if (ZInput.GetButtonDown("JoyButtonA")) { Activate(); } if (ZInput.GetButtonDown("JoyButtonX")) { Activate(night: true); } float mouseScrollWheel = ZInput.GetMouseScrollWheel(); if (mouseScrollWheel != 0f) { ScrollBy((mouseScrollWheel > 0f) ? (-2f * s_pitch) : (2f * s_pitch)); } RefreshCursor(ZInput.IsGamepadActive()); } private static void ReleaseSelection() { EventSystem current = EventSystem.current; if (!((Object)(object)current == (Object)null) && !((Object)(object)s_root == (Object)null)) { GameObject currentSelectedGameObject = current.currentSelectedGameObject; if ((Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.transform.IsChildOf(s_root.transform)) { current.SetSelectedGameObject((GameObject)null); } } } private static int StepInput() { bool flag = ZInput.GetButton("JoyDPadLeft") || ZInput.GetButton("JoyLStickLeft"); bool flag2 = ZInput.GetButton("JoyDPadRight") || ZInput.GetButton("JoyLStickRight"); int num = ((flag != flag2) ? ((!flag) ? 1 : (-1)) : 0); if (num == 0) { s_stepDir = 0; return 0; } if (num != s_stepDir) { s_stepDir = num; s_stepNext = Time.unscaledTime + 0.4f; return num; } if (Time.unscaledTime < s_stepNext) { return 0; } s_stepNext = Time.unscaledTime + 0.06f; return num; } private static RectTransform NewRoot(InventoryGui ig) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0052: 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_0069: 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_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_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_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00b7: 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_00d2: Expected O, but got Unknown //IL_00d3: 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_0111: Expected O, but got Unknown Canvas componentInParent = ((Component)ig).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent == (Object)null) { throw new InvalidOperationException("no canvas above InventoryGui"); } s_root = new GameObject("VKTR_MusicMenu", new Type[1] { typeof(RectTransform) }); s_root.SetActive(false); RectTransform val = (RectTransform)s_root.transform; ((Transform)val).SetParent(((Component)componentInParent.rootCanvas).transform, false); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; Vector2 offsetMin = (val.offsetMax = Vector2.zero); val.offsetMin = offsetMin; ((Transform)val).SetAsLastSibling(); ((Graphic)s_root.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.5f); RectTransform val2 = (RectTransform)ig.m_recipeElementPrefab.transform; s_rowH = ((val2.sizeDelta.y >= 16f) ? val2.sizeDelta.y : 32f); s_pitch = Mathf.Max(ig.m_recipeListSpace, s_rowH); return val; } private static void Build(InventoryGui ig, List<OstCatalog.Entry> choices) { //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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e7: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Expected O, but got Unknown //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) RectTransform parent = NewRoot(ig); RectTransform val = NewRect("Templates", (Transform)(object)parent); ((Component)val).gameObject.SetActive(false); Kit kit = Harvest(ig, (Transform)(object)val); int num = OstCatalog.BiomeOrder.Length; float num2 = 84f; float num3 = (float)num * 40f + 18f + 80f; float num4 = 58f; float num5 = Mathf.Max(num3, num4 + 8f * s_pitch); float num6 = num2 + num5 + 22f; float num7 = num6 + 66f + 8f + 28f + 24f; float num8 = 464f; float num9 = 970f; RectTransform val2 = NewRect("Panel", (Transform)(object)parent); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(1000f, num7); Background(ig, ((Component)val2).gameObject.AddComponent<Image>()); Place(Label(kit.Title, (Transform)(object)val2, "Soundtrack", (TextAlignmentOptions)514).rectTransform, 30f, 420f, 20f, 48f); string text = (s_totem.IsHome ? (Plugin.HomeName(((Component)s_totem).transform.position) ?? "") : "Totem of Songs"); TMP_Text obj = Label(kit.Title, (Transform)(object)val2, text, (TextAlignmentOptions)514); Place(obj.rectTransform, num8, num9, 20f, 48f); NoWrap(obj); HRule(val2, 30f, 580f, 72f); HRule(val2, num8, 30f, 72f); VRule(val2, 442f, 26f, num2 + num5 - 20f - 6f); Place(Shade(val2, DescShade), 30f, 970f, num6 - 8f, 78f); s_desc = Label(kit.Body, (Transform)(object)val2, "", (TextAlignmentOptions)257); Place(s_desc.rectTransform, 42f, 958f, num6 - 2f, 66f); s_hint = Label(kit.Body, (Transform)(object)val2, "", (TextAlignmentOptions)514); Place(s_hint.rectTransform, 30f, 970f, num6 + 66f + 8f, 28f); RectTransform val5 = NewRect("Biomes", (Transform)(object)val2); Place(val5, 30f, 420f, num2, num3); for (int i = 0; i < num; i++) { Biome b = OstCatalog.BiomeOrder[i]; BiomeMode[] offered = Modes.For(b); string[] array = new string[offered.Length]; for (int j = 0; j < offered.Length; j++) { array[j] = Modes.Label(offered[j]); } bool unseen; Sprite icon = P.BiomeIcon(b, out unseen); Row row = SettingRow(kit, val5, (float)i * 40f, 0, BiomeName(b), ModeDesc(b), iconSlot: true, icon, unseen); if (BiomeShade.TryGetValue(b, out var value)) { Shade((RectTransform)row.Name.transform.parent, value); ((Graphic)row.Name).color = (row.BaseColor = GroupText); } Choice(kit, row, 0, array, () => Math.Max(0, Array.IndexOf(offered, P.ModeOf(b))), delegate(int v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) P.SetMode(b, offered[v]); }); } HRule(val5, 8f, 8f, (float)num * 40f + 7f); Row r = SettingRow(kit, val5, (float)num * 40f + 18f, 0, "Combat music", "An OST when a real fight starts, whatever the biome's mode.", iconSlot: false, null); OnOff(kit, r, 0, () => P.CombatOn, delegate(bool v) { P.CombatOn = v; }); Row r2 = SettingRow(kit, val5, (float)num * 40f + 18f + 40f, 0, "Raid remix", "Raids play this mod's combat music: Hildir's, the Mistlands' and Jotun Invasion their own track, the others a combat track. Off: the game's raid music.", iconSlot: false, null); OnOff(kit, r2, 0, () => P.RaidRemix, delegate(bool v) { P.RaidRemix = v; }); Totem t = s_totem; RectTransform val6 = NewRect("When", (Transform)(object)val2); Place(val6, num8, num9, num2, 40f); Row row2 = SettingRow(kit, val6, 0f, 1, "Plays", PlaysDesc(), iconSlot: false, null); string[] array2 = new string[Modes.PlaysOrder.Length]; for (int num10 = 0; num10 < array2.Length; num10++) { array2[num10] = Modes.Label(Modes.PlaysOrder[num10]); } Choice(kit, row2, 1, array2, () => Array.IndexOf(Modes.PlaysOrder, t.Plays), delegate(int v) { t.SetPlays(Modes.PlaysOrder[v]); }); row2.Locked = !s_canEdit; if ((Object)(object)row2.Drop != (Object)null) { ((Selectable)row2.Drop).interactable = s_canEdit; } HRule(val2, num8, 30f, num2 + 40f + 7f); RectTransform val7 = NewRect("List", (Transform)(object)val2); s_viewH = num5 - num4 - 40f - 10f; Place(val7, num8, num9, num2 + num4, s_viewH); ((Component)val7).gameObject.AddComponent<RectMask2D>(); s_content = NewRect("Content", (Transform)(object)val7); s_content.anchorMin = new Vector2(0f, 1f); s_content.anchorMax = new Vector2(1f, 1f); s_content.pivot = new Vector2(0.5f, 1f); HashSet<string> ids = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (OstCatalog.Entry choice in choices) { ids.Add(choice.Id); } string text2 = BiomeNames(P.HostileBiomes); float num11 = 0f; foreach (OstCatalog.Entry choice2 in choices) { if ((int)choice2.Biome == 0) { ListTrack(kit, choice2, num11, 8f); num11 += s_pitch; } } TrackRow(kit, s_content, num11, 8f, null, iconSlot: true, "Automatic", "The music of the biome you are in." + ((text2.Length > 0) ? (" In " + text2 + ": the music of a biome whose boss you defeated.") : ""), delegate { t.SetDay(""); }, () => string.IsNullOrEmpty(t.Day) || !ids.Contains(t.Day), delegate { t.SetNight(""); }, () => string.IsNullOrEmpty(t.Night) || !ids.Contains(t.Night)); num11 += s_pitch; Biome val8 = (Biome)0; foreach (OstCatalog.Entry choice3 in choices) { if ((int)choice3.Biome != 0) { float num12 = -1f; if (choice3.Biome != val8) { val8 = choice3.Biome; num12 = num11 + 8f; Group(kit, s_content, num12, val8); num11 = num12 + 34f + 4f; } Row row3 = ListTrack(kit, choice3, num11, 8f); if (num12 >= 0f) { row3.Top = num12; } num11 += s_pitch; } } if (choices.Count == 0) { Place(Label(kit.Body, (Transform)(object)s_content, "Explore, craft and defeat bosses to unlock more tracks.", (TextAlignmentOptions)257).rectTransform, 14f, num9 - num8 - 8f, num11 + 8f, 2f * s_pitch); num11 += 8f + 2f * s_pitch; } s_contentH = num11; s_content.sizeDelta = new Vector2(0f, num11); HRule(val2, num8, 30f, num2 + num5 - 40f - 5f); RectTransform val9 = NewRect("Volume", (Transform)(object)val2); Place(val9, num8, num9, num2 + num5 - 40f, 40f); Row row4 = SettingRow(kit, val9, 0f, 1, "Volume", VolumeDesc(t), iconSlot: false, null); row4.Locked = !s_canEdit; Slide(kit, row4, 1, "Volume", 4f, 30f, () => t.Volume, delegate(float v) { t.SetVolume(v); s_volumeChanged = true; }); Object.DestroyImmediate((Object)(object)((Component)val).gameObject); s_col = 0; s_idx[0] = 0; s_idx[1] = 0; for (int num13 = 0; num13 < s_cols[1].Count; num13++) { if (s_cols[1][num13].InList && s_cols[1][num13].Chosen != null && s_cols[1][num13].Chosen()) { s_idx[1] = num13; break; } } s_scroll = 0f; EnsureVisible((s_cols[1].Count > 0) ? s_cols[1][s_idx[1]] : null); RefreshValues(); s_viewKey = -1; s_root.SetActive(true); RefreshCursor(ZInput.IsGamepadActive()); } private static Kit Harvest(InventoryGui ig, Transform holder) { //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) Kit kit = new Kit { Ig = ig }; kit.Title = (((Object)(object)ig.m_craftingStationName != (Object)null) ? ig.m_craftingStationName : ig.m_recipeName); kit.Head = (((Object)(object)ig.m_recipeName != (Object)null) ? ig.m_recipeName : kit.Title); kit.Body = (((Object)(object)ig.m_recipeDecription != (Object)null) ? ig.m_recipeDecription : kit.Head); Transform transform = ig.m_recipeElementPrefab.transform; Transform val = transform.Find("name"); kit.RowText = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<TMP_Text>() : ((Component)transform).GetComponentInChildren<TMP_Text>(true)); Transform val2 = transform.Find("selected"); kit.Bar = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<Image>() : null); s_slotFrame = null; HotkeyBar val3 = (((Object)(object)Hud.instance != (Object)null) ? ((Component)Hud.instance).GetComponentInChildren<HotkeyBar>(true) : null); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.m_elementPrefab != (Object)null) { Image[] componentsInChildren = val3.m_elementPrefab.GetComponentsInChildren<Image>(true); foreach (Image val4 in componentsInChildren) { if (((Object)val4).name == "bkg") { s_slotFrame = val4; break; } } } if ((Object)(object)kit.Title == (Object)null || (Object)(object)kit.Body == (Object)null || (Object)(object)kit.RowText == (Object)null) { throw new InvalidOperationException("no text templates in InventoryGui"); } GameObject val5 = (((Object)(object)Menu.instance != (Object)null) ? Menu.instance.m_settingsPrefab : null); if ((Object)(object)val5 == (Object)null) { return kit; } Toggle[] componentsInChildren2 = val5.GetComponentsInChildren<Toggle>(true); foreach (Toggle val6 in componentsInChildren2) { if ((Object)(object)val6 != (Object)null && (Object)(object)((Component)val6).GetComponentInParent<TMP_Dropdown>(true) == (Object)null) { kit.Toggle = Copy((Component)(object)val6, holder, new Vector2(24f, 24f), out kit.ToggleSize); break; } } TMP_Dropdown[] componentsInChildren3 = val5.GetComponentsInChildren<TMP_Dropdown>(true); foreach (TMP_Dropdown val7 in componentsInChildren3) { if ((Object)(object)val7 != (Object)null && (Object)(object)val7.template != (Object)null) { kit.Drop = Copy((Component)(object)val7, holder, new Vector2(160f, 34f), out kit.DropSize); break; } } Slider[] componentsInChildren4 = val5.GetComponentsInChildren<Slider>(true); foreach (Slider val8 in componentsInChildren4) { if ((Object)(object)val8 != (Object)null) { kit.Slider = Copy((Component)(object)val8, holder, new Vector2(160f, 20f), out kit.SliderSize); break; } } return kit; } private static GameObject Copy(Component control, Transform holder, Vector2 fallback, out Vector2 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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_0016: 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_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_0061: 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) RectTransform val = (RectTransform)control.transform; Rect rect = val.rect; size = ((Rect)(ref rect)).size; if (size.x < 1f || size.y < 1f) { size = val.sizeDelta; } if (size.x < 1f || size.y < 1f) { size = fallback; } GameObject val2 = Object.Instantiate<GameObject>(control.gameObject, holder, false); StripLocalize(val2); SettingsTooltip[] componentsInChildren = val2.GetComponentsInChildren<SettingsTooltip>(true); foreach (SettingsTooltip val3 in componentsInChildren) { if (s_tooltipBox == null) { s_tooltipBox = typeof(SettingsTooltip).GetField("m_tooltip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } GameObject val4 = (GameObject)((s_tooltipBox != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)(object)val2 && val4.transform.IsChildOf(val2.transform)) { Object.DestroyImmediate((Object)(object)val4); } Object.DestroyImmediate((Object)(object)val3); } UIGamePad[] componentsInChildren2 = val2.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val5 in componentsInChildren2) { if ((Object)(object)val5.m_hint != (Object)null && (Object)(object)val5.m_hint != (Object)(object)val2 && val5.m_hint.transform.IsChildOf(val2.transform)) { Object.DestroyImmediate((Object)(object)val5.m_hint); } Object.DestroyImmediate((Object)(object)val5); } ContentSizeFitter[] componentsInChildren3 = val2.GetComponentsInChildren<ContentSizeFitter>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } StripTooltips(val2); return val2; } private static Row SettingRow(Kit k, RectTransform parent, float y, int col, string label, string desc, bool iconSlot, Sprite icon, bool unseen = false) { //IL_0029: 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) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect("Row", (Transform)(object)parent); Stretch(val, y + 2f, 36f); ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = Color.clear; AddHover(((Component)val).gameObject, col, s_cols[col].Count); Row row = new Row { Desc = desc, Y = y, Top = y }; row.Cursor = Bar(k, val); float num = 12f; if (iconSlot) { Icon(val, num, icon, unseen); num += 38f; } row.Name = Label(k.RowText, (Transform)(object)val, label, (TextAlignmentOptions)4097); Fill(row.Name.rectTransform, num, 184f); NoWrap(row.Name); row.BaseColor = ((Graphic)row.Name).color; s_cols[col].Add(row); return row; } private static void Choice(Kit k, Row r, int col, string[] options, Func<int> get, Action<int> set) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)r.Name.transform.parent; int idx = s_cols[col].IndexOf(r); if ((Object)(object)k.Drop == (Object)null) { ValueText(k, r, val, options, get, set); return; } GameObject val2 = Object.Instantiate<GameObject>(k.Drop, (Transform)(object)val, false); ((Object)val2).name = "Dropdown"; val2.SetActive(true); TMP_Dropdown d = val2.GetComponent<TMP_Dropdown>(); TMP_Text[] componentsInChildren = val2.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val3 in componentsInChildren) { if ((Object)(object)((Component)val3).gameObject != (Object)(object)val2 && (Object)(object)val3 != (Object)(object)d.captionText && (Object)(object)val3 != (Object)(object)d.itemText && !val3.transform.IsChildOf((Transform)(object)d.template)) { ((Component)val3).gameObject.SetActive(false); } } RectTransform val4 = (RectTransform)val2.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(1f, 0.5f); val4.anchorMax = val5; val4.anchorMin = val5; val4.pivot = new Vector2(1f, 0.5f); val4.anchoredPosition = new Vector2(-10f, 0f); val4.sizeDelta = new Vector2(160f, Mathf.Min(k.DropSize.y, 34f)); d.onValueChanged = new DropdownEvent(); d.ClearOptions(); d.AddOptions(new List<string>(options)); TMP_Dropdown obj = d; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj).navigation = navigation; ((UnityEvent<int>)(object)d.onValueChanged).AddListener((UnityAction<int>)delegate(int v) { s_col = col; s_idx[col] = idx; set(v); RefreshValues(); }); r.Drop = d; r.Refresh = delegate { d.SetValueWithoutNotify(Mathf.Clamp(get(), 0, options.Length - 1)); d.RefreshShownValue(); }; s_drops.Add(d); } private static void OnOff(Kit k, Row r, int col, Func<bool> get, Action<bool> set) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown RectTransform val = (RectTransform)r.Name.transform.parent; int idx = s_cols[col].IndexOf(r); if ((Object)(object)k.Toggle == (Object)null) { ValueText(k, r, val, new string[2] { "Off", "On" }, () => get() ? 1 : 0, delegate(int v) { set(v == 1); }); return; } Toggle t = Box(k, val, 10f); ((UnityEvent<bool>)(object)t.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v) { s_col = col; s_idx[col] = idx; set(v); RefreshValues(); }); r.Tog = t; r.Refresh = delegate { t.SetIsOnWithoutNotify(get()); }; } private static void Slide(Kit k, Row r, int col, string label, float min, float max, Func<float> get, Action<float> set) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)r.Name.transform.parent; int idx = s_cols[col].IndexOf(r); Action caption = delegate { SetText(r.Name, label + ": " + Mathf.RoundToInt(get()) + " m"); }; r.Step = delegate(int d) { set(Mathf.Clamp(Mathf.Round(get()) + (float)d, min, max)); }; if ((Object)(object)k.Slider == (Object)null) { r.Click = delegate { set((get() >= max) ? min : Mathf.Min(max, Mathf.Round(get()) + 2f)); }; r.Refresh = caption; return; } GameObject val2 = Object.Instantiate<GameObject>(k.Slider, (Transform)(object)val, false); ((Object)val2).name = "Slider"; val2.SetActive(true); TMP_Text[] componentsInChildren = val2.GetComponentsInChildren<TMP_Text>(true); for (int num = 0; num < componentsInChildren.Length; num++) { ((Component)componentsInChildren[num]).gameObject.SetActive(false); } RectTransform val3 = (RectTransform)val2.transform; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(1f, 0.5f); val3.anchorMax = val4; val3.anchorMin = val4; val3.pivot = new Vector2(1f, 0.5f); val3.anchoredPosition = new Vector2(-10f, 0f); val3.sizeDelta = new Vector2(160f, Mathf.Min(k.SliderSize.y, 34f)); Slider s = val2.GetComponent<Slider>(); s.onValueChanged = new SliderEvent(); s.minValue = min; s.maxValue = max; s.wholeNumbers = true; Slider obj = s; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj).navigation = navigation; ((UnityEvent<float>)(object)s.onValueChanged).AddListener((UnityAction<float>)delegate(float v) { s_col = col; s_idx[col] = idx; set(v); RefreshValues(); }); r.Refresh = delegate { s.SetValueWithoutNotify(get()); ((Selectable)s).interactable = !r.Locked; caption(); }; } private static void SetText(TMP_Text t, string text) { TMP_Text[] componentsInChildren = ((Component)t).GetComponentsInChildren<TMP_Text>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].text = text; } } private static void ValueText(Kit k, Row r, RectTransform rt, string[] options, Func<int> get, Action<int> set) { TMP_Text v = Label(k.RowText, (Transform)(object)rt, "", (TextAlignmentOptions)4100); Fill(v.rectTransform, 8f, 14f); r.Click = delegate { set((get() + 1) % options.Length); }; r.Refresh = delegate { v.text = options[Mathf.Clamp(get(), 0, options.Length - 1)]; }; } private static Toggle Box(Kit k, RectTransform parent, float right) { //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_0068: 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_0081: 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_0093: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due