using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [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 ColoredNametags { [BepInPlugin("benjamin.colorednametags", "ColoredNametags", "1.0.0")] [BepInProcess("REPO.exe")] public class Plugin : BaseUnityPlugin { public const string Guid = "benjamin.colorednametags"; public const string Name = "ColoredNametags"; public const string Version = "1.0.0"; internal static ManualLogSource Log; private Harmony _harmony; internal static ConfigEntry Enabled; internal static ConfigEntry Saturation; internal static ConfigEntry MinBrightness; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Master switch."); Saturation = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Saturation", 1f, new ConfigDescription("Blend between white (0) and the player's full colour (1). Lower it if saturated nametags are hard to read against bright rooms.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); MinBrightness = ((BaseUnityPlugin)this).Config.Bind("Appearance", "MinBrightness", 0.45f, new ConfigDescription("Floor on how dark a nametag may render. Without this a player who picks near-black becomes effectively invisible in a dark corridor.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); _harmony = new Harmony("benjamin.colorednametags"); _harmony.PatchAll(typeof(NametagPatch)); Log.LogInfo((object)"ColoredNametags v1.0.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(WorldSpaceUIPlayerName))] internal static class NametagPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void AfterUpdate(WorldSpaceUIPlayerName __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Enabled.Value && !((Object)(object)__instance.text == (Object)null) && !((Object)(object)__instance.playerAvatar == (Object)null)) { Color val = SemiFunc.PlayerGetColorMain(__instance.playerAvatar); val = Color.Lerp(Color.white, val, Plugin.Saturation.Value); float num = Mathf.Max(val.r, Mathf.Max(val.g, val.b)); float value = Plugin.MinBrightness.Value; if (num > 0.001f && num < value) { val *= value / num; } val.a = ((Graphic)__instance.text).color.a; ((Graphic)__instance.text).color = val; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ColoredNametags"; public const string PLUGIN_NAME = "ColoredNametags"; public const string PLUGIN_VERSION = "1.0.0"; } }