the initial commit to the repo.

This commit is contained in:
NukedBart 2025-10-25 01:27:14 +08:00
parent 025c032b8c
commit 1b757591b9
264 changed files with 21882 additions and 0 deletions

View file

@ -0,0 +1,33 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using UnityEngine;
namespace stupid.solutions.Utils;
public static class AllocConsoleHandler
{
[DllImport("Kernel32.dll")]
private static extern bool AllocConsole();
[DllImport("msvcrt.dll")]
public static extern int system(string cmd);
public static void Open()
{
AllocConsole();
Console.SetOut(new StreamWriter(Console.OpenStandardOutput())
{
AutoFlush = true
});
Application.logMessageReceivedThreaded += delegate(string condition, string stackTrace, LogType type)
{
Console.WriteLine(condition + " " + stackTrace);
};
}
public static void ClearAllocConsole()
{
system("CLS");
}
}

View file

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using EFT.Interactive;
using EFT.InventoryLogic;
using stupid.solutions.stupid.solutions.Data;
using UnityEngine;
namespace stupid.solutions.Utils;
internal class GameCorpse
{
private Vector3 _screenPosition;
public Corpse Corpse { get; }
public Vector3 ScreenPosition => _screenPosition;
public bool IsOnScreen { get; private set; }
public float Distance { get; private set; }
public List<ContainerItem> LootItems { get; private set; }
public bool ItemInit { get; private set; }
public string FormattedDistance => $"{Math.Round(Distance)}m";
public int? totalprice { get; private set; }
public GameCorpse(Corpse corpse)
{
Corpse = corpse ?? throw new ArgumentNullException("corpse");
_screenPosition = default(Vector3);
Distance = 0f;
LootItems = new List<ContainerItem>();
ItemInit = false;
totalprice = null;
}
public void RecalculateDynamics()
{
if (IsBodyValid(Corpse))
{
_screenPosition = GameUtils.WorldPointToScreenPoint(Corpse.transform.position);
IsOnScreen = GameUtils.IsScreenPointVisible(_screenPosition);
Distance = Vector3.Distance(Main.MainCamera.transform.position, Corpse.transform.position);
}
}
public static bool IsBodyValid(Corpse corpse)
{
return corpse != null;
}
public void RefreshItems()
{
LootItems.Clear();
foreach (Item allItem in Corpse.ItemOwner.RootItem.GetAllItems())
{
if (allItem == null)
{
continue;
}
ContainerItem lootItem = new ContainerItem(allItem);
if (lootItem.Item.StackObjectsCount > lootItem.Item.StackMaxSize || 100 < lootItem.Item.StackObjectsCount || allItem.LocalizedName().ToString() == "Default Inventory")
{
continue;
}
lootItem.RecalculateDynamics();
lootItem.SetItemCat();
ContainerItem containerItem = LootItems.FirstOrDefault((ContainerItem i) => i.ItemID == lootItem.ItemID);
if (containerItem != null)
{
containerItem.Count += lootItem.Count + (lootItem.Item.StackObjectsCount - 1);
if (containerItem.Count > 1500)
{
containerItem.Count -= 1500;
}
if (containerItem.Count > 500)
{
containerItem.Count -= 500;
}
}
else
{
if (lootItem.Item.StackObjectsCount > 1)
{
lootItem.Count += lootItem.Item.StackObjectsCount - 1;
}
LootItems.Add(lootItem);
}
}
foreach (ContainerItem lootItem2 in LootItems)
{
lootItem2.CalculateItemPrice();
}
totalprice = LootItems.Sum((ContainerItem item) => item.itemprice);
ItemInit = true;
}
}

View file

@ -0,0 +1,869 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Diz.Skinning;
using EFT;
using EFT.CameraControl;
using EFT.Interactive;
using EFT.InventoryLogic;
using EFT.NextObservedPlayer;
using EFT.UI;
using stupid.solutions.Data;
using stupid.solutions.stupid.solutions.Data;
using UnityEngine;
namespace stupid.solutions.Utils;
public static class GameUtils
{
public class Tracer
{
public Vector3 StartPos;
public Vector3 EndPos;
public float Time;
}
public class HitMarker
{
public Vector3 HitPos;
public float Time;
}
public static Camera AimCamera;
public static Material DrawMaterial;
public static Vector2 ScreenCenter = new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f);
public static void InitMaterial()
{
try
{
DrawMaterial = new Material(Shader.Find("Hidden/Internal-Colored"))
{
hideFlags = HideFlags.HideAndDontSave
};
if (DrawMaterial.shader == null)
{
throw new Exception("Shader 'Hidden/Internal-Colored' not found or unavailable.");
}
ConsoleScreen.Log("Found Tracer Material Shader");
DrawMaterial.SetInt("_SrcBlend", 5);
DrawMaterial.SetInt("_DstBlend", 10);
DrawMaterial.SetInt("_Cull", 0);
DrawMaterial.SetInt("_ZWrite", 0);
ConsoleScreen.Log("Set Tracer Material Parameters");
}
catch (Exception ex)
{
ConsoleScreen.LogError("[TracerESP] Failed to initialize material: " + ex.Message);
}
}
public static float Map(float value, float sourceFrom, float sourceTo, float destinationFrom, float destinationTo)
{
return (value - sourceFrom) / (sourceTo - sourceFrom) * (destinationTo - destinationFrom) + destinationFrom;
}
public static bool IsPlayerValid(Player player)
{
if (player != null && player.Transform != null && player.PlayerBones != null)
{
return player.PlayerBones.transform != null;
}
return false;
}
public static bool IsOPlayerValid(ObservedPlayerView player)
{
if (player != null && player.Transform != null && player.PlayerBones != null)
{
return player.PlayerBones.transform != null;
}
return false;
}
public static bool IsExfiltrationPointValid(ExfiltrationPoint lootItem)
{
return lootItem != null;
}
public static bool IsTransitPointValid(TransitPoint lootItem)
{
return lootItem != null;
}
public static bool IsLootItemValid(LootItem lootItem)
{
if (lootItem != null && lootItem.Item != null)
{
return lootItem.Item.Template != null;
}
return false;
}
public static int? GetItemPrice(GameLootItem item)
{
string itemid = item.LootItem.TemplateId;
List<ItemData> source = Menu2.pullItemIDs.itemList.Where((ItemData itemData2) => itemData2.Id == itemid).ToList();
if (source.Any())
{
ItemData itemData = source.First();
if (itemData.avg24hPrice > 0)
{
return itemData.avg24hPrice;
}
if (itemData.BasePrice > 0)
{
return itemData.BasePrice;
}
}
return 0;
}
public static int? GetItemPriceBYID(string itemid)
{
List<ItemData> source = Menu2.pullItemIDs.itemList.Where((ItemData itemData2) => itemData2.Id == itemid).ToList();
if (source.Any())
{
ItemData itemData = source.First();
if (itemData.avg24hPrice > 0)
{
return itemData.avg24hPrice;
}
if (itemData.BasePrice > 0)
{
return itemData.BasePrice;
}
}
return 0;
}
public static bool ShouldDisplayItem(ContainerItem lootItem)
{
if (lootItem == null || lootItem.Itemcat == ItemCategories.Uninitialized)
{
return false;
}
if (lootItem.Itemcat == ItemCategories.Superrare && Settings.superrare)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Kappa && Settings.kappa)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Quest && Settings.quest)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Wishlist && Settings.drawwishlistitem)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Stim && Settings.stim)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Hideout && Settings.drawhideoutitems)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Searched && Settings.searchItem)
{
return true;
}
if (lootItem.Itemcat == ItemCategories.Common && Settings.common)
{
return false;
}
if (lootItem.itemprice > Settings.ESPPRICEfiltervalue && Settings.ESPFilterbyprice)
{
return true;
}
return false;
}
public static Color GetItemColor(ItemCategories Itemcat)
{
if (Settings.searchItem && Itemcat == ItemCategories.Searched)
{
return Settings.SearchedColor;
}
if (Settings.kappa && Itemcat == ItemCategories.Kappa)
{
return Settings.KappaColor;
}
if (Settings.superrare && Itemcat == ItemCategories.Superrare)
{
return Settings.SuperrareColor;
}
if (Settings.stim && Itemcat == ItemCategories.Stim)
{
return Settings.StimItemColor;
}
if (Settings.quest && Itemcat == ItemCategories.Quest)
{
return Settings.QuestItemColor;
}
if (Settings.drawwishlistitem && Itemcat == ItemCategories.Wishlist)
{
return Settings.WishlistColor;
}
if (Settings.drawhideoutitems && Itemcat == ItemCategories.Hideout)
{
return Settings.HideoutColor;
}
if (Settings.common && Itemcat == ItemCategories.Common)
{
return Settings.CommonItemColor;
}
return Color.white;
}
public static (string playerText, string shorttext, Color playerColor) GetPlayerTextDetails(GamePlayer gamePlayer, WildSpawnType role)
{
string text = " ";
string text2 = " ";
Color white = Color.white;
if (gamePlayer.Player.Profile.Info.Settings.IsBoss())
{
if (Main.IsBossByName(gamePlayer.Player.Profile.Info.Nickname.Localized()))
{
text2 = " Boss ";
text = Main.TranslateBossName(gamePlayer.Player.Profile.Info.Nickname.Localized()) + " [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BossandGuardColor;
}
else
{
switch (role)
{
case WildSpawnType.shooterBTR:
text2 = " BTR ";
text = " BTR [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BTRColor;
break;
case WildSpawnType.peacefullZryachiyEvent:
case WildSpawnType.ravangeZryachiyEvent:
text2 = " Boss ";
text = " Event Zryachi [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BossandGuardColor;
break;
case WildSpawnType.bossTagillaAgro:
text2 = " Boss ";
text = " Shadow of Tagilla [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BossandGuardColor;
break;
case WildSpawnType.bossKillaAgro:
text2 = " Boss ";
text = " Shadow of Killa [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BossandGuardColor;
break;
case WildSpawnType.tagillaHelperAgro:
text2 = " Guard ";
text = " Guard [" + gamePlayer.FormattedDistance + "] ";
white = Settings.GuardColor;
break;
case WildSpawnType.infectedTagilla:
text2 = " Boss ";
text = " Zombie Tagilla [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BossandGuardColor;
break;
case WildSpawnType.exUsec:
text2 = " Rogue ";
text = " Rogue [" + gamePlayer.FormattedDistance + "] ";
white = Settings.RogueColor;
break;
case WildSpawnType.pmcUSEC:
text2 = " PMC ";
text = $" [USEC] {gamePlayer.Player.Profile.Info.Nickname} [{gamePlayer.Player.Profile.Info.Level}] [{gamePlayer.FormattedDistance}] ";
white = Settings.USECColor;
break;
case WildSpawnType.pmcBEAR:
text2 = " PMC ";
text = $" [BEAR] {gamePlayer.Player.Profile.Info.Nickname} [{gamePlayer.Player.Profile.Info.Level}] [{gamePlayer.FormattedDistance}] ";
white = Settings.BEARColor;
break;
case WildSpawnType.followerZryachiy:
case WildSpawnType.bossBoarSniper:
text2 = " Guard ";
text = " Guard [" + gamePlayer.FormattedDistance + "] ";
white = Settings.GuardColor;
break;
case WildSpawnType.pmcBot:
text2 = " Raider ";
text = " Raider [" + gamePlayer.FormattedDistance + "] ";
white = Settings.RaiderColor;
break;
case WildSpawnType.sectantPriest:
case WildSpawnType.sectactPriestEvent:
case WildSpawnType.sectantPredvestnik:
case WildSpawnType.sectantPrizrak:
case WildSpawnType.sectantOni:
text2 = " Cultist ";
text = " Cultist [" + gamePlayer.FormattedDistance + "] ";
white = Settings.CultistColor;
break;
case WildSpawnType.marksman:
case WildSpawnType.assault:
case WildSpawnType.assaultGroup:
text2 = " Scav ";
text = " Scav [" + gamePlayer.FormattedDistance + "] ";
white = Settings.ScavColor;
break;
case WildSpawnType.infectedAssault:
case WildSpawnType.infectedPmc:
case WildSpawnType.infectedCivil:
case WildSpawnType.infectedLaborant:
text2 = " [Z] ";
text = " Zombie [" + gamePlayer.FormattedDistance + "] ";
white = Settings.ZombieColor;
break;
default:
{
text2 = " U-Boss ";
string text3 = role.ToString();
text = " Unknown Boss Entity Name : " + gamePlayer.Player.Profile.Info.Nickname + " [" + gamePlayer.FormattedDistance + "] Role : " + text3 + " ";
white = Color.red;
break;
}
}
}
}
else
{
switch (role)
{
case WildSpawnType.sectantWarrior:
text2 = " Cultist ";
text = " Cultist[" + gamePlayer.FormattedDistance + "] ";
white = Settings.CultistColor;
break;
case WildSpawnType.marksman:
text2 = " Sniper ";
text = " Scav Sniper [" + gamePlayer.FormattedDistance + "] ";
white = Settings.ScavColor;
break;
case WildSpawnType.shooterBTR:
text2 = " BTR ";
text = " BTR [" + gamePlayer.FormattedDistance + "] ";
white = Settings.BTRColor;
break;
case WildSpawnType.infectedAssault:
case WildSpawnType.infectedPmc:
case WildSpawnType.infectedCivil:
case WildSpawnType.infectedLaborant:
text2 = " [Z] ";
text = " Zombie [" + gamePlayer.FormattedDistance + "] ";
white = Settings.ZombieColor;
break;
case WildSpawnType.arenaFighter:
text2 = " Fighter ";
text = " Arena Fighter [" + gamePlayer.FormattedDistance + "] ";
white = Settings.RaiderColor;
break;
default:
if (role != WildSpawnType.marksman && role != WildSpawnType.assault)
{
text2 = " Guard ";
text = " Guard [" + gamePlayer.FormattedDistance + "] ";
white = Settings.GuardColor;
}
else
{
text2 = " Scav ";
text = " Scav [" + gamePlayer.FormattedDistance + "] ";
white = Settings.ScavColor;
}
break;
}
}
return (playerText: text, shorttext: text2, playerColor: white);
}
public static (string playerText, string shorttext, Color playerColor) GetPlayerTextDetailsO(OnlineGamePlayer gamePlayer)
{
string item = " ";
string item2 = " ";
Color item3 = Color.white;
OnlineGamePlayer.PlayerType role = gamePlayer.role;
if (role == OnlineGamePlayer.PlayerType.Boss)
{
item2 = " Boss ";
item = Main.TranslateBossNameBYWST(gamePlayer.wst) + " [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.BossandGuardColor;
}
else if (role == OnlineGamePlayer.PlayerType.Guard)
{
item2 = " Guard ";
item = " Guard [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.GuardColor;
}
else if (role == OnlineGamePlayer.PlayerType.BTR)
{
item2 = " BTR ";
item = " BTR [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.BTRColor;
}
else if (role == OnlineGamePlayer.PlayerType.Cultist)
{
item2 = " Cultist ";
item = " Cultist [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.CultistColor;
}
else if (role == OnlineGamePlayer.PlayerType.Raider)
{
item2 = " Raider ";
item = " Raider [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.RaiderColor;
}
else if (role == OnlineGamePlayer.PlayerType.Rogue)
{
item2 = " Rogue ";
item = " Rogue [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.RogueColor;
}
else if (role == OnlineGamePlayer.PlayerType.Zombie)
{
item2 = " [Z] ";
item = " Zombie [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.ZombieColor;
}
else if (role == OnlineGamePlayer.PlayerType.Scav)
{
item2 = " Scav ";
item = " Scav [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.ScavColor;
}
else if (role == OnlineGamePlayer.PlayerType.Teammate && !gamePlayer.IsAI)
{
item2 = " [Teammate] ";
item = $" [Teammate] {gamePlayer.NickName} [KD : {gamePlayer.kd:f1}] [{gamePlayer.FormattedDistance}] ";
item3 = Settings.teammatecolor;
}
else if (role == OnlineGamePlayer.PlayerType.USEC && !gamePlayer.IsAI)
{
item2 = " USEC ";
item = $" [LVL {gamePlayer.level} USEC] {gamePlayer.NickName} [KD : {gamePlayer.kd:f1}] [{gamePlayer.FormattedDistance}] ";
item3 = Settings.USECColor;
}
else if (role == OnlineGamePlayer.PlayerType.BEAR && !gamePlayer.IsAI)
{
item2 = " BEAR ";
item = $" [LVL {gamePlayer.level} BEAR] {gamePlayer.NickName} [KD : {gamePlayer.kd:f1}] [{gamePlayer.FormattedDistance}] ";
item3 = Settings.BEARColor;
}
else if (role == OnlineGamePlayer.PlayerType.PlayerScav && !gamePlayer.IsAI)
{
item2 = " Player Scav ";
item = " [Player Scav] " + ConvertRussianToLatin(gamePlayer.NickName) + " [" + gamePlayer.FormattedDistance + "] ";
item3 = Settings.playerscavcolor;
}
return (playerText: item, shorttext: item2, playerColor: item3);
}
public static bool ContainsRussianCharacters(string input)
{
string pattern = "[\\u0400-\\u04FF]";
return Regex.IsMatch(input, pattern);
}
public static bool IsHealing(string input)
{
if (string.IsNullOrWhiteSpace(input))
{
return false;
}
return new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"Splint", "CMS", "Surv12", "Aseptic", "Army", "CAT", "CALOK-B", "Esmarch", "AI-2", "Car",
"Salewa", "IFAK", "AFAK", "Grizzly"
}.Contains(input.Trim());
}
public static string ConvertRussianToLatin(string input)
{
if (string.IsNullOrWhiteSpace(input))
{
return input;
}
Dictionary<char, string> dictionary = new Dictionary<char, string>
{
{ 'А', "A" },
{ 'а', "a" },
{ 'Б', "B" },
{ 'б', "b" },
{ 'В', "V" },
{ 'в', "v" },
{ 'Г', "G" },
{ 'г', "g" },
{ 'Д', "D" },
{ 'д', "d" },
{ 'Е', "E" },
{ 'е', "e" },
{ 'Ё', "Yo" },
{ 'ё', "yo" },
{ 'Ж', "Zh" },
{ 'ж', "zh" },
{ 'З', "Z" },
{ 'з', "z" },
{ 'И', "I" },
{ 'и', "i" },
{ 'Й', "Y" },
{ 'й', "y" },
{ 'К', "K" },
{ 'к', "k" },
{ 'Л', "L" },
{ 'л', "l" },
{ 'М', "M" },
{ 'м', "m" },
{ 'Н', "N" },
{ 'н', "n" },
{ 'О', "O" },
{ 'о', "o" },
{ 'П', "P" },
{ 'п', "p" },
{ 'Р', "R" },
{ 'р', "r" },
{ 'С', "S" },
{ 'с', "s" },
{ 'Т', "T" },
{ 'т', "t" },
{ 'У', "U" },
{ 'у', "u" },
{ 'Ф', "F" },
{ 'ф', "f" },
{ 'Х', "Kh" },
{ 'х', "kh" },
{ 'Ц', "Ts" },
{ 'ц', "ts" },
{ 'Ч', "Ch" },
{ 'ч', "ch" },
{ 'Ш', "Sh" },
{ 'ш', "sh" },
{ 'Щ', "Shch" },
{ 'щ', "shch" },
{ 'Ъ', "" },
{ 'ъ', "" },
{ 'Ы', "Y" },
{ 'ы', "y" },
{ 'Ь', "" },
{ 'ь', "" },
{ 'Э', "E" },
{ 'э', "e" },
{ 'Ю', "Yu" },
{ 'ю', "yu" },
{ 'Я', "Ya" },
{ 'я', "ya" }
};
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in input)
{
if (dictionary.TryGetValue(c, out var value))
{
stringBuilder.Append(value);
}
else
{
stringBuilder.Append(c);
}
}
return stringBuilder.ToString();
}
public static string ConvertLatinToRussian(string input)
{
if (string.IsNullOrWhiteSpace(input))
{
return input;
}
Dictionary<string, string> dictionary = new Dictionary<string, string>
{
{ "A", "А" },
{ "a", "а" },
{ "B", "Б" },
{ "b", "б" },
{ "V", "В" },
{ "v", "в" },
{ "G", "Г" },
{ "g", "г" },
{ "D", "Д" },
{ "d", "д" },
{ "E", "Е" },
{ "e", "е" },
{ "Yo", "Ё" },
{ "yo", "ё" },
{ "Zh", "Ж" },
{ "zh", "ж" },
{ "Z", "З" },
{ "z", "з" },
{ "I", "И" },
{ "i", "и" },
{ "Y", "Й" },
{ "y", "й" },
{ "K", "К" },
{ "k", "к" },
{ "L", "Л" },
{ "l", "л" },
{ "M", "М" },
{ "m", "м" },
{ "N", "Н" },
{ "n", "н" },
{ "O", "О" },
{ "o", "о" },
{ "P", "П" },
{ "p", "п" },
{ "R", "Р" },
{ "r", "р" },
{ "S", "С" },
{ "s", "с" },
{ "T", "Т" },
{ "t", "т" },
{ "U", "У" },
{ "u", "у" },
{ "F", "Ф" },
{ "f", "ф" },
{ "Kh", "Х" },
{ "kh", "х" },
{ "Ts", "Ц" },
{ "ts", "ц" },
{ "Ch", "Ч" },
{ "ch", "ч" },
{ "Sh", "Ш" },
{ "sh", "ш" },
{ "Shch", "Щ" },
{ "shch", "щ" },
{ "'", "ъ" },
{ "Y", "Ы" },
{ "y", "ы" },
{ "''", "ь" },
{ "E", "Э" },
{ "e", "э" },
{ "Yu", "Ю" },
{ "yu", "ю" },
{ "Ya", "Я" },
{ "ya", "я" }
};
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < input.Length; i++)
{
if (i < input.Length - 1)
{
string key = input.Substring(i, 2);
if (dictionary.TryGetValue(key, out var value))
{
stringBuilder.Append(value);
i++;
continue;
}
}
string text = input[i].ToString();
if (dictionary.TryGetValue(text, out var value2))
{
stringBuilder.Append(value2);
}
else
{
stringBuilder.Append(text);
}
}
return stringBuilder.ToString();
}
public static bool IsLootableContainerValid(LootableContainer lootableContainer)
{
if (lootableContainer != null)
{
return lootableContainer.Template != null;
}
return false;
}
public static bool IsPlayerAlive(Player player)
{
if (!IsPlayerValid(player))
{
return false;
}
if (player.HealthController == null)
{
return false;
}
return player.HealthController.IsAlive;
}
public static bool IsOPlayerAlive(ObservedPlayerView player)
{
if (!IsOPlayerValid(player))
{
return false;
}
if (player.HealthController == null)
{
return false;
}
return player.HealthController.IsAlive;
}
public static bool IsCorpseValid(Corpse corpse)
{
return corpse != null;
}
public static bool IsInventoryItemValid(Item item)
{
if (item != null)
{
return item.Template != null;
}
return false;
}
public static bool IsFriend(Player player)
{
if (Main.LocalPlayer.Profile.Info.GroupId == player.Profile.Info.GroupId && player.Profile.Info.GroupId != "0" && player.Profile.Info.GroupId != "")
{
return player.Profile.Info.GroupId != null;
}
return false;
}
public static bool IsInFov(Vector3 screenpos, float fovRadius)
{
Vector3 vector = screenpos;
float num = Screen.width;
float num2 = Screen.height;
Vector2 a = new Vector2(num / 2f, num2 / 2f);
Vector2 b = new Vector2(vector.x, vector.y);
return Vector2.Distance(a, b) <= fovRadius;
}
public static Vector3 WorldPointToScreenPoint(Vector3 worldPoint)
{
if (Main.MainCamera == null)
{
return Vector3.zero;
}
Vector3 result = Main.MainCamera.WorldToScreenPoint(worldPoint);
float num = (float)Screen.height / (float)Main.MainCamera.scaledPixelHeight;
result.y = (float)Screen.height - result.y * num;
result.x *= num;
return result;
}
private static bool IsPointInScopeView(Vector3 worldPoint, Camera opticCamera)
{
OpticSight componentInChildren = Main.LocalPlayer.ProceduralWeaponAnimation.HandsContainer.Weapon.GetComponentInChildren<OpticSight>();
if (componentInChildren == null)
{
return false;
}
Mesh mesh = componentInChildren.LensRenderer.GetComponent<MeshFilter>().mesh;
Vector3 position = componentInChildren.LensRenderer.transform.TransformPoint(mesh.bounds.max);
Vector3 position2 = componentInChildren.LensRenderer.transform.TransformPoint(mesh.bounds.min);
Vector3 vector = opticCamera.WorldToScreenPoint(position);
Vector3 vector2 = opticCamera.WorldToScreenPoint(position2);
Vector3 vector3 = opticCamera.WorldToScreenPoint(worldPoint);
if (vector3.x >= vector2.x && vector3.x <= vector.x && vector3.y >= vector2.y)
{
return vector3.y <= vector.y;
}
return false;
}
private static bool IsPointVisibleInCamera(Vector3 screenPoint, Camera camera)
{
Vector3 vector = camera.ScreenToViewportPoint(screenPoint);
if (screenPoint.z > 0.01f && vector.x >= 0f && vector.x <= 1f && vector.y >= 0f)
{
return vector.y <= 1f;
}
return false;
}
public static void DrawTracer(Vector3 worldpos, Color color)
{
Vector3 vector = Main.ActiveCamera.WorldToScreenPoint(worldpos);
vector.y = (float)Screen.height - vector.y;
GL.PushMatrix();
GL.Begin(1);
DrawMaterial.SetPass(0);
GL.Color(color);
GL.Vertex3(Screen.width / 2, Screen.height, 0f);
GL.Vertex3(vector.x, vector.y, 0f);
GL.End();
GL.PopMatrix();
}
public static bool IsScreenPointVisible(Vector3 screenPoint)
{
if (screenPoint.z > 0.01f && screenPoint.x > -5f && screenPoint.y > -5f && screenPoint.x < (float)Screen.width)
{
return screenPoint.y < (float)Screen.height;
}
return false;
}
public static Vector3 GetBonePosByID(Player player, int id)
{
try
{
return SkeletonBonePos(player.PlayerBones.AnimatedTransform.Original.gameObject.GetComponent<PlayerBody>().SkeletonRootJoint, id);
}
catch (Exception)
{
return Vector3.zero;
}
}
public static Vector3 GetBonePosByIDO(ObservedPlayerView player, int id)
{
try
{
return SkeletonBonePos(player.PlayerBones.AnimatedTransform.Original.gameObject.GetComponent<PlayerBody>().SkeletonRootJoint, id);
}
catch (Exception)
{
return Vector3.zero;
}
}
public static Vector3 SkeletonBonePos(Skeleton skeleton, int id)
{
return skeleton.Bones.ElementAt(id).Value.position;
}
public static Vector3 FinalVector(Player player, int bone)
{
try
{
return player.PlayerBody.SkeletonRootJoint.Bones.ElementAt(bone).Value.position;
}
catch
{
return Vector3.zero;
}
}
public static Vector3 FinalVectorO(ObservedPlayerView player, int bone)
{
try
{
return player.PlayerBody.SkeletonRootJoint.Bones.ElementAt(bone).Value.position;
}
catch
{
return Vector3.zero;
}
}
public static void UpdateCameraState(Player player)
{
Main.ActiveCamera = Main.MainCamera;
}
}

