mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-27 15:15:48 +00:00
Open base in craft of exile (#159)
* Feature - Open base in craft of exile, default ALT + G * misc Co-authored-by: Alexander Drozdov <snosme@gmail.com>
This commit is contained in:
co-authored by
Alexander Drozdov
parent
c96b89425c
commit
6c91130b85
@@ -62,7 +62,7 @@ export interface IpcOpenSystemBrowser {
|
||||
}
|
||||
|
||||
export const OPEN_WIKI = 'MAIN->OVERLAY::open-wiki'
|
||||
|
||||
export const OPEN_COE = 'MAIN->OVERLAY::open-craft-of-exile'
|
||||
export const IMPORT_FILE = 'OVERLAY->MAIN::import-file'
|
||||
|
||||
export const TOGGLE_DELVE_GRID = 'MAIN->OVERLAY::delve-grid'
|
||||
|
||||
@@ -56,6 +56,10 @@ class MainProcessBinding extends EventTarget {
|
||||
this.dispatchEvent(new CustomEvent(ipcEvent.OPEN_WIKI, { detail }))
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on(ipcEvent.OPEN_COE, (e, detail) => {
|
||||
this.dispatchEvent(new CustomEvent(ipcEvent.OPEN_COE, { detail }))
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on(ipcEvent.TOGGLE_DELVE_GRID, (e) => {
|
||||
this.dispatchEvent(new CustomEvent(ipcEvent.TOGGLE_DELVE_GRID))
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface Config {
|
||||
priceCheckKeyHold: string
|
||||
priceCheckLocked: string | null
|
||||
wikiKey: string | null
|
||||
craftOfExileKey: string | null
|
||||
overlayKey: string
|
||||
overlayBackground: string
|
||||
overlayBackgroundExclusive: boolean
|
||||
@@ -63,6 +64,7 @@ export const defaultConfig: Config = {
|
||||
priceCheckKeyHold: 'Ctrl',
|
||||
priceCheckLocked: 'Ctrl + Alt + D',
|
||||
wikiKey: 'Alt + W',
|
||||
craftOfExileKey: null,
|
||||
overlayKey: 'Shift + Space',
|
||||
overlayBackground: 'rgba(129, 139, 149, 0.15)',
|
||||
overlayBackgroundExclusive: true,
|
||||
|
||||
@@ -32,6 +32,7 @@ export const config = (() => {
|
||||
|
||||
if (forbidden.includes(config.priceCheckLocked as string)) { config.priceCheckLocked = null }
|
||||
if (forbidden.includes(config.wikiKey as string)) { config.wikiKey = null }
|
||||
if (forbidden.includes(config.craftOfExileKey as string)) { config.craftOfExileKey = null }
|
||||
if (forbidden.includes(config.mapCheckKey as string)) { config.mapCheckKey = null }
|
||||
if (config.priceCheckKeyHold === 'Ctrl' && forbiddenCtrl.includes(config.priceCheckKey as string)) {
|
||||
config.priceCheckKey = null
|
||||
|
||||
@@ -75,6 +75,13 @@ function registerGlobal () {
|
||||
robotjs.keyTap('C', ['Ctrl'])
|
||||
}
|
||||
),
|
||||
shortcutCallback(
|
||||
config.get('craftOfExileKey'),
|
||||
() => {
|
||||
pollClipboard().then(openCraftOfExile).catch(() => {})
|
||||
robotjs.keyTap('C', ['Ctrl'])
|
||||
}
|
||||
),
|
||||
shortcutCallback(
|
||||
config.get('mapCheckKey'),
|
||||
mapCheck
|
||||
@@ -154,6 +161,11 @@ export function setupShortcuts () {
|
||||
pollClipboard().then(openWiki).catch(() => {})
|
||||
robotjs.keyTap('C', ['Ctrl'])
|
||||
}).cb()
|
||||
} else if (pressed === config.get('craftOfExileKey')) {
|
||||
shortcutCallback(pressed, () => {
|
||||
pollClipboard().then(openCraftOfExile).catch(() => {})
|
||||
robotjs.keyTap('C', ['Ctrl'])
|
||||
}).cb()
|
||||
} else if (pressed === config.get('mapCheckKey')) {
|
||||
shortcutCallback(pressed, mapCheck).cb()
|
||||
} else if (pressed === config.get('delveGridKey')) {
|
||||
@@ -209,6 +221,10 @@ function openWiki (clipboard: string) {
|
||||
overlayWindow!.webContents.send(ipc.OPEN_WIKI, clipboard)
|
||||
}
|
||||
|
||||
function openCraftOfExile (clipboard: string) {
|
||||
overlayWindow!.webContents.send(ipc.OPEN_COE, clipboard)
|
||||
}
|
||||
|
||||
function toggleDelveGrid () {
|
||||
overlayWindow!.webContents.send(ipc.TOGGLE_DELVE_GRID)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { MainProcess } from '@/ipc/main-process-bindings'
|
||||
import { parseClipboard } from '@/parser'
|
||||
|
||||
const COE_URL = 'https://craftofexile.com/'
|
||||
|
||||
export function openCOE (clipboard: string) {
|
||||
const item = parseClipboard(clipboard)
|
||||
if (!item) return
|
||||
|
||||
const encodedClipboard = encodeURI(clipboard)
|
||||
MainProcess.openSystemBrowser(`${COE_URL}?eimport=${encodedClipboard}`)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { MainProcess } from '@/ipc/main-process-bindings'
|
||||
import * as ipc from '@/ipc/ipc-event'
|
||||
import { openWiki } from './wiki'
|
||||
import { openCOE } from './craft-of-exile'
|
||||
import { handleLine } from '../client-log/client-log'
|
||||
|
||||
export function registerOtherServices () {
|
||||
@@ -11,4 +12,8 @@ export function registerOtherServices () {
|
||||
MainProcess.addEventListener(ipc.CLIENT_LOG_UPDATE, (e) => {
|
||||
handleLine((e as CustomEvent<string>).detail)
|
||||
})
|
||||
|
||||
MainProcess.addEventListener(ipc.OPEN_COE, (e) => {
|
||||
openCOE((e as CustomEvent<string>).detail)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
<hotkey-input v-model="config.mapCheckKey" class="w-48" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="config.language === 'en'" class="mb-4">
|
||||
<div class="flex">
|
||||
<div class="flex-1">Open base item on Craft of Exile</div>
|
||||
<hotkey-input v-model="config.craftOfExileKey" class="w-48" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<div class="flex">
|
||||
<div class="flex-1">{{ $t('Delve grid') }}</div>
|
||||
|
||||
Reference in New Issue
Block a user