Skip to content

[WIP] Module Code Refactor and Cleanup#1292

Draft
derfloh205 wants to merge 93 commits into
mainfrom
refactor/EventBasedModules
Draft

[WIP] Module Code Refactor and Cleanup#1292
derfloh205 wants to merge 93 commits into
mainfrom
refactor/EventBasedModules

Conversation

@derfloh205

@derfloh205 derfloh205 commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Refactor Modules to be more generalized, and event subscription based (where it makes sense)

@github-project-automation github-project-automation Bot moved this to Backlog in CraftSim Apr 15, 2026
@derfloh205 derfloh205 changed the title feat: implement module visibility migration and update related option… Module Code Refactor and Cleanup Apr 15, 2026
@derfloh205 derfloh205 changed the title Module Code Refactor and Cleanup Module Code Refactor and Cleanup and Logging Refactor Apr 15, 2026
@derfloh205 derfloh205 linked an issue Apr 16, 2026 that may be closed by this pull request
@derfloh205 derfloh205 moved this from Backlog to In progress in CraftSim Apr 16, 2026
@derfloh205 derfloh205 changed the title Module Code Refactor and Cleanup and Logging Refactor [WIP] Module Code Refactor and Cleanup and Logging Refactor Apr 17, 2026
Copilot AI added a commit that referenced this pull request Apr 17, 2026
…bulk print to Logger changes

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/2eca3faa-5ba2-41e7-b37b-9637c6a38250

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
derfloh205 added a commit that referenced this pull request Apr 17, 2026
* refactor: extract logging changes from PR #1292 - infrastructure and bulk print to Logger changes

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/2eca3faa-5ba2-41e7-b37b-9637c6a38250

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* refactor: update AverageProfit to new logging pattern and fix regression issues in restored files

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/2eca3faa-5ba2-41e7-b37b-9637c6a38250

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* refactor: remove duplicate inner logger registrations, use file-level Logger consistently

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/2eca3faa-5ba2-41e7-b37b-9637c6a38250

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* refactor: remove deprecated RegisterDebugID function and streamline debug frame access

* refactor: remove unnecessary debug logging statements across multiple files

* refactor: clean up whitespace and improve formatting in multiple files

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
Co-authored-by: Genju <derfloh205@gmail.com>
@derfloh205

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

Copilot AI commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts in commit 6d1b5280. The merge brought in the latest changes from main (patron moxie valuation, SBF scan-then-triage refactor, NPC crafting context checks, etc.) while preserving this PR's event-based module refactoring approach.

avilene and others added 14 commits April 25, 2026 13:11
…event triggers

- Removed duplicate event trigger for CRAFTSIM_RECIPE_DATA_UPDATED in the Init module.
- Added new CRAFTSIM_RECIPE_DATA_MODIFIED event in the Modules module to handle recipe data updates.
- Updated SimulationMode and SpecializationInfo modules to utilize the new event and ensure proper data handling.
- Cleaned up comments and improved code readability across affected files.
- Introduced a new CraftSim.CONST.FRAMES table to define constants for various UI frames.
- This addition enhances the organization and accessibility of frame identifiers within the codebase.
* feat: enhance CraftQueue UI with edit recipe frame functionality

- Added a method to retrieve the edit recipe frame within the CraftQueue module.
- Improved the OpenEditRecipeFrame function to ensure proper display and layering of the edit frame.
- Updated the initialization of the edit recipe frame to maintain correct parent-child relationships in the UI.
- Introduced constants for frame strata to manage popup layering effectively.

* fix: update CraftQueue module to correctly enable the craft queue on auto show

- Replaced the Save method with SetModuleEnabled to ensure the MODULE_CRAFT_QUEUE state is accurately updated when the auto show option is triggered.

* feat: add EditRecipe module to CraftQueue

- Introduced a new EditRecipe module within the CraftQueue to facilitate recipe editing functionality.
- Implemented UI elements for the edit recipe frame, including dynamic reagent management and auto-hide features.
- Updated CraftQueue UI to integrate the new EditRecipe frame, ensuring proper layering and interaction handling.

* refactor: streamline CraftQueue edit recipe functionality

- Removed the direct method for retrieving the edit recipe frame from the CraftQueue module.
- Introduced custom events to manage the lifecycle of the edit recipe frame, enhancing modularity and separation of concerns.
- Updated UI interactions to utilize the new event-driven approach for opening and hiding the edit recipe frame, improving code clarity and maintainability.

* refactor: update event handling for CraftQueue edit recipe module

- Replaced the "CRAFTQUEUE_FRAME_HIDDEN" event with "CRAFTSIM_MODULE_CLOSED" to improve modularity in the CraftQueue edit recipe functionality.
- Adjusted the UI to hide the edit recipe frame based on the new event trigger, enhancing the separation of concerns within the code.
- Cleaned up related comments and documentation for clarity.

* remove custom event trigger

* refactor: remove unused event and streamline EditRecipe initialization

- Eliminated the "CRAFTQUEUE_EDIT_RECIPE_HOST_READY" event and its associated method to simplify the EditRecipe module.
- Updated the initialization process to directly call the EditRecipe UI setup, enhancing clarity and reducing unnecessary complexity.
- Cleaned up related comments and documentation for better understanding of the code structure.
* refactor: streamline Reagent Optimization module and UI updates

