mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-27 15:15:48 +00:00
load widgets from cfg
This commit is contained in:
+86
-1
@@ -24,8 +24,28 @@ export interface Config {
|
||||
searchStatRange: number
|
||||
stashScroll: boolean
|
||||
subdomain: string
|
||||
widgets: Widget[]
|
||||
}
|
||||
|
||||
interface Widget {
|
||||
wmId: number
|
||||
wmType: string
|
||||
wmTitle: string
|
||||
wmWants: 'show' | 'hide'
|
||||
wmZorder: number | 'exclusive' | undefined
|
||||
wmFlags: (WidgetWellKnownFlag | string)[]
|
||||
// ---------------
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
type WidgetWellKnownFlag =
|
||||
'uninitialized' |
|
||||
'skip-menu' |
|
||||
'has-browser' |
|
||||
'invisible-on-blur' |
|
||||
'hide-on-blur' |
|
||||
'hide-on-blur(close)'
|
||||
|
||||
export const defaultConfig: Config = {
|
||||
priceCheckKey: 'D',
|
||||
priceCheckKeyHold: 'Ctrl',
|
||||
@@ -60,5 +80,70 @@ export const defaultConfig: Config = {
|
||||
accountName: '',
|
||||
searchStatRange: 10,
|
||||
stashScroll: true,
|
||||
subdomain: 'us'
|
||||
subdomain: 'us',
|
||||
widgets: [
|
||||
// --- REQUIRED ---
|
||||
{
|
||||
wmId: 1,
|
||||
wmType: 'menu',
|
||||
wmTitle: '',
|
||||
wmWants: 'show',
|
||||
wmZorder: 1,
|
||||
wmFlags: ['invisible-on-blur', 'skip-menu'],
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 5,
|
||||
y: 5
|
||||
}
|
||||
},
|
||||
{
|
||||
wmId: 2,
|
||||
wmType: 'price-check',
|
||||
wmTitle: '',
|
||||
wmWants: 'hide',
|
||||
wmZorder: 'exclusive',
|
||||
wmFlags: ['hide-on-blur', 'skip-menu']
|
||||
},
|
||||
// --- DEFAULT ---
|
||||
{
|
||||
wmId: 4,
|
||||
wmType: 'inventory-search',
|
||||
wmTitle: 'Map rolling',
|
||||
wmWants: 'hide',
|
||||
wmZorder: 4,
|
||||
wmFlags: ['invisible-on-blur'],
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 35,
|
||||
y: 46
|
||||
},
|
||||
entries: [
|
||||
{ id: 1, text: '"Pack Size: +3"' },
|
||||
{ id: 2, text: 'Reflect' },
|
||||
{ id: 3, text: '"Cannot Leech Life"' },
|
||||
{ id: 4, text: '"Cannot Leech Mana"' }
|
||||
]
|
||||
},
|
||||
{
|
||||
wmId: 5,
|
||||
wmType: 'inventory-search',
|
||||
wmTitle: 'Dump sorting',
|
||||
wmWants: 'hide',
|
||||
wmZorder: 5,
|
||||
wmFlags: ['invisible-on-blur'],
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 34,
|
||||
y: 56
|
||||
},
|
||||
entries: [
|
||||
{ id: 1, text: 'Currency' },
|
||||
{ id: 2, text: '"Divination Card"' },
|
||||
{ id: 3, text: 'Fossil' },
|
||||
{ id: 4, text: '"Map Tier"' },
|
||||
{ id: 5, text: '"Map Device" "Rarity: Normal"' },
|
||||
{ id: 6, text: 'Tane Laboratory' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -42,56 +42,6 @@ export default {
|
||||
active: false,
|
||||
gameFocused: false,
|
||||
hideUI: false,
|
||||
widgets: [
|
||||
{
|
||||
wmId: 1,
|
||||
wmType: 'timer',
|
||||
wmWants: 'show',
|
||||
wmTitle: 'Timer',
|
||||
wmFlags: [],
|
||||
anchor: {
|
||||
pos: 'cc',
|
||||
x: 10,
|
||||
y: 50
|
||||
}
|
||||
},
|
||||
{
|
||||
wmId: 4,
|
||||
wmType: 'menu',
|
||||
wmWants: 'show',
|
||||
wmFlags: ['invisible-on-blur', 'skip-menu'],
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 5,
|
||||
y: 5
|
||||
}
|
||||
},
|
||||
{
|
||||
wmId: 2,
|
||||
wmType: 'inventory-search',
|
||||
wmFlags: ['invisible-on-blur'],
|
||||
wmWants: 'hide',
|
||||
anchor: {
|
||||
pos: 'tr',
|
||||
x: 81,
|
||||
y: 20
|
||||
},
|
||||
wmTitle: 'Map rolling',
|
||||
entries: [
|
||||
{ id: 2, text: 'Reflect' },
|
||||
{ id: 1, text: '"Quantity: +3"' },
|
||||
{ id: 3, text: '"Cannot Leech Life"' },
|
||||
{ id: 4, text: '"Cannot Leech Mana"' }
|
||||
]
|
||||
},
|
||||
{
|
||||
wmId: 3,
|
||||
wmType: 'price-check',
|
||||
wmZorder: 'exclusive',
|
||||
wmWants: 'hide',
|
||||
wmFlags: ['hide-on-blur', 'skip-menu']
|
||||
}
|
||||
],
|
||||
devicePixelRatio: null
|
||||
}
|
||||
},
|
||||
@@ -136,7 +86,9 @@ export default {
|
||||
}
|
||||
|
||||
if (this.active === false && this.gameFocused === false) {
|
||||
Config.saveConfig()
|
||||
this.$nextTick(() => {
|
||||
Config.saveConfig()
|
||||
})
|
||||
}
|
||||
})
|
||||
MainProcess.addEventListener(VISIBILITY, ({ detail: e }) => {
|
||||
@@ -153,6 +105,14 @@ export default {
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
widgets: {
|
||||
get () {
|
||||
return Config.store.widgets
|
||||
},
|
||||
set (value) {
|
||||
Config.store.widgets = value
|
||||
}
|
||||
},
|
||||
visibilityState () {
|
||||
let showExclusive = this.widgets.find(w => w.wmZorder === 'exclusive' && w.wmWants === 'show')
|
||||
if (!this.active && showExclusive && showExclusive.wmFlags.includes('invisible-on-blur')) {
|
||||
|
||||
@@ -114,6 +114,9 @@ export default {
|
||||
this.updatePoeUiWidth()
|
||||
},
|
||||
data () {
|
||||
this.config.wmWants = 'hide'
|
||||
this.config.wmFlags = ['hide-on-blur', 'skip-menu']
|
||||
|
||||
return {
|
||||
poeUiWidth: '1px',
|
||||
checkPosition: { x: 1, y: 1 },
|
||||
|
||||
Reference in New Issue
Block a user