Skip to content

Conversation

@Infinitay
Copy link
Owner

@Infinitay Infinitay commented Dec 20, 2025

This PR is an attempt to better modularize my existing codebase and plugin lifecycle by using abstraction and primarily constructor injection. The few benefits to this refactor are:

  • Cleaner codebase
  • Better defined plugin lifecycle
  • Better dependency injection handling
  • Re-post various game events which will eliminate the need to manually refetching the required data on cold starts (with the exception of a few events such as Varbits)

Events Implemented and Tested

  • Beekeeper
  • Capt' Arnav's Chest
  • Drill Demon
  • Freaky Forester
  • Gravedigger
  • Maze
  • Mime
  • Pinball
  • Sandwich Lady
  • Surprise Exam
  • Quiz Master

feat(module): Created PluginModule class for modular plugin lifecycle

  • Created an abstract class PluginModule to better handle multiple modules within the plugin and to appropriately handle the lifecycle
    • Construct injected common fields such as OverlayManager, Client, and the config
    • Field injected on-demand fields such as EventBus and GameEventManager
    • Automatically (un)registers the module from the EventBus
    • Re-fire various events by utilizing GameEventManager#simulateGameEvents within #startUp
    • Abstracted #onStartUp to handle module starts, #onShutdown to handle module stops, and #isEnabled to determine the status of the module

- Created an abstract class PluginModule to better handle multiple modules within the plugin and to appropriately handle the lifecycle
	- Construct injected common fields such as OverlayManager, Client, and the config
	- Field injected on-demand fields such as EventBus and GameEventManager
	- Automatically (un)registers the module from the EventBus
	- Re-fire various events by utilizing GameEventManager#simulateGameEvents within #startUp
	- Abstracted #onStartUp to handle module starts, #onShutdown to handle module stops, and #isEnabled to determine the status of the module
@Infinitay Infinitay added enhancement New feature or request implementing Actively working on this issue/PR labels Dec 20, 2025
…ycle

- Removed prior injections that have yet to be refactored
- Refactored #startUp, #shutDown, and #onConfigChanged to utilize the new modular system to handle state changes
…fecycle

- Refactored SurpriseExamHelper to the modular plugin lifecycle
	- Now extends PluginModule and implements respective methods, moving the existing start/stop login there
	- Use constructor injection and removed duplicate field injections
- Injected SurpriseExamHelper and added it to the pluginModulesMap
- Improved handling initial runs when (re)starting the plugin when already inside the Surprise Exam random event
	- Primarily for when the puzzle interface is already on screen
@Infinitay Infinitay added the surprise-exam Surprise Exam module label Dec 22, 2025
@Infinitay
Copy link
Owner Author

feat(module): Created PluginModule class for modular plugin lifecycle

  • Created an abstract class PluginModule to better handle multiple modules within the plugin and to appropriately handle the lifecycle
        - Construct injected common fields such as OverlayManager, Client, and the config
        - Field injected on-demand fields such as EventBus and GameEventManager
        - Automatically (un)registers the module from the EventBus
        - Re-fire various events by utilizing GameEventManager#simulateGameEvents within #startUp
        - Abstracted #onStartUp to handle module starts, #onShutdown to handle module stops, and #isEnabled to determine the status of the module

refactor: Start refactoring RandomEventHelper to modular plugin lifecycle

  • Removed prior injections that have yet to be refactored
  • Refactored #startUp, #shutDown, and #onConfigChanged to utilize the new modular system to handle state changes

refactor(surpriseexam): Migrate SurpriseExamHelper to PluginModule lifecycle

  • Refactored SurpriseExamHelper to the modular plugin lifecycle
    • Now extends PluginModule and implements respective methods, moving the existing start/stop login there
    • Use constructor injection and removed duplicate field injections
  • Injected SurpriseExamHelper and added it to the pluginModulesMap

feat(PluginModule): Add #isLoggedIn to check if the player is logged in

feat(surpriseexam): Improve support for starting during active event

  • Improved handling initial runs when (re)starting the plugin when already inside the Surprise Exam random event
    • Primarily for when the puzzle interface is already on screen

- Refactored PirateHelper to the modular plugin lifecycle
	- Now extends PluginModule and implements respective methods, moving the existing start/stop login there
	- Use constructor injection and removed duplicate field injections
- Injected PirateHelper and added it to the pluginModulesMap
- Refactored MimeHelper to the modular plugin lifecycle
	- Now extends PluginModule and implements respective methods, moving the existing start/stop login there
	- Use constructor injection and removed duplicate field injections
- Injected MimeHelper and added it to the pluginModulesMap
…, refactor

- Improved handling initial runs when (re)starting the plugin when already inside the Mime random event
	- Primarily for when the emote button interface is already on screen
- Change Mime text when undetermined emote answer
- Use default font size for overlay
- Refactored Mime animation checks and answer updating into #updateMimeAnimation
@Infinitay
Copy link
Owner Author

refactor(captarnav): Migrate PirateHelper to PluginModule lifecycle

  • Refactored PirateHelper to the modular plugin lifecycle
    • Now extends PluginModule and implements respective methods, moving the existing start/stop login there
    • Use constructor injection and removed duplicate field injections
  • Injected PirateHelper and added it to the pluginModulesMap

refactor(mime): Migrate MimeHelper to PluginModule lifecycle

  • Refactored MimeHelper to the modular plugin lifecycle
    • Now extends PluginModule and implements respective methods, moving the existing start/stop login there
    • Use constructor injection and removed duplicate field injections
  • Injected MimeHelper and added it to the pluginModulesMap

feat(mime): Improve support for starting during active event, overlay, refactor

  • Improved handling initial runs when (re)starting the plugin when already inside the Mime random event
    • Primarily for when the emote button interface is already on screen
  • Change Mime text when undetermined emote answer
  • Use default font size for overlay
  • Refactored Mime animation checks and answer updating into #updateMimeAnimation

@Infinitay
Copy link
Owner Author

Note, while testing the Mime module, I noticed that starting and stopping the refactored Gravedigger module (multiple times) seems to have overlay issues again when switching back to field injection for both overlays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request implementing Actively working on this issue/PR surprise-exam Surprise Exam module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants