Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friendlist update #7

Merged
merged 4 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ArabicaCliento/ArabicaConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public static class ArabicaConfig
public static float RangedAimbotRadius = 2f;

public static bool SyndicateDetector = true;

public static bool FOVDisable = true;

public static HashSet<string> FriendsSet = [];

//public static bool LogPlayers = true;
}
26 changes: 26 additions & 0 deletions ArabicaCliento/Commands/Arabica.Friend.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.Administration;
using Robust.Shared.Console;

namespace ArabicaCliento.Commands;

[AnyCommand]
public class ArabicaFriendCommand : IConsoleCommand
{
public string Command => "arabica.friend";
public string Description => "Add username to friend-list";
public string Help => "arabica.friend <username>";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError("Invalid args count");
return;
}

if (ArabicaConfig.FriendsSet.Add(args[0]))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Add argument validation before accessing args array

Check args.Length > 0 before accessing args[0] to prevent IndexOutOfRangeException.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Он шарит в этой теме.

shell.WriteLine("Username is successfully added");
else
shell.WriteError("Username is already presented");
}
}
20 changes: 20 additions & 0 deletions ArabicaCliento/Commands/Arabica.FriendList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Content.Shared.Administration;
using Robust.Shared.Console;

namespace ArabicaCliento.Commands;

[AnyCommand]
public class ArabicaFriendList : IConsoleCommand
{
public string Command => "arabica.friend_list";
public string Description => "Output a friendlist";
public string Help => "arabica.friend_list";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
foreach (var friend in ArabicaConfig.FriendsSet)
{
shell.WriteLine(friend);
}
}
}
1 change: 0 additions & 1 deletion ArabicaCliento/Commands/Arabica.PlayerList.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Client.Administration.Systems;
using Content.Shared.Administration;
using Robust.Client.Player;
using Robust.Shared.Console;
Expand Down
26 changes: 26 additions & 0 deletions ArabicaCliento/Commands/Arabica.Unfriend.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.Administration;
using Robust.Shared.Console;

namespace ArabicaCliento.Commands;

[AnyCommand]
public class ArabicaUnfriendCommand : IConsoleCommand
{
public string Command => "arabica.unfriend";
public string Description => "Remove username from friend-list";
public string Help => "arabica.unfriend <username>";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError("Invalid args count");
return;
}

if (ArabicaConfig.FriendsSet.Remove(args[0]))
shell.WriteLine("Username is successfully removed");
else
shell.WriteError("Username is not presented in friend-list");
}
}
1 change: 0 additions & 1 deletion ArabicaCliento/Commands/Arabica.Zoom.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ArabicaCliento.Systems;
using Content.Shared.Administration;
using Robust.Client.Player;
using Robust.Shared.Console;

namespace ArabicaCliento.Commands;
Expand Down
1 change: 0 additions & 1 deletion ArabicaCliento/Commands/Spin/Spin.SetDegrees.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ArabicaCliento.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;

Expand Down
1 change: 0 additions & 1 deletion ArabicaCliento/Commands/Spin/Spin.SetEnabled.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ArabicaCliento.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;

Expand Down
2 changes: 2 additions & 0 deletions ArabicaCliento/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ public override void PostInit()
};
_inputManager.RegisterBinding(registration, false);
MarseyLogger.Debug("Setup context.");


}
}
13 changes: 13 additions & 0 deletions ArabicaCliento/Patches/DrawOcclusionDepthPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using HarmonyLib;

namespace ArabicaCliento.Patches;

[HarmonyPatch("Robust.Client.Graphics.Clyde.Clyde", "DrawOcclusionDepth")]
Comment on lines +1 to +5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Use typeof() instead of string literal for patch target

String literals for type names are fragile. Consider using typeof() to make the patch more resilient to refactoring.

Suggested change
using HarmonyLib;
namespace ArabicaCliento.Patches;
[HarmonyPatch("Robust.Client.Graphics.Clyde.Clyde", "DrawOcclusionDepth")]
using HarmonyLib;
using Robust.Client.Graphics.Clyde;
namespace ArabicaCliento.Patches;
[HarmonyPatch(typeof(Clyde), nameof(Clyde.DrawOcclusionDepth))]

