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 CLLCVRFix v2.0.1
plugins/CLLCVRFix.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; 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: AssemblyTitle("CLLCVRFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CLLCVRFix")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4efe4d09-5f76-46c3-9dff-bfff704b49fb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [HarmonyAfter(new string[] { "WackyMole.EpicMMOSystem" })] public static class CLLCVRHUD { private static MethodInfo getExtraEffect; private static MethodInfo getInfusion; private static MethodInfo getBossAffix; private static MethodInfo getEnemyHud; private static FieldInfo guiField; private static FieldInfo nameField; private const float StarSpacing = 16f; private const int StarsPerRow = 5; private static readonly Regex LeadingStarsRegex = new Regex("^\\s*(<color=#[0-9A-Fa-f]{6}>)?★{1,20}(</color>)?\\s*", RegexOptions.Compiled); public static void Initialize(Harmony harmony) { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("CreatureLevelControl.API, CreatureLevelControl") ?? AccessTools.TypeByName("CreatureLevelControl.API"); if (type == null) { Debug.LogWarning((object)"CLLC VR Fix: CLLC API not found"); return; } getExtraEffect = AccessTools.Method(type, "GetExtraEffectCreature", (Type[])null, (Type[])null); getInfusion = AccessTools.Method(type, "GetInfusionCreature", (Type[])null, (Type[])null); getBossAffix = AccessTools.Method(type, "GetAffixBoss", (Type[])null, (Type[])null); Type type2 = AccessTools.TypeByName("ValheimVRMod.VRCore.UI.EnemyHudManager, ValheimVRMod") ?? AccessTools.TypeByName("ValheimVRMod.VRCore.UI.EnemyHudManager"); Type type3 = AccessTools.TypeByName("ValheimVRMod.VRCore.UI.EnemyHudManager+HudData, ValheimVRMod") ?? AccessTools.TypeByName("ValheimVRMod.VRCore.UI.EnemyHudManager+HudData"); if (type2 == null || type3 == null) { Debug.LogWarning((object)"CLLC VR Fix: ValheimVR EnemyHudManager not found"); return; } getEnemyHud = AccessTools.Method(type2, "getEnemyHud", (Type[])null, (Type[])null); guiField = AccessTools.Field(type3, "gui"); nameField = AccessTools.Field(type3, "name"); MethodInfo methodInfo = AccessTools.Method(type2, "UpdateName", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(type2, "UpdateLevel", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(CLLCVRHUD), "OnHudPostfix", (Type[])null); val.priority = 0; val.after = new string[1] { "WackyMole.EpicMMOSystem" }; HarmonyMethod val2 = val; if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Debug.Log((object)"CLLC VR Fix: VR EnemyHud patches applied"); } catch (Exception arg) { Debug.LogError((object)$"CLLC VR Fix init error: {arg}"); } } private static void OnHudPostfix(object __instance, Character c) { if ((Object)(object)c == (Object)null) { return; } try { object obj = getEnemyHud?.Invoke(__instance, new object[1] { c }); if (obj == null) { return; } object? obj2 = guiField?.GetValue(obj); GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null); object? obj3 = nameField?.GetValue(obj); TextMeshProUGUI val2 = (TextMeshProUGUI)((obj3 is TextMeshProUGUI) ? obj3 : null); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)val2 == (Object)null) { Transform val3 = val.transform.Find("Name"); if ((Object)(object)val3 != (Object)null) { val2 = ((Component)val3).GetComponent<TextMeshProUGUI>(); } } if (!((Object)(object)val2 == (Object)null)) { CleanOldTextStars(val2); UpdateName(val2, c); UpdateVRStars(val, c); } } catch (Exception arg) { Debug.LogError((object)$"CLLC VR HUD Error: {arg}"); } } private static void CleanOldTextStars(TextMeshProUGUI text) { if (!((Object)(object)text == (Object)null) && !string.IsNullOrEmpty(((TMP_Text)text).text)) { ((TMP_Text)text).text = LeadingStarsRegex.Replace(((TMP_Text)text).text, ""); } } private static void UpdateName(TextMeshProUGUI text, Character c) { string text2 = ((TMP_Text)text).text; if (string.IsNullOrEmpty(text2)) { return; } string text3 = null; string text4 = "#FFFFFF"; if (c.IsBoss()) { object obj = getBossAffix?.Invoke(null, new object[1] { c }); if (obj != null && obj.ToString() != "None") { text3 = obj.ToString(); text4 = "#FF0000"; } } if (text3 == null) { object obj2 = getInfusion?.Invoke(null, new object[1] { c }); if (obj2 != null && obj2.ToString() != "None") { text3 = obj2.ToString(); text4 = GetInfusionColorHex(text3); } } if (text3 == null) { object obj3 = getExtraEffect?.Invoke(null, new object[1] { c }); if (obj3 != null && obj3.ToString() != "None") { text3 = obj3.ToString(); text4 = GetEffectColorHex(text3); } } if (text3 != null) { string text5 = (CLLCVRMain.UseIcons.Value ? GetIcon(text3) : text3); if (!text2.Contains(text5)) { ((TMP_Text)text).text = text2 + " <color=" + text4 + ">" + text5 + "</color>"; } } } private static void UpdateVRStars(GameObject gui, Character c) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d5: 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_0148: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: 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) if ((Object)(object)gui == (Object)null) { return; } Transform val = gui.transform.Find("level_2"); Transform val2 = gui.transform.Find("level_3"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } Transform val3 = gui.transform.Find("CLLCVR_Stars"); if ((Object)(object)val3 == (Object)null) { GameObject val4 = new GameObject("CLLCVR_Stars", new Type[1] { typeof(RectTransform) }); val3 = val4.transform; val3.SetParent(gui.transform, false); RectTransform component = val4.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(160f, 48f); Transform val5 = (((Object)(object)val2 != (Object)null) ? val2 : val); if ((Object)(object)val5 != (Object)null) { val3.localPosition = val5.localPosition; val3.localRotation = val5.localRotation; val3.localScale = val5.localScale; } else { val3.localPosition = new Vector3(0f, 48f, 0f); val3.localRotation = Quaternion.identity; val3.localScale = Vector3.one; } } int num = ((!c.IsBoss()) ? Mathf.Max(0, c.GetLevel() - 1) : 0); ((Component)val3).gameObject.SetActive(num > 0); if (num <= 0) { return; } GameObject val6 = FindStarTemplate(val2) ?? FindStarTemplate(val); if ((Object)(object)val6 == (Object)null) { Debug.LogWarning((object)"CLLC VR Fix: Could not find VR star template"); return; } Color effectColor = GetEffectColor(getExtraEffect?.Invoke(null, new object[1] { c })?.ToString()); EnsureStarCount(val3, val6, num); for (int i = 0; i < val3.childCount; i++) { Transform child = val3.GetChild(i); bool flag = i < num; ((Component)child).gameObject.SetActive(flag); if (flag) { int num2 = i / 5; int num3 = i % 5; int num4 = Mathf.Min(5, num - num2 * 5); float num5 = (float)(num4 - 1) * 16f * 0.5f; float num6 = (float)num3 * 16f - num5; float num7 = (float)num2 * -16f; ((Object)child).name = "star_" + (i + 1); child.localPosition = new Vector3(num6, num7, 0f); child.localRotation = Quaternion.identity; child.localScale = val6.transform.localScale; Image componentInChildren = ((Component)child).GetComponentInChildren<Image>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = effectColor; } } } } private static GameObject FindStarTemplate(Transform levelRoot) { if ((Object)(object)levelRoot == (Object)null) { return null; } Transform val = levelRoot.Find("star"); if ((Object)(object)val != (Object)null) { return ((Component)val).gameObject; } Image componentInChildren = ((Component)levelRoot).GetComponentInChildren<Image>(true); return ((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).gameObject : null; } private static void EnsureStarCount(Transform container, GameObject template, int count) { while (container.childCount < count) { GameObject val = Object.Instantiate<GameObject>(template, container, false); ((Object)val).name = "star_" + container.childCount; val.SetActive(true); } } private static string GetEffectColorHex(string effect) { return effect switch { "Aggressive" => "#FF0000", "Quick" => "#FF00FF", "Regenerating" => "#00FF00", "Curious" => "#00FFFF", "Splitting" => "#FFFFFF", "Armored" => "#0000FF", _ => "#FFD15C", }; } private static string GetInfusionColorHex(string infusion) { return infusion switch { "Fire" => "#FF0000", "Frost" => "#80FFFF", "Lightning" => "#FFFF00", "Poison" => "#00FF00", "Spirit" => "#FFFFFF", _ => "#FFFFFF", }; } private static Color GetEffectColor(string effect) { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) return (Color)(effect switch { "Aggressive" => Color.red, "Quick" => Color.magenta, "Regenerating" => Color.green, "Curious" => Color.cyan, "Splitting" => Color.white, "Armored" => Color.blue, _ => new Color(1f, 0.817f, 0.338f), }); } private static string GetIcon(string name) { return name switch { "Aggressive" => "⚔", "Quick" => "⚡", "Regenerating" => "✚", "Curious" => "\ud83d\udc41", "Splitting" => "✦", "Armored" => "\ud83d\udee1", "Fire" => "\ud83d\udd25", "Frost" => "❄", "Lightning" => "⚡", "Poison" => "☣", "Spirit" => "✧", "Reflective" => "\ud83d\udd01", "Shielded" => "\ud83d\udee1", "Mending" => "✚", "Summoner" => "☠", "Elementalist" => "⚡", "Enraged" => "\ud83d\udd25", "Twin" => "\ud83d\udc65", _ => "?", }; } } [BepInPlugin("geekstreet.cllcvrfix", "CLLC VR Fix", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class CLLCVRMain : BaseUnityPlugin { public static ConfigEntry<bool> UseIcons; private Harmony _harmony; private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown UseIcons = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UseIcons", false, "Show creature effects using icons instead of text"); _harmony = new Harmony("geekstreet.cllcvrfix"); CLLCVRHUD.Initialize(_harmony); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CLLC VR Fix v2 loaded"); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } }