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 TeamMemberMonitoringList v1.1.0
plugins/TeamMemberMonitoringList.dll
Decompiled 8 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; [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("TeamMemberMonitoringList")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("TeamMemberMonitoringList")] [assembly: AssemblyTitle("TeamMemberMonitoringList")] [assembly: AssemblyVersion("1.1.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 YanHud { internal static class Cfg { public static ConfigEntry<bool> Show; public static ConfigEntry<KeyCode> Key; public static ConfigEntry<float> X; public static ConfigEntry<float> Y; public static ConfigEntry<float> Scale; public static ConfigEntry<float> BgAlpha; public static ConfigEntry<int> FontSize; public static ConfigEntry<bool> ShowLevel; public static ConfigEntry<bool> ShowNo; public static ConfigEntry<bool> ShowTeam; public static ConfigEntry<bool> ShowHp; public static ConfigEntry<bool> ShowDist; public static ConfigEntry<bool> ShowMon; public static ConfigEntry<bool> ShowVal; public static void Bind(ConfigFile c) { LangHost.Init(c); Show = LangHost.B(c, "show", def: true); Key = LangHost.B<KeyCode>(c, "key", (KeyCode)283); X = LangHost.B(c, "x", 10f); Y = LangHost.B(c, "y", 200f); Scale = LangHost.Bf(c, "scale", 1f, 0.6f, 2.5f); FontSize = LangHost.Bi(c, "font", 0, 0, 40); BgAlpha = LangHost.Bf(c, "bg", 0f, 0f, 1f); ShowLevel = LangHost.B(c, "lvname", def: true); ShowNo = LangHost.B(c, "lvno", def: true); ShowTeam = LangHost.B(c, "team", def: true); ShowHp = LangHost.B(c, "hp", def: true); ShowDist = LangHost.B(c, "dist", def: true); ShowMon = LangHost.B(c, "mon", def: true); ShowVal = LangHost.B(c, "val", def: true); } } internal static class G { public class Row { public string Name = "?"; public string Sid = ""; public bool Dead; public bool IsMe; public int Hp; public int MaxHp; public float Dist; public float RawDist; } public class Mon { public string Name = "?"; public float Dist; public bool Alive; public float Respawn; } public static PlayerAvatar Local; public static readonly List<PlayerAvatar> Players = new List<PlayerAvatar>(); public static readonly List<Row> Rows = new List<Row>(); public static readonly List<Mon> Mons = new List<Mon>(); public static float RemainValue; public static int RemainCount; private static float _worldT = -99f; private static readonly Dictionary<int, float> _goneAt = new Dictionary<int, float>(); private static readonly Dictionary<int, float> _fieldPrev = new Dictionary<int, float>(); private static readonly Dictionary<int, int> _fieldDir = new Dictionary<int, int>(); private static float _scanT = -99f; private static string _sid = ""; private static float _lvlT = -99f; private static string _lvlName = ""; private static int _lvlNo = -1; private static int _lvlMax = -1; private static bool _shop; public static void Tick() { float unscaledTime = Time.unscaledTime; if (!(unscaledTime - _scanT < 0.5f)) { _scanT = unscaledTime; Scan(); Identify(); BuildRows(); ScanWorld(); } } private static void Scan() { Players.Clear(); try { PlayerAvatar[] array = Object.FindObjectsByType<PlayerAvatar>((FindObjectsInactive)1, (FindObjectsSortMode)0); if (array == null) { return; } for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null) { Players.Add(array[i]); } } } catch { } } private static void Identify() { if ((Object)(object)Local != (Object)null && (Object)(object)((Component)Local).gameObject != (Object)null) { return; } Local = null; for (int i = 0; i < Players.Count; i++) { PlayerAvatar val = Players[i]; if ((Object)(object)val == (Object)null) { continue; } try { if (R.Bool(R.Get(val, "isLocal"))) { Local = val; break; } } catch { } } if ((Object)(object)Local == (Object)null && !string.IsNullOrEmpty(_sid)) { for (int j = 0; j < Players.Count; j++) { PlayerAvatar val2 = Players[j]; if (!((Object)(object)val2 == (Object)null) && KeyOf(val2) == _sid) { Local = val2; break; } } } if ((Object)(object)Local == (Object)null) { try { Type type = R.FindType("PlayerAvatar"); object obj2 = ((type != null) ? R.Static(type, "instance") : null); PlayerAvatar val3 = (PlayerAvatar)((obj2 is PlayerAvatar) ? obj2 : null); if (val3 != null) { Local = val3; } } catch { } } if ((Object)(object)Local == (Object)null) { try { Type type2 = R.FindType("PlayerController"); object obj4 = ((type2 != null) ? R.Static(type2, "instance") : null); if (obj4 != null) { object obj5 = R.Get(obj4, "playerAvatar"); PlayerAvatar val4 = (PlayerAvatar)((obj5 is PlayerAvatar) ? obj5 : null); if (val4 != null) { Local = val4; } } } catch { } } if ((Object)(object)Local != (Object)null) { string text = KeyOf(Local); if (!string.IsNullOrEmpty(text)) { _sid = text; } } } public static string KeyOf(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return ""; } try { string text = R.Str(R.Get(p, "playerSteamID")); if (string.IsNullOrEmpty(text)) { text = R.Str(R.Get(p, "steamID")); } if (!string.IsNullOrEmpty(text)) { return text.Trim(); } } catch { } return ""; } public static string PlayerName(PlayerAvatar p, int idx) { if ((Object)(object)p == (Object)null) { return "?"; } try { string text = R.Str(R.Get(p, "playerName")); if (!string.IsNullOrEmpty(text)) { return text.Trim(); } object obj = R.Get(p, "playerController"); if (obj != null) { text = R.Str(R.Get(obj, "playerName")); if (!string.IsNullOrEmpty(text)) { return text.Trim(); } } } catch { } return "玩家" + (idx + 1); } public static object HealthComp(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return null; } try { return R.Get(p, "playerHealth"); } catch { return null; } } public static int HealthOf(PlayerAvatar p) { object obj = HealthComp(p); if (obj == null) { return 0; } return R.Int(R.Get(obj, "health")); } public static int MaxHealthOf(PlayerAvatar p) { object obj = HealthComp(p); if (obj == null) { return 0; } int num = R.Int(R.Get(obj, "maxHealth")); if (num <= 0) { num = 100; } return num; } public static bool StrongDead(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return true; } try { if (!((Component)p).gameObject.activeInHierarchy) { return true; } } catch { return true; } return HealthOf(p) <= 0; } public static Vector3 LocalPos() { //IL_0063: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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)(object)Local != (Object)null && (Object)(object)((Component)Local).gameObject != (Object)null && ((Component)Local).gameObject.activeInHierarchy) { return ((Component)Local).transform.position; } try { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { return ((Component)main).transform.position; } } catch { } return Vector3.zero; } private static void BuildRows() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) Rows.Clear(); Vector3 val = LocalPos(); if ((Object)(object)Local != (Object)null) { StrongDead(Local); } else _ = 0; _ = (Object)(object)Local == (Object)null; for (int i = 0; i < Players.Count; i++) { PlayerAvatar val2 = Players[i]; if (!((Object)(object)val2 == (Object)null)) { Row row = new Row(); row.Name = PlayerName(val2, i); row.Sid = KeyOf(val2); row.IsMe = (Object)(object)val2 == (Object)(object)Local; row.Dead = StrongDead(val2); row.Hp = HealthOf(val2); row.MaxHp = MaxHealthOf(val2); try { Vector3 val3 = ((Component)val2).transform.position - val; val3.y = 0f; row.Dist = ((Vector3)(ref val3)).magnitude; row.RawDist = row.Dist; } catch { row.Dist = 0f; } Rows.Add(row); } } Rows.Sort((Row a, Row b) => (a.IsMe != b.IsMe) ? ((!a.IsMe) ? 1 : (-1)) : a.Dist.CompareTo(b.Dist)); } private static Array FindAll(Type t) { if (t == null) { return null; } try { MethodInfo method = typeof(Object).GetMethod("FindObjectsByType", new Type[3] { typeof(Type), typeof(FindObjectsInactive), typeof(FindObjectsSortMode) }); if (method != null && method.Invoke(null, new object[3] { t, (object)(FindObjectsInactive)0, (object)(FindObjectsSortMode)0 }) is Array result) { return result; } } catch { } try { MethodInfo method2 = typeof(Object).GetMethod("FindObjectsOfType", new Type[1] { typeof(Type) }); if (method2 != null) { return method2.Invoke(null, new object[1] { t }) as Array; } } catch { } return null; } private static void ScanWorld() { //IL_001b: 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_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_016d: 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_01ac: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; if (unscaledTime - _worldT < 1f) { return; } _worldT = unscaledTime; Vector3 val = LocalPos(); float num = 0f; int num2 = 0; try { ValuableObject[] array = Object.FindObjectsByType<ValuableObject>((FindObjectsInactive)0, (FindObjectsSortMode)0); if (array != null) { foreach (ValuableObject val2 in array) { if (!((Object)(object)val2 == (Object)null)) { float num3 = R.Num(R.Get(val2, "dollarValueCurrent")); if (num3 <= 0f) { num3 = R.Num(R.Get(val2, "dollarValueOriginal")); } if (!(num3 <= 0f)) { num += num3; num2++; } } } } } catch { } RemainValue = num; RemainCount = num2; Mons.Clear(); try { Array array2 = FindAll(R.FindType("EnemyParent")); if (array2 != null) { for (int j = 0; j < array2.Length; j++) { object value = array2.GetValue(j); Object val3 = (Object)((value is Object) ? value : null); if (val3 == (Object)null) { continue; } Mon mon = new Mon(); string text = R.Str(R.Get(value, "enemyName")); mon.Name = (string.IsNullOrEmpty(text) ? "?" : text.Trim()); mon.Alive = R.Bool(R.Get(value, "Spawned")); Vector3 val4 = Vector3.zero; object obj2 = R.Get(value, "transform"); Transform val5 = (Transform)((obj2 is Transform) ? obj2 : null); if ((Object)(object)val5 != (Object)null) { val4 = val5.position; } object obj3 = R.Get(value, "Enemy"); if (obj3 != null) { object obj4 = R.Get(obj3, "CenterTransform"); Transform val6 = (Transform)((obj4 is Transform) ? obj4 : null); if ((Object)(object)val6 != (Object)null) { val4 = val6.position; } } Vector3 val7 = val4 - val; val7.y = 0f; mon.Dist = ((Vector3)(ref val7)).magnitude; int instanceID = val3.GetInstanceID(); if (mon.Alive) { _goneAt.Remove(instanceID); _fieldPrev.Remove(instanceID); _fieldDir.Remove(instanceID); mon.Respawn = 0f; } else { if (!_goneAt.TryGetValue(instanceID, out var value2)) { value2 = unscaledTime; _goneAt[instanceID] = unscaledTime; } float num4 = unscaledTime - value2; float num5 = R.Num(R.Get(value, "DespawnedTimer")); float num6 = R.Num(R.Get(value, "DespawnedTimeMin")); if (num6 <= 0f) { num6 = 30f; } int value3 = 0; _fieldDir.TryGetValue(instanceID, out value3); if (_fieldPrev.TryGetValue(instanceID, out var value4) && num5 > 0f && value4 > 0f) { if (num5 < value4 - 0.001f) { value3 = 1; } else if (num5 > value4 + 0.001f) { value3 = 2; } } _fieldPrev[instanceID] = num5; _fieldDir[instanceID] = value3; float num7 = value3 switch { 1 => num5, 2 => num6 - num5, _ => num6 - num4, }; mon.Respawn = ((num7 > 0f) ? num7 : 0f); } Mons.Add(mon); } } } catch { } Mons.Sort((Mon a, Mon b) => (a.Alive != b.Alive) ? ((!a.Alive) ? 1 : (-1)) : a.Dist.CompareTo(b.Dist)); } public static string LevelName() { RefreshLevel(); return _lvlName; } public static int LevelNo() { RefreshLevel(); return _lvlNo; } public static int LevelsMax() { RefreshLevel(); return _lvlMax; } public static bool IsShop() { RefreshLevel(); return _shop; } private static void RefreshLevel() { if (Time.unscaledTime - _lvlT < 1f) { return; } _lvlT = Time.unscaledTime; _lvlName = ""; _lvlNo = -1; _lvlMax = -1; _shop = false; try { Type type = R.FindType("RunManager"); object obj = ((type != null) ? R.Static(type, "instance") : null); if (obj == null) { Object val = Object.FindObjectOfType(type); if (val != (Object)null) { obj = val; } } if (obj == null) { return; } _shop = R.Bool(R.Get(obj, "levelIsShop")); _lvlNo = R.Int(R.Get(obj, "levelsCompleted")) + 1; _lvlMax = R.Int(R.Get(obj, "levelsMax")); if (_shop) { _lvlName = "商店"; return; } object obj2 = R.Get(obj, "levelCurrent"); if (obj2 != null) { string text = ""; object obj3 = R.Get(obj2, "NarrativeNameLocalized"); if (obj3 != null) { text = R.Str(R.Call(obj3, "GetLocalizedString")); } if (string.IsNullOrEmpty(text)) { text = R.Str(R.Get(obj2, "NarrativeName")); } _lvlName = text ?? ""; } } catch { } } } internal static class Hud { private static readonly Color ColLevel = new Color(1f, 0.87f, 0.36f, 1f); private static readonly Color ColHead = new Color(0.78f, 0.82f, 0.9f, 1f); private static readonly Color ColMe = new Color(0.55f, 0.92f, 1f, 1f); private static readonly Color ColMate = new Color(0.96f, 0.96f, 0.96f, 1f); private static readonly Color ColDead = new Color(0.72f, 0.42f, 0.42f, 1f); private static readonly Color ColMon = new Color(1f, 0.38f, 0.38f, 1f); private static readonly Color ColVal = new Color(0.62f, 0.95f, 0.62f, 1f); private static GUIStyle _st; private static Texture2D _white; private static Font _font; private static int _fontSize = -1; public static void DrawAll() { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0345: 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_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: 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) try { if (!Cfg.Show.Value) { return; } Ensure(); float value = Cfg.X.Value; float num = Cfg.Y.Value; float num2 = Mathf.Clamp01(Cfg.BgAlpha.Value); int num3 = ((Cfg.FontSize.Value > 0) ? Cfg.FontSize.Value : Mathf.Clamp(Mathf.RoundToInt((float)Screen.height / 78f * Cfg.Scale.Value), 10, 42)); if (Cfg.ShowLevel.Value || Cfg.ShowNo.Value) { string text = ""; string text2 = G.LevelName(); if (Cfg.ShowNo.Value) { int num4 = G.LevelNo(); if (num4 > 0) { text = Lang.R("第 " + num4 + " 关", "Level " + num4); } } if (Cfg.ShowLevel.Value) { string text3 = (string.IsNullOrEmpty(text2) ? Lang.R("未知关卡", "Unknown level") : Lang.Lvl(text2)); text = ((text.Length > 0) ? (text + " · " + text3) : text3); } if (text.Length > 0) { num += Line(value, num, "◆ " + text, num3 + 2, ColLevel, num2); } } if (Cfg.ShowTeam.Value) { num += Line(value, num, Lang.R("── 队伍 ──", "── Team ──"), num3 - 1, ColHead, num2 * 0.55f); List<G.Row> rows = G.Rows; if (rows.Count == 0) { num += Line(value, num, Lang.R("等待入局…", "Waiting for a run…"), num3, ColMate, num2); return; } string text4 = Lang.R("(我)", " (me)"); string text5 = Lang.R(" ✝ 已死亡", " ✝ DEAD"); for (int i = 0; i < rows.Count; i++) { G.Row row = rows[i]; string text6; if (row.Dead) { text6 = row.Name + (row.IsMe ? text4 : "") + text5; } else { text6 = row.Name + (row.IsMe ? text4 : ""); if (Cfg.ShowHp.Value) { text6 = text6 + " " + row.Hp + "/" + row.MaxHp; } if (Cfg.ShowDist.Value && !row.IsMe) { text6 = text6 + " " + Mathf.RoundToInt(row.Dist) + "m"; } } num += Line(value, num, text6, num3, row.Dead ? ColDead : (row.IsMe ? ColMe : ColMate), num2); } } if (Cfg.ShowMon.Value) { num += Line(value, num, Lang.R("── 怪物 ──", "── Enemies ──"), num3 - 1, ColHead, num2 * 0.55f); List<G.Mon> mons = G.Mons; if (mons.Count == 0) { num += Line(value, num, Lang.R("附近没有怪物", "No enemies around"), num3 - 1, ColMon, num2); } else { int num5 = ((mons.Count > 12) ? 12 : mons.Count); for (int j = 0; j < num5; j++) { G.Mon mon = mons[j]; string text7 = Lang.Mon(mon.Name) + " " + Mathf.RoundToInt(mon.Dist) + "m"; if (!mon.Alive) { text7 = text7 + " " + Lang.R("✝ 复活 ", "✝ respawn ") + Mathf.CeilToInt(mon.Respawn) + "s"; } num += Line(value, num, text7, num3 - 1, ColMon, num2); } if (mons.Count > num5) { num += Line(value, num, Lang.R("… 还有 " + (mons.Count - num5) + " 只", "… +" + (mons.Count - num5) + " more"), num3 - 1, ColMon, num2 * 0.7f); } } } if (Cfg.ShowVal.Value) { num += Line(value, num, Lang.R("── 剩余价值 ──", "── Value left ──"), num3 - 1, ColHead, num2 * 0.55f); string text8 = "$" + Mathf.RoundToInt(G.RemainValue) + Lang.R(" 共 ", " in ") + G.RemainCount + Lang.R(" 件", " items"); num += Line(value, num, text8, num3 - 1, ColVal, num2); } } catch { } } private static void Ensure() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (_st == null) { _st = new GUIStyle(GUI.skin.label); _st.alignment = (TextAnchor)3; _st.fontStyle = (FontStyle)1; _st.wordWrap = false; _st.clipping = (TextClipping)0; _st.richText = false; } if ((Object)(object)_font == (Object)null) { try { _font = Font.CreateDynamicFontFromOSFont(new string[5] { "Microsoft YaHei UI", "Microsoft YaHei", "SimHei", "SimSun", "Arial Unicode MS" }, 16); } catch { } if ((Object)(object)_font != (Object)null) { _st.font = _font; } } if ((Object)(object)_white == (Object)null) { _white = new Texture2D(1, 1, (TextureFormat)4, false); _white.SetPixel(0, 0, Color.white); _white.Apply(); } } private static float Line(float x, float topY, string text, int fs, Color fg, float bgA) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_00a6: 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_00c5: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01b3: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(text)) { return 0f; } int num = Mathf.Clamp(fs, 8, 44); if (num != _fontSize) { _st.fontSize = num; _fontSize = num; } Vector2 val = _st.CalcSize(new GUIContent(text)); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(x, topY, val.x + 6f, val.y + 2f); if (bgA > 0.001f) { Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, bgA); GUI.DrawTexture(val2, (Texture)(object)_white); GUI.color = color; } Color textColor = _st.normal.textColor; _st.normal.textColor = new Color(0f, 0f, 0f, Mathf.Clamp01(fg.a) * 0.85f); GUI.Label(new Rect(((Rect)(ref val2)).x - 1f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), text, _st); GUI.Label(new Rect(((Rect)(ref val2)).x + 1f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), text, _st); GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y - 1f, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), text, _st); GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + 1f, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), text, _st); _st.normal.textColor = fg; GUI.Label(val2, text, _st); _st.normal.textColor = textColor; return val.y + 3f; } } internal static class Lang { public const string SecLang = "0.Language"; public const string KeyLang = "Language"; public static ConfigEntry<string> Cur; private static readonly Dictionary<string, string> MonZh = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Animal", "野兽" }, { "Banger", "轰鸣者" }, { "Clown", "小丑" }, { "Birthday Boy", "庆生小子" }, { "Cleanup Crew", "投弹者" }, { "Bowtie", "领结客" }, { "Peeper", "窥视者" }, { "Apex Predator", "顶级掠食者" }, { "Elsa", "可爱小狗" }, { "Mentalist", "念能者" }, { "Gnome", "地精" }, { "Headman", "大头" }, { "Headgrab", "猎头者" }, { "Heart Hugger", "抱心者" }, { "Hidden", "隐匿者" }, { "Huntsman", "猎人" }, { "Oogly", "怪脸仔" }, { "Robe", "长袍" }, { "Reaper", "死神" }, { "Loom", "老奶" }, { "Spewer", "喷吐怪" }, { "Trudge", "跋涉者" }, { "Gambit", "赌徒" }, { "Shadow Child", "影童" }, { "Tick", "蜱虫" }, { "Bella", "贝拉" }, { "Chef", "主厨" }, { "Upscream", "尖啸者" }, { "Rugrat", "顽童" } }; private static Dictionary<string, string> _lvlMap; private static bool _lvlTried; public static readonly string[][] T = new string[14][] { new string[7] { "show", "1.显示", "1. Display", "显示HUD", "Show HUD", "总开关(按快捷键也能即时切换)", "Master switch. The hotkey toggles it as well." }, new string[7] { "key", "1.显示", "1. Display", "显隐快捷键", "Toggle hotkey", "按一下隐藏,再按一下显示", "Tap once to hide, tap again to show." }, new string[7] { "x", "1.显示", "1. Display", "横向位置(像素)", "X position (px)", "距屏幕左边的距离;按住左Ctrl+方向键可现场拖动", "Distance from the left edge. Hold LeftCtrl + arrow keys to drag in game." }, new string[7] { "y", "1.显示", "1. Display", "纵向位置(像素)", "Y position (px)", "距屏幕上边的距离", "Distance from the top edge." }, new string[7] { "scale", "1.显示", "1. Display", "字号缩放", "Text scale", "整体字号倍率,0.6 ~ 2.5", "Overall text scale, 0.6 to 2.5." }, new string[7] { "font", "1.显示", "1. Display", "字号像素-0自动", "Font size px - 0 auto", "0 表示按屏幕高度自动计算", "0 means computed automatically from screen height." }, new string[7] { "bg", "1.显示", "1. Display", "背景不透明度", "Background opacity", "0 = 完全透明(默认),1 = 纯黑底", "0 = fully transparent (default), 1 = solid black." }, new string[7] { "lvname", "2.内容", "2. Content", "显示关卡名", "Show level name", "例如 豪宅 / 商店", "For example Manor / Shop." }, new string[7] { "lvno", "2.内容", "2. Content", "显示关卡数", "Show level count", "例如 第 3 关 / 共 8 关", "For example Level 3 of 8." }, new string[7] { "team", "2.内容", "2. Content", "显示队伍", "Show team", "队友名字与状态", "Teammate names and status." }, new string[7] { "hp", "2.内容", "2. Content", "显示血量", "Show HP", "队友当前血量 / 上限", "Teammate current / max HP." }, new string[7] { "dist", "2.内容", "2. Content", "显示距离", "Show distance", "队友离你多少米", "Distance to each teammate in meters." }, new string[7] { "mon", "2.内容", "2. Content", "显示怪物列表", "Show enemy list", "红字:怪物名 + 距离,死掉的显示复活倒计时", "Red lines: enemy name + distance. Dead ones show a respawn countdown." }, new string[7] { "val", "2.内容", "2. Content", "显示剩余价值", "Show value left", "本局场上还没被拿走的贵重物品总价", "Total dollar value of valuables still lying around this run." } }; public static bool En { get { if (Cur != null) { return Cur.Value == "English"; } return false; } } public static string R(string zh, string en) { if (!En) { return zh; } return en; } private static bool HasCjk(string s) { if (string.IsNullOrEmpty(s)) { return false; } foreach (char c in s) { if (c >= '㐀' && c <= '鿿') { return true; } } return false; } private static void AddLvlPair(Dictionary<string, string> m, string a, string b) { if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(b)) { return; } a = a.Trim(); b = b.Trim(); if (a.Length == 0 || b.Length == 0 || a == b) { return; } if (!HasCjk(a) || HasCjk(b)) { if (!HasCjk(b) || HasCjk(a)) { return; } string text = a; a = b; b = text; } if (!m.ContainsKey(a)) { m[a] = b; } if (!m.ContainsKey(b)) { m[b] = a; } } private static void ReadLvlTsv(string path, Dictionary<string, string> into) { try { if (!File.Exists(path)) { return; } string[] array = File.ReadAllLines(path, Encoding.UTF8); foreach (string text in array) { int num = text.IndexOf('\t'); if (num <= 0) { continue; } string text2 = text.Substring(0, num).Trim(); if (text2.StartsWith("LEVEL.NAME.", StringComparison.Ordinal)) { string text3 = text.Substring(num + 1).Trim(); if (text3.Length != 0) { into[text2] = text3; } } } } catch { } } private static void BuildLvlMap() { Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.Ordinal); AddLvlPair(dictionary, "商店", "Shop"); Dictionary<string, string> dictionary2 = new Dictionary<string, string>(StringComparer.Ordinal); Dictionary<string, string> dictionary3 = new Dictionary<string, string>(StringComparer.Ordinal); try { string text = Application.streamingAssetsPath + "/Localizations/"; ReadLvlTsv(text + "Menu.tsv", dictionary2); ReadLvlTsv(text + "Default/Menu.tsv", dictionary3); } catch { } foreach (KeyValuePair<string, string> item in dictionary2) { if (dictionary3.TryGetValue(item.Key, out var value)) { AddLvlPair(dictionary, item.Value, value); } } _lvlMap = dictionary; Plugin.LogInfo("lang: lvl map n=" + dictionary.Count); } public static string Lvl(string s) { if (string.IsNullOrEmpty(s)) { return s; } if (_lvlMap == null && !_lvlTried) { _lvlTried = true; try { BuildLvlMap(); } catch (Exception ex) { Plugin.LogWarn("lang lvl: " + ex.Message); _lvlMap = new Dictionary<string, string>(StringComparer.Ordinal); } } string text = s.Trim(); bool flag = HasCjk(text); if (En == flag && _lvlMap != null && _lvlMap.TryGetValue(text, out var value)) { return value; } return text; } public static string Mon(string en) { if (string.IsNullOrEmpty(en)) { return "?"; } string text = en.Trim(); if (En) { return text; } if (MonZh.TryGetValue(text, out var value)) { return value; } if (text.Length > 2 && (text.StartsWith("A ") || text.StartsWith("An ")) && MonZh.TryGetValue(text.Substring(text.IndexOf(' ') + 1), out value)) { return value; } if (text.Length > 4 && text.StartsWith("The ") && MonZh.TryGetValue(text.Substring(4), out value)) { return value; } return text; } public static string[] Row(string id) { for (int i = 0; i < T.Length; i++) { if (T[i][0] == id) { return T[i]; } } return null; } } internal static class LangHost { private static ConfigFile _c; private static readonly Dictionary<string, ConfigEntryBase> _map = new Dictionary<string, ConfigEntryBase>(); private static float _refreshAt = -1f; public static void Init(ConfigFile c) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (_c == null) { _c = c; Lang.Cur = c.Bind<string>("0.Language", "Language", "中文", new ConfigDescription("配置菜单显示的语言 / Language of the config menu", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "中文", "English" }), Array.Empty<object>())); Lang.Cur.SettingChanged += OnLangChanged; } } public static ConfigEntry<T> B<T>(ConfigFile c, string id, T def, AcceptableValueBase range = null) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown string[] array = Lang.Row(id); if (array == null) { return c.Bind<T>("x", id, def, (ConfigDescription)null); } string text = (Lang.En ? array[2] : array[1]); string text2 = (Lang.En ? array[4] : array[3]); ConfigDescription val = new ConfigDescription(Lang.R(array[5], array[6]), range, Array.Empty<object>()); ConfigEntry<T> val2 = c.Bind<T>(text, text2, def, val); _map[id] = (ConfigEntryBase)(object)val2; return val2; } public static ConfigEntry<float> Bf(ConfigFile c, string id, float def, float min, float max) { return B(c, id, def, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max)); } public static ConfigEntry<int> Bi(ConfigFile c, string id, int def, int min, int max) { return B(c, id, def, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max)); } private static void OnLangChanged(object sender, EventArgs ev) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (_c == null) { return; } try { foreach (KeyValuePair<string, ConfigEntryBase> item in _map) { string[] array = Lang.Row(item.Key); if (array != null) { ConfigEntryBase value = item.Value; ConfigDescription description = value.Description; ConfigDefinition val = new ConfigDefinition(Lang.En ? array[2] : array[1], Lang.En ? array[4] : array[3]); object[] array2 = ((description != null && description.Tags != null) ? description.Tags : new object[0]); ConfigDescription val2 = new ConfigDescription(Lang.R(array[5], array[6]), (description == null) ? null : description.AcceptableValues, array2); SetBacking(value, "Definition", val); SetBacking(value, "Description", val2); } } RebuildEntries(); PurgeOrphans(); _c.Save(); _refreshAt = Time.unscaledTime + 0.15f; Plugin.LogInfo("lang switch -> " + (Lang.En ? "English" : "中文")); } catch (Exception ex) { Plugin.LogWarn("lang switch failed: " + ex.Message); } } private static void RebuildEntries() { FieldInfo field = typeof(ConfigFile).GetField("Entries", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return; } Dictionary<ConfigDefinition, ConfigEntryBase> dictionary = new Dictionary<ConfigDefinition, ConfigEntryBase>(); foreach (KeyValuePair<string, ConfigEntryBase> item in _map) { if (item.Value != null) { dictionary[item.Value.Definition] = item.Value; } } if (Lang.Cur != null) { dictionary[((ConfigEntryBase)Lang.Cur).Definition] = (ConfigEntryBase)(object)Lang.Cur; } field.SetValue(_c, dictionary); } private static void PurgeOrphans() { try { FieldInfo field = typeof(ConfigFile).GetField("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); if (!(field == null) && field.GetValue(_c) is IDictionary dictionary) { dictionary.Clear(); } } catch { } } private static void SetBacking(object obj, string member, object val) { Type type = obj.GetType(); while (type != null) { FieldInfo field = type.GetField("<" + member + ">k__BackingField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(obj, val); break; } type = type.BaseType; } } public static void MenuRefreshTick() { if (_refreshAt < 0f || Time.unscaledTime < _refreshAt) { return; } _refreshAt = -1f; try { Type type = R.FindType("MenuLib.MenuAPI"); Type type2 = R.FindType("REPOConfig.ConfigMenu"); if (type == null || type2 == null) { return; } FieldInfo field = type2.GetField("hasPopupMenuOpened", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(null); if (value is bool && !(bool)value) { return; } } MethodInfo method = type.GetMethod("CloseAllPagesAddedOnTop", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method != null) { method.Invoke(null, null); } MethodInfo method2 = type2.GetMethod("CreateModMenu", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method2 != null) { method2.Invoke(null, null); } Plugin.LogInfo("lang: menu rebuilt"); } catch (Exception ex) { Plugin.LogWarn("lang menu refresh: " + ex.Message); } } } [BepInPlugin("com.yanyan.hud", "Team member monitoring list 队员监控列表", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.yanyan.hud"; public const string VERSION = "1.1.0"; internal static Plugin I; internal static ManualLogSource Log; private float _saveT = -99f; private bool _moved; internal static void LogInfo(string s) { try { if (Log != null) { Log.LogInfo((object)s); } } catch { } } internal static void LogWarn(string s) { try { if (Log != null) { Log.LogWarning((object)s); } } catch { } } private void Awake() { I = this; Log = ((BaseUnityPlugin)this).Logger; Cfg.Bind(((BaseUnityPlugin)this).Config); LogInfo("Team member monitoring list v1.1.0 loaded"); } private void Update() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) try { G.Tick(); LangHost.MenuRefreshTick(); if ((int)Cfg.Key.Value != 0 && Input.GetKeyDown(Cfg.Key.Value)) { Cfg.Show.Value = !Cfg.Show.Value; ((BaseUnityPlugin)this).Config.Save(); } Drag(); } catch { } } private void Drag() { if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) { float num = ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) ? 1f : 10f); float num2 = 0f; float num3 = 0f; if (Input.GetKeyDown((KeyCode)276)) { num2 = 0f - num; } if (Input.GetKeyDown((KeyCode)275)) { num2 = num; } if (Input.GetKeyDown((KeyCode)273)) { num3 = 0f - num; } if (Input.GetKeyDown((KeyCode)274)) { num3 = num; } if (num2 != 0f || num3 != 0f) { Cfg.X.Value = Mathf.Max(0f, Cfg.X.Value + num2); Cfg.Y.Value = Mathf.Max(0f, Cfg.Y.Value + num3); _moved = true; _saveT = Time.unscaledTime; } } } private void OnGUI() { try { Hud.DrawAll(); if (Time.unscaledTime - _saveT < 0.35f) { Hint(); } } catch { } } private void Hint() { //IL_0000: 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_0047: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.9f); GUI.Label(new Rect(Cfg.X.Value, Cfg.Y.Value + 4f, 400f, 24f), Lang.R("HUD 位置 ", "HUD position ") + Mathf.RoundToInt(Cfg.X.Value) + "," + Mathf.RoundToInt(Cfg.Y.Value)); GUI.color = color; } private void OnDestroy() { if (_moved) { ((BaseUnityPlugin)this).Config.Save(); } } } internal static class R { private const BindingFlags BF = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, Type> _types = new Dictionary<string, Type>(); public static Type FindType(string simpleName) { if (string.IsNullOrEmpty(simpleName)) { return null; } if (_types.TryGetValue(simpleName, out var value)) { return value; } Type type = null; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type[] types; try { types = assembly.GetTypes(); } catch { continue; } Type[] array = types; foreach (Type type2 in array) { if (type2.Name == simpleName) { type = type2; break; } } if (type != null) { break; } } } catch { } _types[simpleName] = type; return type; } public static object Get(object o, string name) { if (o == null) { return null; } try { Type type = o.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(field.IsStatic ? null : o); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (getMethod != null) { return property.GetValue(getMethod.IsStatic ? null : o); } } } catch { } return null; } public static void Set(object o, string name, object v) { if (o == null) { return; } try { Type type = o.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(field.IsStatic ? null : o, v); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (setMethod != null) { property.SetValue(setMethod.IsStatic ? null : o, v); } } } catch { } } public static object Static(Type t, string name) { if (t == null) { return null; } try { FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name == name && fieldInfo.IsStatic) { return fieldInfo.GetValue(null); } } PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true); if (propertyInfo.Name == name && getMethod != null && getMethod.IsStatic) { return propertyInfo.GetValue(null); } } } catch { } return null; } public static object Call(object o, string name, params object[] args) { if (o == null) { return null; } try { MethodInfo[] methods = o.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != name) && methodInfo.GetParameters().Length == args.Length) { try { return methodInfo.Invoke(methodInfo.IsStatic ? null : o, args); } catch { } } } } catch { } return null; } public static int Int(object o) { try { if (o == null) { return 0; } if (o is int result) { return result; } return Convert.ToInt32(o); } catch { return 0; } } public static float Num(object o) { try { if (o == null) { return 0f; } if (o is float result) { return result; } return Convert.ToSingle(o); } catch { return 0f; } } public static string Str(object o) { return o as string; } public static bool Bool(object o) { bool flag = default(bool); int num; if (o is bool) { flag = (bool)o; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } } }