Wurst7 icon indicating copy to clipboard operation
Wurst7 copied to clipboard

New hack: MurderMystery + .mm command

Open BlueGradientHorizon opened this issue 4 months ago • 7 comments

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.

BlueGradientHorizon avatar Mar 02 '24 18:03 BlueGradientHorizon

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 02 '24 18:03 CLAassistant

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 fc14057e50c948cf11cab57e7dc0c8ccb95c6460 and e6b9eeeeabe38983eaba690055ce302ab53ed333.
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.

coderabbitai[bot] avatar Mar 02 '24 18:03 coderabbitai[bot]

@coderabbitai review

BlueGradientHorizon avatar Mar 03 '24 15:03 BlueGradientHorizon

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

BlueGradientHorizon avatar Apr 21 '24 12:04 BlueGradientHorizon