diff --git a/src/main/shortcuts.ts b/src/main/shortcuts.ts index 07f96ad8..8b3f74e7 100644 --- a/src/main/shortcuts.ts +++ b/src/main/shortcuts.ts @@ -107,6 +107,8 @@ function registerGlobal () { register.forEach(a => { const success = globalShortcut.register(shortcutToElectron(a.shortcut!), a.cb) if (!success) { + logger.error('Cannot register shortcut, because it is already registered by another application.', { source: 'shortcuts', shortcut: a.shortcut }) + new Notification({ title: 'Awakened PoE Trade', body: `Cannot register shortcut ${a.shortcut}, because it is already registered by another application.` @@ -149,7 +151,7 @@ export function setupShortcuts () { uIOhook.on('keydown', (e) => { const pressed = eventToString(e) - logger.debug('Keydown', { source: 'shortcuts', keys: pressed }) + // logger.debug('Keydown', { source: 'shortcuts', keys: pressed }) if (!PoeWindow.isActive || config.get('useOsGlobalShortcut')) return @@ -188,24 +190,23 @@ export function setupShortcuts () { }) uIOhook.on('keyup', (e) => { - logger.debug('Keyup', { source: 'shortcuts', key: UiohookToName[e.keycode] || 'unknown' }) + // logger.debug('Keyup', { source: 'shortcuts', key: UiohookToName[e.keycode] || 'unknown' }) }) uIOhook.on('wheel', (e) => { - if (!e.ctrlKey || !PoeWindow.bounds || !PoeWindow.isActive || !config.get('stashScroll')) return + if (!PoeWindow.bounds || !PoeWindow.isActive || !config.get('stashScroll')) return - if (!isGameScrolling(e)) { if (e.rotation > 0) { robotjs.keyTap('ArrowRight') } else if (e.rotation < 0) { robotjs.keyTap('ArrowLeft') } - } }) uIOhook.start() } +// eslint-disable-next-line @typescript-eslint/no-unused-vars function isGameScrolling (mouse: UiohookWheelEvent): boolean { if (!PoeWindow.bounds || mouse.x > (PoeWindow.bounds.x + PoeWindow.uiSidebarWidth)) return false diff --git a/src/web/background/Prices.ts b/src/web/background/Prices.ts index 985e620b..d50c25e1 100644 --- a/src/web/background/Prices.ts +++ b/src/web/background/Prices.ts @@ -138,16 +138,19 @@ async function load (force: boolean = false) { }) if (currency.detailsId === 'exalted-orb') { + const receive = currency.receive.value + const pay = currency.pay?.value ? (1 / currency.pay.value) : undefined // sanity check, better poe.ninja to implement this on its own end - if (currency.receive.value >= 15) { - chaosExaRate.value = currency.receive.value - } else { - // fallback to sell price - if (currency.pay?.value && (1 / currency.pay.value) >= 15) { - chaosExaRate.value = (1 / currency.pay.value) + if (pay) { + if (pay >= 15 && receive >= 15 && + (Math.min(receive, pay) / Math.max(receive, pay)) >= 0.75) { + chaosExaRate.value = receive } else { - chaosExaRate.value = undefined + // fallback to sell price + chaosExaRate.value = (pay >= 15) ? pay : undefined } + } else { + chaosExaRate.value = (receive >= 15) ? receive : undefined } } }