internal static class DrawOcclusionDepthPatch
{
[HarmonyPrefix]
static bool Prefix()
{
return !ArabicaConfig.FOVDisable;
}
}
3 changes: 2 additions & 1 deletion ArabicaCliento/Systems/ArabicaAimSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ArabicaAimSystem : EntitySystem
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly ArabicaFriendSystem _friend = default!;


public static Vector2? CalculateInterceptPosition(Vector2 shooterPosition, float bulletSpeed, Vector2 targetPosition, Vector2 targetVelocity)
Expand Down Expand Up @@ -123,7 +124,7 @@ private bool FilterEntity(Entity<TransformComponent> ent)
if (!TryComp(ent, out MobStateComponent? state))
return false;
if (state.CurrentState != MobState.Alive) return false;
if (HasComp<ArabicaFriendComponent>(ent)) return false;
if (_friend.IsFriend(ent.Owner)) return false;
return true;
}
}
23 changes: 23 additions & 0 deletions ArabicaCliento/Systems/ArabicaDiscordSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Robust.Client.UserInterface;

namespace ArabicaCliento.Systems;

public class ArabicaDiscordSystem : EntitySystem
{
private const string DiscordUrl = "https://discord.gg/BKucu6uFUH";
private const string FilePath = "arbc_ds_ws_pnd";
[Dependency] private readonly IUriOpener _uri = default!;

public void OpenDiscord()
{
_uri.OpenUri(DiscordUrl);
}

public override void Initialize()
{
if (File.Exists(FilePath))
return;
OpenDiscord();
File.WriteAllText(FilePath, DiscordUrl);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Consider using a more secure approach for file operations

The current file operation could fail or be exploited. Consider using Path.Combine() with a known safe directory, adding try-catch blocks, and implementing proper file access controls.

}
}
24 changes: 22 additions & 2 deletions ArabicaCliento/Systems/ArabicaFriendSystem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using ArabicaCliento.Components;
using Content.Client.Administration.Systems;
using Content.Shared.Mobs.Components;
using Content.Shared.Verbs;
using Robust.Shared.Player;

namespace ArabicaCliento.Systems;

public class ArabicaFriendSystem: EntitySystem
public class ArabicaFriendSystem : EntitySystem
{
[Dependency] private readonly AdminSystem _adminSystem = default!;

public override void Initialize()
{
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddFriendVerb);
Expand All @@ -27,9 +31,25 @@ private void AddFriendVerb(GetVerbsEvent<Verb> ev)
verb = new Verb
{
Text = "Friend",
Act = () => AddComp(ev.Target, new ArabicaFriendComponent {NetSyncEnabled = false}),
Act = () => AddComp(ev.Target, new ArabicaFriendComponent { NetSyncEnabled = false }),
ClientExclusive = true
};
ev.Verbs.Add(verb);
}

public bool IsFriend(Entity<ActorComponent?> ent)
{
if (HasComp<ArabicaFriendComponent>(ent))
return true;
Resolve(ent, ref ent.Comp);
if (ArabicaConfig.FriendsSet.Contains((ent.Comp?.PlayerSession.Name ?? GetUsername(ent)) ?? string.Empty))
return true;
return false;
}

private string? GetUsername(EntityUid uid)
{
var netEntity = GetNetEntity(uid);
return _adminSystem.PlayerList.FirstOrDefault(player => player.NetEntity == netEntity)?.Username;
}
}
12 changes: 7 additions & 5 deletions ArabicaCliento/UI/CheatMenuWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
SetSize="600 400">
<BoxContainer Orientation="Vertical" HorizontalAlignment="Center" VerticalExpand="True" VerticalAlignment="Center"
SeparationOverride="5">
<Button ToggleMode="True" Text="Ranged aimbot" StyleClasses="ButtonSquare" Name="Ranged" />
<Button ToggleMode="True" Text="Melee aimbot" StyleClasses="ButtonSquare" Name="Melee" />
<Button ToggleMode="True" Text="Autospin" StyleClasses="ButtonSquare" Name="Autospin" />
<Button ToggleMode="True" Text="AntiSlip" StyleClasses="ButtonSquare" Name="Antislip" />
<Button ToggleMode="True" Text="Syndicate detector" StyleClasses="ButtonSquare" Name="SyndicateDetector" />
<Button ToggleMode="True" Text="Ranged Aimbot" StyleClasses="ButtonSquare" Name="Ranged" />
<Button ToggleMode="True" Text="Melee Aimbot" StyleClasses="ButtonSquare" Name="Melee" />
<Button ToggleMode="True" Text="AutoSpin" StyleClasses="ButtonSquare" Name="AutoSpin" />
<Button ToggleMode="True" Text="AntiSlip" StyleClasses="ButtonSquare" Name="AntiSlip" />
<Button ToggleMode="True" Text="Syndicate Detector" StyleClasses="ButtonSquare" Name="SyndicateDetector" />
<Button ToggleMode="True" Text="Fov Disabler" StyleClasses="ButtonSquare" Name="DOD" />
<!-- <Button ToggleMode="True" Text="Log players" StyleClasses="ButtonSquare" Name="LogPlayers" /> -->
<Button Text="OPEN DISCORD" StyleClasses="ButtonColorRed" Name="Discord" />
</BoxContainer>
</arabica:ArabicaWindow>
24 changes: 16 additions & 8 deletions ArabicaCliento/UI/CheatMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
using ArabicaCliento.Systems;
using ArabicaCliento.UI.Controls;
using Content.Client.Resources;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.XAML;

namespace ArabicaCliento.UI;

[GenerateTypedNameReferences]
public sealed partial class CheatMenuWindow : ArabicaWindow
{
[Dependency] private readonly IEntityManager _entMan = default!;

private readonly ArabicaDiscordSystem? _arabicaDiscord;

public CheatMenuWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_arabicaDiscord ??= _entMan.System<ArabicaDiscordSystem>();
TitleLabel.Text = "ArabicaCliento: Click GUI";
Ranged.Pressed = ArabicaConfig.RangedAimbotEnabled;
Melee.Pressed = ArabicaConfig.MeleeAimbotEnabled;
Autospin.Pressed = ArabicaConfig.SpinBotEnabled;
Antislip.Pressed = ArabicaConfig.AntiSlipEnabled;
//LogPlayers.Pressed = ArabicaConfig.LogPlayers;

AutoSpin.Pressed = ArabicaConfig.SpinBotEnabled;
AntiSlip.Pressed = ArabicaConfig.AntiSlipEnabled;
SyndicateDetector.Pressed = ArabicaConfig.SyndicateDetector;
DOD.Pressed = ArabicaConfig.FOVDisable;
//LogPlayers.Pressed = ArabicaConfig.LogPlayers;

Melee.OnToggled += args => ArabicaConfig.MeleeAimbotEnabled = args.Pressed;
Ranged.OnToggled += args => ArabicaConfig.RangedAimbotEnabled = args.Pressed;
Autospin.OnToggled += args => ArabicaConfig.SpinBotEnabled = args.Pressed;
Antislip.OnToggled += args => ArabicaConfig.AntiSlipEnabled = args.Pressed;
AutoSpin.OnToggled += args => ArabicaConfig.SpinBotEnabled = args.Pressed;
AntiSlip.OnToggled += args => ArabicaConfig.AntiSlipEnabled = args.Pressed;
SyndicateDetector.OnToggled += args => ArabicaConfig.SyndicateDetector = args.Pressed;
DOD.OnToggled += args => ArabicaConfig.FOVDisable = args.Pressed;
Discord.OnPressed += _ => _arabicaDiscord?.OpenDiscord();
//LogPlayers.OnToggled += args => ArabicaConfig.LogPlayers = args.Pressed;
}
}
Loading