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

New hack: MurderMystery + .mm command #963

Conversation

BlueGradientHorizon
Copy link

@BlueGradientHorizon BlueGradientHorizon commented Mar 2, 2024

Description

This is a hack for mini-game called Murder Mystery. Its goal is to listen for entity equipment update packages and, if in player's main hand item is one of defined in hack settings (separately for murderers and detectives), then add that player to corresponding list and start displaing a texture (i call it "indicator") of sword, bow or both (if murderer got the bow by collecting gold ingots) above player's head. Notifications about found murderers or detectives in chat can be enabled or disabled separatly, just as indicators for both sword and bow.
The only one reason i also implemented .mm command is because i found a server which uses a proxy for players transfering between servers (like bungeecord), and it was used for transfering them between waiting lobby and game arena. On mini-game end, when all players were teleported back to lobby, server didn't sent PlayerRespawnS2CPacket to client. It was my only idea to somehow detect player transfering. So, manually clearing the murderers and detectives lists will be required in such rare case using .mm clear. If you have any ideas, open an issue and mention me, thanks.

Testing

Real game experience is the most suitable way to test this hack's functions. I was playing with it several hours, and there was one bug i catched some sort of randomly (ConcurrentModificationException, fixed by using fail-safe CopyOnWriteArrayList for players).

I know, ruining game for players is vile, and don't really recommend doing it on purpose. Just for fun. I remember Impact client had similar feature, and i wanted to implement it in Wurst. It was interesting.

References

None.

2024-03-02_20 35 47

Summary by CodeRabbit

  • New Features
    • Added a new MurderMysteryCmd for managing Murder Mystery game statistics, including commands to display and clear lists of murderers and detectives.
    • Introduced MurderMysteryHack which enhances gameplay by displaying role indicators above players, listing game-specific items, and auto-clearing lists based on game events.

@CLAassistant
Copy link

CLAassistant commented Mar 2, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

coderabbitai bot commented Mar 2, 2024

Walkthrough

Walkthrough

The recent update enhances the WurstClient with a focus on the Murder Mystery game mode. It introduces the MurderMysteryCmd class for managing session statistics and player roles, along with the MurderMysteryHack for improved gameplay features like visual indicators and automated functionalities. These changes aim to elevate the player experience by providing more information and strategic tools during Murder Mystery sessions.

Changes

File Path Change Summary
.../command/CmdList.java Added MurderMysteryCmd entity to the CmdList class.
.../commands/MurderMysteryCmd.java Introduces a class managing Murder Mystery session statistics, murderers, and detectives.
.../hacks/MurderMysteryHack.java Introduces a hack adding Murder Mystery game mode functionality like role indicators and lists.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between fc14057 and e6b9eee.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1 hunks)
Additional Context Used
Learnings (1)
src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1)
User: Alexander01998"
PR: Wurst-Imperium/Wurst7#850
File: src/main/java/net/wurstclient/hacks/XRayHack.java:136-138
Timestamp: 2023-12-14T13:56:33.292Z
Learning: Wurst Client hacks retrieved via `WURST.getHax().someHack` are guaranteed to be non-null and do not require null checks.
Additional comments not posted (7)
src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (7)

44-148: The implementation of MurderMysteryHack class is comprehensive, covering various functionalities such as settings management, player role detection, and rendering indicators. The use of CopyOnWriteArrayList for thread-safe operations and the registration of event listeners in the constructor are appropriate for the intended functionality.


98-101: The clearMurderers method correctly clears the list of murderers. This is a simple and effective implementation.


103-108: The method getMurderersCommaSeparatedEnumerationString effectively generates a comma-separated string of murderer names, using Java streams. The formatting with Minecraft color codes is correctly implemented.


112-115: The clearDetectives method correctly clears the list of detectives. This is a simple and effective implementation.


117-122: The method getDetectivesCommaSeparatedEnumerationString effectively generates a comma-separated string of detective names, using Java streams. The formatting with Minecraft color codes is correctly implemented.


124-130: The clearLists method effectively clears the lists of murderers and detectives based on user settings. This method is well-implemented to handle client events such as DISCONNECT and JOIN.


284-328: The onReceivedPacket method is well-implemented, handling equipment updates to correctly identify and update player roles. The method makes good use of settings to provide user-configurable notifications.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 86f3ae8 and 612a1f3.
Files ignored due to path filters (2)
  • src/main/resources/assets/wurst/lang/en_us.json is excluded by: !**/*.json
  • src/main/resources/assets/wurst/lang/ru_ru.json is excluded by: !**/*.json
Files selected for processing (4)
  • src/main/java/net/wurstclient/command/CmdList.java (1 hunks)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (1 hunks)
  • src/main/java/net/wurstclient/hack/HackList.java (1 hunks)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1 hunks)
