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 REPOPingSystem v0.3.1
plugins\REPOPingMod.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; 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 ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOPingMod.Input; using REPOPingMod.Networking; using REPOPingMod.PingSystem; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOPingMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2d663e5aa121592efa0d517d5f83a67d631348ce")] [assembly: AssemblyProduct("REPOPingMod")] [assembly: AssemblyTitle("REPOPingMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 REPOPingMod { public static class ArmPointing { private class PointState { public bool isPointing; public Vector3 worldTarget; public float timer; } private static readonly Dictionary<int, PointState> _states = new Dictionary<int, PointState>(); public static void Initialize(Harmony harmony) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(typeof(PlayerAvatarRightArm), "Update", (Type[])null, (Type[])null); if (methodInfo != null) { HarmonyMethod val = new HarmonyMethod(typeof(ArmPointing), "RemoteArmPostfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Plugin.Logger.LogInfo((object)"[ArmPointing] Patched PlayerAvatarRightArm.Update"); } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("[ArmPointing] Failed to patch: " + ex.Message)); } SceneManager.sceneLoaded += delegate { _states.Clear(); }; } public static void StartPointing(Vector3 worldPosition, float duration = 1f) { } public static void StartPointingForPlayer(int actorNumber, Vector3 worldPosition, float duration = 1f) { //IL_007f: 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) PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if ((Object)(object)val.photonView != (Object)null && val.photonView.Owner != null && val.photonView.Owner.ActorNumber == actorNumber) { int instanceID = ((Object)val).GetInstanceID(); if (!_states.ContainsKey(instanceID)) { _states[instanceID] = new PointState(); } _states[instanceID].isPointing = true; _states[instanceID].worldTarget = worldPosition; _states[instanceID].timer = duration; break; } } } private static void RemoteArmPostfix(PlayerAvatarRightArm __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.playerAvatar == (Object)null) { return; } int instanceID = ((Object)__instance.playerAvatar).GetInstanceID(); if (!_states.TryGetValue(instanceID, out var value) || !value.isPointing) { return; } float deltaTime = Time.deltaTime; value.timer -= deltaTime; if (value.timer <= 0f) { value.isPointing = false; _states.Remove(instanceID); } else { if ((Object)(object)__instance.rightArmTransform == (Object)null) { return; } __instance.rightArmTransform.localEulerAngles = __instance.grabberPose; Transform grabberAimTarget = __instance.grabberAimTarget; if (!((Object)(object)grabberAimTarget == (Object)null)) { Transform rightArmParentTransform = __instance.rightArmParentTransform; if (!((Object)(object)rightArmParentTransform == (Object)null)) { Vector3 position = grabberAimTarget.position; grabberAimTarget.position = Vector3.Lerp(position, value.worldTarget, 30f * deltaTime); Quaternion localRotation = rightArmParentTransform.localRotation; rightArmParentTransform.LookAt(grabberAimTarget); Quaternion localRotation2 = rightArmParentTransform.localRotation; rightArmParentTransform.localRotation = localRotation; rightArmParentTransform.localRotation = SemiFunc.SpringQuaternionGet(__instance.grabberSteerSpring, localRotation2, deltaTime); } } } } } public class PingController : MonoBehaviour { private RadialWheel _radialWheel; private float _pressStartTime; private bool _isPressed; private bool _wheelOpened; private bool _hasHitPoint; private Vector3 _savedHitPoint; private Vector3 _savedHitNormal; private GameObject _savedHitObject; private float _lastPingTime; public void Initialize(RadialWheel radialWheel) { _radialWheel = radialWheel; } private void Update() { //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) bool mouseButtonDown = Input.GetMouseButtonDown(2); bool mouseButtonUp = Input.GetMouseButtonUp(2); bool mouseButtonDown2 = Input.GetMouseButtonDown(1); float value = Plugin.PingConfig.RadialWheelDelay.Value; if (mouseButtonDown) { _pressStartTime = Time.time; _isPressed = true; _wheelOpened = false; _hasHitPoint = TryRaycast(out _savedHitPoint, out _savedHitNormal, out _savedHitObject); } if (_isPressed && !_wheelOpened && Time.time - _pressStartTime >= value) { _wheelOpened = true; _radialWheel?.Show(); } if (_wheelOpened && mouseButtonDown2) { _radialWheel?.Hide(); _isPressed = false; _wheelOpened = false; } if (!(_isPressed && mouseButtonUp)) { return; } _isPressed = false; if (_hasHitPoint && Time.time - _lastPingTime >= 0.5f) { _lastPingTime = Time.time; PingType pingType2; if (_wheelOpened) { PingType? pingType = _radialWheel?.GetSelectedType(); _radialWheel?.Hide(); if (!pingType.HasValue) { _wheelOpened = false; return; } pingType2 = pingType.Value; } else { pingType2 = DetectPingType(_savedHitObject); } Vector3 position = _savedHitPoint + _savedHitNormal * 0.3f; GameObject hitObject = null; if ((Object)(object)_savedHitObject != (Object)null && (pingType2 != 0 || IsCart(_savedHitObject))) { hitObject = _savedHitObject; } PingManager.Instance?.PlacePingLocal(position, pingType2, hitObject); } else if (_wheelOpened) { _radialWheel?.Hide(); } _wheelOpened = false; } private bool TryRaycast(out Vector3 hitPoint, out Vector3 hitNormal, out GameObject hitObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0045: 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_0051: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00de: Unknown result type (might be due to invalid IL or missing references) hitPoint = Vector3.zero; hitNormal = Vector3.up; hitObject = null; Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return false; } float value = Plugin.PingConfig.MaxPingDistance.Value; Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; Ray val = new Ray(position, forward); int num = ~804864; RaycastHit[] array = Physics.RaycastAll(val, value, num, (QueryTriggerInteraction)1); if (array.Length == 0) { return false; } Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!((RaycastHit)(ref val2)).collider.isTrigger && !(((RaycastHit)(ref val2)).distance < 0.5f)) { hitPoint = ((RaycastHit)(ref val2)).point; hitNormal = ((RaycastHit)(ref val2)).normal; hitObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; return true; } } return false; } private static PingType DetectPingType(GameObject hitObj) { if ((Object)(object)hitObj == (Object)null) { return PingType.GoHere; } bool flag = IsCart(hitObj); bool flag2 = IsEnemy(hitObj); bool flag3 = IsItem(hitObj); Plugin.Logger.LogInfo((object)$"[DETECT] Object: {((Object)hitObj).name} | Layer: {hitObj.layer} | IsCart: {flag} | IsEnemy: {flag2} | IsItem: {flag3}"); if (flag2) { return PingType.Enemy; } if (flag) { return PingType.GoHere; } if (flag3) { return PingType.Loot; } return PingType.GoHere; } private static bool IsEnemy(GameObject obj) { if (!((Object)(object)obj.GetComponentInParent<EnemyHealth>() != (Object)null) && !((Object)(object)obj.GetComponentInParent<EnemyParent>() != (Object)null)) { return (Object)(object)obj.GetComponentInParent<EnemyRigidbody>() != (Object)null; } return true; } private static bool IsItem(GameObject obj) { if (!((Object)(object)obj.GetComponentInParent<ValuableObject>() != (Object)null)) { return (Object)(object)obj.GetComponentInParent<ItemAttributes>() != (Object)null; } return true; } private static bool IsCart(GameObject obj) { return (Object)(object)obj.GetComponentInParent<PhysGrabCart>() != (Object)null; } private static string GetCustomLabel(GameObject hitObj) { if ((Object)(object)hitObj != (Object)null && IsCart(hitObj)) { return "Cart is here"; } return null; } } [BepInPlugin("com.repomods.pingsystem", "REPO Ping System", "0.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.repomods.pingsystem"; public const string PluginName = "REPO Ping System"; public const string PluginVersion = "0.3.1"; internal static ManualLogSource Logger; internal static PingConfig PingConfig; private void Awake() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"REPO Ping System v0.3.1 loading..."); PingConfig = new PingConfig(((BaseUnityPlugin)this).Config); try { GameObject val = new GameObject("REPOPingMod"); ((Object)val).hideFlags = (HideFlags)61; Logger.LogInfo((object)"[DEBUG] GameObject created with HideAndDontSave"); PingAudio.Initialize(val); Logger.LogInfo((object)"[DEBUG] PingAudio initialized"); val.AddComponent<PingManager>(); Logger.LogInfo((object)"[DEBUG] PingManager added"); PingNetSync pingNetSync = val.AddComponent<PingNetSync>(); Logger.LogInfo((object)"[DEBUG] PingNetSync added"); pingNetSync.Initialize(); Logger.LogInfo((object)"[DEBUG] PingNetSync initialized"); RadialWheel radialWheel = val.AddComponent<RadialWheel>(); Logger.LogInfo((object)"[DEBUG] RadialWheel added"); PingController pingController = val.AddComponent<PingController>(); pingController.Initialize(radialWheel); Logger.LogInfo((object)$"[DEBUG] PingController added, enabled={((Behaviour)pingController).enabled}, go.active={val.activeInHierarchy}"); ArmPointing.Initialize(new Harmony("com.repomods.pingsystem")); Logger.LogInfo((object)"REPO Ping System v0.3.1 loaded successfully!"); } catch (Exception arg) { Logger.LogError((object)string.Format("{0} v{1} FAILED to load: {2}", "REPO Ping System", "0.3.1", arg)); } } } } namespace REPOPingMod.PingSystem { public static class PingAudio { private enum ToneShape { Sine, Square } private static readonly Dictionary<PingType, AudioClip> _clips = new Dictionary<PingType, AudioClip>(); private static AudioSource _audioSource; public static void Initialize(GameObject parent) { _audioSource = parent.AddComponent<AudioSource>(); _audioSource.playOnAwake = false; _audioSource.spatialBlend = 0f; _clips[PingType.GoHere] = GenerateTone(440f, 0.15f, ToneShape.Sine); _clips[PingType.Danger] = GenerateDoubleTone(880f, 0.1f, 0.05f); _clips[PingType.Enemy] = GenerateTone(220f, 0.25f, ToneShape.Square); _clips[PingType.Loot] = GenerateRisingTone(523f, 784f, 0.2f); } public static void Play(PingType type) { if (Plugin.PingConfig.SoundEnabled.Value && _clips.TryGetValue(type, out var value)) { _audioSource.volume = Plugin.PingConfig.SoundVolume.Value; _audioSource.PlayOneShot(value); } } private static AudioClip GenerateTone(float frequency, float duration, ToneShape shape) { int num = 44100; int num2 = (int)((float)num * duration); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num; float num4 = 1f - (float)i / (float)num2; float num5 = ((shape == ToneShape.Sine) ? Mathf.Sin(MathF.PI * 2f * frequency * num3) : ((Mathf.Sin(MathF.PI * 2f * frequency * num3) >= 0f) ? 1f : (-1f))); array[i] = num5 * num4 * 0.5f; } AudioClip obj = AudioClip.Create($"ping_{shape}_{frequency}", num2, 1, num, false); obj.SetData(array, 0); return obj; } private static AudioClip GenerateDoubleTone(float frequency, float toneDuration, float gapDuration) { int num = 44100; int num2 = (int)((float)num * toneDuration); int num3 = (int)((float)num * gapDuration); int num4 = num2 * 2 + num3; float[] array = new float[num4]; for (int i = 0; i < num2; i++) { float num5 = (float)i / (float)num; float num6 = 1f - (float)i / (float)num2; array[i] = Mathf.Sin(MathF.PI * 2f * frequency * num5) * num6 * 0.5f; } int num7 = num2 + num3; for (int j = 0; j < num2; j++) { float num8 = (float)j / (float)num; float num9 = 1f - (float)j / (float)num2; array[num7 + j] = Mathf.Sin(MathF.PI * 2f * frequency * num8) * num9 * 0.5f; } AudioClip obj = AudioClip.Create("ping_double", num4, 1, num, false); obj.SetData(array, 0); return obj; } private static AudioClip GenerateRisingTone(float startFreq, float endFreq, float duration) { int num = 44100; int num2 = (int)((float)num * duration); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num; float num4 = (float)i / (float)num2; float num5 = Mathf.Lerp(startFreq, endFreq, num4); float num6 = 1f - num4 * 0.5f; array[i] = Mathf.Sin(MathF.PI * 2f * num5 * num3) * num6 * 0.5f; } AudioClip obj = AudioClip.Create("ping_rising", num2, 1, num, false); obj.SetData(array, 0); return obj; } } public class PingConfig { public ConfigEntry<KeyCode> PingKey { get; } public ConfigEntry<float> PingDuration { get; } public ConfigEntry<float> PingFadeDuration { get; } public ConfigEntry<float> MaxPingDistance { get; } public ConfigEntry<float> SoundVolume { get; } public ConfigEntry<bool> SoundEnabled { get; } public ConfigEntry<bool> ShowDistance { get; } public ConfigEntry<bool> ShowPlayerName { get; } public ConfigEntry<float> RadialWheelDelay { get; } public PingConfig(ConfigFile config) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown PingKey = config.Bind<KeyCode>("Input", "PingKey", (KeyCode)325, "Key to activate ping"); PingDuration = config.Bind<float>("Ping", "PingDuration", 4f, new ConfigDescription("How long the ping marker lasts (seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); PingFadeDuration = config.Bind<float>("Ping", "PingFadeDuration", 2f, new ConfigDescription("Fade out duration at end of ping (seconds)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); MaxPingDistance = config.Bind<float>("Ping", "MaxPingDistance", 100f, new ConfigDescription("Maximum raycast distance for placing pings", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f), Array.Empty<object>())); SoundVolume = config.Bind<float>("Audio", "SoundVolume", 0.7f, new ConfigDescription("Ping sound volume", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SoundEnabled = config.Bind<bool>("Audio", "SoundEnabled", true, "Enable or disable ping sounds"); ShowDistance = config.Bind<bool>("Display", "ShowDistance", true, "Show distance on ping marker"); ShowPlayerName = config.Bind<bool>("Display", "ShowPlayerName", true, "Show player name on ping marker"); RadialWheelDelay = config.Bind<float>("Input", "RadialWheelDelay", 0.3f, new ConfigDescription("Seconds to hold before radial wheel opens", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>())); } } public class PingManager : MonoBehaviour { private readonly Dictionary<string, PingMarker> _activePings = new Dictionary<string, PingMarker>(); public static PingManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); return; } Instance = this; SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { _activePings.Clear(); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } public void PlacePingLocal(Vector3 position, PingType type, GameObject hitObject = null, string customLabel = null) { //IL_0048: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)LevelGenerator.Instance == (Object)null) && LevelGenerator.Instance.Generated && !SemiFunc.MenuLevel()) { string localPlayerId = GetLocalPlayerId(); string localPlayerName = GetLocalPlayerName(); string hitObjectName = (((Object)(object)hitObject != (Object)null) ? ((Object)hitObject).name : ""); PlacePing(position, type, localPlayerId, localPlayerName, hitObject, customLabel); PingAudio.Play(type); PingNetSync.Instance?.BroadcastPing(position, type, localPlayerId, localPlayerName, hitObjectName); ArmPointing.StartPointing(position); } } public void PlacePing(Vector3 position, PingType type, string playerId, string playerName, GameObject hitObject = null, string customLabel = null) { //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_0041: 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) if (_activePings.TryGetValue(playerId, out var value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } GameObject val = new GameObject($"Ping_{type}_{playerName}"); val.transform.position = position; PingMarker pingMarker = val.AddComponent<PingMarker>(); pingMarker.Initialize(type, playerName, playerId, hitObject, customLabel); _activePings[playerId] = pingMarker; Plugin.Logger.LogInfo((object)$"Ping placed: {type} by {playerName} at {position}"); } public void OnMarkerDestroyed(string playerId, PingMarker marker) { if (playerId != null && _activePings.TryGetValue(playerId, out var value) && (Object)(object)value == (Object)(object)marker) { _activePings.Remove(playerId); } } public void RemovePing(string playerId) { if (_activePings.TryGetValue(playerId, out var value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } _activePings.Remove(playerId); } public GameObject FindObjectByName(Vector3 position, string objectName) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, 3f); Collider[] array2 = array; foreach (Collider val in array2) { if (!val.isTrigger && ((Object)((Component)val).gameObject).name == objectName) { return ((Component)val).gameObject; } } array2 = array; foreach (Collider val2 in array2) { if (val2.isTrigger) { continue; } Transform val3 = ((Component)val2).transform; for (int j = 0; j < 3; j++) { if (!((Object)(object)val3 != (Object)null)) { break; } if (((Object)((Component)val3).gameObject).name == objectName) { return ((Component)val2).gameObject; } val3 = val3.parent; } } return null; } private string GetLocalPlayerId() { if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.LocalPlayer.ActorNumber.ToString(); } return "local"; } private string GetLocalPlayerName() { if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.LocalPlayer.NickName; } return "Player"; } } public class PingMarker : MonoBehaviour { [CompilerGenerated] private sealed class <CapturePreviewAsync>d__29 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject target; public PingMarker <>4__this; private Transform <root>5__2; private GameObject <clone>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CapturePreviewAsync>d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <root>5__2 = null; <clone>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_01b2: 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_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Expected O, but got Unknown //IL_06b4: Expected O, but got Unknown //IL_06c0: Expected O, but got Unknown int num = <>1__state; PingMarker pingMarker = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; <root>5__2 = target.transform; MeshRenderer[] array = null; Transform val14 = target.transform; for (int k = 0; k < 8; k++) { if (!((Object)(object)val14 != (Object)null)) { break; } if ((Object)(object)((Component)val14).GetComponent("PhysGrabCart") != (Object)null) { <root>5__2 = val14; array = ((Component)<root>5__2).GetComponentsInChildren<MeshRenderer>(true); break; } if ((Object)(object)val14.parent != (Object)null && (Object)(object)((Component)val14.parent).GetComponent("LevelGenerator") != (Object)null) { break; } val14 = val14.parent; } if (array == null || array.Length == 0) { <root>5__2 = target.transform; for (int l = 0; l < 3; l++) { if (!((Object)(object)<root>5__2 != (Object)null)) { break; } array = ((Component)<root>5__2).GetComponentsInChildren<MeshRenderer>(true); if ((array != null && array.Length != 0) || ((Object)(object)<root>5__2.parent != (Object)null && (Object)(object)((Component)<root>5__2.parent).GetComponent("LevelGenerator") != (Object)null)) { break; } <root>5__2 = <root>5__2.parent; } } if (array == null || array.Length == 0) { return false; } <>2__current = null; <>1__state = 1; return true; } case 1: { <>1__state = -1; bool activeSelf = ((Component)<root>5__2).gameObject.activeSelf; ((Component)<root>5__2).gameObject.SetActive(false); Vector3 val13 = default(Vector3); ((Vector3)(ref val13))..ctor(0f, -5000f, 0f); <clone>5__3 = Object.Instantiate<GameObject>(((Component)<root>5__2).gameObject, val13, Quaternion.identity); ((Component)<root>5__2).gameObject.SetActive(activeSelf); <>2__current = null; <>1__state = 2; return true; } case 2: { <>1__state = -1; if ((Object)(object)<clone>5__3 == (Object)null) { return false; } MonoBehaviour[] componentsInChildren8 = <clone>5__3.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val12 in componentsInChildren8) { if ((Object)(object)val12 != (Object)null) { ((Behaviour)val12).enabled = false; } } <>2__current = null; <>1__state = 3; return true; } case 3: { <>1__state = -1; if ((Object)(object)<clone>5__3 == (Object)null) { return false; } Rigidbody[] componentsInChildren3 = <clone>5__3.GetComponentsInChildren<Rigidbody>(true); foreach (Rigidbody val7 in componentsInChildren3) { if ((Object)(object)val7 != (Object)null) { val7.isKinematic = true; } } Collider[] componentsInChildren4 = <clone>5__3.GetComponentsInChildren<Collider>(true); foreach (Collider val8 in componentsInChildren4) { if ((Object)(object)val8 != (Object)null) { val8.enabled = false; } } AudioSource[] componentsInChildren5 = <clone>5__3.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val9 in componentsInChildren5) { if ((Object)(object)val9 != (Object)null) { ((Behaviour)val9).enabled = false; } } Animator[] componentsInChildren6 = <clone>5__3.GetComponentsInChildren<Animator>(true); foreach (Animator val10 in componentsInChildren6) { if ((Object)(object)val10 != (Object)null) { ((Behaviour)val10).enabled = false; } } ParticleSystem[] componentsInChildren7 = <clone>5__3.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val11 in componentsInChildren7) { if ((Object)(object)val11 != (Object)null) { val11.Stop(); } } <>2__current = null; <>1__state = 4; return true; } case 4: { <>1__state = -1; if ((Object)(object)<clone>5__3 == (Object)null) { return false; } <clone>5__3.SetActive(true); int num2 = 31; Transform[] componentsInChildren = <clone>5__3.GetComponentsInChildren<Transform>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = num2; } Renderer[] componentsInChildren2 = <clone>5__3.GetComponentsInChildren<Renderer>(true); if (componentsInChildren2.Length == 0) { Object.Destroy((Object)(object)<clone>5__3); return false; } Bounds bounds = componentsInChildren2[0].bounds; for (int j = 1; j < componentsInChildren2.Length; j++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren2[j].bounds); } float num3 = Mathf.Max(new float[3] { ((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.y, ((Bounds)(ref bounds)).size.z }); if (num3 < 0.01f) { Object.Destroy((Object)(object)<clone>5__3); return false; } GameObject val = new GameObject("PingPreviewLight"); val.layer = num2; Light obj = val.AddComponent<Light>(); obj.type = (LightType)1; obj.color = Color.white; obj.intensity = 1.5f; obj.cullingMask = 1 << num2; val.transform.position = ((Bounds)(ref bounds)).center + new Vector3(1f, 2f, 1f) * num3; val.transform.LookAt(((Bounds)(ref bounds)).center); GameObject val2 = new GameObject("PingPreviewFillLight") { layer = num2 }; Light obj2 = val2.AddComponent<Light>(); obj2.type = (LightType)1; obj2.color = new Color(0.8f, 0.85f, 1f); obj2.intensity = 0.8f; obj2.cullingMask = 1 << num2; val2.transform.position = ((Bounds)(ref bounds)).center + new Vector3(-1f, 0.5f, -1f) * num3; val2.transform.LookAt(((Bounds)(ref bounds)).center); GameObject val3 = new GameObject("PingPreviewCam"); Camera val4 = val3.AddComponent<Camera>(); val4.clearFlags = (CameraClearFlags)2; val4.backgroundColor = new Color(0f, 0f, 0f, 0f); val4.orthographic = true; ((Behaviour)val4).enabled = false; val4.orthographicSize = num3 * 0.6f; val4.nearClipPlane = 0.01f; val4.farClipPlane = num3 * 10f; val4.cullingMask = 1 << num2; Vector3 val5 = new Vector3(1f, 0.8f, 1f); Vector3 val6 = ((Vector3)(ref val5)).normalized * num3 * 3f; val3.transform.position = ((Bounds)(ref bounds)).center + val6; val3.transform.LookAt(((Bounds)(ref bounds)).center); pingMarker._previewRT = new RenderTexture(64, 64, 16, (RenderTextureFormat)0); val4.targetTexture = pingMarker._previewRT; val4.Render(); val4.targetTexture = null; Object.Destroy((Object)val3); Object.Destroy((Object)(object)val); Object.Destroy((Object)val2); Object.Destroy((Object)(object)<clone>5__3); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Font _cachedFont; private static Texture2D _circleTexture; private static GUIStyle _labelStyle; private static GUIStyle _nameStyle; private static GUIStyle _distStyle; private string _playerId; private float _spawnTime; private float _duration; private float _fadeDuration; private RenderTexture _previewRT; private string _customLabel; private Transform _trackedObject; private Vector3 _trackingOffset; public PingType Type { get; private set; } public string PlayerName { get; private set; } public Vector3 WorldPosition { get; private set; } public void Initialize(PingType type, string playerName, string playerId, GameObject hitObject = null, string customLabel = null) { //IL_0024: 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) //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_005c: Unknown result type (might be due to invalid IL or missing references) Type = type; PlayerName = playerName; _playerId = playerId; _customLabel = customLabel; WorldPosition = ((Component)this).transform.position; if ((Object)(object)hitObject != (Object)null) { _trackedObject = hitObject.transform; _trackingOffset = WorldPosition - _trackedObject.position; } PingConfig pingConfig = Plugin.PingConfig; _duration = pingConfig.PingDuration.Value; _fadeDuration = Mathf.Min(pingConfig.PingFadeDuration.Value, _duration); _spawnTime = Time.time; if ((Object)(object)_cachedFont == (Object)null) { _cachedFont = Resources.GetBuiltinResource<Font>("Arial.ttf"); if ((Object)(object)_cachedFont == (Object)null) { _cachedFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); } } if ((Object)(object)_circleTexture == (Object)null) { _circleTexture = CreateCircleTexture(64); } InitStyles(); if ((Object)(object)hitObject != (Object)null) { ((MonoBehaviour)this).StartCoroutine(CapturePreviewAsync(hitObject)); } } private static void InitStyles() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0053: 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_0068: Expected O, but got Unknown //IL_0068: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_labelStyle == null) { GUIStyle val = new GUIStyle { alignment = (TextAnchor)4, fontSize = 14, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; _labelStyle = val; GUIStyle val2 = new GUIStyle { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; val2.normal.textColor = Color.white; _nameStyle = val2; GUIStyle val3 = new GUIStyle { alignment = (TextAnchor)4, fontSize = 12 }; val3.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 0.9f); _distStyle = val3; } } private void Update() { //IL_0035: 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_0040: Unknown result type (might be due to invalid IL or missing references) if (Time.time - _spawnTime >= _duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if ((Object)(object)_trackedObject != (Object)null) { WorldPosition = _trackedObject.position + _trackingOffset; } } private void OnGUI() { //IL_0086: 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_0090: 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_00ad: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_017f: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = Time.time - _spawnTime; float num2 = 1f; if (_fadeDuration > 0f) { float num3 = _duration - _fadeDuration; if (num >= num3) { num2 = Mathf.Lerp(1f, 0f, (num - num3) / _fadeDuration); } } float num4 = 1f; if (num < 0.2f) { num4 = Mathf.SmoothStep(0f, 1f, num / 0.2f); } Vector3 val = main.WorldToViewportPoint(WorldPosition); if (val.z <= 0f) { return; } float num5 = Vector3.Distance(((Component)main).transform.position, WorldPosition); if (!(num5 > 15f)) { float num6 = val.x * (float)Screen.width; float num7 = (1f - val.y) * (float)Screen.height; Color color = Type.GetColor(); color.a = num2; float num8 = 50f * num4; float num9 = num8 / 2f; GUI.color = color; GUI.DrawTexture(new Rect(num6 - num9, num7 - num9, num8, num8), (Texture)(object)_circleTexture); if ((Object)(object)_previewRT != (Object)null) { float num10 = num8 * 0.7f; float num11 = num10 / 2f; GUI.color = new Color(1f, 1f, 1f, num2); GUI.DrawTexture(new Rect(num6 - num11, num7 - num11, num10, num10), (Texture)(object)_previewRT); } GUI.color = new Color(1f, 1f, 1f, num2); _labelStyle.normal.textColor = new Color(1f, 1f, 1f, num2); GUI.Label(new Rect(num6 - 60f, num7 - num9 - 2f, 120f, 20f), Type.GetLabel(), _labelStyle); _nameStyle.normal.textColor = new Color(color.r, color.g, color.b, num2); GUI.Label(new Rect(num6 - 80f, num7 - num9 - 22f, 160f, 20f), PlayerName, _nameStyle); _distStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f, num2); GUI.Label(new Rect(num6 - 60f, num7 + num9 + 2f, 120f, 20f), $"{num5:F0}m", _distStyle); GUI.color = Color.white; } } [IteratorStateMachine(typeof(<CapturePreviewAsync>d__29))] private IEnumerator CapturePreviewAsync(GameObject target) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CapturePreviewAsync>d__29(0) { <>4__this = this, target = target }; } private void OnDestroy() { PingManager.Instance?.OnMarkerDestroyed(_playerId, this); if ((Object)(object)_previewRT != (Object)null) { _previewRT.Release(); Object.Destroy((Object)(object)_previewRT); } } private static Texture2D CreateCircleTexture(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_005a: 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) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[size * size]; float num = (float)size / 2f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num, num)); float num3 = Mathf.Clamp01((num - num2) * 2f); array[i * size + j] = (Color)((num2 <= num) ? new Color(1f, 1f, 1f, num3) : Color.clear); } } val.SetPixels(array); val.Apply(); return val; } } public enum PingType { GoHere, Danger, Enemy, Loot } public static class PingTypeExtensions { public static Color GetColor(this PingType type) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0064: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) return (Color)(type switch { PingType.GoHere => new Color(0.2f, 0.6f, 1f, 1f), PingType.Danger => new Color(1f, 0.2f, 0.2f, 1f), PingType.Enemy => new Color(1f, 0.6f, 0.1f, 1f), PingType.Loot => new Color(0.2f, 0.9f, 0.3f, 1f), _ => Color.white, }); } public static string GetLabel(this PingType type) { return type switch { PingType.GoHere => "Go Here", PingType.Danger => "Danger", PingType.Enemy => "Enemy", PingType.Loot => "Loot", _ => "Ping", }; } } } namespace REPOPingMod.Networking { public class PingNetSync : MonoBehaviour { private NetworkedEvent _pingEvent; private bool _initialized; private static readonly Dictionary<string, float> _lastPingTime = new Dictionary<string, float>(); public static PingNetSync Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); } else { Instance = this; } } public void Initialize() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown try { _pingEvent = new NetworkedEvent("PingSystem_PlacePing", (Action<EventData>)HandlePingEventData); _initialized = true; Plugin.Logger.LogInfo((object)"Ping network sync initialized via REPOLib NetworkedEvent"); } catch (Exception ex) { Plugin.Logger.LogWarning((object)("REPOLib NetworkedEvent init failed: " + ex.Message + " — local-only mode")); _initialized = false; } } public void BroadcastPing(Vector3 position, PingType type, string playerId, string playerName, string hitObjectName = "") { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) if (_initialized && SemiFunc.IsMultiplayer()) { string[] obj = new string[7] { position.x.ToString(CultureInfo.InvariantCulture), position.y.ToString(CultureInfo.InvariantCulture), position.z.ToString(CultureInfo.InvariantCulture), null, null, null, null }; int num = (int)type; obj[3] = num.ToString(); obj[4] = playerId; obj[5] = hitObjectName ?? ""; obj[6] = playerName; string text = string.Join("|", obj); RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions sendReliable = SendOptions.SendReliable; _pingEvent.RaiseEvent((object)text, val, sendReliable); } } private void HandlePingEventData(EventData eventData) { if (eventData.CustomData is string data) { HandlePingReceived(data); } } private void HandlePingReceived(string data) { //IL_0119: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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) try { string[] array = data.Split('|'); if (array.Length < 7) { return; } float num = float.Parse(array[0], CultureInfo.InvariantCulture); float num2 = float.Parse(array[1], CultureInfo.InvariantCulture); float num3 = float.Parse(array[2], CultureInfo.InvariantCulture); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, num2, num3); PingType pingType = (PingType)int.Parse(array[3]); if (!Enum.IsDefined(typeof(PingType), pingType)) { return; } string text = array[4]; string text2 = array[5]; string playerName = string.Join("|", array, 6, array.Length - 6); if (SemiFunc.IsMultiplayer() && text == PhotonNetwork.LocalPlayer.ActorNumber.ToString()) { return; } float time = Time.time; if (!_lastPingTime.TryGetValue(text, out var value) || !(time - value < 0.5f)) { _lastPingTime[text] = time; GameObject hitObject = null; if (!string.IsNullOrEmpty(text2)) { hitObject = PingManager.Instance?.FindObjectByName(val, text2); } PingManager.Instance?.PlacePing(val, pingType, text, playerName, hitObject); if (int.TryParse(text, out var result)) { ArmPointing.StartPointingForPlayer(result, val); } Camera main = Camera.main; if ((Object)(object)main != (Object)null && Vector3.Distance(((Component)main).transform.position, val) <= 20f) { PingAudio.Play(pingType); } } } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Failed to process received ping: " + ex.Message)); } } } } namespace REPOPingMod.Input { public class RadialWheel : MonoBehaviour { private bool _visible; private PingType? _hoveredType; private Vector2 _screenCenter; private float _wheelRadius = 120f; private float _sectionSize = 80f; private float _deadZone = 30f; private Texture2D _bgTexture; private Texture2D _hoverGoHereTexture; private Texture2D _hoverDangerTexture; private Texture2D _hoverEnemyTexture; private Texture2D _hoverLootTexture; private Texture2D _sectionBgTexture; private CursorLockMode _savedCursorLockState; private bool _savedCursorVisible; private readonly Dictionary<PingType, GUIStyle> _normalStyles = new Dictionary<PingType, GUIStyle>(); private GUIStyle _hoveredStyle; private void Awake() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) //IL_0054: 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_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_015b: Expected O, but got Unknown _bgTexture = MakeSolidTexture(new Color(0f, 0f, 0f, 0.6f)); _sectionBgTexture = MakeSolidTexture(new Color(0.2f, 0.2f, 0.2f, 0.7f)); _hoverGoHereTexture = MakeSolidTexture(WithAlpha(PingType.GoHere.GetColor(), 0.8f)); _hoverDangerTexture = MakeSolidTexture(WithAlpha(PingType.Danger.GetColor(), 0.8f)); _hoverEnemyTexture = MakeSolidTexture(WithAlpha(PingType.Enemy.GetColor(), 0.8f)); _hoverLootTexture = MakeSolidTexture(WithAlpha(PingType.Loot.GetColor(), 0.8f)); foreach (PingType value in Enum.GetValues(typeof(PingType))) { Dictionary<PingType, GUIStyle> normalStyles = _normalStyles; GUIStyle val = new GUIStyle { alignment = (TextAnchor)4, fontSize = 14, fontStyle = (FontStyle)0 }; val.normal.textColor = value.GetColor(); normalStyles[value] = val; } GUIStyle val2 = new GUIStyle { alignment = (TextAnchor)4, fontSize = 16, fontStyle = (FontStyle)1 }; val2.normal.textColor = Color.white; _hoveredStyle = val2; } public void Show() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) _visible = true; _hoveredType = null; _screenCenter = new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f); _savedCursorLockState = Cursor.lockState; _savedCursorVisible = Cursor.visible; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } public void Hide() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) _visible = false; _hoveredType = null; Cursor.lockState = _savedCursorLockState; Cursor.visible = _savedCursorVisible; } public PingType? GetSelectedType() { return _hoveredType; } private void Update() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0023: Unknown result type (might be due to invalid IL or missing references) //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_004a: 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) if (!_visible) { return; } Vector2 val = new Vector2(Input.mousePosition.x, Input.mousePosition.y) - _screenCenter; if (((Vector2)(ref val)).magnitude < _deadZone) { _hoveredType = null; return; } float num = Mathf.Atan2(val.y, val.x) * 57.29578f; if (num < 0f) { num += 360f; } if (num >= 45f && num < 135f) { _hoveredType = PingType.GoHere; } else if (num >= 135f && num < 225f) { _hoveredType = PingType.Loot; } else if (num >= 225f && num < 315f) { _hoveredType = PingType.Enemy; } else { _hoveredType = PingType.Danger; } } private void OnGUI() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (_visible) { float num = _wheelRadius + 40f; float num2 = (float)Screen.height - _screenCenter.y; GUI.DrawTexture(new Rect(_screenCenter.x - num, num2 - num, num * 2f, num * 2f), (Texture)(object)_bgTexture); DrawSection(PingType.GoHere, new Vector2(0f, _wheelRadius), _hoverGoHereTexture); DrawSection(PingType.Danger, new Vector2(_wheelRadius, 0f), _hoverDangerTexture); DrawSection(PingType.Enemy, new Vector2(0f, 0f - _wheelRadius), _hoverEnemyTexture); DrawSection(PingType.Loot, new Vector2(0f - _wheelRadius, 0f), _hoverLootTexture); } } private void DrawSection(PingType type, Vector2 offset, Texture2D hoverTexture) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) bool flag = _hoveredType == type; float num = (flag ? (_sectionSize * 1.2f) : _sectionSize); float num2 = _screenCenter.x + offset.x - num / 2f; float num3 = (float)Screen.height - _screenCenter.y - offset.y - num / 2f; Rect val = new Rect(num2, num3, num, num); GUI.DrawTexture(val, (Texture)(object)(flag ? hoverTexture : _sectionBgTexture)); GUIStyle val2 = (flag ? _hoveredStyle : _normalStyles[type]); GUI.Label(val, type.GetLabel(), val2); } private static Texture2D MakeSolidTexture(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } private static Color WithAlpha(Color c, float a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r, c.g, c.b, a); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }