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 TrophyPercent v1.2.0
TrophyPercent.dll
Decompiled 6 days agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Combifightet")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Combifightet")] [assembly: AssemblyDescription("Never again be uncertain when you will get the next trophy. \\n\\nThis mod allows you to see how many more enemies you need to kill to get the next trophy dropped.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+6a99f6e1a6f32dd73db72d73e8e896689e8354ff")] [assembly: AssemblyProduct("TrophyPercent")] [assembly: AssemblyTitle("TrophyPercent")] [assembly: AssemblyVersion("1.2.0.0")] namespace ValheimTrophyPercent; public static class ProgressList { [HarmonyPatch(typeof(Hud), "Awake")] public static class Hud_Awake_Patch { public static void Postfix(Hud __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.m_rootObject == (Object)null)) { PinnedPanel = new GameObject("PinnedTrophiesPanel"); PinnedPanel.transform.SetParent(__instance.m_rootObject.transform, false); Container = PinnedPanel.AddComponent<RectTransform>(); CanvasGroup val = PinnedPanel.AddComponent<CanvasGroup>(); val.interactable = false; val.blocksRaycasts = false; Container.anchorMin = new Vector2(1f, 1f); Container.anchorMax = new Vector2(1f, 1f); Container.pivot = new Vector2(1f, 1f); Container.anchoredPosition = new Vector2(-30f, -260f); Container.sizeDelta = new Vector2(250f, 0f); VerticalLayoutGroup val2 = PinnedPanel.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val2).childAlignment = (TextAnchor)2; ((HorizontalOrVerticalLayoutGroup)val2).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ContentSizeFitter val3 = PinnedPanel.AddComponent<ContentSizeFitter>(); val3.verticalFit = (FitMode)1; UpdatePinnedUI(); } } } [HarmonyPatch(typeof(Hud), "Update")] public static class Hud_Update_Patch { private static float updateTimer; public static void Postfix() { if (!((Object)(object)PinnedPanel == (Object)null) && PinnedPanel.activeInHierarchy) { updateTimer += Time.deltaTime; if (updateTimer > 2f) { updateTimer = 0f; UpdatePinnedUI(); } } } } private static GameObject PinnedPanel; private static RectTransform Container; public static void UpdatePinnedUI() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if ((Object)(object)PinnedPanel == (Object)null || (Object)(object)ObjectDB.instance == (Object)null || (Object)(object)Hud.instance == (Object)null) { return; } TrophyManager.CacheEnemyData(); if (TrophyManager.TrophyToEnemy.Count == 0) { return; } foreach (Transform item in PinnedPanel.transform) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } foreach (string pinnedTrophy in TrophyManager.PinnedTrophies) { if (!TrophyManager.TrophyToEnemy.TryGetValue(pinnedTrophy, out var value) || TrophyManager.GetKillCount(value) > 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(pinnedTrophy); if (!((Object)(object)itemPrefab == (Object)null)) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); string text = Localization.instance.Localize(component.m_itemData.m_shared.m_name); text = text.Replace(" trophy", "").Replace(" Trophy", ""); Sprite icon = component.m_itemData.GetIcon(); CreateRow(pinnedTrophy, text, icon); } } } } private static void CreateRow(string trophyPrefab, string localizedName, Sprite icon) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PinnedRow"); val.transform.SetParent(PinnedPanel.transform, false); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.minHeight = 30f; val2.minWidth = 250f; HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f; ((LayoutGroup)val3).childAlignment = (TextAnchor)5; ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false; int num = 1; if (TrophyManager.TrophyDropChances.TryGetValue(trophyPrefab, out var value)) { num = Mathf.Max(1, Mathf.RoundToInt(1f / value)); } int num2 = num; bool flag = false; if (CharacterDrop.s_pseudoCounter != null && CharacterDrop.s_pseudoCounter.TryGetValue(trophyPrefab, out var value2)) { num2 = value2.Item2; if (num2 <= 0) { num2 = num + num2 % num; if (num2 <= 0) { num2 = num; } flag = true; } } else { flag = true; string value3 = ""; if (TrophyManager.TrophyToEnemy.TryGetValue(trophyPrefab, out value3)) { int killCount = TrophyManager.GetKillCount(value3); num2 = num - killCount % num; if (num2 <= 0) { num2 = num; } } } string arg = (flag ? "~" : ""); string text = $"{arg}{num2} Left - {localizedName}"; GameObject val4 = Object.Instantiate<GameObject>(((Component)Hud.instance.m_hoverName).gameObject, val.transform); ((Object)val4).name = "Text"; TMP_Text component = val4.GetComponent<TMP_Text>(); component.text = text; component.fontSize = 18f; ((Graphic)component).color = Color.white; component.alignment = (TextAlignmentOptions)516; ((Graphic)component).raycastTarget = false; ((Component)component).GetComponent<RectTransform>().sizeDelta = new Vector2(200f, 30f); val4.SetActive(true); GameObject val5 = new GameObject("Icon"); val5.transform.SetParent(val.transform, false); Image val6 = val5.AddComponent<Image>(); val6.sprite = icon; val6.preserveAspect = true; ((Graphic)val6).raycastTarget = false; val5.GetComponent<RectTransform>().sizeDelta = new Vector2(25f, 25f); } } public static class TrophyManager { public static HashSet<string> PinnedTrophies = new HashSet<string>(); public static int TotalTrophiesInGame = -1; public static TMP_FontAsset ValheimFont; public static Dictionary<string, string> TrophyToEnemy = new Dictionary<string, string>(); public static Dictionary<string, float> TrophyDropChances = new Dictionary<string, float>(); public static Sprite CheckboxBackground; public static Sprite Checkmark; public static GameObject DefaultTooltipPrefab; public static void LoadToggleSprites() { if ((Object)(object)CheckboxBackground == (Object)null || (Object)(object)Checkmark == (Object)null) { Toggle[] array = Resources.FindObjectsOfTypeAll<Toggle>(); Toggle[] array2 = array; foreach (Toggle val in array2) { if (!((Object)(object)((Selectable)val).targetGraphic != (Object)null) || !((Object)(object)val.graphic != (Object)null)) { continue; } Graphic targetGraphic = ((Selectable)val).targetGraphic; Image val2 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null); Graphic graphic = val.graphic; Image val3 = (Image)(object)((graphic is Image) ? graphic : null); if (!((Object)(object)val2 != (Object)null) || !((Object)(object)val3 != (Object)null) || !((Object)(object)val2.sprite != (Object)null) || !((Object)(object)val3.sprite != (Object)null)) { continue; } string text = ((Object)val2.sprite).name.ToLower(); string text2 = ((Object)val3.sprite).name.ToLower(); string text3 = ((Object)val).name.ToLower(); if (!text3.Contains("map") && !text3.Contains("public") && !text.Contains("map") && !text.Contains("circle") && !text2.Contains("circle") && !text.Contains("radio") && !text2.Contains("radio")) { CheckboxBackground = val2.sprite; Checkmark = val3.sprite; if (text.Contains("checkbox") && text2.Contains("check")) { break; } } } } if (!((Object)(object)DefaultTooltipPrefab == (Object)null)) { return; } UITooltip[] array3 = Resources.FindObjectsOfTypeAll<UITooltip>(); UITooltip[] array4 = array3; foreach (UITooltip val4 in array4) { if ((Object)(object)val4.m_tooltipPrefab != (Object)null) { DefaultTooltipPrefab = val4.m_tooltipPrefab; break; } } } public static void LoadConfig(string configStr) { PinnedTrophies.Clear(); if (string.IsNullOrEmpty(configStr)) { return; } string[] array = configStr.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { if (!string.IsNullOrEmpty(text)) { PinnedTrophies.Add(text); } } } public static TMP_FontAsset GetValheimFont() { if ((Object)(object)ValheimFont == (Object)null) { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { if (((Object)val).name == "AveriaSerifLibre-Bold" || ((Object)val).name == "AveriaSerifLibre-Light") { ValheimFont = val; return ValheimFont; } } if (array.Length != 0) { ValheimFont = array[0]; } } return ValheimFont; } public static void TogglePin(string trophyPrefabName) { if (PinnedTrophies.Contains(trophyPrefabName)) { PinnedTrophies.Remove(trophyPrefabName); } else { PinnedTrophies.Add(trophyPrefabName); } ValheimMod.Instance.SavePinnedConfig(); ProgressList.UpdatePinnedUI(); } public static void CacheEnemyData() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Invalid comparison between Unknown and I4 if (TrophyToEnemy.Count > 0 || (Object)(object)ZNetScene.instance == (Object)null) { return; } foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { CharacterDrop component = prefab.GetComponent<CharacterDrop>(); Character component2 = prefab.GetComponent<Character>(); if (!((Object)(object)component != (Object)null) || !((Object)(object)component2 != (Object)null)) { continue; } string name = component2.m_name; foreach (Drop drop in component.m_drops) { if ((Object)(object)drop.m_prefab == (Object)null) { continue; } ItemDrop component3 = drop.m_prefab.GetComponent<ItemDrop>(); if ((Object)(object)component3 != (Object)null && (int)component3.m_itemData.m_shared.m_itemType == 13) { string name2 = ((Object)drop.m_prefab).name; if (!TrophyToEnemy.ContainsKey(name2)) { TrophyToEnemy[name2] = name; TrophyDropChances[name2] = drop.m_chance; } } } } } public static int GetKillCount(string enemyKey) { if ((Object)(object)Game.instance == (Object)null) { return 0; } PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); if (playerProfile.m_playerStats[0].m_enemyStats[0] != null && playerProfile.m_playerStats[0].m_enemyStats[0].TryGetValue(enemyKey, out var value)) { return (int)value; } return 0; } public static int GetTotalTrophies() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 if (TotalTrophiesInGame != -1) { return TotalTrophiesInGame; } TotalTrophiesInGame = 0; foreach (GameObject item in ObjectDB.instance.m_items) { ItemDrop component = item.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null && (int)component.m_itemData.m_shared.m_itemType == 13) { TotalTrophiesInGame++; } } return TotalTrophiesInGame; } public static List<string> GetKilledButMissingTrophies() { CacheEnemyData(); List<string> list = new List<string>(); List<string> trophies = Player.m_localPlayer.GetTrophies(); foreach (KeyValuePair<string, string> item in TrophyToEnemy) { string key = item.Key; string value = item.Value; if (!trophies.Contains(key) && GetKillCount(value) > 0) { list.Add(key); } } return list; } } public class TrophyItemData { public GameObject GameObject; public string PrefabName; public int X; public int Y; } [HarmonyPatch(typeof(InventoryGui), "UpdateTrophyList")] public static class InventoryGui_UpdateTrophyList_Patch { public static void Postfix(InventoryGui __instance, ref List<GameObject> ___m_trophyList, RectTransform ___m_trophieListRoot, GameObject ___m_trophieElementPrefab, float ___m_trophieListSpace) { //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)___m_trophieElementPrefab == (Object)null) { return; } TrophyManager.LoadToggleSprites(); TrophyManager.CacheEnemyData(); List<string> trophies = Player.m_localPlayer.GetTrophies(); int totalTrophies = TrophyManager.GetTotalTrophies(); Transform transform = __instance.m_trophiesPanel.transform; string text = Localization.instance.Localize("$inventory_trophies"); TMP_Text val = null; TMP_Text[] componentsInChildren = ((Component)transform).GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val2 in componentsInChildren) { string text2 = ((Object)val2).name.ToLower(); if (text2 == "topic" || text2 == "title" || text2 == "text_title") { val = val2; break; } if (val2.text.StartsWith(text) || val2.text.StartsWith(text.ToUpper())) { val = val2; break; } } if ((Object)(object)val != (Object)null) { val.overflowMode = (TextOverflowModes)0; val.enableWordWrapping = false; string arg = text; if (val.text.StartsWith(text.ToUpper())) { arg = text.ToUpper(); } val.text = $"{arg} <color=orange>({trophies.Count}/{totalTrophies})</color>"; } List<TrophyItemData> list = new List<TrophyItemData>(); for (int j = 0; j < trophies.Count; j++) { GameObject val3 = ___m_trophyList[j]; string text3 = trophies[j]; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(text3); if ((Object)(object)itemPrefab != (Object)null) { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); Vector2Int trophyPos = component.m_itemData.m_shared.m_trophyPos; list.Add(new TrophyItemData { GameObject = val3, PrefabName = text3, X = ((Vector2Int)(ref trophyPos)).x, Y = ((Vector2Int)(ref trophyPos)).y }); } AddPinButtonToElement(val3, text3); } List<string> killedButMissingTrophies = TrophyManager.GetKilledButMissingTrophies(); foreach (string item in killedButMissingTrophies) { GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab(item); if (!((Object)(object)itemPrefab2 == (Object)null)) { ItemDrop component2 = itemPrefab2.GetComponent<ItemDrop>(); GameObject val4 = Object.Instantiate<GameObject>(___m_trophieElementPrefab, (Transform)(object)___m_trophieListRoot); val4.SetActive(true); string text4 = Localization.instance.Localize(component2.m_itemData.m_shared.m_name); Image component3 = ((Component)val4.transform.Find("icon_bkg/icon")).GetComponent<Image>(); component3.sprite = component2.m_itemData.GetIcon(); ((Graphic)component3).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); ((Component)val4.transform.Find("name")).GetComponent<TMP_Text>().text = text4 + " <color=red>(Missing)</color>"; ((Component)val4.transform.Find("description")).GetComponent<TMP_Text>().text = "You have slain this beast, but the trophy eludes you..."; ___m_trophyList.Add(val4); AddPinButtonToElement(val4, item); Vector2Int trophyPos2 = component2.m_itemData.m_shared.m_trophyPos; list.Add(new TrophyItemData { GameObject = val4, PrefabName = item, X = ((Vector2Int)(ref trophyPos2)).x, Y = ((Vector2Int)(ref trophyPos2)).y }); } } foreach (Transform item2 in (Transform)___m_trophieListRoot) { Transform val5 = item2; if (((Object)val5).name == "BiomeHeader") { Object.Destroy((Object)(object)((Component)val5).gameObject); } } IOrderedEnumerable<IGrouping<int, TrophyItemData>> orderedEnumerable = from t in list group t by t.Y into g orderby g.Key select g; float num = -20f; Rect rect = ___m_trophieListRoot.rect; float num2; if (!(((Rect)(ref rect)).width > 100f)) { num2 = 650f; } else { rect = ___m_trophieListRoot.rect; num2 = ((Rect)(ref rect)).width - 20f; } float num3 = num2; foreach (IGrouping<int, TrophyItemData> item3 in orderedEnumerable) { CreateBiomeHeader(___m_trophieListRoot, GetBiomeName(item3.Key), num); num -= 40f; float num4 = 0f; foreach (TrophyItemData item4 in item3.OrderBy((TrophyItemData t) => t.X)) { if (num4 + ___m_trophieListSpace > num3) { num4 = 0f; num -= ___m_trophieListSpace; } Transform transform2 = item4.GameObject.transform; RectTransform val6 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); val6.anchoredPosition = new Vector2(num4, num); num4 += ___m_trophieListSpace; } num -= ___m_trophieListSpace; } float num5 = Mathf.Abs(num) + 100f; ___m_trophieListRoot.SetSizeWithCurrentAnchors((Axis)1, num5); } private static string GetBiomeName(int y) { return y switch { 0 => "Meadows", 1 => "Black Forest", 2 => "Swamp", 3 => "Mountains", 4 => "Plains", 5 => "Ocean", 6 => "Mistlands", 7 => "Ashlands", 8 => "Deep North", _ => "Events & Other", }; } private static void CreateBiomeHeader(RectTransform root, string title, float yPos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BiomeHeader"); val.transform.SetParent((Transform)(object)root, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0f, 1f); val2.anchoredPosition = new Vector2(10f, yPos); val2.sizeDelta = new Vector2(0f, 30f); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).text = title; ((TMP_Text)val3).font = TrophyManager.GetValheimFont(); ((TMP_Text)val3).fontSize = 24f; ((Graphic)val3).color = new Color(1f, 0.7f, 0.2f); ((TMP_Text)val3).alignment = (TextAlignmentOptions)513; } private static void AddPinButtonToElement(GameObject uiElement, string trophyPrefabName) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_010d: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown GameObject val = new GameObject("PinButton"); val.transform.SetParent(uiElement.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(1f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.anchoredPosition = new Vector2(-22f, -22f); val2.sizeDelta = new Vector2(28f, 28f); Image val3 = val.AddComponent<Image>(); if ((Object)(object)TrophyManager.CheckboxBackground != (Object)null) { val3.sprite = TrophyManager.CheckboxBackground; } else { ((Graphic)val3).color = new Color(0f, 0f, 0f, 0.5f); } Button val4 = val.AddComponent<Button>(); ((Selectable)val4).targetGraphic = (Graphic)(object)val3; GameObject val5 = new GameObject("Checkmark"); val5.transform.SetParent(val.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.sizeDelta = Vector2.zero; val6.anchoredPosition = Vector2.zero; Image checkImg = val5.AddComponent<Image>(); if ((Object)(object)TrophyManager.Checkmark != (Object)null) { checkImg.sprite = TrophyManager.Checkmark; } ((Graphic)checkImg).color = new Color(0.8f, 0.5f, 0.2f, 1f); ((Behaviour)checkImg).enabled = TrophyManager.PinnedTrophies.Contains(trophyPrefabName); ((UnityEvent)val4.onClick).AddListener((UnityAction)delegate { TrophyManager.TogglePin(trophyPrefabName); ((Behaviour)checkImg).enabled = TrophyManager.PinnedTrophies.Contains(trophyPrefabName); }); UITooltip val7 = val.AddComponent<UITooltip>(); val7.m_topic = "Track Trophy"; val7.m_text = "Pin this trophy's progress to your HUD."; if ((Object)(object)TrophyManager.DefaultTooltipPrefab != (Object)null) { val7.m_tooltipPrefab = TrophyManager.DefaultTooltipPrefab; } } } [BepInPlugin("Combifightet.TrophyPercent", "Valheim Trophy Percent", "1.1.0")] [BepInProcess("valheim.exe")] public class ValheimMod : BaseUnityPlugin { private const string pluginGUID = "Combifightet.TrophyPercent"; private const string pluginName = "Valheim Trophy Percent"; private const string pluginVersion = "1.1.0"; private readonly Harmony HarmonyInstance = new Harmony("Combifightet.TrophyPercent"); public static ManualLogSource logger = Logger.CreateLogSource("Valheim Trophy Percent"); public static ValheimMod Instance; public ConfigEntry<string> PinnedTrophiesConfig; public void Awake() { Instance = this; logger.LogInfo((object)"Trophy Percent Mod is loading..."); PinnedTrophiesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PinnedTrophies", "", "Comma-separated list of pinned trophy prefab names. Example: TrophyBoar,TrophyNeck,TrophyDeer"); TrophyManager.LoadConfig(PinnedTrophiesConfig.Value); Assembly executingAssembly = Assembly.GetExecutingAssembly(); HarmonyInstance.PatchAll(executingAssembly); logger.LogInfo((object)"Trophy Percent Mod loaded successfully!"); } public void SavePinnedConfig() { PinnedTrophiesConfig.Value = string.Join(",", TrophyManager.PinnedTrophies); ((BaseUnityPlugin)this).Config.Save(); } }