Additional comments: 17
src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (6)
  • 11-16: The command description and usage instructions are clear and informative, providing users with a good understanding of the command's purpose and how to use it.
  • 22-25: The default action when no arguments are provided is to display statistics. This is a user-friendly default behavior, ensuring that users can quickly access information without needing to remember specific argument keywords.
  • 28-29: Correctly throws a CmdSyntaxError if more than the expected number of arguments are provided, ensuring that users are informed of incorrect usage.
  • 31-43: The switch statement handles different command arguments effectively, providing clear paths for "stat" and "clear" operations, and defaulting to a syntax error for unrecognized arguments. This structure is logical and maintainable.
  • 47-51: The stat method retrieves and displays the comma-separated lists of murderers and detectives. This method is concise and leverages the MurderMysteryHack class effectively to obtain the necessary information.
  • 54-86: The clear method provides functionality to clear the lists of murderers, detectives, or both, based on the provided argument. The method is well-structured and includes appropriate error handling for unexpected arguments.
src/main/java/net/wurstclient/command/CmdList.java (1)
  • 49-49: The MurderMysteryCmd has been correctly instantiated and added to the CmdList class. This ensures that the new command will be available for use within the Wurst client.
src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (9)
  • 42-44: The scale setting allows users to adjust the size of the indicators, providing flexibility in how the hack is visually represented. This is a thoughtful addition that enhances user experience.
  • 46-49: The murdererItems and detectiveItems settings (lines 46-54) allow users to customize the items that identify murderers and detectives. This flexibility is valuable for accommodating different game variations or server-specific rules.
  • 56-63: The checkbox settings for showing indicators and reporting in chat (lines 56-71) provide users with control over the hack's behavior, allowing for a customizable experience based on personal preference or gameplay strategy.
  • 73-81: The auto-clear settings for murderers and detectives lists (lines 73-81) are a practical feature that helps manage the lists efficiently, especially in scenarios where players frequently join or leave games.
  • 122-137: The constructor initializes the hack with its name, category, settings, and event listeners for clearing lists on disconnect or join events. This setup is comprehensive and ensures that the hack is fully functional upon activation.
  • 140-153: The methods for enabling and disabling the hack add and remove the necessary event listeners, ensuring that the hack's functionality is properly managed based on its active state.
  • 156-169: The onUpdate method updates the list of players in the game, filtering out ineligible entities. This is crucial for maintaining an accurate list of potential murderers and detectives.
  • 203-270: The onRender method, responsible for rendering the indicators above players' heads, is well-implemented. It includes logic for scaling the indicators based on distance and player roles, enhancing the visual clarity and usefulness of the indicators.
  • 273-319: The onReceivedPacket method handles EntityEquipmentUpdateS2CPacket packets to identify murderers and detectives based on their held items. This method is central to the hack's functionality, effectively updating the player lists based on in-game actions.
src/main/java/net/wurstclient/hack/HackList.java (1)
  • 129-129: The MurderMysteryHack has been correctly instantiated and added to the HackList class. This ensures that the new hack will be available for use within the Wurst client.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 612a1f3 and 71bed0e.
Files selected for processing (1)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java

@BlueGradientHorizon
Copy link
Author

@coderabbitai review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 71bed0e and 692f29f.
Files selected for processing (2)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (1 hunks)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java

@BlueGradientHorizon BlueGradientHorizon marked this pull request as draft March 3, 2024 20:22
…ctive items describing (didn't know about that setting existence)
@BlueGradientHorizon BlueGradientHorizon marked this pull request as ready for review March 4, 2024 15:23
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 692f29f and e8bb06d.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e8bb06d and 05e7631.
Files selected for processing (1)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/net/wurstclient/hacks/MurderMysteryHack.java

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 05e7631 and fc14057.
Files selected for processing (1)
  • src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (1 hunks)
Additional comments: 4
src/main/java/net/wurstclient/commands/MurderMysteryCmd.java (4)
  • 18-23: The constructor is well-defined, providing clear information about the command's usage, including managing MurderMystery session statistics and clearing lists. This makes the command intuitive for users.
  • 26-52: The call method is well-structured, handling different command arguments effectively. It's important to ensure that WURST.getHax().murderMysteryHack is always non-null to avoid potential NullPointerExceptions.
  • 54-59: The stat method effectively displays the lists of murderers and detectives. Consider ensuring that the messages are user-friendly and provide clear information to the player.
  • 61-94: The clear method is well-implemented, offering functionality to clear lists of murderers, detectives, or both. Ensure that the feedback messages to the user are clear and informative.

@Alexander01998 Alexander01998 added type:enhancement New feature or request type:new feature A new hack/command/etc. category:render labels Mar 25, 2024
@BlueGradientHorizon
Copy link
Author

From now on, this PR branch will not be merged with master until further notice about including these changes.

Copy link

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

@BlueGradientHorizon
Copy link
Author

Porting my PR to 1.21 update, idk why but texture indicators don't render. Trying to fix it but starting feeling myself a bit dumb.

@grape-lol
Copy link

Do you have discord?

Copy link

This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.

Pull requests should be closed if:

  • They have been superseded by another pull request
  • They are out of scope or don't align with the project
  • They have become obsolete due to other changes
  • They have bugs or conflicts that won't be resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants