mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-24 21:55:41 +00:00
more checks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user