View file

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using EFT.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace stupid.solutions.Utils;
public class ItemPresetManager
{
public Dictionary<string, object> itemParameters;
public ItemPresetManager()
{
itemParameters = new Dictionary<string, object>();
}
public void SaveToJson(string filePath)
{
try
{
string text = (itemParameters.ContainsKey("ItemId") ? itemParameters["ItemId"].ToString() : "");
if (string.IsNullOrEmpty(text))
{
ConsoleScreen.Log("Log: No main item ID found. Cannot save.");
return;
}
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (string key in itemParameters.Keys)
{
if (itemParameters[key] is Dictionary<string, string> dictionary2)
{
dictionary[key] = new Dictionary<string, string>
{
{
"SlotID",
dictionary2["SlotID"]
},
{
"SlotName",
dictionary2["SlotName"]
},
{
"ItemId",
dictionary2["ItemId"]
}
};
}
}
string contents = JsonConvert.SerializeObject(new Dictionary<string, object> {
{
text,
new Dictionary<string, object>
{
{
"StackMaxSize",
itemParameters.ContainsKey("StackMaxSize") ? itemParameters["StackMaxSize"] : ((object)1)
},
{
"QuestItem",
itemParameters.ContainsKey("QuestItem") ? itemParameters["QuestItem"] : ((object)false)
},
{ "Slots", dictionary }
}
} }, Formatting.Indented);
File.WriteAllText(filePath, contents);
ConsoleScreen.Log("Log: Item preset saved successfully to " + filePath);
}
catch (Exception ex)
{
ConsoleScreen.Log("Log: Error saving preset: " + ex.Message);
}
}
public Dictionary<string, Dictionary<string, string>> LoadFromJson(string filePath, out string mainItemId)
{
mainItemId = null;
try
{
if (!File.Exists(filePath))
{
ConsoleScreen.Log("Log: JSON file not found at " + filePath);
return null;
}
Dictionary<string, object> dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText(filePath));
mainItemId = dictionary.Keys.FirstOrDefault();
if (string.IsNullOrEmpty(mainItemId))
{
ConsoleScreen.Log("Log: No main item ID found in the JSON.");
return null;
}
Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
if (dictionary[mainItemId] is JObject jObject && jObject.TryGetValue("Slots", out JToken value) && value is JObject jObject2)
{
foreach (JProperty item in jObject2.Properties())
{
if (item.Value is JObject jObject3)
{
string key = jObject3["SlotID"].ToString();
string value2 = jObject3["ItemId"].ToString();
dictionary2[key] = value2;
}
}
}
return new Dictionary<string, Dictionary<string, string>> { { "Slots", dictionary2 } };
}
catch (Exception ex)
{
ConsoleScreen.Log("Log: Error loading preset: " + ex.Message);
return null;
}
}
public void Clear()
{
itemParameters.Clear();
ConsoleScreen.Log("Log: Item parameters cleared.");
}
}

View file

@ -0,0 +1,375 @@
using System;
using System.Collections.Generic;
using EFT.UI;
using UnityEngine;
namespace stupid.solutions.Utils;
public static class Render
{
private class RingArray
{
public Vector2[] Positions { get; private set; }
public RingArray(int numSegments)
{
Positions = new Vector2[numSegments];
float num = 360f / (float)numSegments;
for (int i = 0; i < numSegments; i++)
{
float f = (float)Math.PI / 180f * num * (float)i;
Positions[i] = new Vector2(Mathf.Sin(f), Mathf.Cos(f));
}
}
}
private static Color _texturesColor;
private static Texture2D _currentTexture;
private static Color _currentTextureColor = Color.black;
private static readonly Texture2D _texture = new Texture2D(2, 2, TextureFormat.ARGB32, mipChain: false)
{
filterMode = FilterMode.Bilinear
};
private static readonly Texture2D Texture2D = new Texture2D(2, 2, TextureFormat.ARGB32, mipChain: false)
{
filterMode = FilterMode.Bilinear
};
public static Material material;
private static Dictionary<int, RingArray> ringDict = new Dictionary<int, RingArray>();
public static Vector4[] taaJitter = new Vector4[4]
{
new Vector4(0.5f, 0.5f, 0f, 0f),
new Vector4(-0.5f, 0.5f, 0f, 0f),
new Vector4(-0.5f, -0.5f, 0f, 0f),
new Vector4(0.5f, -0.5f, 0f, 0f)
};
public static int frameIndex = 0;
public static GUIStyle StringStyle { get; set; } = new GUIStyle(GUI.skin.label);
public static GUIStyle StringStyleOutline { get; set; } = new GUIStyle(GUI.skin.label);
public static Color Color
{
get
{
return GUI.color;
}
set
{
GUI.color = value;
}
}
public static void DrawLine(Vector2 from, Vector2 to, float thickness, Color color)
{
Color = color;
DrawLine(from, to, thickness);
}
public static void DrawLine(Vector2 from, Vector2 to, float thickness)
{
Main.AAMaterial.SetPass(0);
Vector2 normalized = (to - from).normalized;
float num = Mathf.Atan2(normalized.y, normalized.x) * 57.29578f;
GUIUtility.RotateAroundPivot(num, from);
DrawBox(from, Vector2.right * (from - to).magnitude, thickness, centered: false);
GUIUtility.RotateAroundPivot(0f - num, from);
}
public static void DrawLineGL(Vector2 from, Vector2 to, Color color)
{
GL.PushMatrix();
GameUtils.DrawMaterial.SetPass(0);
GL.LoadOrtho();
GL.Begin(1);
GL.Color(color);
GL.Vertex(new Vector3(from.x / (float)Screen.width, from.y / (float)Screen.height, 0f));
GL.Vertex(new Vector3(to.x / (float)Screen.width, to.y / (float)Screen.height, 0f));
GL.End();
GL.PopMatrix();
}
public static void DrawBox(float x, float y, float w, float h, Color color)
{
DrawLine(new Vector2(x, y), new Vector2(x + w, y), 1f, color);
DrawLine(new Vector2(x, y), new Vector2(x, y + h), 1f, color);
DrawLine(new Vector2(x + w, y), new Vector2(x + w, y + h), 1f, color);
DrawLine(new Vector2(x, y + h), new Vector2(x + w, y + h), 1f, color);
}
public static void DrawBox(Vector2 position, Vector2 size, float thickness, Color color, bool centered = true)
{
Color = color;
DrawBox(position, size, thickness, centered);
}
public static void DrawBox(Vector2 position, Vector2 size, float thickness, bool centered = true)
{
if (centered)
{
_ = position - size / 2f;
}
GUI.DrawTexture(new Rect(position.x, position.y, size.x, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(position.x, position.y, thickness, size.y), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(position.x + size.x, position.y, thickness, size.y), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(position.x, position.y + size.y, size.x + thickness, thickness), Texture2D.whiteTexture);
}
public static void DrawCornerBox(Vector2 position, Vector2 size, float thickness, Color color, float cornerLength = 10f, bool centered = true)
{
Vector2 vector = (centered ? (position - size / 2f) : position);
GUI.color = color;
GUI.DrawTexture(new Rect(vector.x, vector.y, cornerLength, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x, vector.y, thickness, cornerLength), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x + size.x - cornerLength, vector.y, cornerLength, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x + size.x - thickness, vector.y, thickness, cornerLength), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x, vector.y + size.y - cornerLength, thickness, cornerLength), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x, vector.y + size.y - thickness, cornerLength, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x + size.x - cornerLength, vector.y + size.y - thickness, cornerLength, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(vector.x + size.x - thickness, vector.y + size.y - cornerLength, thickness, cornerLength), Texture2D.whiteTexture);
GUI.color = Color.white;
}
public static void DrawCross(Vector2 position, Vector2 size, float thickness, Color color)
{
Color = color;
DrawCross(position, size, thickness);
}
public static void DrawCross(Vector2 position, Vector2 size, float thickness)
{
GUI.DrawTexture(new Rect(position.x - size.x / 2f, position.y, size.x, thickness), Texture2D.whiteTexture);
GUI.DrawTexture(new Rect(position.x, position.y - size.y / 2f, thickness, size.y), Texture2D.whiteTexture);
}
public static void DrawDot(Vector2 position)
{
DrawBox(position - Vector2.one, Vector2.one * 2f, 1f);
}
public static void DrawString(Vector2 position, string label, Color color, bool centered = true, Color outlineColor = default(Color), bool outline = true)
{
if (outlineColor == default(Color))
{
outlineColor = Color.black;
}
DrawText(position, label, color, outlineColor, centered, outline);
}
public static void DrawRichTextString(Vector2 position, string label, Color color, bool centered = true)
{
DrawTextRich(position, label, color, centered);
}
private static void DrawTextRich(Vector2 position, string label, Color color, bool centered = true, bool outline = true)
{
if (Main.TXTFONT == null)
{
ConsoleScreen.Log("TEXT FONT NOT LOADED !");
return;
}
GUIContent content = new GUIContent(label);
StringStyle.fontSize = Settings.fontsize;
if (StringStyle.font != Main.TXTFONT)
{
StringStyle.font = Main.TXTFONT;
}
StringStyle.normal.textColor = color;
StringStyle.alignment = TextAnchor.MiddleCenter;
Vector2 vector = StringStyle.CalcSize(content);
Vector2 position2 = (centered ? (position - vector / 2f) : position);
Color = color;
StringStyle.normal.textColor = color;
GUI.Label(new Rect(position2, vector), content, StringStyle);
}
public static void DrawTextRadar(Vector2 position, string label, Color color, bool centered = true)
{
if (Main.TXTFONT == null)
{
ConsoleScreen.Log("TEXT FONT NOT LOADED !");
}
GUIContent content = new GUIContent(label);
StringStyle.fontSize = 12;
if (StringStyle.font != Main.TXTFONT)
{
StringStyle.font = Main.TXTFONT;
}
StringStyle.alignment = TextAnchor.MiddleCenter;
Vector2 vector = StringStyle.CalcSize(content);
Vector2 position2 = (centered ? (position - vector / 2f) : position);
StringStyle.normal.textColor = color;
Color = color;
GUI.Label(new Rect(position2, vector), content, StringStyle);
}
public static void DrawText1(Vector2 position, string label, Color color, bool centered = true)
{
if (Main.TXTFONT == null)
{
ConsoleScreen.Log("TEXT FONT NOT LOADED !");
}
GUIContent content = new GUIContent(label);
StringStyle.fontSize = Settings.fontsize;
if (StringStyle.font != Main.TXTFONT)
{
StringStyle.font = Main.TXTFONT;
}
StringStyle.alignment = TextAnchor.MiddleCenter;
Vector2 vector = StringStyle.CalcSize(content);
Vector2 position2 = (centered ? (position - vector / 2f) : position);
StringStyle.normal.textColor = color;
Color = color;
GUI.Label(new Rect(position2, vector), content, StringStyle);
}
private static void DrawText(Vector2 position, string label, Color color, Color outlinecolor, bool centered = true, bool outline = true)
{
if (Main.TXTFONT == null)
{
ConsoleScreen.Log("TEXT FONT NOT LOADED !");
return;
}
GUIContent content = new GUIContent(label);
StringStyle.fontSize = Settings.fontsize;
if (StringStyle.font != Main.TXTFONT)
{
StringStyle.font = Main.TXTFONT;
}
StringStyle.normal.textColor = color;
StringStyle.alignment = TextAnchor.MiddleCenter;
Vector2 vector = StringStyle.CalcSize(content);
Vector2 vector2 = (centered ? (position - vector / 2f) : position);
if (Settings.DrawOutline && outline)
{
StringStyleOutline.fontSize = Settings.fontsize;
if (StringStyleOutline.font != Main.TXTFONT)
{
StringStyleOutline.font = Main.TXTFONT;
}
StringStyleOutline.alignment = TextAnchor.MiddleCenter;
StringStyleOutline.normal.textColor = outlinecolor;
Vector2[] array = new Vector2[8]
{
new Vector2(-1f, 0f),
new Vector2(1f, 0f),
new Vector2(0f, -1f),
new Vector2(0f, 1f),
new Vector2(-1f, -1f),
new Vector2(1f, -1f),
new Vector2(-1f, 1f),
new Vector2(1f, 1f)
};
foreach (Vector2 vector3 in array)
{
GUI.Label(new Rect(vector2 + vector3, vector), content, StringStyleOutline);
}
}
Color = color;
StringStyle.normal.textColor = color;
GUI.Label(new Rect(vector2, vector), content, StringStyle);
}
public static void DrawCircle(Vector2 position, float radius, int numSides, Color color, bool centered = true)
{
GL.PushMatrix();
GameUtils.DrawMaterial.SetPass(0);
GL.LoadOrtho();
GL.Begin(1);
GL.Color(color);
float num = 360f / (float)numSides;
Vector2 vector = (centered ? position : (position + Vector2.one * radius));
for (int i = 0; i < numSides; i++)
{
float f = (float)Math.PI / 180f * ((float)i * num);
float f2 = (float)Math.PI / 180f * ((float)(i + 1) * num);
Vector2 vector2 = vector + new Vector2(Mathf.Cos(f), Mathf.Sin(f)) * radius;
Vector2 vector3 = vector + new Vector2(Mathf.Cos(f2), Mathf.Sin(f2)) * radius;
GL.Vertex(new Vector3(vector2.x / (float)Screen.width, vector2.y / (float)Screen.height, 0f));
GL.Vertex(new Vector3(vector3.x / (float)Screen.width, vector3.y / (float)Screen.height, 0f));
}
GL.End();
GL.PopMatrix();
}
public static void DrawCornerBox(Vector2 headPosition, float width, float height, Color color, bool outline)
{
int num = (int)(width / 4f);
int num2 = num;
if (outline)
{
RectFilled(headPosition.x - width / 2f - 1f, headPosition.y - 1f, num + 2, 3f, Color.black);
RectFilled(headPosition.x - width / 2f - 1f, headPosition.y - 1f, 3f, num2 + 2, Color.black);
RectFilled(headPosition.x + width / 2f - (float)num - 1f, headPosition.y - 1f, num + 2, 3f, Color.black);
RectFilled(headPosition.x + width / 2f - 1f, headPosition.y - 1f, 3f, num2 + 2, Color.black);
RectFilled(headPosition.x - width / 2f - 1f, headPosition.y + height - 4f, num + 2, 3f, Color.black);
RectFilled(headPosition.x - width / 2f - 1f, headPosition.y + height - (float)num2 - 4f, 3f, num2 + 2, Color.black);
RectFilled(headPosition.x + width / 2f - (float)num - 1f, headPosition.y + height - 4f, num + 2, 3f, Color.black);
RectFilled(headPosition.x + width / 2f - 1f, headPosition.y + height - (float)num2 - 4f, 3f, num2 + 3, Color.black);
}
RectFilled(headPosition.x - width / 2f, headPosition.y, num, 1f, color);
RectFilled(headPosition.x - width / 2f, headPosition.y, 1f, num2, color);
RectFilled(headPosition.x + width / 2f - (float)num, headPosition.y, num, 1f, color);
RectFilled(headPosition.x + width / 2f, headPosition.y, 1f, num2, color);
RectFilled(headPosition.x - width / 2f, headPosition.y + height - 3f, num, 1f, color);
RectFilled(headPosition.x - width / 2f, headPosition.y + height - (float)num2 - 3f, 1f, num2, color);
RectFilled(headPosition.x + width / 2f - (float)num, headPosition.y + height - 3f, num, 1f, color);
RectFilled(headPosition.x + width / 2f, headPosition.y + height - (float)num2 - 3f, 1f, num2 + 1, color);
}
public static void RectFilled(float x, float y, float width, float height, Color color)
{
if (color != _texturesColor)
{
_texturesColor = color;
_texture.SetPixel(0, 0, color);
_texture.Apply();
}
GUI.DrawTexture(new Rect(x, y, width, height), _texture);
}
public static void BoxRect(Rect rect, Color color)
{
if (_currentTexture == null)
{
_currentTexture = new Texture2D(1, 1);
_currentTexture.SetPixel(0, 0, color);
_currentTexture.Apply();
_currentTextureColor = color;
}
else if (color != _currentTextureColor)
{
_currentTexture.SetPixel(0, 0, color);
_currentTexture.Apply();
_currentTextureColor = color;
}
GUI.DrawTexture(rect, _currentTexture);
}
public static void DrawRadarBackground(Rect rect)
{
Color color = new Color(0f, 0f, 0f, 0.5f);
Texture2D.SetPixel(0, 0, color);
Texture2D.Apply();
GUI.color = color;
GUI.DrawTexture(rect, Texture2D);
}
public static void ApplyTAA()
{
if (Main.AAMaterial != null)
{
frameIndex = (frameIndex + 1) % taaJitter.Length;
Main.AAMaterial.SetVector("_Jitter", taaJitter[frameIndex]);
}
}
}

View file

@ -0,0 +1,10 @@
using UnityEngine;
namespace stupid.solutions.Utils;
public struct RendererStruct
{
public EDecalTextureType DecalType;
public Renderer[] Renderers;
}

View file

@ -0,0 +1,10 @@
using UnityEngine;
namespace stupid.solutions.Utils;
public static class ScopeParameters
{
public static Vector2 center;
public static float radius;
}

File diff suppressed because it is too large Load diff