agoara update
This commit is contained in:
@@ -139,3 +139,35 @@ Players manually open the World Wonder window and use UI helpers to calculate ho
|
||||
**Benefits:**
|
||||
- Maximizes alliance contributions to World Wonders around the clock.
|
||||
- Perfectly balances resources sent so the player doesn't accidentally empty their town of a critical resource.
|
||||
|
||||
## 6. On-Demand Market Capacity & Trade Order Monitor
|
||||
**Inspired by:** `3rdparty/ModernBot.user.js` (`getAllTrades`) and `3rdparty/DIO-TOOLS-David1327 stamasPacket.user.js` (transport capacity logic)
|
||||
|
||||
**Background & Why Previous Attempts Failed:**
|
||||
Earlier attempts to read market capacity via `town.getAvailableTradeCapacity()` and active orders via `uw.MM.getCollections().Trade` consistently returned empty/zero values. The root cause: both APIs depend on Grepolis having pre-loaded the town's trade models in memory, which only happens if the user has recently opened that specific town's market window. For towns the user hasn't visited this session, the models are simply absent.
|
||||
|
||||
**Proposed Implementation (On-Demand, Single AJAX Call):**
|
||||
- Add a **[Sync Market 🔄]** button in the dashboard town details panel.
|
||||
- On click, the dashboard sends a `POST /api/market-sync-request` to Flask.
|
||||
- The bot detects the pending request during its next poll cycle and executes a single AJAX call:
|
||||
```javascript
|
||||
uw.gpAjax.ajaxGet('town_overviews', 'trade_overview', {}, true, e => {
|
||||
// e.towns_merchants → available & total merchant capacity per town
|
||||
// e.movements → all active incoming & outgoing shipments
|
||||
});
|
||||
```
|
||||
- The `true` flag fetches data for **all towns simultaneously** — one call, full empire snapshot.
|
||||
- The bot pushes the result to Flask via `POST /api/market-state`.
|
||||
- The dashboard polls and renders:
|
||||
- **Capacity** inline in the town detail panel (e.g., `Merchants: 8 / 15`)
|
||||
- **Shipments** as a small list: `→ Αθήνα: 2,500 🪵 (12m 30s)` / `← Σπάρτη: 1,800 ⛏️ (3m)`
|
||||
|
||||
**UI Layout (TBD):**
|
||||
- Capacity shown inline with resources (compact).
|
||||
- Shipments shown in a collapsible section or modal — to be decided with user.
|
||||
|
||||
**Benefits:**
|
||||
- Zero automatic polling — completely stealthy, fires only when the user explicitly requests it.
|
||||
- Bypasses the model-dependency problem entirely by going straight to the Grepolis server.
|
||||
- A single AJAX call populates market data for all towns at once, making it highly efficient.
|
||||
- Follows the existing Live Sync button pattern — no new architectural concepts needed.
|
||||
|
||||
Reference in New Issue
Block a user