// ═══════════════════════════════════════════════════════════════════════
// SETTINGS PANEL — in-battle configuration UI
// ═══════════════════════════════════════════════════════════════════════
function toggleSettings() {
if (STATE.settingsVisible) { closeSettings(); } else { openSettings(); }
}
function closeSettings() {
const p = document.getElementById('hv-settings-panel');
if (p) p.remove();
STATE.settingsVisible = false;
}
function openSettings() {
if (document.getElementById('hv-settings-panel')) return;
STATE.settingsVisible = true;
const p = document.createElement('div');
p.id = 'hv-settings-panel';
p.style.cssText = css({
position: 'fixed',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: '520px',
maxHeight: '80vh',
overflowY: 'auto',
background: '#1a1a2e',
color: '#ccc',
zIndex: '99999',
borderRadius: '8px',
padding: '16px',
fontSize: '12px',
fontFamily: 'monospace',
boxShadow: '0 0 30px rgba(0,0,0,0.8)',
});
const mkTog = (l, k) =>
``;
const mkNum = (l, k, st) =>
`
${l}
`;
p.innerHTML = `
⚙ HV Unified v${VERSION}
Battle
${mkTog('Auto-buff (Haste, Protection, etc.)', 'autoBuff')}
${mkTog('Auto-debuff (Imperil, Weaken)', 'autoDebuff')}
${mkTog('Auto-cure when HP low', 'autoCure')}
${mkTog('Auto Spirit Stance', 'autoSpirit')}
${mkTog('Hover-to-attack mode', 'hoverEnabled')}
${mkTog('Auto-difficulty suggestion', 'autoDifficulty')}
${mkTog('Use attack spells', 'useAttackSpells')}
${mkNum('Cure HP threshold', 'cureHP')}
${mkNum('Item HP threshold', 'cureItemHP')}
${mkNum('Mana gem MP threshold', 'manaGemMP')}
${mkNum('Mana potion MP threshold', 'manaPotionMP')}
${mkNum('Spirit Stance OC%', 'spiritStanceOC', 5)}
Out of Battle
${mkTog('Equip quick sell buttons', 'autoSell')}
${mkTog('Bulk Shrine buttons', 'bulkShrine')}
${mkTog('RE Timer', 'reTimer')}
${mkTog('Training queue info', 'trainingQueue')}
${mkTog('Advisor panel', 'showGuidance')}
${mkTog('Equip KEEP/SELL tags', 'showEquipAdvice')}
UI
${mkTog('Cooldown timers', 'showCooldowns')}
${mkTog('Monster HP numbers', 'showMonsterHP')}
${mkTog('Buff duration counters', 'showDurations')}
${mkTog('Alert colours', 'alertColours')}
${mkTog('Monster numbers', 'showMonsterNumbers')}
${mkTog('Config button', 'cfgButton')}
Changes apply immediately. Press , in battle to open settings.
`;
document.body.appendChild(p);
document.getElementById('hv-settings-close').onclick = closeSettings;
$$('input', p).forEach(inp => {
inp.addEventListener('change', () => {
const k = inp.dataset.key;
if (!k || CFG[k] === undefined) return;
if (inp.type === 'checkbox') CFG[k] = inp.checked;
else CFG[k] = parseFloat(inp.value) || CFG[k];
saveConfig();
refreshUI();
});
});
}