working on crop
This commit is contained in:
parent
93e2234c4e
commit
f74e3e1c85
12 changed files with 1135 additions and 220 deletions
|
|
@ -214,24 +214,39 @@ export class Bot extends EventEmitter {
|
|||
this.gameController, this.screenReader, this.logWatcher, this.config,
|
||||
);
|
||||
|
||||
// /hideout + waitForAreaTransition
|
||||
this.emit('log', 'info', 'Sending /hideout command...');
|
||||
await this.gameController.focusGame();
|
||||
const arrivedHome = await this.inventoryManager.waitForAreaTransition(
|
||||
this.config.travelTimeoutMs,
|
||||
() => this.gameController.goToHideout(),
|
||||
);
|
||||
if (arrivedHome) {
|
||||
// Pre-warm OCR daemon + EasyOCR model in background (don't await yet)
|
||||
const ocrWarmup = this.screenReader.warmup().catch(err => {
|
||||
logger.warn({ err }, 'OCR warmup failed (will retry on first use)');
|
||||
});
|
||||
|
||||
// Check if already in hideout from log tail
|
||||
const alreadyInHideout = this.logWatcher.currentArea.toLowerCase().includes('hideout');
|
||||
|
||||
if (alreadyInHideout) {
|
||||
logger.info({ area: this.logWatcher.currentArea }, 'Already in hideout, skipping /hideout command');
|
||||
this.inventoryManager.setLocation(true);
|
||||
this.logWatcher.currentArea = 'Hideout';
|
||||
} else {
|
||||
this.inventoryManager.setLocation(true);
|
||||
this.logWatcher.currentArea = 'Hideout';
|
||||
logger.warn('Timed out waiting for hideout transition on startup (may already be in hideout)');
|
||||
this.emit('log', 'info', 'Sending /hideout command...');
|
||||
await this.gameController.focusGame();
|
||||
const arrivedHome = await this.inventoryManager.waitForAreaTransition(
|
||||
this.config.travelTimeoutMs,
|
||||
() => this.gameController.goToHideout(),
|
||||
);
|
||||
if (arrivedHome) {
|
||||
this.inventoryManager.setLocation(true);
|
||||
this.logWatcher.currentArea = 'Hideout';
|
||||
} else {
|
||||
this.inventoryManager.setLocation(true);
|
||||
this.logWatcher.currentArea = 'Hideout';
|
||||
logger.warn('Timed out waiting for hideout transition on startup (may already be in hideout)');
|
||||
}
|
||||
}
|
||||
this.state = 'IN_HIDEOUT';
|
||||
this.emit('log', 'info', 'In hideout, ready to trade');
|
||||
|
||||
// Ensure OCR warmup finished before proceeding to inventory scan
|
||||
await ocrWarmup;
|
||||
|
||||
// Clear leftover inventory
|
||||
this.emit('log', 'info', 'Checking inventory for leftover items...');
|
||||
await this.inventoryManager.clearToStash();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue