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 PassiveSkillHud v1.0.1
PassiveSkillHud.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Skills; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ntshtng")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Shows your survivor's passive skill above the skill bar, with its description on hover.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+60d0cb63f9010fd8be4ca59cfc9763d9fc4ee9f7")] [assembly: AssemblyProduct("PassiveSkillHud")] [assembly: AssemblyTitle("PassiveSkillHud")] [assembly: AssemblyVersion("1.0.1.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 PassiveSkillHud { public class PassiveSkillDisplay : MonoBehaviour { private sealed class Icon { private readonly GenericSkill skill; private readonly PassiveSkill passive; private GameObject root; private Image image; private TooltipProvider tooltip; private bool shown; private Object shownSkillDef; private string shownLanguage; private const float RingMargin = 1f; public bool IsShown { get { if (Object.op_Implicit((Object)(object)root)) { return root.activeSelf; } return false; } } public Icon(PassiveSkill passive) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.passive = passive; } public Icon(GenericSkill skill) { this.skill = skill; } public bool TryCreate(SkillIcon template, Color titleColor) { //IL_00d5: 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) root = Object.Instantiate<GameObject>(((Component)template).gameObject, ((Component)template).transform.parent); ((Object)root).name = "PassiveSkillIcon"; SkillIcon component = root.GetComponent<SkillIcon>(); image = (Owns((Component)(object)component.iconImage) ? component.iconImage : null); if (!Object.op_Implicit((Object)(object)image)) { PassiveSkillHudPlugin.Log.LogWarning((object)"The HUD's skill icon has an unexpected layout; not showing passive skills."); Destroy(); return false; } tooltip = (Owns((Component)(object)component.tooltipProvider) ? component.tooltipProvider : root.GetComponentInChildren<TooltipProvider>()); if (!Object.op_Implicit((Object)(object)tooltip)) { tooltip = ((Component)image).gameObject.AddComponent<TooltipProvider>(); ((Graphic)image).raycastTarget = true; } tooltip.titleColor = titleColor; if (Owns((Component)(object)component.cooldownText)) { ((Component)component.cooldownText).gameObject.SetActive(false); } if (Owns((Component)(object)component.stockText)) { ((Component)component.stockText).gameObject.SetActive(false); } if (Owns(component.flashPanelObject)) { component.flashPanelObject.SetActive(false); } if (Owns((Component)(object)component.cooldownRemapPanel)) { ((Behaviour)component.cooldownRemapPanel).enabled = false; } if (Owns((Component)(object)component.animator)) { ((Behaviour)component.animator).enabled = false; } InputBindingDisplayController[] componentsInChildren = root.GetComponentsInChildren<InputBindingDisplayController>(true); foreach (InputBindingDisplayController val in componentsInChildren) { Transform parent = ((Component)val).transform.parent; Transform val2 = (((Object)(object)parent != (Object)(object)root.transform && !((Component)image).transform.IsChildOf(parent)) ? parent : ((Component)val).transform); if ((Object)(object)val2 != (Object)(object)root.transform) { ((Component)val2).gameObject.SetActive(false); } } GameObject val3 = (Owns(component.isReadyPanelObject) ? component.isReadyPanelObject : null); if (Object.op_Implicit((Object)(object)val3)) { val3.SetActive(true); } Object.DestroyImmediate((Object)(object)component); MakeRound(val3); LayoutElement val4 = root.GetComponent<LayoutElement>(); if (!Object.op_Implicit((Object)(object)val4)) { val4 = root.AddComponent<LayoutElement>(); } val4.ignoreLayout = true; Refresh(); return true; } private void MakeRound(GameObject readyPanel) { //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) //IL_006c: 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_0078: Expected O, but got Unknown //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_00b7: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01c7: Unknown result type (might be due to invalid IL or missing references) Image component = root.GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component)) { UseSprite(component, RoundSprites.Disc); } GameObject val = new GameObject("RoundMask", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Mask) }) { layer = ((Component)image).gameObject.layer }; RectTransform val2 = (RectTransform)val.transform; RectTransform rectTransform = ((Graphic)image).rectTransform; ((Transform)val2).SetParent(((Transform)rectTransform).parent, false); ((Transform)val2).SetSiblingIndex(((Transform)rectTransform).GetSiblingIndex()); val2.anchorMin = rectTransform.anchorMin; val2.anchorMax = rectTransform.anchorMax; val2.pivot = rectTransform.pivot; val2.offsetMin = rectTransform.offsetMin; val2.offsetMax = rectTransform.offsetMax; Image component2 = val.GetComponent<Image>(); UseSprite(component2, RoundSprites.Disc); ((Graphic)component2).raycastTarget = false; val.GetComponent<Mask>().showMaskGraphic = false; ((Transform)rectTransform).SetParent((Transform)(object)val2, false); rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; Image val3 = (Object.op_Implicit((Object)(object)readyPanel) ? readyPanel.GetComponent<Image>() : null); if (Object.op_Implicit((Object)(object)val3)) { UseSprite(val3, RoundSprites.Ring); RectTransform rectTransform2 = ((Graphic)val3).rectTransform; ((Transform)rectTransform2).SetParent(((Transform)val2).parent, false); ((Transform)rectTransform2).SetAsLastSibling(); rectTransform2.anchorMin = val2.anchorMin; rectTransform2.anchorMax = val2.anchorMax; rectTransform2.pivot = val2.pivot; rectTransform2.offsetMin = val2.offsetMin - Vector2.one * 1f; rectTransform2.offsetMax = val2.offsetMax + Vector2.one * 1f; } } private static void UseSprite(Image target, Sprite sprite) { target.sprite = sprite; target.type = (Type)0; target.preserveAspect = false; } private bool Owns(Component component) { if (Object.op_Implicit((Object)(object)component)) { return component.transform.IsChildOf(root.transform); } return false; } private bool Owns(GameObject obj) { if (Object.op_Implicit((Object)(object)obj)) { return obj.transform.IsChildOf(root.transform); } return false; } public bool Contains(Transform transform) { if (Object.op_Implicit((Object)(object)root)) { return transform.IsChildOf(root.transform); } return false; } public void SetLocalPosition(Vector3 position) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root) && root.transform.localPosition != position) { root.transform.localPosition = position; } } public void Refresh() { if (!Object.op_Implicit((Object)(object)root)) { return; } SkillDef val = (Object.op_Implicit((Object)(object)skill) ? skill.skillDef : null); string currentLanguageName = Language.currentLanguageName; if (shown && (Object)(object)val == shownSkillDef && currentLanguageName == shownLanguage) { return; } shown = true; shownSkillDef = (Object)(object)val; shownLanguage = currentLanguageName; if (Object.op_Implicit((Object)(object)skill)) { root.SetActive(Object.op_Implicit((Object)(object)val)); if (Object.op_Implicit((Object)(object)val)) { Show(skill.icon, skill.skillNameToken, skill.skillDescriptionToken, val.keywordTokens); } } else { string[] keywordTokens = (string.IsNullOrEmpty(passive.keywordToken) ? null : new string[1] { passive.keywordToken }); Show(passive.icon, passive.skillNameToken, passive.skillDescriptionToken, keywordTokens); } } private void Show(Sprite sprite, string nameToken, string descriptionToken, string[] keywordTokens) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) image.sprite = sprite; ((Graphic)image).color = Color.white; tooltip.titleToken = nameToken; tooltip.bodyToken = descriptionToken; tooltip.overrideBodyText = BuildBodyText(descriptionToken, keywordTokens); } private static string BuildBodyText(string descriptionToken, string[] keywordTokens) { if (keywordTokens == null || keywordTokens.Length <= 0) { return null; } StringBuilder stringBuilder = new StringBuilder(Language.GetString(descriptionToken)); foreach (string text in keywordTokens) { if (!string.IsNullOrEmpty(text)) { stringBuilder.Append("\n\n").Append(Language.GetString(text)); } } return stringBuilder.ToString(); } public void Destroy() { if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)root); } root = null; } } private HUD hud; private SkillLocator shownSkillLocator; private int shownSettingsVersion = -1; private readonly List<Icon> icons = new List<Icon>(); private readonly List<Rect> slots = new List<Rect>(); private readonly List<Graphic> graphics = new List<Graphic>(); private static readonly Vector3[] corners = (Vector3[])(object)new Vector3[4]; private SkillIcon PrimaryIcon { get { SkillIcon[] skillIcons = hud.skillIcons; if (skillIcons == null || skillIcons.Length <= 0) { return null; } return hud.skillIcons[0]; } } private void Awake() { hud = ((Component)this).GetComponent<HUD>(); } private void OnDestroy() { ClearIcons(); } private void LateUpdate() { CharacterBody val = (Object.op_Implicit((Object)(object)hud.targetBodyObject) ? hud.targetBodyObject.GetComponent<CharacterBody>() : null); SkillLocator val2 = (Object.op_Implicit((Object)(object)val) ? val.skillLocator : null); if (val2 != shownSkillLocator || shownSettingsVersion != PassiveSkillHudPlugin.SettingsVersion) { Rebuild(val, val2); } if (icons.Count == 0 || !Object.op_Implicit((Object)(object)PrimaryIcon)) { return; } foreach (Icon icon in icons) { icon.Refresh(); } PlaceIcons(); } private void Rebuild(CharacterBody body, SkillLocator skillLocator) { //IL_003b: 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_0050: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) ClearIcons(); shownSkillLocator = skillLocator; shownSettingsVersion = PassiveSkillHudPlugin.SettingsVersion; if (!Object.op_Implicit((Object)(object)skillLocator) || !Object.op_Implicit((Object)(object)PrimaryIcon) || !PassiveSkillHudPlugin.ShowPassives.Value) { return; } Color tooltipTitleColor = GetTooltipTitleColor(body); if (skillLocator.passiveSkill.enabled) { AddIcon(new Icon(skillLocator.passiveSkill), tooltipTitleColor); } GenericSkill[] components = ((Component)body).GetComponents<GenericSkill>(); foreach (GenericSkill val in components) { if (!val.hideInCharacterSelect && (int)skillLocator.FindSkillSlot(val) == -1 && !SharesSkillsWithSlot(val, skillLocator)) { AddIcon(new Icon(val), tooltipTitleColor); } } } private static bool SharesSkillsWithSlot(GenericSkill row, SkillLocator skillLocator) { //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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)row.skillFamily)) { return false; } GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[4] { skillLocator.primary, skillLocator.secondary, skillLocator.utility, skillLocator.special }; foreach (GenericSkill val in array) { if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.skillFamily)) { continue; } Variant[] variants = val.skillFamily.variants; foreach (Variant val2 in variants) { Variant[] variants2 = row.skillFamily.variants; for (int k = 0; k < variants2.Length; k++) { if ((Object)(object)variants2[k].skillDef == (Object)(object)val2.skillDef) { return true; } } } } return false; } private void AddIcon(Icon icon, Color titleColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (icon.TryCreate(PrimaryIcon, titleColor)) { icons.Add(icon); } } private void ClearIcons() { foreach (Icon icon in icons) { icon.Destroy(); } icons.Clear(); } private void PlaceIcons() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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) RectTransform val = (RectTransform)((Component)PrimaryIcon).transform; Transform parent = ((Transform)val).parent; Rect box = GetBox(val, parent); SkillIcon val2 = ((hud.skillIcons.Length > 1) ? hud.skillIcons[1] : null); float step = (Object.op_Implicit((Object)(object)val2) ? Mathf.Abs(((Transform)val).localPosition.x - ((Component)val2).transform.localPosition.x) : (((Rect)(ref box)).width * 1.1f)); float num = step - ((Rect)(ref box)).width; FindSlots(parent, box); if (slots.Count == 0) { slots.Add(box); } float num2 = ((Rect)(ref box)).yMax; foreach (Rect slot in slots) { Rect current = slot; num2 = Mathf.Max(num2, ((Rect)(ref current)).yMax); } int num3 = 0; foreach (Icon icon in icons) { if (icon.IsShown) { num3++; } } if (num3 == 0) { return; } Rect lastSlot = slots[slots.Count - 1]; float left = ColumnCenter(num3 - 1) - ((Rect)(ref box)).width / 2f; float right = ColumnCenter(0) + ((Rect)(ref box)).width / 2f; float popupLine = num2 + ((Rect)(ref box)).height * 0.5f; float num4 = FindFreeBottom(parent, left, right, num2 + num, ((Rect)(ref box)).height, num, popupLine); int num5 = 0; Vector2 val3 = default(Vector2); foreach (Icon icon2 in icons) { if (icon2.IsShown) { ((Vector2)(ref val3))..ctor(ColumnCenter(num5) - ((Rect)(ref box)).center.x, num4 - ((Rect)(ref box)).yMin); icon2.SetLocalPosition(((Transform)val).localPosition + Vector2.op_Implicit(val3)); num5++; } } float ColumnCenter(int column) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (column >= slots.Count) { return ((Rect)(ref lastSlot)).center.x - step * (float)(column - slots.Count + 1); } Rect val4 = slots[column]; return ((Rect)(ref val4)).center.x; } } private void FindSlots(Transform bar, Rect primaryBox) { //IL_0022: 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) slots.Clear(); SkillIcon[] skillIcons = hud.skillIcons; foreach (SkillIcon slot in skillIcons) { AddSlot((Component)(object)slot, bar, primaryBox); } EquipmentIcon[] equipmentIcons = hud.equipmentIcons; foreach (EquipmentIcon slot2 in equipmentIcons) { AddSlot((Component)(object)slot2, bar, primaryBox); } slots.Sort((Rect a, Rect b) => ((Rect)(ref b)).center.x.CompareTo(((Rect)(ref a)).center.x)); } private void AddSlot(Component slot, Transform bar, Rect primaryBox) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_005b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)slot) && slot.gameObject.activeInHierarchy) { Rect box = GetBox((RectTransform)slot.transform, bar); if (Mathf.Abs(((Rect)(ref box)).center.y - ((Rect)(ref primaryBox)).center.y) < ((Rect)(ref primaryBox)).height * 0.3f) { slots.Add(box); } } } private float FindFreeBottom(Transform bar, float left, float right, float bottom, float height, float gap, float popupLine) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ((Component)bar).GetComponentsInChildren<Graphic>(false, graphics); for (int i = 0; i < 8; i++) { float num = float.NegativeInfinity; foreach (Graphic graphic in graphics) { if (IsObstacle(graphic)) { Rect box = GetBox(graphic.rectTransform, bar); if ((!(((Rect)(ref box)).yMax <= popupLine) || !IsPartOfSlot(((Component)graphic).transform)) && !(((Rect)(ref box)).xMax <= left) && !(((Rect)(ref box)).xMin >= right) && !(((Rect)(ref box)).yMax <= bottom) && !(((Rect)(ref box)).yMin >= bottom + height)) { num = Mathf.Max(num, ((Rect)(ref box)).yMax); } } } if (float.IsNegativeInfinity(num)) { break; } bottom = num + gap; } return bottom; } private bool IsObstacle(Graphic graphic) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)graphic).enabled || graphic.color.a <= 0.01f) { return false; } TMP_Text val = (TMP_Text)(object)((graphic is TMP_Text) ? graphic : null); if (val != null && string.IsNullOrEmpty(val.text)) { return false; } foreach (Icon icon in icons) { if (icon.Contains(((Component)graphic).transform)) { return false; } } return true; } private bool IsPartOfSlot(Transform t) { SkillIcon[] skillIcons = hud.skillIcons; foreach (SkillIcon val in skillIcons) { if (Object.op_Implicit((Object)(object)val) && t.IsChildOf(((Component)val).transform)) { return true; } } EquipmentIcon[] equipmentIcons = hud.equipmentIcons; foreach (EquipmentIcon val2 in equipmentIcons) { if (Object.op_Implicit((Object)(object)val2) && t.IsChildOf(((Component)val2).transform)) { return true; } } return false; } private static Rect GetBox(RectTransform rectTransform, Transform space) { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0050: 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_0057: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) rectTransform.GetWorldCorners(corners); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(float.PositiveInfinity, float.PositiveInfinity); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(float.NegativeInfinity, float.NegativeInfinity); Vector3[] array = corners; foreach (Vector3 val3 in array) { Vector2 val4 = Vector2.op_Implicit(space.InverseTransformPoint(val3)); val = Vector2.Min(val, val4); val2 = Vector2.Max(val2, val4); } return Rect.MinMaxRect(val.x, val.y, val2.x, val2.y); } private static Color GetTooltipTitleColor(CharacterBody body) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(body.bodyColor, ref num, ref num2, ref num3); return Color.HSVToRGB(num, num2, Mathf.Min(num3, 0.7f)); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("ntshtng.PassiveSkillHud", "PassiveSkillHud", "1.0.1")] public class PassiveSkillHudPlugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry<bool> ShowPassives; internal static int SettingsVersion; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ShowPassives = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show passives", true, "Show the survivor's passive skills above the skill bar."); ShowPassives.SettingChanged += delegate { SettingsVersion++; }; HUD.onHudTargetChangedGlobal += delegate(HUD hud) { if (!Object.op_Implicit((Object)(object)((Component)hud).GetComponent<PassiveSkillDisplay>())) { ((Component)hud).gameObject.AddComponent<PassiveSkillDisplay>(); } }; RiskOfOptionsIntegration.Register(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); } } internal static class RiskOfOptionsIntegration { public const string Guid = "com.rune580.riskofoptions"; public static void Register(string pluginDir) { if (!Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { return; } try { AddOptions(pluginDir); } catch (Exception arg) { PassiveSkillHudPlugin.Log.LogError((object)$"Error during RiskOfOptions integration: {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void AddOptions(string pluginDir) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown AssemblyDescriptionAttribute customAttribute = typeof(RiskOfOptionsIntegration).Assembly.GetCustomAttribute<AssemblyDescriptionAttribute>(); if (customAttribute != null) { ModSettingsManager.SetModDescription(customAttribute.Description); } Sprite val = LoadIcon(Path.Combine(pluginDir, "icon.png")); if (Object.op_Implicit((Object)(object)val)) { ModSettingsManager.SetModIcon(val); } ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PassiveSkillHudPlugin.ShowPassives)); } private static Sprite LoadIcon(string path) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(path)) { return null; } Texture2D val = new Texture2D(2, 2); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path))) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } internal static class RoundSprites { private const int Size = 128; private const float RingInnerRadius = 0.93f; private static Sprite disc; private static Sprite ring; public static Sprite Disc { get { if (!Object.op_Implicit((Object)(object)disc)) { return disc = Create("PassiveSkillHudDisc", 0f); } return disc; } } public static Sprite Ring { get { if (!Object.op_Implicit((Object)(object)ring)) { return ring = Create("PassiveSkillHudRing", 0.93f); } return ring; } } private static Sprite Create(string name, float innerRadius) { //IL_00c6: 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_00d9: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //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_008f: 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) float num = 64f; float num2 = num * innerRadius; Color32[] array = (Color32[])(object)new Color32[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { Vector2 val = new Vector2((float)j + 0.5f - num, (float)i + 0.5f - num); float magnitude = ((Vector2)(ref val)).magnitude; float num3 = Mathf.Clamp01(num - magnitude); if (innerRadius > 0f) { num3 *= Mathf.Clamp01(magnitude - num2); } array[i * 128 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(num3 * 255f)); } } Texture2D val2 = new Texture2D(128, 128, (TextureFormat)4, true) { name = name, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)32 }; val2.SetPixels32(array); val2.Apply(true, true); Sprite obj = Sprite.Create(val2, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); ((Object)obj).name = name; ((Object)obj).hideFlags = (HideFlags)32; return obj; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ntshtng.PassiveSkillHud"; public const string PLUGIN_NAME = "PassiveSkillHud"; public const string PLUGIN_VERSION = "1.0.1"; } }