Fix prototype: calibrate vision for real D2R screenshots, implement orb detection, improve dashboard

- Created debug tool (cmd/debug/main.go) to analyze real D2R screenshots and calibrate HSV ranges
- Fixed HSV color ranges for health/mana orbs based on real screenshot analysis (99.5% and 82% detection rates)
- Replaced ReadBarPercentage with ReadOrbPercentage for circular orbs (not horizontal bars)
- Added SetSource() method to capture Manager for hot-swapping capture sources
- Fixed dashboard JavaScript null reference errors with proper array checks
- Improved dashboard refresh rate from 100ms to 1000ms for better performance
- Added proper error handling for empty/null API responses
- Successfully detecting game state, health (99.5%), and mana (82%) from real D2R screenshot
This commit is contained in:
Hoid 2026-02-14 10:55:30 +00:00
parent 4ebed5e3ab
commit 4f0b84ec31
10 changed files with 473 additions and 19 deletions

View file

@ -399,7 +399,9 @@
renderRegionsList();
// Enable all regions by default
regions.forEach(region => visibleRegions.add(region.name));
if (regions && Array.isArray(regions)) {
regions.forEach(region => visibleRegions.add(region.name));
}
addLogLine('INFO', `Loaded ${regions.length} regions`);
} catch (error) {
@ -412,7 +414,8 @@
const container = document.getElementById('regions-list');
container.innerHTML = '';
regions.forEach(region => {
if (regions && Array.isArray(regions)) {
regions.forEach(region => {
const item = document.createElement('div');
item.className = 'region-item';
@ -436,7 +439,8 @@
item.appendChild(checkbox);
item.appendChild(label);
container.appendChild(item);
});
});
}
}
// Update bot status
@ -517,13 +521,15 @@
const container = document.getElementById('routines-list');
container.innerHTML = '';
routines.forEach(routine => {
const item = document.createElement('div');
item.style.fontSize = '11px';
item.style.marginBottom = '3px';
item.innerHTML = `• ${routine.name} <span style="color: #888;">[${routine.phase}]</span>`;
container.appendChild(item);
});
if (routines && Array.isArray(routines)) {
routines.forEach(routine => {
const item = document.createElement('div');
item.style.fontSize = '11px';
item.style.marginBottom = '3px';
item.innerHTML = `• ${routine.name} <span style="color: #888;">[${routine.phase}]</span>`;
container.appendChild(item);
});
}
} catch (error) {
addLogLine('ERROR', `Failed to update routines: ${error.message}`);
@ -575,7 +581,7 @@
await updateState();
await updateStats();
await updateCaptureImage();
}, 100); // 10 FPS update rate
}, 1000); // 1 FPS update rate for dev (less aggressive)
// Slower updates for less frequent data
setInterval(async () => {