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

Add support for the ModeratorEvent sim callback #121

Closed
3 tasks done
Garanas opened this issue Mar 19, 2024 · 0 comments · Fixed by #123
Closed
3 tasks done

Add support for the ModeratorEvent sim callback #121

Garanas opened this issue Mar 19, 2024 · 0 comments · Fixed by #123

Comments

@Garanas
Copy link
Member

Garanas commented Mar 19, 2024

Description

The goal is to introduce a new sim callback with the sole responsibility to inform the moderators. At the moment we (ab)use the GiveResourcesToPlayer callback which is also (ab)used by chat messages. Therefore we'll effectively extend the functionality of the following file/class:

  • faf-commons-data/src/main/java/com/faforever/commons/replay/ReplayDataParser.java

Checklist

  • Create a new class called ModeratorEvent, similar to ChatMessage except that there's no receiver field.
  • Create a new private field ModeratorEvents in the ReplayDataParser class. This will be an array list of type ModeratorEvent, just like the chat messages are.
  • In the function parseTicks we want to extend the case CMDST_LUA_SIM_CALLBACK to also check for the ModeratorEvent sim callback. The format of the sim callback is as follows:
---@class ModeratorEvent
---@field From number
---@field Message string

And as an example:

{ From: 1, Message: 'killed 50 units' }

These should be parsed and pushed into the previously mentioned private field ModeratorEvents. An (untested) example can be found in: #102

Notes

It may be interesting to also store the active command source in the ModeratorEvent class. If the player in question is not meddling with the callbacks, it should represent the same value as the From field in the callback.

magge-faf added a commit to magge-faf/faf-java-commons that referenced this issue Mar 20, 2024
@Garanas Garanas linked a pull request Mar 20, 2024 that will close this issue
Sheikah45 pushed a commit that referenced this issue Mar 22, 2024
* Added ModeratorEvent to ReplayDataParser and handled activeCommandSource (#121)

* WIP

* Removed unused code

* Removed unnecessary code and added basic unit testing for testParseModeratorEvent

* Changed from Float to Integer, represents focus army

* Switched to using Java records instead of traditional classes for less boilerplate code
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 a pull request may close this issue.

1 participant