170 lines
5.7 KiB
C#
170 lines
5.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using EFT;
|
|
using stupid.solutions.Data;
|
|
using stupid.solutions.stupid.solutions.Data;
|
|
using stupid.solutions.Utils;
|
|
using UnityEngine;
|
|
|
|
namespace stupid.solutions.Features.ESP;
|
|
|
|
internal class Radar : MonoBehaviour
|
|
{
|
|
private Dictionary<bool, string> SettingList = new Dictionary<bool, string>
|
|
{
|
|
{
|
|
Settings.Godmode,
|
|
"Godmode"
|
|
},
|
|
{
|
|
Settings.Flyhack,
|
|
"Flyhack"
|
|
},
|
|
{
|
|
Settings.Speedhack,
|
|
"Speedhack"
|
|
},
|
|
{
|
|
Settings.MagicBullet,
|
|
"Magic Bullet"
|
|
}
|
|
};
|
|
|
|
private void Update()
|
|
{
|
|
try
|
|
{
|
|
if (Main.GameWorld != null)
|
|
{
|
|
_ = Settings.DrawRadar;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void OnGUI()
|
|
{
|
|
try
|
|
{
|
|
if (!Settings.DrawRadar || !Menu2.showmenu)
|
|
{
|
|
return;
|
|
}
|
|
Render.BoxRect(new Rect(Settings.RadarX + Settings.RadarSize / 2f - 3f, Settings.RadarY + Settings.RadarSize / 2f - 3f, 6f, 6f), Color.white);
|
|
Render.DrawCornerBox(new Vector2(Settings.RadarX + Settings.RadarSize / 2f, Settings.RadarY), Settings.RadarSize, Settings.RadarSize, Color.white, outline: true);
|
|
Render.DrawRadarBackground(new Rect(Settings.RadarX, Settings.RadarY, Settings.RadarSize, Settings.RadarSize));
|
|
int? num = Main.GameWorld.RegisteredPlayers.Count() - 1;
|
|
string[] obj = new string[5] { " Entity Count : ", null, null, null, null };
|
|
int? num2 = num;
|
|
obj[1] = num2.ToString();
|
|
obj[2] = " Radar Range : ";
|
|
obj[3] = ((int)Settings.DrawPlayersRadarDistance).ToString();
|
|
obj[4] = "m ";
|
|
string label = string.Concat(obj);
|
|
Vector2 position = new Vector2(Settings.RadarX - 5f, Settings.RadarY - 20f);
|
|
if (Main.GameWorld != null)
|
|
{
|
|
Render.DrawTextRadar(position, label, Color.white, centered: false);
|
|
}
|
|
if (Main.OnlineGamePlayers.Count > 0)
|
|
{
|
|
foreach (OnlineGamePlayer onlineGamePlayer in Main.OnlineGamePlayers)
|
|
{
|
|
if (onlineGamePlayer.Distance < Settings.DrawPlayersRadarDistance)
|
|
{
|
|
float y = Main.LocalPlayer.Transform.position.x - onlineGamePlayer.Player.Transform.position.x;
|
|
float x = Main.LocalPlayer.Transform.position.z - onlineGamePlayer.Player.Transform.position.z;
|
|
float num3 = Mathf.Atan2(y, x) * 57.29578f - 270f - Main.LocalPlayer.Transform.eulerAngles.y;
|
|
float num4 = onlineGamePlayer.Distance * Mathf.Cos(num3 * ((float)Math.PI / 180f));
|
|
float num5 = onlineGamePlayer.Distance * Mathf.Sin(num3 * ((float)Math.PI / 180f));
|
|
num4 = num4 * (Settings.RadarSize / Settings.RadarRange) / 2f;
|
|
num5 = num5 * (Settings.RadarSize / Settings.RadarRange) / 2f;
|
|
_ = Color.white;
|
|
if (onlineGamePlayer.Distance <= Settings.RadarRange)
|
|
{
|
|
Color item = GameUtils.GetPlayerTextDetailsO(onlineGamePlayer).playerColor;
|
|
float num6 = Settings.RadarX + Settings.RadarSize / 2f + num4;
|
|
float num7 = Settings.RadarY + Settings.RadarSize / 2f + num5;
|
|
Render.BoxRect(new Rect(num6 - 3f, num7 - 3f, 6f, 6f), item);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
foreach (GamePlayer gamePlayer in Main.GamePlayers)
|
|
{
|
|
if (gamePlayer.Distance < Settings.DrawPlayersRadarDistance)
|
|
{
|
|
float y2 = Main.LocalPlayer.Transform.position.x - gamePlayer.Player.Transform.position.x;
|
|
float x2 = Main.LocalPlayer.Transform.position.z - gamePlayer.Player.Transform.position.z;
|
|
float num8 = Mathf.Atan2(y2, x2) * 57.29578f - 270f - Main.LocalPlayer.Transform.eulerAngles.y;
|
|
float num9 = gamePlayer.Distance * Mathf.Cos(num8 * ((float)Math.PI / 180f));
|
|
float num10 = gamePlayer.Distance * Mathf.Sin(num8 * ((float)Math.PI / 180f));
|
|
num9 = num9 * (Settings.RadarSize / Settings.RadarRange) / 2f;
|
|
num10 = num10 * (Settings.RadarSize / Settings.RadarRange) / 2f;
|
|
Color white = Color.white;
|
|
WildSpawnType role = gamePlayer.Player.Profile.Info.Settings.Role;
|
|
if (gamePlayer.Distance <= Settings.RadarRange)
|
|
{
|
|
white = GameUtils.GetPlayerTextDetails(gamePlayer, role).playerColor;
|
|
float num11 = Settings.RadarX + Settings.RadarSize / 2f + num9;
|
|
float num12 = Settings.RadarY + Settings.RadarSize / 2f + num10;
|
|
Render.BoxRect(new Rect(num11 - 3f, num12 - 3f, 6f, 6f), white);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void DrawActiveFeatures(bool setting, string settingName, ref int currentOffsetY)
|
|
{
|
|
string label = settingName + ": " + (setting ? "On" : "Off");
|
|
Render.DrawTextRadar(new Vector2(Settings.RadarX - 5f - (float)currentOffsetY, Settings.RadarY - 20f), label, Color.white, centered: false);
|
|
currentOffsetY += 20;
|
|
}
|
|
|
|
private void DrawFeatures()
|
|
{
|
|
int currentOffsetY = 0;
|
|
foreach (KeyValuePair<bool, string> setting in SettingList)
|
|
{
|
|
DrawActiveFeatures(setting.Key, setting.Value, ref currentOffsetY);
|
|
}
|
|
}
|
|
|
|
private void ShowAim(GamePlayer gamePlayer, float radarX, float radarY)
|
|
{
|
|
Vector3 vector = RayCast.BarrelRayCast(gamePlayer.Player);
|
|
if (vector != Vector3.zero)
|
|
{
|
|
Vector3 position = gamePlayer.Player.Fireport.position;
|
|
Vector3 normalized = (vector - position).normalized;
|
|
float num = normalized.x * 15f;
|
|
float num2 = normalized.y * 15f;
|
|
float x = radarX + num;
|
|
float y = radarY + num2;
|
|
Render.DrawLine(new Vector3(radarX, radarY, 0f), new Vector3(x, y, 0f), 1f, Color.red);
|
|
}
|
|
}
|
|
|
|
private void ShowAimO(OnlineGamePlayer gamePlayer, float radarX, float radarY)
|
|
{
|
|
Vector3 vector = RayCast.BarrelRayCastO(gamePlayer);
|
|
if (vector != Vector3.zero)
|
|
{
|
|
Vector3 position = gamePlayer.Player.ObservedPlayerController.HandsController.CurrentFireport.position;
|
|
Vector3 normalized = (vector - position).normalized;
|
|
float num = (0f - normalized.x) * 15f;
|
|
float num2 = normalized.y * 15f;
|
|
float x = radarX + num;
|
|
float y = radarY + num2;
|
|
Render.DrawLine(new Vector3(radarX, radarY, 0f), new Vector3(x, y, 0f), 1f, Color.red);
|
|
}
|
|
}
|
|
}
|