Skip to content

feat(farming): inactive finder, free oases and add to farm list - #176

Open
ertugrulkutluer wants to merge 8 commits into
vinaghost:mainfrom
ertugrulkutluer:feat/inactive-finder
Open

ertugrulkutluer wants to merge 8 commits into
vinaghost:mainfrom
ertugrulkutluer:feat/inactive-finder

Conversation

@ertugrulkutluer

@ertugrulkutluer ertugrulkutluer commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

Adds an Inactive finder to the Farming tab (Windows and macOS UI) that lists raid targets around a village and can add them to a farm list.

Depends on #174 (macOS / Avalonia UI) and #175 (apostrophe fix). This branch is built on top of them, so their commits show up here too. Please review/merge those first; the new commits start at f05b7b1.

What it does

  • Inactive players from map.sql: the bot downloads the server's public /map.sql once a day (DownloadMapDataTask, a single request, no game page) and keeps one snapshot per day under the data folder. Players whose total population did not grow over 2 days count as inactive.
    • Until 2 days of snapshots exist it falls back to distance + population filters only, and the status line says so.
    • Filters: radius around a chosen own village, village population range, player population range.
    • Excludes Natars and the account's own villages; distance uses the wrapping map.
  • Free oases and last attack results: reads the tiles the game map itself loads from /api/v1/map/position (zoom 2, four requests for a 15 field radius) through the logged-in browser.
    • Lists free oases with their animals ("Skip oases with animals" is on by default).
    • Shows the result, time and loot of the last own attack on every target, so failed or lossy targets are easy to spot.
    • Uses the language-independent placeholders in the tile data ({k.fo}, {b:ri2}, ...), so it works in any game language.
  • Add to farm list: AddFarmTargetsTask opens the rally point farm list and adds each target through the game's "Add target" dialog with a configurable troop column and amount.
    • Skips coordinates already in the list and respects the 100-target limit.
    • Targets the game does not accept are skipped instead of stopping the bot.
  • Settings: new account settings for radius, population ranges, oasis options and troop column/amount, with validator rules.

Testing

  • MapDataService was tested against the live map.sql of an x10 international server: all 13,042 villages parse, and the filters, wrap-around distance and "not enough history" message were checked.
  • Farm list selectors, the add-target dialog fields and the map tile parsing were checked against the live game (reading only, nothing was saved).
  • Not tested: actually saving a target through AddFarmTargetsTask, and the inactive filter on real multi-day history (needs 2 days of snapshots).
  • WPFUI builds (EnableWindowsTargeting on macOS) but has not been run on Windows.

ertugrulkutluer and others added 8 commits October 14, 2026 15:55
Add AvaloniaUI, a cross-platform port of WPFUI that reuses the
MainCore view models, so TBS can run on macOS.

- AvaloniaUI: every WPFUI view ported to Avalonia 12 + ReactiveUI.
  The UI runs on the process main thread, which macOS requires.
- MainCore: detect Chrome on macOS, keep Windows-only build settings
  conditional, and store data in ~/Library/Application Support on
  macOS. Windows behaviour is unchanged.
- build-mac.sh: builds a self-contained TravianBotSharp.app.
- release.yml: build the macOS app on macos-latest and attach
  TBS-<version>-macOS.zip to the release. The Windows zip is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same fix as PR vinaghost#175, kept here so the local macOS build has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Download the server's public map.sql once a day and keep one snapshot
per day. Players whose total population did not grow over 2 days are
treated as inactive; their villages within a radius of a chosen village
and inside a population range are listed in the Farming tab.

Natars and the account's own villages are excluded and distances use
the wrapping map. Adding the villages to a farm list is not part of
this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an "Add to selected farm list" action to the inactive finder. A new
AddFarmTargetsTask opens the rally point farm list, skips coordinates
already in the list, respects the 100 target limit and adds each
village through the game's add target dialog with the configured troop
column and amount. Targets the game does not accept are skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the tiles the game map loads from /api/v1/map/position (zoom 2,
four requests for a 15 field radius) through the logged in browser.
The inactive finder now also lists free oases with their animals,
optionally skipping oases that have animals, and shows the result,
time and loot of the last own attack on every target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring the inactive finder, free oases, last attack results and the add
to farm list action to the Windows UI, matching the Avalonia layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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