Repository navigation
Refactor golf features, improve UI handling, and enhance capture reliability - #101
Merged
Merged
Conversation
Replace manual character-by-character numeric extraction with Regex-based parsing for robustness. FormatSeconds now uses up to 3 decimal places instead of conditionally rounding. ParseToMilliseconds uses word-boundary regex for ms/s unit detection, validates range/NaN/Infinity, and uses MidpointRounding.AwayFromZero. CustomFishingActions now correctly converts the display value back to milliseconds when populating the time input.
- Replace hardcoded CTRL swing key references with the user-configured Jump key, shown dynamically in all golf dialogs and the instructions label - Refresh golf instructions label when game controls are changed in Settings - Switch key simulation from raw InputSimulator calls to CoreFunctionality.SendKeyDown/Up so remapped keys are used correctly - Temporarily disable background input mode during golf actions (foreground SendInput required) - Wrap async key holds in try/finally to guarantee key release on cancellation - Add pre-flight validation before starting golf: checks for TTR window, empty/invalid action files, and missing SWING POWER action - Route golf action file loading through CustomGolfActionFileManager in both GolfService and CustomActionsGolf - Remove swallowed exception catch in GolfService.StartGolfAsync so errors surface properly
Refactor IsReadyToSwing to search only the top-right region instead of the full window, reducing false positives from orange course graphics. Add multi-variant template support, require two consecutive detections before confirming a turn, and restrict color fallback to timer-only region when no template is saved. Improve PromptForTurnTimerTemplate to support recapture with a Yes/No dialog and return whether a template was saved. Propagate detector status changes to the main status label in GolfService.
Keep UIElementManager's manual fallback data in sync with the legacy coordinate file so Reset State actually clears stale positions. Manual element coordinates are now treated as absolute screen points, invalid manual values outside the game window are discarded and re-searched, and failures now direct the user to recapture the template instead of silently falling back.
Introduces a dedicated `WindowCaptureException` and hardens screenshot capture when `PrintWindow` returns unusable black frames. `ImageRecognition` now retries `PrintWindow` with alternate flags, detects effectively black captures via grid sampling, falls back to visible screen capture when needed, and emits a one-time warning when background capture is unavailable. It also adds explicit minimized-window and invalid-bounds failure messages. Fish and golf detectors were updated to rethrow `WindowCaptureException` instead of swallowing it in generic handlers, so capture failures surface correctly.
- Switch DPI mode to PerMonitorV2 for sharper rendering on high-DPI displays - GlobalKeyboardHook.Start() now returns bool and exposes LastErrorCode; callers show actionable error dialogs on failure - Custom fishing recorders show warnings when nothing was recorded and restore the window before showing dialogs - Key-to-action mapping delegates to GameControls.GetMovementAction() so custom bindings are respected instead of hardcoding arrow keys - Add GetMovementBindingSummary() helper and update recorder UI labels to show the active bindings - Update Random Variance tooltip to clarify it does not provide ban protection - Add README warning about automation policy risks - Fix 'black frame' log messages to say 'blank frame'; add uniform-frame detection to PrintWindow fallback logic
Update to version 2.7.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and fixes to the Toontown Rewritten Bot, focusing on more robust handling of custom golf actions, improved coordinate management, and general code quality. It also updates the version to 2.7.0.0 and adds a warning about bot usage risks.
Golf Actions and File Handling Improvements:
Newtonsoft.Jsondirectly, relying on a utility for loading and validation. [1] [2] [3]Coordinate and UI Element Management:
Red Fishing Buttonentry inUIElementCoordinates.jsonto have null manual and cached coordinates, reflecting the new handling.General Enhancements and Housekeeping:
PerMonitorV2for better high-DPI support.README.mdabout the risks of bot usage and Toontown Rewritten's policies.Other Code Quality Improvements:
Newtonsoft.Jsonusings from several files. [1] [2]These changes collectively improve reliability, user feedback, and maintainability of the bot.