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 VanityOutfit v1.0.0
VKTR_VanityOutfit.dll
Decompiled a day 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.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using Valheim.SettingsGui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VKTR.VanityOutfit { internal static class Home { private const string Stash = "stash"; private static float s_since; private static bool s_lastState; private static float s_nextCheck; private static bool s_skipVisit; private static bool s_locResolved; private static Func<bool> s_locInHome; internal const string HomeId = "home"; private static bool LocationIntroInHome() { if (!s_locResolved) { s_locResolved = true; try { if (Chainloader.PluginInfos.ContainsKey("vktr.locationintro")) { Type type = AccessTools.TypeByName("VKTR.LocationIntro.State"); MethodInfo methodInfo = ((type != null) ? AccessTools.PropertyGetter(type, "InHome") : null); if (methodInfo != null) { s_locInHome = AccessTools.MethodDelegate<Func<bool>>(methodInfo, (object)null, true); } } } catch (Exception ex) { Debug.LogWarning((object)("[VKTR_VanityOutfit] LocationIntro: " + ex)); } } try { return s_locInHome != null && s_locInHome(); } catch { s_locInHome = null; return false; } } internal static void Update() { Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || !Plugin.HomeOutfit.Value || Outfit.Active || Time.time < s_nextCheck) { return; } s_nextCheck = Time.time + 0.25f; bool flag = localPlayer.InShelter() || LocationIntroInHome(); if (flag != s_lastState) { s_lastState = flag; s_since = Time.time; } if (Time.time - s_since < Plugin.HomeDelay.Value) { return; } if (!flag) { s_skipVisit = false; } if (flag && !Vanity.HomeMode) { if (!s_skipVisit && Vanity.PresetExists("home") && !Vanity.MatchesPreset("home")) { Vanity.DeletePreset("stash"); Vanity.CopyCurrentTo("stash", withOff: true); Vanity.LoadPreset("home"); Vanity.HomeMode = true; } } else if (!flag && Vanity.HomeMode) { if (Vanity.PresetExists("stash")) { Vanity.LoadPreset("stash"); } Vanity.DeletePreset("stash"); Vanity.HomeMode = false; } } internal static void CancelAuto() { if (s_lastState) { s_skipVisit = true; } if (Vanity.HomeMode) { Vanity.DeletePreset("stash"); Vanity.HomeMode = false; } } } internal static class Hotkey { internal static void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = Plugin.CycleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && !((Character)localPlayer).IsDead() && !Outfit.Active && (!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !TextInput.IsVisible() && !Menu.IsVisible()) { Cycle(); } } } private static void Cycle() { List<int> list = new List<int>(); for (int i = 0; i < 4; i++) { if (Vanity.PresetExists(i)) { list.Add(i); } } int num = 0; if (!Vanity.Off) { num = list.FindIndex((int n) => Vanity.MatchesPreset(n)) + 1; } Home.CancelAuto(); string text; if (num < list.Count) { int num2 = list[num]; Vanity.LoadPreset(num2); text = Vanity.PresetName(num2); if (string.IsNullOrEmpty(text)) { text = Loc.Get("preset", (num2 + 1).ToString()); } } else if (!Vanity.Off) { Vanity.Off = true; text = Loc.Get("real_gear"); } else { Vanity.Off = false; text = Loc.Get("title"); } if (Object.op_Implicit((Object)(object)MessageHud.instance)) { MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false, true); } } } internal static class Lights { private static readonly Dictionary<int, bool> s_cache = new Dictionary<int, bool>(); private static bool s_logged; internal static bool Has(string prefab) { if (!string.IsNullOrEmpty(prefab)) { return Has(StringExtensionMethods.GetStableHashCode(prefab)); } return false; } internal static void LogAll() { if (s_logged || !Object.op_Implicit((Object)(object)ObjectDB.instance)) { return; } s_logged = true; List<string> list = new List<string>(); foreach (GameObject item in ObjectDB.instance.m_items) { ItemDrop val = (Object.op_Implicit((Object)(object)item) ? item.GetComponent<ItemDrop>() : null); if (Object.op_Implicit((Object)(object)val) && Vanity.SlotFor(val.m_itemData) >= 0 && Has(((Object)item).name)) { list.Add(((Object)item).name); } } Debug.Log((object)("[VKTR_VanityOutfit] Light-emitting pieces excluded from outfits: " + ((list.Count > 0) ? string.Join(", ", list) : "none"))); } internal static bool Has(int hash) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (hash == 0) { return false; } if (s_cache.TryGetValue(hash, out var value)) { return value; } ObjectDB instance = ObjectDB.instance; GameObject val = (Object.op_Implicit((Object)(object)instance) ? instance.GetItemPrefab(hash) : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } value = false; foreach (Transform item in val.transform) { Transform val2 = item; if (((Object)val2).name.StartsWith("attach") && ((Component)val2).GetComponentsInChildren<Light>(true).Length != 0) { value = true; break; } } s_cache[hash] = value; return value; } } internal static class Loc { internal static readonly string[] Keys = new string[19] { "title", "hover", "hide", "slot_helmet", "slot_chest", "slot_legs", "slot_cape", "save", "select", "delete", "confirm", "hidden", "preset", "empty", "name_topic", "hide_belt", "home", "real_gear", "has_light" }; private static readonly Dictionary<string, string[]> T = new Dictionary<string, string[]> { ["English"] = new string[19] { "Outfit", "Hold: Outfit", "Hide", "Helmet", "Chest", "Legs", "Cape", "Save", "Wear", "Delete", "Sure?", "Hidden", "Preset {0}", "Empty", "Outfit name", "Hide {0}", "Home", "Real equipment", "Emits light: not usable in outfits" }, ["Swedish"] = new string[19] { "Utstyrsel", "Håll: Utstyrsel", "Dölj", "Hjälm", "Bröst", "Ben", "Mantel", "Spara", "Ta på", "Radera", "Säker?", "Dold", "Förval {0}", "Tom", "Namn på utstyrsel", "Dölj {0}", "Hemma", "Verklig utrustning", "Avger ljus: kan inte användas i utstyrslar" }, ["French"] = new string[19] { "Tenue", "Maintenir : Tenue", "Masquer", "Casque", "Torse", "Jambes", "Cape", "Enregistrer", "Porter", "Supprimer", "Sûr ?", "Masqué", "Préréglage {0}", "Vide", "Nom de la tenue", "Masquer {0}", "Maison", "Équipement réel", "Émet de la lumière : inutilisable dans une tenue" }, ["Italian"] = new string[19] { "Outfit", "Tieni premuto: Outfit", "Nascondi", "Elmo", "Petto", "Gambe", "Mantello", "Salva", "Indossa", "Elimina", "Sicuro?", "Nascosto", "Preset {0}", "Vuoto", "Nome outfit", "Nascondi {0}", "Casa", "Equipaggiamento reale", "Emette luce: non usabile negli outfit" }, ["German"] = new string[19] { "Outfit", "Halten: Outfit", "Verbergen", "Helm", "Brust", "Beine", "Umhang", "Speichern", "Anziehen", "Löschen", "Sicher?", "Verborgen", "Vorlage {0}", "Leer", "Name des Outfits", "{0} verbergen", "Zuhause", "Echte Ausrüstung", "Leuchtet: nicht für Outfits nutzbar" }, ["Spanish"] = new string[19] { "Atuendo", "Mantener: Atuendo", "Ocultar", "Casco", "Pecho", "Piernas", "Capa", "Guardar", "Vestir", "Borrar", "¿Seguro?", "Oculto", "Preajuste {0}", "Vacío", "Nombre del atuendo", "Ocultar {0}", "Casa", "Equipo real", "Emite luz: no se puede usar en atuendos" }, ["Russian"] = new string[19] { "Облик", "Удерживать: Облик", "Скрыть", "Шлем", "Грудь", "Ноги", "Плащ", "Сохранить", "Надеть", "Удалить", "Точно?", "Скрыто", "Набор {0}", "Пусто", "Название облика", "Скрыть {0}", "Дом", "Настоящая экипировка", "Излучает свет: нельзя использовать в облике" }, ["Romanian"] = new string[19] { "Ținută", "Ține apăsat: Ținută", "Ascunde", "Coif", "Piept", "Picioare", "Mantie", "Salvează", "Îmbracă", "Șterge", "Sigur?", "Ascuns", "Set {0}", "Gol", "Numele ținutei", "Ascunde {0}", "Acasă", "Echipament real", "Emite lumină: nu poate fi folosit în ținute" }, ["Bulgarian"] = new string[19] { "Облекло", "Задръж: Облекло", "Скрий", "Шлем", "Гърди", "Крака", "Наметало", "Запази", "Облечи", "Изтрий", "Сигурен?", "Скрито", "Комплект {0}", "Празно", "Име на облеклото", "Скрий {0}", "Вкъщи", "Истинска екипировка", "Излъчва светлина: не може да се ползва в облекла" }, ["Macedonian"] = new string[19] { "Облека", "Задржи: Облека", "Скриј", "Шлем", "Гради", "Нозе", "Наметка", "Зачувај", "Облечи", "Избриши", "Сигурно?", "Скриено", "Комплет {0}", "Празно", "Име на облеката", "Скриј {0}", "Дома", "Вистинска опрема", "Емитува светлина: не може да се користи во облека" }, ["Finnish"] = new string[19] { "Asu", "Pidä pohjassa: Asu", "Piilota", "Kypärä", "Rinta", "Jalat", "Viitta", "Tallenna", "Pue päälle", "Poista", "Varma?", "Piilotettu", "Asu {0}", "Tyhjä", "Asun nimi", "Piilota {0}", "Koti", "Todellinen varustus", "Hohtaa valoa: ei käytettävissä asuissa" }, ["Danish"] = new string[19] { "Påklædning", "Hold: Påklædning", "Skjul", "Hjelm", "Bryst", "Ben", "Kappe", "Gem", "Tag på", "Slet", "Sikker?", "Skjult", "Sæt {0}", "Tom", "Navn på påklædning", "Skjul {0}", "Hjemme", "Rigtigt udstyr", "Udsender lys: kan ikke bruges i outfits" }, ["Norwegian"] = new string[19] { "Antrekk", "Hold: Antrekk", "Skjul", "Hjelm", "Bryst", "Bein", "Kappe", "Lagre", "Ta på", "Slett", "Sikker?", "Skjult", "Sett {0}", "Tom", "Navn på antrekk", "Skjul {0}", "Hjemme", "Ekte utstyr", "Gir lys: kan ikke brukes i antrekk" }, ["Icelandic"] = new string[19] { "Klæðnaður", "Haltu inni: Klæðnaður", "Fela", "Hjálmur", "Bringa", "Fætur", "Skikkja", "Vista", "Klæðast", "Eyða", "Viss?", "Falið", "Sett {0}", "Tómt", "Heiti klæðnaðar", "Fela {0}", "Heima", "Raunverulegur búnaður", "Gefur frá sér ljós: ekki hægt að nota í klæðnaði" }, ["Turkish"] = new string[19] { "Kıyafet", "Basılı tut: Kıyafet", "Gizle", "Miğfer", "Göğüs", "Bacak", "Pelerin", "Kaydet", "Giy", "Sil", "Emin misin?", "Gizli", "Set {0}", "Boş", "Kıyafet adı", "{0} öğesini gizle", "Ev", "Gerçek teçhizat", "Işık yayar: kıyafetlerde kullanılamaz" }, ["Lithuanian"] = new string[19] { "Apranga", "Laikyti: Apranga", "Slėpti", "Šalmas", "Krūtinė", "Kojos", "Apsiaustas", "Išsaugoti", "Apsivilkti", "Ištrinti", "Tikrai?", "Paslėpta", "Rinkinys {0}", "Tuščia", "Aprangos pavadinimas", "Slėpti {0}", "Namai", "Tikra ekipuotė", "Skleidžia šviesą: negalima naudoti aprangoje" }, ["Czech"] = new string[19] { "Oblečení", "Podržet: Oblečení", "Skrýt", "Helma", "Hruď", "Nohy", "Plášť", "Uložit", "Obléct", "Smazat", "Jistě?", "Skryto", "Sada {0}", "Prázdné", "Název oblečení", "Skrýt {0}", "Doma", "Skutečná výstroj", "Vyzařuje světlo: nelze použít v oblečení" }, ["Hungarian"] = new string[19] { "Öltözet", "Tartsd lenyomva: Öltözet", "Elrejt", "Sisak", "Mellvért", "Lábvért", "Köpeny", "Mentés", "Felvétel", "Törlés", "Biztos?", "Rejtett", "Szett {0}", "Üres", "Öltözet neve", "{0} elrejtése", "Otthon", "Valódi felszerelés", "Fényt bocsát ki: öltözékben nem használható" }, ["Slovak"] = new string[19] { "Oblečenie", "Podržať: Oblečenie", "Skryť", "Prilba", "Hruď", "Nohy", "Plášť", "Uložiť", "Obliecť", "Zmazať", "Isto?", "Skryté", "Sada {0}", "Prázdne", "Názov oblečenia", "Skryť {0}", "Doma", "Skutočná výstroj", "Vyžaruje svetlo: nedá sa použiť v oblečení" }, ["Polish"] = new string[19] { "Strój", "Przytrzymaj: Strój", "Ukryj", "Hełm", "Tors", "Nogi", "Peleryna", "Zapisz", "Załóż", "Usuń", "Na pewno?", "Ukryte", "Zestaw {0}", "Pusty", "Nazwa stroju", "Ukryj {0}", "Dom", "Prawdziwy ekwipunek", "Emituje światło: nie można użyć w stroju" }, ["Dutch"] = new string[19] { "Outfit", "Ingedrukt houden: Outfit", "Verbergen", "Helm", "Borst", "Benen", "Cape", "Opslaan", "Aantrekken", "Wissen", "Zeker?", "Verborgen", "Set {0}", "Leeg", "Naam van outfit", "{0} verbergen", "Thuis", "Echte uitrusting", "Geeft licht: niet bruikbaar in outfits" }, ["Portuguese_European"] = new string[19] { "Traje", "Manter premido: Traje", "Ocultar", "Elmo", "Peito", "Pernas", "Capa", "Guardar", "Vestir", "Apagar", "Certeza?", "Oculto", "Conjunto {0}", "Vazio", "Nome do traje", "Ocultar {0}", "Casa", "Equipamento real", "Emite luz: não pode ser usado em trajes" }, ["Portuguese_Brazilian"] = new string[19] { "Visual", "Segurar: Visual", "Ocultar", "Capacete", "Peito", "Pernas", "Capa", "Salvar", "Vestir", "Excluir", "Certeza?", "Oculto", "Conjunto {0}", "Vazio", "Nome do visual", "Ocultar {0}", "Casa", "Equipamento real", "Emite luz: não pode ser usado em trajes" }, ["Chinese"] = new string[19] { "外观", "长按:外观", "隐藏", "头盔", "胸甲", "腿甲", "披风", "保存", "穿戴", "删除", "确定?", "已隐藏", "预设 {0}", "空", "外观名称", "隐藏{0}", "居家", "真实装备", "会发光:无法用于外观" }, ["Chinese_Trad"] = new string[19] { "外觀", "長按:外觀", "隱藏", "頭盔", "胸甲", "腿甲", "披風", "儲存", "穿戴", "刪除", "確定?", "已隱藏", "預設 {0}", "空", "外觀名稱", "隱藏{0}", "居家", "真實裝備", "會發光:無法用於外觀" }, ["Japanese"] = new string[19] { "衣装", "長押し:衣装", "非表示", "頭", "胴", "脚", "マント", "保存", "着用", "削除", "本当に?", "非表示", "プリセット{0}", "空き", "衣装名", "{0}を非表示", "自宅", "実際の装備", "光を放つ:コーデには使えません" }, ["Korean"] = new string[19] { "외형", "길게 누르기: 외형", "숨기기", "투구", "상의", "하의", "망토", "저장", "착용", "삭제", "확실한가요?", "숨김", "프리셋 {0}", "비어 있음", "외형 이름", "{0} 숨기기", "집", "실제 장비", "빛을 냄: 외형에 사용할 수 없음" }, ["Hindi"] = new string[19] { "प\u094bश\u093eक", "दब\u093eए रख\u0947\u0902: प\u094bश\u093eक", "छ\u093fप\u093eए\u0901", "ह\u0947लम\u0947ट", "छ\u093eत\u0940", "प\u0948र", "लब\u093eद\u093e", "सह\u0947ज\u0947\u0902", "पहन\u0947\u0902", "हट\u093eए\u0901", "पक\u094dक\u093e?", "छ\u093fप\u093e ह\u0941आ", "प\u094dर\u0940स\u0947ट {0}", "ख\u093eल\u0940", "प\u094bश\u093eक क\u093e न\u093eम", "{0} छ\u093fप\u093eए\u0901", "घर", "असल\u0940 उपकरण", "र\u094bशन\u0940 द\u0947त\u093e ह\u0948: प\u094bश\u093eक म\u0947\u0902 उपय\u094bग नह\u0940\u0902 ह\u094b सकत\u093e" }, ["Thai"] = new string[19] { "ช\u0e38ดแต\u0e48งกาย", "กดค\u0e49าง: ช\u0e38ดแต\u0e48งกาย", "ซ\u0e48อน", "หมวก", "เส\u0e37\u0e49อ", "กางเกง", "ผ\u0e49าคล\u0e38ม", "บ\u0e31นท\u0e36ก", "สวมใส\u0e48", "ลบ", "แน\u0e48ใจ?", "ซ\u0e48อนอย\u0e39\u0e48", "ช\u0e38ดท\u0e35\u0e48 {0}", "ว\u0e48าง", "ช\u0e37\u0e48อช\u0e38ด", "ซ\u0e48อน{0}", "บ\u0e49าน", "อ\u0e38ปกรณ\u0e4cจร\u0e34ง", "เปล\u0e48งแสง: ใช\u0e49เป\u0e47นช\u0e38ดแต\u0e48งไม\u0e48ได\u0e49" }, ["Croatian"] = new string[19] { "Odjeća", "Drži: Odjeća", "Sakrij", "Kaciga", "Prsa", "Noge", "Plašt", "Spremi", "Odjeni", "Obriši", "Sigurno?", "Skriveno", "Komplet {0}", "Prazno", "Naziv odjeće", "Sakrij {0}", "Dom", "Prava oprema", "Svijetli: ne može se koristiti u odjeći" }, ["Georgian"] = new string[19] { "სამოსი", "ხანგრძლივად: სამოსი", "დამალვა", "ჩაფხუტი", "მკერდი", "ფეხები", "მოსასხამი", "შენახვა", "ჩაცმა", "წაშლა", "დარწმუნებული ხარ?", "დამალული", "ნაკრები {0}", "ცარიელი", "სამოსის სახელი", "{0}-ის დამალვა", "სახლი", "ნამდვილი აღჭურვილობა", "ასხივებს სინათლეს: სამოსში ვერ გამოიყენება" }, ["Greek"] = new string[19] { "Ενδυμασία", "Κράτα πατημένο: Ενδυμασία", "Απόκρυψη", "Κράνος", "Στήθος", "Πόδια", "Κάπα", "Αποθήκευση", "Φόρεσε", "Διαγραφή", "Σίγουρα;", "Κρυφό", "Σετ {0}", "Κενό", "Όνομα ενδυμασίας", "Απόκρυψη {0}", "Σπίτι", "Πραγματικός εξοπλισμός", "Εκπέμπει φως: δεν χρησιμοποιείται σε εμφάνιση" }, ["Serbian"] = new string[19] { "Одећа", "Држи: Одећа", "Сакриј", "Кацига", "Груди", "Ноге", "Плашт", "Сачувај", "Обуци", "Обриши", "Сигурно?", "Скривено", "Комплет {0}", "Празно", "Назив одеће", "Сакриј {0}", "Дом", "Права опрема", "Светли: не може се користити у одећи" }, ["Ukrainian"] = new string[19] { "Вбрання", "Утримуй: Вбрання", "Сховати", "Шолом", "Груди", "Ноги", "Плащ", "Зберегти", "Вдягнути", "Видалити", "Точно?", "Приховано", "Набір {0}", "Порожньо", "Назва вбрання", "Сховати {0}", "Дім", "Справжнє спорядження", "Випромінює світло: не можна використати в образі" }, ["Latvian"] = new string[19] { "Tērps", "Turēt: Tērps", "Paslēpt", "Ķivere", "Krūtis", "Kājas", "Apmetnis", "Saglabāt", "Uzvilkt", "Dzēst", "Droši?", "Paslēpts", "Komplekts {0}", "Tukšs", "Tērpa nosaukums", "Paslēpt {0}", "Mājas", "Īstais ekipējums", "Izstaro gaismu: nav izmantojams tērpos" } }; private static string s_loaded; private static readonly Action<Localization, string, string> AddWord = AccessTools.MethodDelegate<Action<Localization, string, string>>(AccessTools.Method(typeof(Localization), "AddWord", (Type[])null, (Type[])null), (object)null, true); private static readonly Dictionary<string, string> s_words = new Dictionary<string, string>(); internal static void Load(Localization loc, string language) { if (loc != null) { if (language == null || !T.TryGetValue(language, out var value)) { value = T["English"]; } for (int i = 0; i < Keys.Length; i++) { AddWord(loc, "vktr_vanity_" + Keys[i], value[i]); s_words[Keys[i]] = value[i]; } s_loaded = language; } } internal static string Get(string key) { Localization instance = Localization.instance; if (instance == null) { return key; } string selectedLanguage = instance.GetSelectedLanguage(); if (s_loaded != selectedLanguage) { Load(instance, selectedLanguage); } if (!s_words.TryGetValue(key, out var value)) { return key; } return value; } internal static string Get(string key, string arg) { return string.Format(Get(key), arg); } internal static string Slot(int i) { if (i >= 4) { return Game("$item_trinket"); } return Get(Keys[3 + i]); } internal static string Game(string text) { if (Localization.instance == null) { return text; } return Localization.instance.Localize(text); } } [HarmonyPatch(typeof(Localization), "SetupLanguage")] internal static class SetupLanguage_Patch { private static void Postfix(Localization __instance, string language) { Loc.Load(__instance, language); } } internal static class BarberHold { private static Barber s_pending; private static float s_start; internal static bool Bypass; private static bool UseHeld() { if (!ZInput.GetButton("Use")) { return ZInput.GetButton("JoyUse"); } return true; } internal static bool OnInteract(Barber barber, Humanoid human, bool hold, bool alt) { if (Bypass || alt || (Object)(object)human != (Object)(object)Player.m_localPlayer) { return false; } if (!hold) { s_pending = barber; s_start = Time.time; return true; } if ((Object)(object)s_pending == (Object)(object)barber && Time.time - s_start >= Plugin.HoldTime.Value) { s_pending = null; Outfit.Open(barber); } return true; } internal static void Update() { if (!Object.op_Implicit((Object)(object)s_pending) || UseHeld()) { return; } Barber val = s_pending; s_pending = null; if (Time.time - s_start >= Plugin.HoldTime.Value || !Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } Bypass = true; try { val.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } finally { Bypass = false; } } } [HarmonyPatch(typeof(Barber), "Interact")] internal static class BarberInteract_Patch { private static bool Prefix(Barber __instance, Humanoid __0, bool __1, bool __2, ref bool __result) { if (!BarberHold.OnInteract(__instance, __0, __1, __2)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Barber), "GetHoverText")] internal static class BarberHover_Patch { private static void Postfix(Barber __instance, ref string __result) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && !string.IsNullOrEmpty(__result) && !(Vector3.Distance(((Component)localPlayer).transform.position, ((Component)__instance).transform.position) > __instance.m_useDistance + 1f)) { __result = __result + Loc.Game("\n[<color=yellow><b>$KEY_Use</b></color>] ") + Loc.Get("hover"); } } } internal static class Outfit { internal static bool Active; private static Barber s_barber; private static Inventory s_inv; private static GameObject s_root; private static GameObject s_row; private static Toggle[] s_btns; private static TMP_Text[] s_txt; private static UIGroupHandler s_group; private static Action<Vector2i> s_prevLower; private static bool s_prevJump; internal static Vector3 CamDir; private static Quaternion s_savedYaw; private static readonly Dictionary<Graphic, Color> s_orig = new Dictionary<Graphic, Color>(); private static readonly Dictionary<Graphic, Material> s_origMat = new Dictionary<Graphic, Material>(); private static readonly Dictionary<Selectable, ColorBlock> s_origColors = new Dictionary<Selectable, ColorBlock>(); private static CanvasGroup s_craftingGroup; private static bool s_craftingHadGroup; private static bool s_sized; private static Vector2 s_origSize; private const float GridTopPad = 8f; private static readonly HashSet<InventoryElement> s_shifted = new HashSet<InventoryElement>(); private static readonly List<GameObject> s_hiddenGos = new List<GameObject>(); private static RectTransform s_beltPanel; private static Toggle s_belt; private static TMP_Text s_beltLabel; internal static bool Dirty; internal static void Open(Barber barber) { InventoryGui instance = InventoryGui.instance; if (!Object.op_Implicit((Object)(object)instance) || Active) { return; } s_barber = barber; Active = true; FacePlayerToCamera(); Vanity.Refresh(); Rebuild(); instance.Show((Container)null, 1); try { Setup(instance); } catch (Exception ex) { Debug.LogWarning((object)("[VKTR_VanityOutfit] Setup UI: " + ex)); } } internal static void Close() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } Active = false; s_barber = null; if (Dirty) { Home.CancelAuto(); } Dirty = false; Vanity.Refresh(); Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { R.LookYaw.Invoke((Character)(object)localPlayer) = s_savedYaw; localPlayer.FaceLookDirection(); ((Character)localPlayer).SetLookDir(s_savedYaw * Vector3.forward, 0f); } InventoryGui instance = InventoryGui.instance; if (!Object.op_Implicit((Object)(object)instance)) { return; } try { InventoryGrid val = R.ContainerGrid.Invoke(instance); val.OnMoveToLowerInventoryGrid = s_prevLower; R.JumpToNext.Invoke(val) = s_prevJump; if (Object.op_Implicit((Object)(object)s_root)) { s_root.SetActive(false); } RestoreColors(); if (Object.op_Implicit((Object)(object)s_group)) { s_group.SetActive(false); instance.m_uiGroups = Array.FindAll(instance.m_uiGroups, (UIGroupHandler g) => (Object)(object)g != (Object)(object)s_group); } if (Object.op_Implicit((Object)(object)instance.m_takeAllButton)) { ((Component)instance.m_takeAllButton).gameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)instance.m_stackAllButton)) { ((Component)instance.m_stackAllButton).gameObject.SetActive(true); } ((Component)instance.m_container).gameObject.SetActive(false); } catch (Exception ex) { Debug.LogWarning((object)("[VKTR_VanityOutfit] Close: " + ex)); } } internal static void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } InventoryGui instance = InventoryGui.instance; Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)instance) || !InventoryGui.IsVisible() || !Object.op_Implicit((Object)(object)localPlayer)) { Close(); return; } if (!Object.op_Implicit((Object)(object)s_barber) || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)s_barber).transform.position) > Plugin.CloseDistance.Value) { instance.Hide(); return; } Quaternion val = Quaternion.LookRotation(CamDir, Vector3.up); if (Quaternion.Angle(R.LookYaw.Invoke((Character)(object)localPlayer), val) > 0.5f) { R.LookYaw.Invoke((Character)(object)localPlayer) = val; localPlayer.FaceLookDirection(); } ((Character)localPlayer).SetLookDir(CamDir, 0f); if (Object.op_Implicit((Object)(object)s_group) && s_group.IsActive && Object.op_Implicit((Object)(object)SelectedButton()) && !TextInput.IsVisible() && (ZInput.GetButtonDown("JoyDPadUp") || ZInput.GetButtonDown("JoyLStickUp"))) { int num = Math.Max(0, Array.IndexOf(s_btns, SelectedButton())); R.ContainerGrid.Invoke(instance).SetGamepadSelection(new Vector2i(num, 0)); R.SetActiveGroup(instance, 0, arg3: true); } } internal static void CycleGroups(InventoryGui ig, int dir) { if (!Object.op_Implicit((Object)(object)s_group)) { return; } int num = Array.IndexOf(ig.m_uiGroups, s_group); if (num < 0) { return; } EventSystem current = EventSystem.current; int num2 = 6; int num3 = 0; if (R.ActiveGroup.Invoke(ig) == num && Object.op_Implicit((Object)(object)current) && Object.op_Implicit((Object)(object)current.currentSelectedGameObject)) { int num4 = Presets.PanelOf(current.currentSelectedGameObject); num3 = ((num4 >= 0) ? (num4 + 1) : 0); } int num5 = (num3 + dir + num2) % num2; if (R.ActiveGroup.Invoke(ig) != 0 && R.ActiveGroup.Invoke(ig) != num) { num5 = ((dir <= 0) ? (num2 - 1) : 0); } if (num5 == 0) { R.SetActiveGroup(ig, 0, arg3: true); return; } R.SetActiveGroup(ig, num, arg3: true); if (Object.op_Implicit((Object)(object)current)) { current.SetSelectedGameObject(((Component)Presets.WearButton(num5 - 1)).gameObject); } } private static void FacePlayerToCamera() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { s_savedYaw = R.LookYaw.Invoke((Character)(object)localPlayer); Vector3 val = Vector3.zero; if (Object.op_Implicit((Object)(object)GameCamera.instance)) { val = ((Component)GameCamera.instance).transform.position - ((Component)localPlayer).transform.position; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)localPlayer).transform.forward; } CamDir = ((Vector3)(ref val)).normalized; R.LookYaw.Invoke((Character)(object)localPlayer) = Quaternion.LookRotation(CamDir, Vector3.up); localPlayer.FaceLookDirection(); ((Character)localPlayer).SetLookDir(CamDir, 0f); } } private static Toggle SelectedButton() { EventSystem current = EventSystem.current; GameObject val = (Object.op_Implicit((Object)(object)current) ? current.currentSelectedGameObject : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.GetComponent<Toggle>(); } internal static void Rebuild() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown Player localPlayer = Player.m_localPlayer; s_inv = new Inventory("vanity_outfit", Object.op_Implicit((Object)(object)localPlayer) ? ((Humanoid)localPlayer).GetInventory().GetBkg() : null, 5, 1); for (int i = 0; i < 5; i++) { if (Vanity.TryGetItem(i, out var prefab, out var variant)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefab); ItemDrop val = (Object.op_Implicit((Object)(object)itemPrefab) ? itemPrefab.GetComponent<ItemDrop>() : null); if (Object.op_Implicit((Object)(object)val)) { ItemData val2 = val.m_itemData.Clone(); val2.m_dropPrefab = itemPrefab; val2.m_variant = variant; val2.m_stack = 1; val2.m_durability = val2.GetMaxDurability(); R.AddItemAt(s_inv, val2, 1, i, 0, arg6: true); } } } } internal static void Tint(Graphic g, Color tint, bool temporary) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)g)) { return; } if (temporary) { if (!s_orig.ContainsKey(g)) { s_orig[g] = g.color; } if (!s_origMat.ContainsKey(g)) { s_origMat[g] = g.material; } } Color a = (temporary ? s_orig[g] : g.color); g.material = null; g.color = Mul(a, tint); } internal static Color Mul(Color a, Color b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) return new Color(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a); } internal static void Shade(Image bg, Vector2 inset) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)bg)) { ((Graphic)bg).color = Color.white; Tint((Graphic)(object)bg, Plugin.PanelTint.Value, temporary: false); InventoryGui instance = InventoryGui.instance; Transform val = (Object.op_Implicit((Object)(object)instance) ? ((Transform)instance.m_container).Find("sunken") : null); Image val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Image>() : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.sprite) && Object.op_Implicit((Object)(object)((Component)bg).transform.parent)) { Rect rect = instance.m_container.rect; float width = ((Rect)(ref rect)).width; rect = ((Graphic)val2).rectTransform.rect; float num = Mathf.Max(0f, (width - ((Rect)(ref rect)).width) * 0.5f); GameObject val3 = new GameObject("SunkenClip", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val3.transform.SetParent(((Component)bg).transform.parent, false); val3.transform.SetSiblingIndex(((Component)bg).transform.GetSiblingIndex() + 1); RectTransform val4 = (RectTransform)val3.transform; val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = new Vector2(num, num); val4.offsetMax = new Vector2(0f - num, 0f - num); GameObject val5 = new GameObject("sunken", new Type[2] { typeof(RectTransform), typeof(Image) }); val5.transform.SetParent((Transform)(object)val4, false); Image component = val5.GetComponent<Image>(); component.sprite = val2.sprite; component.type = val2.type; ((Graphic)component).color = ((Graphic)val2).color; ((Graphic)component).material = ((Graphic)val2).material; component.pixelsPerUnitMultiplier = val2.pixelsPerUnitMultiplier; ((Graphic)component).raycastTarget = false; Vector4 border = val2.sprite.border; float num2 = Mathf.Max(0.0001f, val2.pixelsPerUnit * val2.pixelsPerUnitMultiplier); RectTransform val6 = (RectTransform)val5.transform; val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.offsetMin = new Vector2((0f - border.x) / num2, (0f - border.y) / num2); val6.offsetMax = new Vector2(border.z / num2, border.w / num2); } } } internal static List<Image> PanelBackgrounds(RectTransform panel) { List<Image> list = new List<Image>(); if (!Object.op_Implicit((Object)(object)panel)) { return list; } Image[] componentsInChildren = ((Component)panel).GetComponentsInChildren<Image>(true); foreach (Image val in componentsInChildren) { string text = (Object.op_Implicit((Object)(object)val.sprite) ? ((Object)val.sprite).name : ""); string text2 = (Object.op_Implicit((Object)(object)((Graphic)val).material) ? ((Object)((Graphic)val).material).name : ""); if (text.StartsWith("woodpanel") || text == "crafting_panel_bkg" || text2.StartsWith("litpanel")) { list.Add(val); } } return list; } private static void SetColor(Graphic g, Color c) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)g)) { if (!s_orig.ContainsKey(g)) { s_orig[g] = g.color; } g.color = c; } } private static void RestoreColors() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Graphic, Color> item in s_orig) { if (Object.op_Implicit((Object)(object)item.Key)) { item.Key.color = item.Value; } } s_orig.Clear(); foreach (KeyValuePair<Graphic, Material> item2 in s_origMat) { if (Object.op_Implicit((Object)(object)item2.Key)) { item2.Key.material = item2.Value; } } s_origMat.Clear(); foreach (KeyValuePair<Selectable, ColorBlock> s_origColor in s_origColors) { if (Object.op_Implicit((Object)(object)s_origColor.Key)) { s_origColor.Key.colors = s_origColor.Value; } } s_origColors.Clear(); ShowCrafting(show: true); foreach (InventoryElement item3 in s_shifted) { if (Object.op_Implicit((Object)(object)item3)) { RectTransform val = (RectTransform)((Component)item3).transform; val.anchoredPosition += new Vector2(0f, 8f); } } s_shifted.Clear(); foreach (GameObject s_hiddenGo in s_hiddenGos) { if (Object.op_Implicit((Object)(object)s_hiddenGo)) { s_hiddenGo.SetActive(true); } } s_hiddenGos.Clear(); InventoryGui instance = InventoryGui.instance; if (s_sized && Object.op_Implicit((Object)(object)instance)) { instance.m_container.sizeDelta = s_origSize; s_sized = false; } } private static void ShowCrafting(bool show) { InventoryGui instance = InventoryGui.instance; if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance.m_crafting)) { return; } if (!show) { s_craftingGroup = ((Component)instance.m_crafting).GetComponent<CanvasGroup>(); s_craftingHadGroup = Object.op_Implicit((Object)(object)s_craftingGroup); if (!Object.op_Implicit((Object)(object)s_craftingGroup)) { s_craftingGroup = ((Component)instance.m_crafting).gameObject.AddComponent<CanvasGroup>(); } s_craftingGroup.alpha = 0f; s_craftingGroup.interactable = false; s_craftingGroup.blocksRaycasts = false; } else if (Object.op_Implicit((Object)(object)s_craftingGroup)) { if (s_craftingHadGroup) { s_craftingGroup.alpha = 1f; s_craftingGroup.interactable = true; s_craftingGroup.blocksRaycasts = true; } else { Object.Destroy((Object)(object)s_craftingGroup); } s_craftingGroup = null; } } private static void ResizePanel(InventoryGui ig) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: 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_0092: Unknown result type (might be due to invalid IL or missing references) RectTransform container = ig.m_container; InventoryGrid obj = R.ContainerGrid.Invoke(ig); RectTransform val = (RectTransform)((Component)obj).transform; s_origSize = container.sizeDelta; Rect rect = container.rect; float height = ((Rect)(ref rect)).height; rect = val.rect; float height2 = ((Rect)(ref rect)).height; float elementSpace = obj.m_elementSpace; if (!(height <= 1f) && !(height2 <= elementSpace)) { float num = height - height2 + elementSpace; float num2; if (s_btns == null || !Object.op_Implicit((Object)(object)s_btns[0])) { num2 = 34f; } else { rect = ((RectTransform)((Component)s_btns[0]).transform).rect; num2 = ((Rect)(ref rect)).height + 8f; } float num3 = num2; float num4 = num * 1.05f + num3 + 12f + 8f; if (!(num4 >= height)) { container.SetSizeWithCurrentAnchors((Axis)1, num4); s_sized = true; } } } private static void Setup(InventoryGui ig) { //IL_001f: 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) foreach (Image item in PanelBackgrounds(ig.m_player)) { Tint((Graphic)(object)item, Plugin.PanelTint.Value, temporary: true); } foreach (Image item2 in PanelBackgrounds(ig.m_container)) { Tint((Graphic)(object)item2, Plugin.PanelTint.Value, temporary: true); } ShowCrafting(show: false); InventoryGrid val = R.ContainerGrid.Invoke(ig); s_prevLower = val.OnMoveToLowerInventoryGrid; s_prevJump = R.JumpToNext.Invoke(val); val.OnMoveToLowerInventoryGrid = OnGridDown; R.JumpToNext.Invoke(val) = true; if (!Object.op_Implicit((Object)(object)s_root)) { CreateRow(ig); } if (!s_sized) { ResizePanel(ig); } s_root.SetActive(true); s_root.transform.SetAsLastSibling(); if (Array.IndexOf(ig.m_uiGroups, s_group) < 0) { List<UIGroupHandler> list = new List<UIGroupHandler>(ig.m_uiGroups) { s_group }; ig.m_uiGroups = list.ToArray(); } } private static void CreateRow(InventoryGui ig) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) s_root = new GameObject("VanityOutfitUI", new Type[1] { typeof(RectTransform) }); s_root.transform.SetParent(((Transform)ig.m_container).parent, false); s_root.AddComponent<LayoutElement>().ignoreLayout = true; s_row = new GameObject("VanityOutfitRow", new Type[1] { typeof(RectTransform) }); s_row.transform.SetParent(s_root.transform, false); s_btns = (Toggle[])(object)new Toggle[5]; s_txt = (TMP_Text[])(object)new TMP_Text[5]; Toggle val = SettingsToggle(); float width = Mathf.Max(40f, R.ContainerGrid.Invoke(ig).m_elementSpace - 4f); for (int i = 0; i < 5; i++) { int slot = i; Toggle val2 = (Object.op_Implicit((Object)(object)val) ? BuildToggle(ig, val, width, out s_txt[i]) : ClonePvpToggle(ig, out s_txt[i])); ((Object)((Component)val2).gameObject).name = "VanityHide" + i; val2.onValueChanged = new ToggleEvent(); val2.group = null; ((Selectable)val2).interactable = true; val2.SetIsOnWithoutNotify(Vanity.IsHidden(slot)); ((UnityEvent<bool>)(object)val2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v) { Vanity.SetHidden(slot, v); Dirty = true; }); s_btns[i] = val2; } Presets.Create(ig, s_root.transform); Button val3 = Presets.WearButton(0); CreateBeltPanel(ig, val); Navigation val4; for (int num = 0; num < 5; num++) { val4 = default(Navigation); ((Navigation)(ref val4)).mode = (Mode)4; Navigation navigation = val4; ((Navigation)(ref navigation)).selectOnLeft = (Selectable)(object)((num > 0) ? s_btns[num - 1] : null); ((Navigation)(ref navigation)).selectOnRight = (Selectable)(object)((num < 4) ? s_btns[num + 1] : null); ((Navigation)(ref navigation)).selectOnDown = (Selectable)(Object.op_Implicit((Object)(object)s_belt) ? ((object)s_belt) : ((object)val3)); ((Selectable)s_btns[num]).navigation = navigation; } if (Object.op_Implicit((Object)(object)s_belt)) { Toggle obj = s_belt; val4 = default(Navigation); ((Navigation)(ref val4)).mode = (Mode)4; ((Navigation)(ref val4)).selectOnUp = (Selectable)(object)s_btns[0]; ((Navigation)(ref val4)).selectOnRight = (Selectable)(object)val3; ((Selectable)obj).navigation = val4; } Presets.SetupNav((Selectable)(object)s_btns[0]); s_group = s_root.AddComponent<UIGroupHandler>(); s_group.m_defaultElement = ((Component)s_btns[0]).gameObject; s_group.m_groupPriority = ((ig.m_uiGroups.Length != 0) ? ig.m_uiGroups[0].m_groupPriority : 0); s_group.m_enableWhenActiveAndGamepad = null; } private static RectTransform CreateTogglePanel(InventoryGui ig, Toggle src, string name, float width, Func<bool> get, Action<bool> set, out Toggle toggle, out TMP_Text label) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: 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_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(s_root.transform, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; Transform val5 = ((Transform)ig.m_container).Find("Bkg"); Image val6 = (Object.op_Implicit((Object)(object)val5) ? ((Component)val5).GetComponent<Image>() : null); GameObject val7 = new GameObject("Bkg", new Type[2] { typeof(RectTransform), typeof(Image) }); val7.transform.SetParent(val.transform, false); RectTransform val8 = (RectTransform)val7.transform; val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; Image component = val7.GetComponent<Image>(); Rect rect; if (Object.op_Implicit((Object)(object)val6)) { rect = ((Graphic)val6).rectTransform.rect; Vector2 size = ((Rect)(ref rect)).size; rect = ig.m_container.rect; Vector2 val9 = (size - ((Rect)(ref rect)).size) * 0.5f; val8.offsetMin = -val9 * 0.5f; val8.offsetMax = val9 * 0.5f; component.sprite = val6.sprite; component.type = val6.type; component.pixelsPerUnitMultiplier = val6.pixelsPerUnitMultiplier; } else { anchorMin = (val8.offsetMax = Vector2.zero); val8.offsetMin = anchorMin; } ((Graphic)component).color = Color.white; Vector2 inset; if (!Object.op_Implicit((Object)(object)val6)) { inset = Vector2.zero; } else { rect = ((Graphic)val6).rectTransform.rect; Vector2 size2 = ((Rect)(ref rect)).size; rect = ig.m_container.rect; inset = (size2 - ((Rect)(ref rect)).size) * 0.25f; } Shade(component, inset); label = null; Toggle val10 = (Object.op_Implicit((Object)(object)src) ? BuildToggle(ig, src, width, out label, val.transform) : null); if (!Object.op_Implicit((Object)(object)val10)) { val10 = ClonePvpToggle(ig, out label); ((Component)val10).transform.SetParent(val.transform, false); } ((Object)((Component)val10).gameObject).name = name + "Toggle"; val10.onValueChanged = new ToggleEvent(); val10.group = null; ((Selectable)val10).interactable = true; val10.SetIsOnWithoutNotify(get()); ((UnityEvent<bool>)(object)val10.onValueChanged).AddListener((UnityAction<bool>)delegate(bool v) { set(v); Dirty = true; }); RectTransform val11 = (RectTransform)((Component)val10).transform; ((Vector2)(ref val3))..ctor(0f, 0.5f); val11.pivot = val3; anchorMin = (val11.anchorMax = val3); val11.anchorMin = anchorMin; rect = val11.rect; float num = Mathf.Max(28f, ((Rect)(ref rect)).height); val11.anchoredPosition = new Vector2(8f, 0f); val2.sizeDelta = new Vector2(width + 16f, num + 16f); toggle = val10; return val2; } private static void CreateBeltPanel(InventoryGui ig, Toggle src) { s_beltPanel = CreateTogglePanel(ig, src, "VanityBeltPanel", 240f, () => Vanity.BeltHidden, delegate(bool v) { Vanity.BeltHidden = v; }, out s_belt, out s_beltLabel); } private static void UpdateBeltPanel(InventoryGui ig) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0038: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)s_beltPanel)) { Vector3[] array = (Vector3[])(object)new Vector3[4]; ig.m_container.GetWorldCorners(array); RectTransform val = (RectTransform)((Transform)s_beltPanel).parent; ((Transform)s_beltPanel).localPosition = ((Transform)val).InverseTransformPoint(array[0]) + new Vector3(6f, -14f, 0f); ((Selectable)s_belt).interactable = true; s_belt.SetIsOnWithoutNotify(Vanity.BeltHidden); if (Object.op_Implicit((Object)(object)s_beltLabel)) { s_beltLabel.text = Loc.Get("hide_belt", Loc.Game("$item_beltstrength")); } } } private static Toggle SettingsToggle() { try { Menu instance = Menu.instance; GameObject val = (Object.op_Implicit((Object)(object)instance) ? instance.m_settingsPrefab : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } GameplaySettings componentInChildren = val.GetComponentInChildren<GameplaySettings>(true); Toggle val2 = (Toggle)(Object.op_Implicit((Object)(object)componentInChildren) ? /*isinst with value type is only supported in some contexts*/: null); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.GetComponentInChildren<Toggle>(true); } return (Object.op_Implicit((Object)(object)val2) && ((Selectable)val2).targetGraphic is Image && val2.graphic is Image) ? val2 : null; } catch (Exception ex) { Debug.LogWarning((object)("[VKTR_VanityOutfit] Settings toggle: " + ex)); return null; } } private static Toggle BuildToggle(InventoryGui ig, Toggle src, float width, out TMP_Text label, Transform parent = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_0202: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026b: 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_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) Image val = (Image)((Selectable)src).targetGraphic; Image val2 = (Image)src.graphic; Rect rect = ((Graphic)val).rectTransform.rect; float num = ((Rect)(ref rect)).height; if (num < 8f) { num = 26f; } num = Mathf.Min(num, 28f); GameObject val3 = new GameObject("VanityHide", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Toggle) }); val3.transform.SetParent(Object.op_Implicit((Object)(object)parent) ? parent : s_row.transform, false); RectTransform val4 = (RectTransform)val3.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); val4.pivot = val5; Vector2 anchorMin = (val4.anchorMax = val5); val4.anchorMin = anchorMin; val4.sizeDelta = new Vector2(width, num); ((Graphic)val3.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); GameObject val7 = new GameObject("Box", new Type[2] { typeof(RectTransform), typeof(Image) }); val7.transform.SetParent(val3.transform, false); RectTransform val8 = (RectTransform)val7.transform; ((Vector2)(ref val5))..ctor(0f, 0.5f); val8.pivot = val5; anchorMin = (val8.anchorMax = val5); val8.anchorMin = anchorMin; val8.sizeDelta = new Vector2(num, num); Image component = val7.GetComponent<Image>(); CopyImage(val, component); GameObject val10 = new GameObject("Check", new Type[2] { typeof(RectTransform), typeof(Image) }); val10.transform.SetParent(val7.transform, false); RectTransform val11 = (RectTransform)val10.transform; ((Vector2)(ref val5))..ctor(0.5f, 0.5f); val11.pivot = val5; anchorMin = (val11.anchorMax = val5); val11.anchorMin = anchorMin; rect = ((Graphic)val).rectTransform.rect; float num2; if (!(((Rect)(ref rect)).height > 1f)) { num2 = 0.7f; } else { rect = ((Graphic)val2).rectTransform.rect; float height = ((Rect)(ref rect)).height; rect = ((Graphic)val).rectTransform.rect; num2 = height / ((Rect)(ref rect)).height; } float num3 = num2; val11.sizeDelta = new Vector2(num, num) * Mathf.Clamp(num3, 0.3f, 1.2f); Image component2 = val10.GetComponent<Image>(); CopyImage(val2, component2); GameObject val13 = Object.Instantiate<GameObject>(((Component)ig.m_containerName).gameObject, val3.transform, false); StripClone(val13); RectTransform val14 = (RectTransform)val13.transform; val14.anchorMin = new Vector2(0f, 0f); val14.anchorMax = new Vector2(1f, 1f); val14.pivot = new Vector2(0f, 0.5f); val14.offsetMin = new Vector2(num + 4f, 0f); val14.offsetMax = Vector2.zero; label = val13.GetComponent<TMP_Text>(); if (Object.op_Implicit((Object)(object)label)) { label.enableAutoSizing = true; label.fontSizeMax = Mathf.Min(label.fontSize, 18f); label.fontSizeMin = 8f; label.alignment = (TextAlignmentOptions)4097; } Toggle component3 = val3.GetComponent<Toggle>(); ((Selectable)component3).targetGraphic = (Graphic)(object)component; component3.graphic = (Graphic)(object)component2; ((Selectable)component3).transition = ((Selectable)src).transition; ((Selectable)component3).colors = ((Selectable)src).colors; ((Selectable)component3).spriteState = ((Selectable)src).spriteState; Tint((Graphic)(object)component, Plugin.ButtonTint.Value, temporary: false); return component3; } private static void CopyImage(Image from, Image to) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) to.sprite = from.sprite; to.type = from.type; ((Graphic)to).color = ((Graphic)from).color; ((Graphic)to).material = ((Graphic)from).material; to.preserveAspect = from.preserveAspect; to.pixelsPerUnitMultiplier = from.pixelsPerUnitMultiplier; } private static Toggle ClonePvpToggle(InventoryGui ig, out TMP_Text label) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)ig.m_pvp).gameObject, s_row.transform, false); val.SetActive(true); StripClone(val); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; label = val.GetComponentInChildren<TMP_Text>(true); if (Object.op_Implicit((Object)(object)label)) { label.enableAutoSizing = true; label.fontSizeMax = label.fontSize; label.fontSizeMin = 8f; } return val.GetComponent<Toggle>(); } internal static void StripClone(GameObject go) { UIGamePad[] componentsInChildren = go.GetComponentsInChildren<UIGamePad>(true); foreach (UIGamePad val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val.m_hint)) { Object.Destroy((Object)(object)val.m_hint); } Object.Destroy((Object)(object)val); } MonoBehaviour[] componentsInChildren2 = go.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && ((object)val2).GetType().Name == "Localize") { Object.Destroy((Object)(object)val2); } } } private static void OnGridDown(Vector2i pos) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; if (Active && Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)s_group)) { int num = Mathf.Clamp(pos.x, 0, 4); R.SetActiveGroup(instance, Array.IndexOf(instance.m_uiGroups, s_group), arg3: true); EventSystem current = EventSystem.current; if (Object.op_Implicit((Object)(object)current)) { current.SetSelectedGameObject(((Component)s_btns[num]).gameObject); } } } internal static void UpdatePanel(InventoryGui ig, Player player) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) InventoryGrid val = R.ContainerGrid.Invoke(ig); ((Component)ig.m_container).gameObject.SetActive(true); val.UpdateInventory(s_inv, player, (ItemData)null); for (int i = 0; i < 5; i++) { InventoryElement val2 = R.GetElement(val, i, 0, 5); if (Object.op_Implicit((Object)(object)val2) && s_shifted.Add(val2)) { RectTransform val3 = (RectTransform)((Component)val2).transform; val3.anchoredPosition += new Vector2(0f, -8f); } } ig.m_containerName.text = Loc.Get("title"); if (Object.op_Implicit((Object)(object)ig.m_containerWeight)) { ig.m_containerWeight.text = ""; } if (Object.op_Implicit((Object)(object)ig.m_takeAllButton)) { ((Component)ig.m_takeAllButton).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)ig.m_stackAllButton)) { ((Component)ig.m_stackAllButton).gameObject.SetActive(false); } foreach (Transform item in (Transform)ig.m_container) { Transform val4 = item; if (((Component)val4).gameObject.activeSelf && Object.op_Implicit((Object)(object)((Component)val4).GetComponent<Button>()) && (!Object.op_Implicit((Object)(object)ig.m_takeAllButton) || !((Object)(object)val4 == (Object)(object)((Component)ig.m_takeAllButton).transform)) && (!Object.op_Implicit((Object)(object)ig.m_stackAllButton) || !((Object)(object)val4 == (Object)(object)((Component)ig.m_stackAllButton).transform))) { ((Component)val4).gameObject.SetActive(false); if (!s_hiddenGos.Contains(((Component)val4).gameObject)) { s_hiddenGos.Add(((Component)val4).gameObject); } } } for (int j = 0; j < 5; j++) { InventoryElement val5 = R.GetElement(val, j, 0, 5); if (!Object.op_Implicit((Object)(object)val5)) { continue; } SetColor((Graphic)((Object.op_Implicit((Object)(object)val5.m_button) && Object.op_Implicit((Object)(object)((Selectable)val5.m_button).targetGraphic)) ? ((object)((Selectable)val5.m_button).targetGraphic) : ((object)((Component)val5).GetComponent<Image>())), (s_inv.GetItemAt(j, 0) != null || Vanity.IsHidden(j)) ? Plugin.FilledSlot.Value : Plugin.EmptySlot.Value); if (Object.op_Implicit((Object)(object)val5.m_button) && !s_origColors.ContainsKey((Selectable)(object)val5.m_button)) { s_origColors[(Selectable)(object)val5.m_button] = ((Selectable)val5.m_button).colors; ColorBlock colors = ((Selectable)val5.m_button).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((Selectable)val5.m_button).colors = colors; } if (s_inv.GetItemAt(j, 0) == null && Object.op_Implicit((Object)(object)val5.m_amount)) { ((Behaviour)val5.m_amount).enabled = true; val5.m_amount.text = Loc.Slot(j); } if (s_btns != null && Object.op_Implicit((Object)(object)s_btns[j])) { RectTransform val6 = (RectTransform)((Component)val5).transform; RectTransform val7 = (RectTransform)((Component)s_btns[j]).transform; Rect rect = val6.rect; ((Transform)val7).position = ((Transform)val6).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center)); Vector2 anchoredPosition = val7.anchoredPosition; rect = val6.rect; float num = ((Rect)(ref rect)).height * 0.5f; rect = val7.rect; val7.anchoredPosition = anchoredPosition + new Vector2(0f, 0f - (num + ((Rect)(ref rect)).height * 0.5f + 6f)); ((Selectable)s_btns[j]).interactable = true; s_btns[j].SetIsOnWithoutNotify(Vanity.IsHidden(j)); if (Object.op_Implicit((Object)(object)s_txt[j])) { s_txt[j].text = Loc.Get("hide"); } } } Presets.Update(ig); UpdateBeltPanel(ig); } internal static bool OnClick(InventoryGui ig, InventoryGrid grid, ItemData item, bool dragging) { if ((Object)(object)grid == (Object)(object)R.ContainerGrid.Invoke(ig)) { if (!dragging && item != null) { Vanity.Clear(item.m_gridPos.x); Dirty = true; Rebuild(); Effect(ig); } return true; } if ((Object)(object)grid == (Object)(object)ig.m_playerGrid && !dragging && item != null && Vanity.SlotFor(item) >= 0) { if (!Vanity.Register(item)) { Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer)) { ((Character)localPlayer).Message((MessageType)2, Loc.Get("has_light"), 0, (Sprite)null, false); } return true; } Dirty = true; Rebuild(); Effect(ig); return true; } return false; } private static void Effect(InventoryGui ig) { //IL_0014: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (ig.m_moveItemEffects != null) { ig.m_moveItemEffects.Create(((Component)ig).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } } } [HarmonyPatch(typeof(InventoryGui), "UpdateContainer")] internal static class UpdateContainer_Patch { private static bool Prefix(InventoryGui __instance, Player __0) { if (!Outfit.Active) { return true; } try { Outfit.UpdatePanel(__instance, __0); } catch (Exception ex) { Debug.LogWarning((object)("[VKTR_VanityOutfit] UpdatePanel: " + ex)); Outfit.Close(); } return false; } } [HarmonyPatch(typeof(InventoryGui), "UpdateGamepad")] internal static class UpdateGamepad_Patch { private static bool Prefix(InventoryGui __instance) { if (!Outfit.Active) { return true; } if (!__instance.m_inventoryGroup.IsActive || ZInput.IsTouchActive() || TextInput.IsVisible()) { return false; } if (ZInput.GetButtonDown("JoyTabLeft")) { Outfit.CycleGroups(__instance, -1); } else if (ZInput.GetButtonDown("JoyTabRight")) { Outfit.CycleGroups(__instance, 1); } return false; } } [HarmonyPatch(typeof(InventoryGui), "Update")] internal static class InventoryGuiUpdate_Patch { private static bool Prefix() { if (Outfit.Active) { return !TextInput.IsVisible(); } return true; } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] internal static class Crosshair_Patch { private static bool s_hidden; private static bool Prefix(Hud __instance) { if (!Outfit.Active) { if (s_hidden) { s_hidden = false; if (Object.op_Implicit((Object)(object)__instance.m_crosshair)) { ((Behaviour)__instance.m_crosshair).enabled = true; } } return true; } s_hidden = true; if (Object.op_Implicit((Object)(object)__instance.m_crosshair)) { ((Behaviour)__instance.m_crosshair).enabled = false; } if (Object.op_Implicit((Object)(object)__instance.m_crosshairBow)) { ((Behaviour)__instance.m_crosshairBow).enabled = false; } if (Object.op_Implicit((Object)(object)__instance.m_hoverName)) { ((TMP_Text)__instance.m_hoverName).text = ""; } if (Object.op_Implicit((Object)(object)__instance.m_hoveredPieceAuthorWindow)) { __instance.m_hoveredPieceAuthorWindow.SetActive(false); } return false; } } [HarmonyPatch(typeof(InventoryGui), "IsContainerOpen")] internal static class IsContainerOpen_Patch { private static void Postfix(ref bool __result) { if (Outfit.Active) { __result = true; } } } [HarmonyPatch(typeof(InventoryGui), "Hide")] internal static class Hide_Patch { private static void Postfix() { Outfit.Close(); } } [HarmonyPatch(typeof(InventoryGui), "OnSelectedItem")] internal static class OnSelectedItem_Patch { [HarmonyPriority(800)] private static bool Prefix(InventoryGui __instance, InventoryGrid grid, ItemData item) { if (!Outfit.Active) { return true; } return !Outfit.OnClick(__instance, grid, item, Object.op_Implicit((Object)(object)R.DragGo.Invoke(__instance))); } } [HarmonyPatch(typeof(InventoryGui), "OnRightClickItem")] internal static class OnRightClickItem_Patch { [HarmonyPriority(800)] private static bool Prefix(InventoryGui __instance, InventoryGrid grid, ItemData item) { if (!Outfit.Active) { return true; } return !Outfit.OnClick(__instance, grid, item, Object.op_Implicit((Object)(object)R.DragGo.Invoke(__instance))); } } [HarmonyPatch(typeof(GameCamera), "LateUpdate")] internal static class Camera_Patch { private static bool s_blending; private static Vector3 s_pos; private static Quaternion s_rot; private static Camera s_cam; private static void Postfix(GameCamera __instance) { //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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_016a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Outfit.Active || !Object.op_Implicit((Object)(object)localPlayer)) { s_blending = false; return; } Transform transform = ((Component)__instance).transform; if (!s_blending) { s_pos = transform.position; s_rot = transform.rotation; s_blending = true; } if (!Object.op_Implicit((Object)(object)s_cam)) { s_cam = ((Component)transform).GetComponentInChildren<Camera>(); } float num = (Object.op_Implicit((Object)(object)s_cam) ? s_cam.fieldOfView : 65f); float num2 = 1f * Mathf.Max(0.5f, Plugin.CamFraming.Value) / Mathf.Tan(num * 0.5f * ((float)Math.PI / 180f)); Vector3 val = ((Component)localPlayer).transform.position + Vector3.up * Plugin.CamHeight.Value; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Outfit.CamDir, ref val2, num2, LayerMask.op_Implicit(__instance.m_blockCameraMask))) { num2 = Mathf.Max(0.8f, ((RaycastHit)(ref val2)).distance - 0.25f); } Vector3 val3 = val + Outfit.CamDir * num2; Quaternion val4 = Quaternion.LookRotation(val - val3, Vector3.up); float num3 = 1f - Mathf.Exp(-8f * Time.unscaledDeltaTime); s_pos = Vector3.Lerp(s_pos, val3, num3); s_rot = Quaternion.Slerp(s_rot, val4, num3); transform.SetPositionAndRotation(s_pos, s_rot); } } internal static class Presets { private class Panel { public RectTransform Root; public TMP_Text Title; public Image HomeIcon; public InventoryElement[] Slots; public Graphic[] SlotBg; public Button[] Buttons; public TMP_Text[] Labels; public float W; public float H; } private class Namer : TextReceiver { private readonly object m_n; public Namer(object n) { m_n = n; } public string GetText() { return Vanity.PresetName(m_n); } public void SetText(string text) { if (!string.IsNullOrWhiteSpace(text) && Vanity.PresetExists(m_n)) { Vanity.SetPresetName(m_n, text.Trim()); } } } internal const int Count = 5; internal const int HomeIndex = 4; private const float Pad = 8f; private const float TitleH = 24f; private const float Gap = 6f; private const float PanelGap = 8f; private const float SlotScale = 0.8f; private const float BtnH = 34f; private const int Save = 0; private const int Wear = 1; private const int Delete = 2; private static Panel[] s_panels; private static int s_confirmDelete = -1; private static float s_confirmUntil; private static Sprite s_house; internal static object Id(int n) { if (n != 4) { return n; } return "home"; } internal static Button WearButton(int n) { return s_panels[n].Buttons[1]; } internal static int PanelOf(GameObject go) { if (s_panels == null || !Object.op_Implicit((Object)(object)go)) { return -1; } for (int i = 0; i < 5; i++) { if (Object.op_Implicit((Object)(object)s_panels[i].Root) && go.transform.IsChildOf((Transform)(object)s_panels[i].Root)) { return i; } } return -1; } internal static void SetupNav(Selectable above) { //IL_0049: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 5; i++) { Button[] buttons = s_panels[i].Buttons; Selectable selectOnUp = (Selectable)((i > 0) ? ((object)s_panels[i - 1].Buttons[0]) : ((object)above)); Selectable selectOnDown = (Selectable)(object)((i < 4) ? s_panels[i + 1].Buttons[1] : null); Button obj = buttons[1]; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = selectOnUp; ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)buttons[0]; ((Selectable)obj).navigation = navigation; Button obj2 = buttons[0]; navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)buttons[1]; ((Navigation)(ref navigation)).selectOnDown = selectOnDown; ((Navigation)(ref navigation)).selectOnRight = (Selectable)(object)buttons[2]; ((Selectable)obj2).navigation = navigation; Button obj3 = buttons[2]; navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)buttons[1]; ((Navigation)(ref navigation)).selectOnDown = selectOnDown; ((Navigation)(ref navigation)).selectOnLeft = (Selectable)(object)buttons[0]; ((Selectable)obj3).navigation = navigation; } } internal static void Create(InventoryGui ig, Transform parent) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_0232: 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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Expected O, but got Unknown //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) InventoryGrid obj = R.ContainerGrid.Invoke(ig); float elementSpace = obj.m_elementSpace; GameObject elementPrefab = obj.m_elementPrefab; float num = ((RectTransform)elementPrefab.transform).sizeDelta.x; if (num <= 1f) { num = elementSpace - 4f; } float num2 = elementSpace * 0.8f; float num3 = num * 0.8f; float num4 = elementSpace * 1.3f; float num5 = Mathf.Max(num3, 74f); Transform val = ((Transform)ig.m_container).Find("Bkg"); Image val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Image>() : null); s_panels = new Panel[5]; Vector2 val4 = default(Vector2); for (int i = 0; i < 5; i++) { Panel pan