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

Friendlist update #7

merged 4 commits into from
Dec 29, 2024

Conversation

noverd
Copy link
Owner

@noverd noverd commented Dec 29, 2024

Friend list & toggle fov

Summary by Sourcery

Add friend list functionality and a toggle for the field of view.

New Features:

  • Added a friend list feature, allowing players to add and remove friends using console commands. The friend list is used to exclude friends from certain actions, such as aimbot targeting.
  • Added a toggle in the cheat menu to disable the field of view (FOV) occlusion.

Tests:

  • Added a DrawOcclusionDepth patch.

Copy link

sourcery-ai bot commented Dec 29, 2024

Reviewer's Guide by Sourcery

This pull request introduces a friend list feature and a toggle for the field of view. It also includes several related commands and UI updates.

Sequence diagram for Friend Management

sequenceDiagram
    actor User
    participant Console
    participant FriendSystem
    participant Config

    User->>Console: arabica.friend username
    Console->>FriendSystem: Execute command
    FriendSystem->>Config: Add to FriendsSet
    Config-->>Console: Success/Error message
    Console-->>User: Display result

    User->>Console: arabica.unfriend username
    Console->>FriendSystem: Execute command
    FriendSystem->>Config: Remove from FriendsSet
    Config-->>Console: Success/Error message
    Console-->>User: Display result
Loading

Class diagram for new Friend Commands

classDiagram
    class IConsoleCommand {
        <<interface>>
        +string Command
        +string Description
        +string Help
        +Execute(IConsoleShell, string, string[])
    }

    class ArabicaFriendCommand {
        +string Command
        +string Description
        +string Help
        +Execute()
    }

    class ArabicaUnfriendCommand {
        +string Command
        +string Description
        +string Help
        +Execute()
    }

    class ArabicaFriendList {
        +string Command
        +string Description
        +string Help
        +Execute()
    }

    IConsoleCommand <|-- ArabicaFriendCommand
    IConsoleCommand <|-- ArabicaUnfriendCommand
    IConsoleCommand <|-- ArabicaFriendList
Loading

File-Level Changes

Change Details Files
Added friend list functionality.
  • Added ArabicaFriendComponent to track friends.
  • Added IsFriend method to check if an entity is a friend.
  • Added friend list UI elements.
  • Integrated friend list with aimbot.
  • Added commands for managing the friend list: arabica.friend, arabica.unfriend, and arabica.friend_list.
  • Added FriendsSet to ArabicaConfig to store the friend list.
  • Updated aimbot logic to exclude friends from targeting.
ArabicaCliento/Systems/ArabicaFriendSystem.cs
ArabicaCliento/UI/CheatMenuWindow.xaml.cs
ArabicaCliento/ArabicaConfig.cs
ArabicaCliento/Systems/ArabicaAimSystem.cs
ArabicaCliento/Commands/Arabica.Friend.cs
ArabicaCliento/Commands/Arabica.Unfriend.cs
ArabicaCliento/Commands/Arabica.FriendList.cs
Added a toggle for the field of view (FOV).
  • Added a toggle button to the cheat menu UI to enable/disable FOV.
  • Added FOVDisable to ArabicaConfig to store the FOV toggle state.
  • Added a Harmony patch to control FOV based on the toggle state.
ArabicaCliento/UI/CheatMenuWindow.xaml.cs
ArabicaCliento/ArabicaConfig.cs
ArabicaCliento/Patches/DrawOcclusionDepthPatch.cs
Added a Discord button to the UI.
  • Added a button to the cheat menu that opens the Arabica Discord link.
  • Created a system to handle opening the Discord link and storing a local file to prevent the link from opening repeatedly.
ArabicaCliento/UI/CheatMenuWindow.xaml.cs
ArabicaCliento/Systems/ArabicaDiscordSystem.cs
Removed unnecessary dependencies.
  • Removed unused dependencies from several command classes.
ArabicaCliento/Commands/Arabica.PlayerList.cs
ArabicaCliento/Commands/Arabica.Zoom.cs
ArabicaCliento/Commands/Spin/Spin.SetDegrees.cs
ArabicaCliento/Commands/Spin/Spin.SetEnabled.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @noverd - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Add input validation for friend/unfriend commands to handle null/empty usernames and other edge cases
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


public void Execute(IConsoleShell shell, string argStr, string[] args)
{
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.

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

@noverd
Copy link
Owner Author

noverd commented Dec 29, 2024

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @noverd - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The Discord integration automatically opens URLs and writes files without user consent. This is a security concern - consider making this opt-in and adding proper user confirmation before taking these actions.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

Comment on lines +1 to +5
using HarmonyLib;

namespace ArabicaCliento.Patches;

[HarmonyPatch("Robust.Client.Graphics.Clyde.Clyde", "DrawOcclusionDepth")]
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))]

@noverd noverd merged commit 742e1b6 into main Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants