Skip to content

2.4.0#89

Merged
primetime43 merged 9 commits into
mainfrom
develop
May 15, 2026
Merged

2.4.0#89
primetime43 merged 9 commits into
mainfrom
develop

Conversation

@primetime43

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and fixes across the gardening automation, UI element management, and golf course detection features. The main focus is on making gardening actions more flexible and robust (including overlay management and water count customization), enhancing UI element location diagnostics, and improving course name matching accuracy. There are also updates to cached UI element positions and versioning.

Gardening Automation Improvements:

  • The PlantFlowerAsync method now accepts a waterCount parameter to allow custom watering counts, skips watering steps if zero, and plays an audible cue on completion. Overlay management is improved with the introduction of HideOverlay (non-destructive hide) and CloseOverlay (disposes overlay), and overlay updates are made thread-safe. [1] [2] [3] [4] [5] [6] [7] [8]
  • Overlay visibility logic is improved to ensure the overlay is shown or hidden appropriately without losing state between actions. [1] [2]

UI Element Location & Diagnostics:

  • Added GetElementLocationWithSourceAsync in UIElementManager, which returns both the element's location and the source (cache, template, manual), allowing for more detailed logging and diagnostics. All usages and logs are updated to reflect the source of coordinates. [1] [2] [3] [4]

Golf Course Detection Enhancement:

  • Improved the MatchCourseName logic to prioritize longer/more specific course names before substring matches, reducing false positives when course names are substrings of others. [1] [2]

UI Element Template & Cache Updates:

  • Updated UIElementCoordinates.json with new or corrected cached coordinates, timestamps, and additional template variants for several UI elements, improving reliability of image recognition. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Versioning:

  • Bumped application version to 2.4.0.0 in AssemblyInfo.cs, .csproj, and GlobalSettings.cs to reflect these changes. [1] [2] [3]

After #80 made GetElementLocationAsync return cached centers without
re-verifying, capturing new template variants or updating manual
coordinates had no effect — the cache short-circuited every lookup
and the bot kept clicking the stale location. Most visible on fishing
(RedFishingButton is resolved every cast).

Drop CachedCenter when SaveTemplate or SaveTemplateVariant runs, and
when SetManualCoordinates is called with a value that actually changed
(CoordinatesManager calls it on every lookup, so unconditional
clearing would defeat caching). Reset All in the Dev tab now also
clears the cache so users with stale state from prior builds have
a one-click fix.
Introduce a "Reset State" developer button and add UI for doodle training cycles.

- Add devResetCoordinatesBtn to the Debug group (moves it out of the coordinates group), set its size, location, tooltip and click handler to reset manual coordinates and clear the image-recognition cache. Update the Debug/Open Config layout accordingly.
- Add doodle training controls: Cycles label, numericUpDownMaxTricks and "times" label, with proper initialization (BeginInit/EndInit), tooltips and defaults. Reorder some control declarations and adjust a few control sizes/positions for layout consistency.
- Shorten/resize the Download OCR button text and size, and update the MessageBox text in MainForm.Dev.cs to a more informative string and icon.
- Update MainForm.resx: add devResetCoordinatesBtn.ToolTip text and tidy up some metadata entries and resource data.

Misc: small form layout/spacing tweaks (label sizes, comments formatting) to keep the designer generated code consistent.
Make watering behavior configurable and allow skipping it. Change PlantFlowerAsync signature to accept an int waterCount (negative values clamped to 0) and update overlay text/step counting to reflect the chosen water count. Optimize watering flow by only locating the watering-can button when waterCount > 0 and support 0 waters to skip the loop. WaterPlantAsync now returns immediately if the requested count is <= 0. UI changes: read the water spinner value on the UI thread and pass it into the planting service; during batch actions per-action WaterCount overrides the UI spinner when set. Designer tweak: allow the spinner to be 0 (removed minimum) and add a tooltip explaining that 0 will skip auto-watering after planting. Minor .resx designer asset update included.
Introduce CloseOverlay (and CloseOverlayInternal) to explicitly close and dispose the gardening overlay while keeping HideOverlay for in-session hiding/preserving state. Replace several async BeginInvoke calls with synchronous Invoke to ensure UI operations occur on the UI thread, and make ShowOverlay reuse the existing overlay when hidden. Move the gardening overlay panel to the bottom-right of the screen (adjust panelY) and update the related comment. Update UIElementCoordinates.json cached coordinates and timestamps for multiple template entries (add/update Remove Plant, Scratch Doodle and several jellybean/plant buttons) from recent captures to improve template lookups.
Introduce a non-modal plantStatusLabel to the gardening UI and use it to display planting progress and results (success, cancelled, error) with colored text and timestamps. Replace intrusive completion MessageBox/overlay updates in Services.Gardening with an audible cue (SystemSounds.Asterisk.Play()) so the UI label is the primary visible indicator. Add SetPlantStatus helper to MainForm.Gardening to update label text, color, and tooltip; update planting routine to set status before/after operations and on exceptions.
GetElementLocationAsync short-circuits on cached coordinates, but
CoordinatesManager labelled every successful resolve as
[source=ImageRec] — so stale-cache bugs (like the one in #84)
looked like template-matching bugs in the logs, sending people
chasing the wrong theory. Add a UIElementSource enum
(Cache/ImageRec/Manual/None) and a GetElementLocationWithSourceAsync
overload that returns where the value actually came from. The
existing GetElementLocationAsync delegates and drops the source,
so callers outside CoordinatesManager don't change.
MatchCourseName did a substring-containment scan of CourseNameToFile
in dictionary insertion order. Since "Whole in Won" is a substring
of "Whole in Won-2" and the shorter key is inserted first, OCR text
for the harder course resolved to the easier course and the wrong
action file ran. 17 courses with both a base and "-2" variant were
affected. Iterate candidates by descending key length so the more
specific name claims the match first. Same ordering fix applied to
the fuzzy-match fallback below it. #86
Bump to version 2.4.0
@primetime43 primetime43 self-assigned this May 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73bd596be1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"ManualCoordinates": null,
"CachedCenter": null,
"LastFoundTime": null
"CachedCenter": "72, 271",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not ship per-window cached button coordinates

Because GetElementLocationWithSourceAsync returns element.CachedCenter before attempting template matching when HasCachedCoordinates is true, this committed cache is used immediately for Plant Flower Button instead of being discovered on the user's machine. On any TTR window with a different resolution/layout from the one that produced 72, 271, planting clicks the wrong spot and never prompts for recapture; shipped template data should leave these caches null so they are populated locally.

Useful? React with 👍 / 👎.

@primetime43 primetime43 merged commit 2283ad8 into main May 15, 2026
2 checks passed
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 this pull request may close these issues.

1 participant