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 Radar Ident QuickSwitch v0.1.5
Radar Ident QuickSwitch.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using On; using On.GameNetcodeStuff; using TMPro; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Radar Ident QuickSwitch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Rethunk.Tech, LLC. 2023")] [assembly: AssemblyDescription("\n\t\t\tAdds numbers over player radar icons, enabling for faster terminal switching.\n\t\t")] [assembly: AssemblyFileVersion("0.1.4.0")] [assembly: AssemblyInformationalVersion("0.1.4+e0f27b3cb06d3582d43d1bfdea6e3f19571d71c5")] [assembly: AssemblyProduct("Radar Ident QuickSwitch")] [assembly: AssemblyTitle("Radar Ident QuickSwitch")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 Radar_Ident_QuickSwitch { public static class MyPluginInfo { public const string PLUGIN_GUID = "Radar Ident QuickSwitch"; public const string PLUGIN_NAME = "Radar Ident QuickSwitch"; public const string PLUGIN_VERSION = "0.1.4"; } } namespace Rethunk.LC.RadarIdentQuickSwitch { [BepInPlugin("tech.rethunk.src.lc_radar_ident_quickswitch", "Radar Ident QuickSwitch", "0.1.4")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__ManualCameraRenderer_Awake; public static hook_AddTransformAsTargetToRadar <1>__ManualCameraRenderer_AddTransformAsTargetToRadar; public static hook_RemoveTargetFromRadar <2>__ManualCameraRenderer_RemoveTargetFromRadar; } private const string PLUGIN_GUID = "tech.rethunk.src.lc_radar_ident_quickswitch"; private const string PLUGIN_NAME = "Radar Ident QuickSwitch"; private const string PLUGIN_VERSION = "0.1.4"; public static ConfigFile config; private static readonly Dictionary<GameObject, string> playerAssignments = new Dictionary<GameObject, string>(); private static readonly Dictionary<string, GameObject> playerMapLabels = new Dictionary<string, GameObject>(); public static ManualLogSource LogSource { get; private set; } private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; LogSource = ((BaseUnityPlugin)this).Logger; object obj = <>O.<0>__ManualCameraRenderer_Awake; if (obj == null) { hook_Awake val = ManualCameraRenderer_Awake; <>O.<0>__ManualCameraRenderer_Awake = val; obj = (object)val; } ManualCameraRenderer.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__ManualCameraRenderer_AddTransformAsTargetToRadar; if (obj2 == null) { hook_AddTransformAsTargetToRadar val2 = ManualCameraRenderer_AddTransformAsTargetToRadar; <>O.<1>__ManualCameraRenderer_AddTransformAsTargetToRadar = val2; obj2 = (object)val2; } ManualCameraRenderer.AddTransformAsTargetToRadar += (hook_AddTransformAsTargetToRadar)obj2; object obj3 = <>O.<2>__ManualCameraRenderer_RemoveTargetFromRadar; if (obj3 == null) { hook_RemoveTargetFromRadar val3 = ManualCameraRenderer_RemoveTargetFromRadar; <>O.<2>__ManualCameraRenderer_RemoveTargetFromRadar = val3; obj3 = (object)val3; } ManualCameraRenderer.RemoveTargetFromRadar += (hook_RemoveTargetFromRadar)obj3; PlayerControllerB.KillPlayerClientRpc += new hook_KillPlayerClientRpc(PlayerControllerB_KillPlayerClientRpc); PlayerControllerB.KillPlayerServerRpc += new hook_KillPlayerServerRpc(PlayerControllerB_KillPlayerServerRpc); PlayerControllerB.SendNewPlayerValuesClientRpc += new hook_SendNewPlayerValuesClientRpc(PlayerControllerB_SendNewPlayerValuesClientRpc); PlayerControllerB.SendNewPlayerValuesServerRpc += new hook_SendNewPlayerValuesServerRpc(PlayerControllerB_SendNewPlayerValuesServerRpc); PlayerControllerB.SpawnDeadBody += new hook_SpawnDeadBody(PlayerControllerB_SpawnDeadBody); Terminal.ParsePlayerSentence += new hook_ParsePlayerSentence(Terminal_ParsePlayerSentence); LogSource.LogInfo((object)"tech.rethunk.src.lc_radar_ident_quickswitch v0.1.4 was loaded!"); } private void OnDestroy() { LogSource.LogInfo((object)"tech.rethunk.src.lc_radar_ident_quickswitch v0.1.4 was unloaded!"); } internal static void TrackAllRadarTargets() { ManualCameraRenderer val = StartOfRound.Instance?.mapScreen; if ((Object)(object)val == (Object)null) { return; } for (int i = 0; i < val.radarTargets.Count; i++) { if ((Object)(object)val.radarTargets[i]?.transform != (Object)null) { StartTracking(((Component)val.radarTargets[i].transform).gameObject); } } } internal static void StartTracking(GameObject target) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } GameObject val = FindMapDot(target); if ((Object)(object)val == (Object)null) { return; } if (!playerAssignments.ContainsKey(target)) { int num = 0; while (playerAssignments.ContainsValue(num.ToString())) { num++; } playerAssignments.Add(target, num.ToString()); } string text = playerAssignments[target]; TextMeshPro component; if (playerMapLabels.ContainsKey(text)) { component = playerMapLabels[text].GetComponent<TextMeshPro>(); ((TMP_Text)component).text = text; return; } GameObject val2 = new GameObject(); val2.transform.SetParent(val.transform, false); val2.transform.SetLocalPositionAndRotation(new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(90f, 0f, 0f))); val2.transform.localScale = Vector3.one / 2f; val2.layer = val.layer; ((Object)val2).name = "MapNumber"; val2.AddComponent<Billboard>(); component = val2.AddComponent<TextMeshPro>(); ((TMP_Text)component).alignment = (TextAlignmentOptions)514; ((TMP_Text)component).autoSizeTextContainer = false; ((TMP_Text)component).maxVisibleLines = 1; ((TMP_Text)component).maxVisibleWords = 1; ((TMP_Text)component).text = text; playerMapLabels.Add(text, val2); } private static GameObject FindMapDot(GameObject target) { GameObject val = null; PlayerControllerB component = target.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { if (component.isPlayerDead) { if ((Object)(object)component.redirectToEnemy != (Object)null) { Transform obj = ((Component)component.redirectToEnemy).transform.Find("Misc"); object obj2; if (obj == null) { obj2 = null; } else { Transform obj3 = obj.Find("MapDot"); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); } val = (GameObject)obj2; } else if ((Object)(object)component.deadBody != (Object)null) { Transform obj4 = ((Component)component.deadBody).transform.Find("MapDot"); val = ((obj4 != null) ? ((Component)obj4).gameObject : null); } } else { Transform obj5 = target.transform.Find("Misc"); object obj6; if (obj5 == null) { obj6 = null; } else { Transform obj7 = obj5.Find("MapDot"); obj6 = ((obj7 != null) ? ((Component)obj7).gameObject : null); } val = (GameObject)obj6; } } if ((Object)(object)val == (Object)null) { Transform obj8 = target.transform.Find("RadarBoosterDot"); val = ((obj8 != null) ? ((Component)obj8).gameObject : null); } return val; } private static void ManualCameraRenderer_Awake(orig_Awake orig, ManualCameraRenderer self) { orig.Invoke(self); if (!((Object)(object)((NetworkBehaviour)self).NetworkManager == (Object)null) && ((NetworkBehaviour)self).NetworkManager.IsListening) { TrackAllRadarTargets(); } } private static string ManualCameraRenderer_AddTransformAsTargetToRadar(orig_AddTransformAsTargetToRadar orig, ManualCameraRenderer self, Transform newTargetTransform, string targetName, bool isNonPlayer) { string result = orig.Invoke(self, newTargetTransform, targetName, isNonPlayer); StartTracking(((Component)newTargetTransform).gameObject); return result; } private static void ManualCameraRenderer_RemoveTargetFromRadar(orig_RemoveTargetFromRadar orig, ManualCameraRenderer self, Transform removeTransform) { orig.Invoke(self, removeTransform); TrackAllRadarTargets(); } private void PlayerControllerB_KillPlayerServerRpc(orig_KillPlayerServerRpc orig, PlayerControllerB self, int playerId, bool spawnBody, Vector3 bodyVelocity, int causeOfDeath, int deathAnimation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, playerId, spawnBody, bodyVelocity, causeOfDeath, deathAnimation); TrackAllRadarTargets(); } private void PlayerControllerB_KillPlayerClientRpc(orig_KillPlayerClientRpc orig, PlayerControllerB self, int playerId, bool spawnBody, Vector3 bodyVelocity, int causeOfDeath, int deathAnimation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, playerId, spawnBody, bodyVelocity, causeOfDeath, deathAnimation); TrackAllRadarTargets(); } private void PlayerControllerB_SendNewPlayerValuesServerRpc(orig_SendNewPlayerValuesServerRpc orig, PlayerControllerB self, ulong newPlayerSteamId) { orig.Invoke(self, newPlayerSteamId); TrackAllRadarTargets(); } private void PlayerControllerB_SendNewPlayerValuesClientRpc(orig_SendNewPlayerValuesClientRpc orig, PlayerControllerB self, ulong[] playerSteamIds) { orig.Invoke(self, playerSteamIds); TrackAllRadarTargets(); } private void PlayerControllerB_SpawnDeadBody(orig_SpawnDeadBody orig, PlayerControllerB self, int playerId, Vector3 bodyVelocity, int causeOfDeath, PlayerControllerB deadPlayerController, int deathAnimation, Transform overridePosition) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, playerId, bodyVelocity, causeOfDeath, deadPlayerController, deathAnimation, overridePosition); TrackAllRadarTargets(); } private static string RemovePunctuation(string s) { StringBuilder stringBuilder = new StringBuilder(); foreach (char c in s) { if (!char.IsPunctuation(c)) { stringBuilder.Append(c); } } return stringBuilder.ToString().ToLower(); } private TerminalNode Terminal_ParsePlayerSentence(orig_ParsePlayerSentence orig, Terminal self) { TerminalNode val = orig.Invoke(self); if ((Object)(object)val != (Object)(object)self.terminalNodes.specialNodes[10]) { return val; } LogSource.LogInfo((object)"Extended Parse"); string text = RemovePunctuation(self.screenText.text.Substring(self.screenText.text.Length - self.textAdded)); string[] array = text.Split(" ", StringSplitOptions.RemoveEmptyEntries); if (array.Length == 1 && int.TryParse(array[0], out var result)) { LogSource.LogInfo((object)"Number Found"); int num = result; if (num < StartOfRound.Instance.mapScreen.radarTargets.Count) { LogSource.LogInfo((object)"Valid Number"); PlayerControllerB component = ((Component)StartOfRound.Instance.mapScreen.radarTargets[num].transform).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerControlled && !component.isPlayerDead && (Object)(object)component.redirectToEnemy == (Object)null) { return null; } StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num); LogSource.LogInfo((object)"Updated Target"); return self.terminalNodes.specialNodes[20]; } } return val; } } public class Billboard : MonoBehaviour { public void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.transform.rotation = Quaternion.Euler(90f, -45f, 0f); } } }