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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PlayerLocator")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PlayerLocator")]
[assembly: AssemblyTitle("PlayerLocator")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 modtolocatefriends
{
[BepInPlugin("bayturtleking.bigwalk.playerlocate", "Player Locator", "1.0.0")]
public class Plugin : BasePlugin
{
public const string ourrguidd = "bayturtleking.bigwalk.playerlocate";
public static ManualLogSource Log;
public static ConfigEntry<KeyCode> keythatturnson;
public static ConfigEntry<string> colorforcircle;
public static ConfigEntry<float> bignessofcircle;
public static ConfigEntry<bool> smallerwithdistance;
public static ConfigEntry<bool> shownames;
public override void Load()
{
//IL_00be: 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_00c9: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
keythatturnson = ((BasePlugin)this).Config.Bind<KeyCode>("General", "keytotoggle", (KeyCode)107, "key to toggle the mod");
colorforcircle = ((BasePlugin)this).Config.Bind<string>("Appearance", "color-of-circle", "#33FF33E6", "color of the circle that shows where the player is (hex, RRGGBB or RRGGBBAA)");
bignessofcircle = ((BasePlugin)this).Config.Bind<float>("Appearance", "how-big-is-circle", 100f, "diameter of the circle/player indicator (its in pixels)");
smallerwithdistance = ((BasePlugin)this).Config.Bind<bool>("Appearance", "size-changes-with-distance", false, "shrink the circle if the player moves farther away");
shownames = ((BasePlugin)this).Config.Bind<bool>("Appearance", "showplayernames", true, "show names of the players");
ClassInjector.RegisterTypeInIl2Cpp<overlaything>();
GameObject val = new GameObject("modtolocatefriends");
Object.DontDestroyOnLoad((Object)val);
val.AddComponent<overlaything>();
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(20, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("player locate loaded");
}
log.LogInfo(val2);
}
}
public class overlaything : MonoBehaviour
{
private bool doitshow;
private Texture2D textureofcirlce;
private GUIStyle designoflabel;
public overlaything(IntPtr ptr)
: base(ptr)
{
}
private void Awake()
{
doitshow = false;
textureofcirlce = makedacircle(64);
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(Plugin.keythatturnson.Value))
{
doitshow = !doitshow;
}
}
private void OnGUI()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if (!doitshow)
{
return;
}
try
{
drawthesillycircles();
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("player locate had an error:( ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
doitshow = false;
}
}
private void drawthesillycircles()
{
List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
if (allPlayerCharacters == null)
{
return;
}
PlayerCharacter val = null;
for (int i = 0; i < allPlayerCharacters.Count; i++)
{
if ((Object)(object)allPlayerCharacters[i] != (Object)null && ((NetworkBehaviour)allPlayerCharacters[i]).isLocalPlayer)
{
val = allPlayerCharacters[i];
break;
}
}
if ((Object)(object)val == (Object)null)
{
return;
}
Camera val2 = docamerastuff(val);
if ((Object)(object)val2 == (Object)null)
{
return;
}
for (int j = 0; j < allPlayerCharacters.Count; j++)
{
PlayerCharacter val3 = allPlayerCharacters[j];
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)val))
{
showplr(val3, val2);
}
}
}
private void showplr(PlayerCharacter target, Camera cameraaa)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_0024: 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_002a: 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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_00ba: 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_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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)
Vector3 position = (((Object)(object)target.cameraTransform != (Object)null) ? target.cameraTransform : ((Component)target).transform).position;
Vector3 val = cameraaa.WorldToViewportPoint(position);
bool num = val.z > 0f;
bool flag = val.x >= 0f && val.x <= 1f && val.y >= 0f && val.y <= 1f;
if (num && flag)
{
Vector3 val2 = cameraaa.WorldToScreenPoint(position);
float x = val2.x;
float num2 = (float)Screen.height - val2.y;
float num3 = Plugin.bignessofcircle.Value;
if (Plugin.smallerwithdistance.Value)
{
float num4 = Vector3.Distance(((Component)cameraaa).transform.position, position);
float num5 = Mathf.Clamp(20f / Mathf.Max(num4, 1f), 0.5f, 1.5f);
num3 *= num5;
}
Color color = GUI.color;
Color green = default(Color);
if (!ColorUtility.TryParseHtmlString(Plugin.colorforcircle.Value, ref green))
{
green = Color.green;
}
GUI.color = green;
GUI.DrawTexture(new Rect(x - num3 / 2f, num2 - num3 / 2f, num3, num3), (Texture)(object)textureofcirlce);
GUI.color = color;
if (Plugin.shownames.Value)
{
makeitrightstyle();
string text = getplayerdisplayname(target);
GUI.Label(new Rect(x - 80f, num2 + num3 / 2f + 2f, 160f, 20f), text, designoflabel);
}
}
}
private string getplayerdisplayname(PlayerCharacter target)
{
if ((Object)(object)target.playerNetworking == (Object)null)
{
return "Player";
}
if (!string.IsNullOrWhiteSpace(target.playerNetworking.moderationNameSanitized))
{
return target.playerNetworking.moderationNameSanitized;
}
if (!string.IsNullOrWhiteSpace(target.playerNetworking.moderationName))
{
return target.playerNetworking.moderationName;
}
if (!string.IsNullOrWhiteSpace(target.playerNetworking.username))
{
return target.playerNetworking.username;
}
return "Player";
}
private Camera docamerastuff(PlayerCharacter theactualplr)
{
if ((Object)(object)Camera.main != (Object)null)
{
return Camera.main;
}
Il2CppArrayBase<Camera> componentsInChildren = ((Component)theactualplr).GetComponentsInChildren<Camera>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if ((Object)(object)componentsInChildren[i] != (Object)null && ((Behaviour)componentsInChildren[i]).enabled)
{
return componentsInChildren[i];
}
}
return null;
}
private void makeitrightstyle()
{
//IL_0014: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (designoflabel == null)
{
designoflabel = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)1,
fontStyle = (FontStyle)1
};
designoflabel.normal.textColor = Color.white;
}
}
private static Texture2D makedacircle(int howwide)
{
//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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(howwide, howwide, (TextureFormat)4, false);
float num = (float)howwide / 2f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(num, num);
for (int i = 0; i < howwide; i++)
{
for (int j = 0; j < howwide; j++)
{
float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val2);
float num3 = Mathf.Clamp01((num - num2) / 2f);
val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
}
}
val.Apply();
return val;
}
}
}