- Removed unused code related to the Reagent Optimization Work Order frame.
- Enhanced the Reagent Optimization module by adding a new update method for handling recipe data.
- Updated UI initialization to utilize the new module structure and improve frame management.
- Cleaned up event handling to ensure proper updates on recipe data changes.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: streamline ReagentOptimization UI updates and improve visibility checks

- Removed unnecessary checks in the Update function to simplify UI updates.
- Enhanced the recipe data parameter documentation for clarity.
- Improved visibility logic in the UI to ensure proper context handling.

---------

Co-authored-by: genjuwow <derfloh205@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…1354)

- Added methods to calculate spendable and queueable amounts in ConcentrationData.
- Updated CanAfford method to streamline affordability checks across various modules.
- Refactored UI components to utilize new methods for displaying current concentration values and managing crafting costs.

Co-authored-by: genjuwow <derfloh205@gmail.com>
when closing the profession window, the edit recipe window would stay visible
@derfloh205

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

Copilot AI commented May 11, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Merged in commit f1e0efc. The 6 commits from main (DB2 data updates, TopGear gear selection fix, inventory character info fix, version bump to 26.1.7) merged cleanly with no conflicts.

Copilot AI and others added 11 commits May 12, 2026 09:46
…uldron exclusions (#1372)

* feat(datamining): add multicraft support mapper and output data file

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/e9155b2d-2c03-45ed-8f98-4783462f9bea

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(datamining): exclude alchemy cauldron recipes from multicraft support

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): clarify cauldron filter constants and parsing note

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): normalize cauldron keyword comparison

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): align cauldron keyword constant casing

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): harden cauldron name extraction and keyword matching

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): tighten item name fallback handling for cauldron filter

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(datamining): filter cauldrons by recipe category instead of keyword

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): harden category field handling for cauldron filter

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix: set default debug values for build and module in updateAll.py

* chore(datamining): normalize cauldron category matching logic

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): handle invalid trade skill category IDs safely

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(multicraft): remove obsolete item IDs from MULTICRAFT_SUPPORT_DATA

* fix: reset debug values for build and module in updateAll.py

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
Co-authored-by: Genju <derfloh205@gmail.com>
* fix

* feat(datamining): add multicraft support mapper by profession with cauldron exclusions (#1372)

* feat(datamining): add multicraft support mapper and output data file

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/e9155b2d-2c03-45ed-8f98-4783462f9bea

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(datamining): exclude alchemy cauldron recipes from multicraft support

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): clarify cauldron filter constants and parsing note

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): normalize cauldron keyword comparison

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): align cauldron keyword constant casing

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): harden cauldron name extraction and keyword matching

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): tighten item name fallback handling for cauldron filter

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/825ee9fb-7a2c-4c24-b4a0-60aa20364416

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(datamining): filter cauldrons by recipe category instead of keyword

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): harden category field handling for cauldron filter

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix: set default debug values for build and module in updateAll.py

* chore(datamining): normalize cauldron category matching logic

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* chore(datamining): handle invalid trade skill category IDs safely

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/d3ace29b-28c0-42fc-b327-625337eb7f61

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* fix(multicraft): remove obsolete item IDs from MULTICRAFT_SUPPORT_DATA

* fix: reset debug values for build and module in updateAll.py

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
Co-authored-by: Genju <derfloh205@gmail.com>

* feat(multicraft): enhance recipe initialization and preload logic for professions

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
* feat: enhance concentration tracker UI with moxie display and updates

- Introduced moxie icon display in the concentration tracker, including visibility logic based on moxie quantity.
- Added methods to check for gathering professions and populate tracker rows with relevant data.
- Updated UI layout for the concentration list to accommodate new moxie column and improved spacing.
- Enhanced tooltip functionality for moxie display, providing clearer information to users.

* feat: implement ApplyConcentrationTrackerMoxieIcon function for moxie display

- Added the ApplyConcentrationTrackerMoxieIcon function to manage the display of moxie icons in the concentration tracker.
- Included logic to handle visibility and alpha settings based on moxie quantity thresholds.
- Removed the previous implementation of the function to streamline the code.

* feat: add support for acuity in TWW

* refactor: move GetCrafterProfessionUID to UTIL module

* refactor: streamline concentration tracker logic and update gathering profession handling

- Removed the previous MOXIE_GATHERING_PROFESSIONS definition from UI.lua and moved it to Const.lua for better organization.
- Updated the logic in UpdateTrackerDisplay to utilize the new CrafterHasProfession utility function for checking gathering professions.
- Renamed desiredRowKeys to validRowKeys for clarity in tracking valid entries in the concentration tracker.

---------

Co-authored-by: genjuwow <derfloh205@gmail.com>
…dule.UI` (#1382)

* refactor: migrate remaining legacy modules to module/ui types

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/71d40cf8-516a-4562-bcf7-274e3a90fcb0

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* refactor: align module UIs with review feedback

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/f1ea74ce-f1d4-4e6e-ab04-14f390c16d96

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* refactor: apply follow-up visibility and naming feedback

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/b6511680-81c7-495a-a452-0e8c803b02cd

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

* style: simplify explanations visibility return

Agent-Logs-Url: https://github.com/derfloh205/CraftSim/sessions/b6511680-81c7-495a-a452-0e8c803b02cd

Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: derfloh205 <9341090+derfloh205@users.noreply.github.com>
…ofessions frame opens; enhance CRAFTSIM_RECIPE_DATA_UPDATED and UpdateDisplay with module checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants