mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2025-12-18 14:05:37 +00:00
fix(Update to 2): Fixes linting yay
linters, am i right
This commit is contained in:
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -20,8 +20,8 @@ jobs:
|
||||
working-directory: ./renderer
|
||||
- run: npm run make-index-files
|
||||
working-directory: ./renderer
|
||||
# - run: npm run lint
|
||||
# working-directory: ./renderer
|
||||
- run: npm run lint
|
||||
working-directory: ./renderer
|
||||
- run: npm run build
|
||||
working-directory: ./renderer
|
||||
- uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -28,6 +28,7 @@ export class HttpProxy {
|
||||
delete req.headers[key]
|
||||
}
|
||||
}
|
||||
const url = req.url.slice('/proxy/'.length);
|
||||
|
||||
const proxyReq = net.request({
|
||||
url: 'https://' + req.url.slice('/proxy/'.length),
|
||||
@@ -47,6 +48,7 @@ export class HttpProxy {
|
||||
})
|
||||
proxyReq.addListener('error', (err) => {
|
||||
logger.write(`error [cors-proxy] ${err.message} (${host})`)
|
||||
logger.write(`[DEBUG] error [cors-proxy] ${url}`)
|
||||
res.destroy(err)
|
||||
})
|
||||
req.pipe(proxyReq as unknown as NodeJS.WritableStream)
|
||||
|
||||
@@ -5,14 +5,11 @@ module.exports = {
|
||||
},
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'prettier'
|
||||
// 'only-warn'
|
||||
],
|
||||
extends: [
|
||||
'plugin:vue/base',
|
||||
'standard-with-typescript',
|
||||
'plugin:prettier/recommended',
|
||||
'eslint-plugin-prettier/recommended',
|
||||
],
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
@@ -40,7 +37,6 @@ module.exports = {
|
||||
'func-call-spacing': 'off',
|
||||
// TODO: refactor IPC and enable
|
||||
'@typescript-eslint/consistent-type-assertions': 'off',
|
||||
"indent": ["error", "tab"]
|
||||
},
|
||||
overrides: [{
|
||||
files: ['src/main/**/*'],
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"endOfLine": "lf",
|
||||
"tabWidth": 2,
|
||||
"useTabs": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"lint": "eslint --ext .ts,.vue src",
|
||||
"lint-fix": "eslint --ext .ts,.vue src --fix",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"make-index-files": "node src/assets/make-index-files.mjs"
|
||||
},
|
||||
@@ -34,10 +35,7 @@
|
||||
"@types/object-hash": "^3.0.0",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"autoprefixer": "^10.0.2",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"postcss": "^8.2.14",
|
||||
"prettier": "3.4.2",
|
||||
"typescript": "5.6.x",
|
||||
"vite": "^5.0.0",
|
||||
"vue-tsc": "^2.0.0"
|
||||
|
||||
@@ -299,8 +299,8 @@ function parseNamePlate (section: string[]) {
|
||||
const item: ParserState = {
|
||||
rarity: undefined,
|
||||
category: undefined,
|
||||
name: name,
|
||||
baseType: baseType,
|
||||
name,
|
||||
baseType,
|
||||
isUnidentified: false,
|
||||
isCorrupted: false,
|
||||
newMods: [],
|
||||
|
||||
@@ -57,41 +57,41 @@ export const WEAPON_ONE_HANDED_MELEE = new Set([
|
||||
ItemCategory.Claw,
|
||||
ItemCategory.Dagger,
|
||||
ItemCategory.RuneDagger,
|
||||
ItemCategory.Sceptre,
|
||||
]);
|
||||
ItemCategory.Sceptre
|
||||
])
|
||||
|
||||
export const WEAPON_ONE_HANDED = new Set([
|
||||
ItemCategory.Wand,
|
||||
...WEAPON_ONE_HANDED_MELEE,
|
||||
]);
|
||||
...WEAPON_ONE_HANDED_MELEE
|
||||
])
|
||||
|
||||
export const WEAPONE_TWO_HANDED_MELEE = new Set([
|
||||
ItemCategory.TwoHandedAxe,
|
||||
ItemCategory.TwoHandedMace,
|
||||
ItemCategory.TwoHandedSword,
|
||||
ItemCategory.Staff,
|
||||
ItemCategory.Warstaff,
|
||||
]);
|
||||
ItemCategory.Warstaff
|
||||
])
|
||||
|
||||
export const WEAPON = new Set([
|
||||
ItemCategory.FishingRod,
|
||||
ItemCategory.Bow,
|
||||
...WEAPON_ONE_HANDED,
|
||||
...WEAPONE_TWO_HANDED_MELEE,
|
||||
]);
|
||||
...WEAPONE_TWO_HANDED_MELEE
|
||||
])
|
||||
|
||||
export const ARMOUR = new Set([
|
||||
ItemCategory.BodyArmour,
|
||||
ItemCategory.Boots,
|
||||
ItemCategory.Gloves,
|
||||
ItemCategory.Helmet,
|
||||
ItemCategory.Shield,
|
||||
]);
|
||||
ItemCategory.Shield
|
||||
])
|
||||
|
||||
export const ACCESSORY = new Set([
|
||||
ItemCategory.Amulet,
|
||||
ItemCategory.Belt,
|
||||
ItemCategory.Ring,
|
||||
ItemCategory.Trinket,
|
||||
ItemCategory.Trinket
|
||||
// ItemCategory.Quiver
|
||||
]);
|
||||
])
|
||||
|
||||
@@ -109,7 +109,7 @@ export function translateStatWithRoll (
|
||||
calc.sources.some(s => s.stat.stat.ref === calc.stat.ref && s.stat.roll!.dp)
|
||||
: undefined
|
||||
|
||||
return { string: translation.string, negate: translation.negate || false, dp: dp }
|
||||
return { string: translation.string, negate: translation.negate || false, dp }
|
||||
}
|
||||
|
||||
export enum ModifierType {
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
import { reactive as deepReactive, shallowRef, toRaw } from 'vue';
|
||||
import isDeepEqual from 'fast-deep-equal';
|
||||
import { Host } from '@/web/background/IPC';
|
||||
import { HostConfig, ShortcutAction } from '@ipc/types';
|
||||
import type * as widget from './overlay/widgets';
|
||||
import type { StashSearchWidget } from './stash-search/widget';
|
||||
import type { ItemCheckWidget } from './item-check/widget';
|
||||
import type { ItemSearchWidget } from './item-search/widget';
|
||||
import { reactive as deepReactive, shallowRef, toRaw } from 'vue'
|
||||
import isDeepEqual from 'fast-deep-equal'
|
||||
import { Host } from '@/web/background/IPC'
|
||||
import { HostConfig, ShortcutAction } from '@ipc/types'
|
||||
import type * as widget from './overlay/widgets'
|
||||
import type { StashSearchWidget } from './stash-search/widget'
|
||||
import type { ItemCheckWidget } from './item-check/widget'
|
||||
import type { ItemSearchWidget } from './item-search/widget'
|
||||
|
||||
const _config = shallowRef<Config | null>(null);
|
||||
let _lastSavedConfig: Config | null = null;
|
||||
const _config = shallowRef<Config | null>(null)
|
||||
let _lastSavedConfig: Config | null = null
|
||||
|
||||
export function AppConfig(): Config;
|
||||
export function AppConfig<T extends widget.Widget>(type: string): T | undefined;
|
||||
export function AppConfig (): Config
|
||||
export function AppConfig<T extends widget.Widget> (type: string): T | undefined
|
||||
export function AppConfig (type?: string) {
|
||||
if (!type) {
|
||||
return _config.value!;
|
||||
return _config.value!
|
||||
} else {
|
||||
return _config.value!.widgets.find((w) => w.wmType === type);
|
||||
return _config.value!.widgets.find((w) => w.wmType === type)
|
||||
}
|
||||
}
|
||||
|
||||
export function updateConfig (updates: Config) {
|
||||
_config.value = deepReactive(JSON.parse(JSON.stringify(updates)));
|
||||
document.documentElement.style.fontSize = `${_config.value!.fontSize}px`;
|
||||
_config.value = deepReactive(JSON.parse(JSON.stringify(updates)))
|
||||
document.documentElement.style.fontSize = `${_config.value!.fontSize}px`
|
||||
}
|
||||
|
||||
export function saveConfig (opts?: { isTemporary: boolean }) {
|
||||
const rawConfig = toRaw(_config.value!);
|
||||
const rawConfig = toRaw(_config.value!)
|
||||
if (
|
||||
rawConfig.widgets.some(
|
||||
(w) => w.wmZorder === 'exclusive' && w.wmWants === 'show'
|
||||
)
|
||||
) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
if (!isDeepEqual(rawConfig, _lastSavedConfig)) {
|
||||
_lastSavedConfig = JSON.parse(JSON.stringify(rawConfig));
|
||||
_lastSavedConfig = JSON.parse(JSON.stringify(rawConfig))
|
||||
Host.sendEvent({
|
||||
name: 'CLIENT->MAIN::save-config',
|
||||
payload: {
|
||||
contents: JSON.stringify(AppConfig()),
|
||||
isTemporary: opts?.isTemporary ?? false,
|
||||
},
|
||||
});
|
||||
isTemporary: opts?.isTemporary ?? false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function pushHostConfig () {
|
||||
Host.sendEvent({
|
||||
name: 'CLIENT->MAIN::update-host-config',
|
||||
payload: getConfigForHost(),
|
||||
});
|
||||
payload: getConfigForHost()
|
||||
})
|
||||
}
|
||||
|
||||
export async function initConfig () {
|
||||
Host.onEvent('MAIN->CLIENT::config-changed', (e) => {
|
||||
_lastSavedConfig = JSON.parse(e.contents); // should be a deep copy
|
||||
updateConfig(JSON.parse(e.contents));
|
||||
});
|
||||
_lastSavedConfig = JSON.parse(e.contents) // should be a deep copy
|
||||
updateConfig(JSON.parse(e.contents))
|
||||
})
|
||||
|
||||
const contents = await Host.getConfig();
|
||||
const contents = await Host.getConfig()
|
||||
if (!contents) {
|
||||
updateConfig(defaultConfig());
|
||||
return;
|
||||
updateConfig(defaultConfig())
|
||||
return
|
||||
}
|
||||
|
||||
let config: Config;
|
||||
let config: Config
|
||||
try {
|
||||
config = JSON.parse(contents);
|
||||
config = JSON.parse(contents)
|
||||
} catch {
|
||||
updateConfig(defaultConfig());
|
||||
saveConfig({ isTemporary: true });
|
||||
return;
|
||||
updateConfig(defaultConfig())
|
||||
saveConfig({ isTemporary: true })
|
||||
return
|
||||
|
||||
// TODO
|
||||
// dialog.showErrorBox(
|
||||
@@ -83,46 +83,46 @@ export async function initConfig() {
|
||||
// )
|
||||
}
|
||||
|
||||
updateConfig(upgradeConfig(config));
|
||||
updateConfig(upgradeConfig(config))
|
||||
}
|
||||
|
||||
export function poeWebApi () {
|
||||
const { language, realm } = AppConfig();
|
||||
const { language, realm } = AppConfig()
|
||||
switch (language) {
|
||||
case 'en':
|
||||
return 'www.pathofexile.com';
|
||||
return 'www.pathofexile.com'
|
||||
case 'ru':
|
||||
return 'ru.pathofexile.com';
|
||||
return 'ru.pathofexile.com'
|
||||
case 'cmn-Hant':
|
||||
return realm === 'pc-garena' ? 'pathofexile.tw' : 'www.pathofexile.com';
|
||||
return realm === 'pc-garena' ? 'pathofexile.tw' : 'www.pathofexile.com'
|
||||
case 'ko':
|
||||
return 'poe.game.daum.net';
|
||||
return 'poe.game.daum.net'
|
||||
}
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
configVersion: number;
|
||||
leagueId?: string;
|
||||
overlayKey: string;
|
||||
overlayBackground: string;
|
||||
overlayBackgroundClose: boolean;
|
||||
restoreClipboard: boolean;
|
||||
configVersion: number
|
||||
leagueId?: string
|
||||
overlayKey: string
|
||||
overlayBackground: string
|
||||
overlayBackgroundClose: boolean
|
||||
restoreClipboard: boolean
|
||||
commands: Array<{
|
||||
text: string;
|
||||
hotkey: string | null;
|
||||
send: boolean;
|
||||
}>;
|
||||
clientLog: string | null;
|
||||
gameConfig: string | null;
|
||||
windowTitle: string;
|
||||
logKeys: boolean;
|
||||
accountName: string;
|
||||
stashScroll: boolean;
|
||||
language: 'en' | 'ru' | 'cmn-Hant' | 'ko';
|
||||
realm: 'pc-ggg' | 'pc-garena';
|
||||
widgets: widget.Widget[];
|
||||
fontSize: number;
|
||||
showAttachNotification: boolean;
|
||||
text: string
|
||||
hotkey: string | null
|
||||
send: boolean
|
||||
}>
|
||||
clientLog: string | null
|
||||
gameConfig: string | null
|
||||
windowTitle: string
|
||||
logKeys: boolean
|
||||
accountName: string
|
||||
stashScroll: boolean
|
||||
language: 'en' | 'ru' | 'cmn-Hant' | 'ko'
|
||||
realm: 'pc-ggg' | 'pc-garena'
|
||||
widgets: widget.Widget[]
|
||||
fontSize: number
|
||||
showAttachNotification: boolean
|
||||
}
|
||||
|
||||
export const defaultConfig = (): Config => ({
|
||||
@@ -136,33 +136,33 @@ export const defaultConfig = (): Config => ({
|
||||
{
|
||||
text: '/hideout',
|
||||
hotkey: 'F5',
|
||||
send: true,
|
||||
send: true
|
||||
},
|
||||
{
|
||||
text: '/exit',
|
||||
hotkey: 'F9',
|
||||
send: true,
|
||||
send: true
|
||||
},
|
||||
{
|
||||
text: '@last ty',
|
||||
hotkey: null,
|
||||
send: true,
|
||||
send: true
|
||||
},
|
||||
{
|
||||
text: '/invite @last',
|
||||
hotkey: null,
|
||||
send: true,
|
||||
send: true
|
||||
},
|
||||
{
|
||||
text: '/tradewith @last',
|
||||
hotkey: null,
|
||||
send: true,
|
||||
send: true
|
||||
},
|
||||
{
|
||||
text: '/hideout @last',
|
||||
hotkey: null,
|
||||
send: true,
|
||||
},
|
||||
send: true
|
||||
}
|
||||
],
|
||||
clientLog: null,
|
||||
gameConfig: null,
|
||||
@@ -185,9 +185,9 @@ export const defaultConfig = (): Config => ({
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 5,
|
||||
y: 5,
|
||||
y: 5
|
||||
},
|
||||
alwaysShow: false,
|
||||
alwaysShow: false
|
||||
} as widget.WidgetMenu,
|
||||
{
|
||||
wmId: 2,
|
||||
@@ -210,7 +210,7 @@ export const defaultConfig = (): Config => ({
|
||||
searchStatRange: 10,
|
||||
showCursor: true,
|
||||
requestPricePrediction: false,
|
||||
rememberCurrency: false,
|
||||
rememberCurrency: false
|
||||
} as widget.PriceCheckWidget,
|
||||
{
|
||||
wmId: 3,
|
||||
@@ -230,22 +230,22 @@ export const defaultConfig = (): Config => ({
|
||||
selectedStats: [
|
||||
{
|
||||
matcher: '#% maximum Player Resistances',
|
||||
decision: 'w--',
|
||||
decision: 'w--'
|
||||
},
|
||||
{
|
||||
matcher: 'Monsters reflect #% of Physical Damage',
|
||||
decision: 'd--',
|
||||
decision: 'd--'
|
||||
},
|
||||
{
|
||||
matcher: 'Monsters reflect #% of Elemental Damage',
|
||||
decision: 'd--',
|
||||
decision: 'd--'
|
||||
},
|
||||
{
|
||||
matcher: 'Area contains two Unique Bosses',
|
||||
decision: 'g--',
|
||||
},
|
||||
],
|
||||
},
|
||||
decision: 'g--'
|
||||
}
|
||||
]
|
||||
}
|
||||
} as ItemCheckWidget,
|
||||
{
|
||||
wmId: 4,
|
||||
@@ -254,7 +254,7 @@ export const defaultConfig = (): Config => ({
|
||||
wmWants: 'hide',
|
||||
wmZorder: 4,
|
||||
wmFlags: ['hide-on-focus', 'skip-menu'],
|
||||
toggleKey: null,
|
||||
toggleKey: null
|
||||
} as widget.DelveGridWidget,
|
||||
{
|
||||
wmId: 5,
|
||||
@@ -262,7 +262,7 @@ export const defaultConfig = (): Config => ({
|
||||
wmTitle: '',
|
||||
wmWants: 'hide',
|
||||
wmZorder: 'exclusive',
|
||||
wmFlags: ['invisible-on-blur', 'ignore-ui-visibility'],
|
||||
wmFlags: ['invisible-on-blur', 'ignore-ui-visibility']
|
||||
},
|
||||
{
|
||||
wmId: 6,
|
||||
@@ -274,8 +274,8 @@ export const defaultConfig = (): Config => ({
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 10,
|
||||
y: 20,
|
||||
},
|
||||
y: 20
|
||||
}
|
||||
} as ItemSearchWidget,
|
||||
// --- DEFAULT ---
|
||||
{
|
||||
@@ -288,14 +288,14 @@ export const defaultConfig = (): Config => ({
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 35,
|
||||
y: 46,
|
||||
y: 46
|
||||
},
|
||||
entries: [
|
||||
{ id: 1, name: '', text: '"Pack Size: +3"', hotkey: null },
|
||||
{ id: 2, name: '', text: 'Reflect', hotkey: null },
|
||||
{ id: 3, name: '', text: '"Cannot Leech Life"', hotkey: null },
|
||||
{ id: 4, name: '', text: '"Cannot Leech Mana"', hotkey: null },
|
||||
],
|
||||
{ id: 4, name: '', text: '"Cannot Leech Mana"', hotkey: null }
|
||||
]
|
||||
} as StashSearchWidget,
|
||||
{
|
||||
wmId: 102,
|
||||
@@ -307,7 +307,7 @@ export const defaultConfig = (): Config => ({
|
||||
anchor: {
|
||||
pos: 'tl',
|
||||
x: 34,
|
||||
y: 56,
|
||||
y: 56
|
||||
},
|
||||
entries: [
|
||||
{ id: 1, name: '', text: 'Currency', hotkey: null },
|
||||
@@ -318,10 +318,10 @@ export const defaultConfig = (): Config => ({
|
||||
id: 5,
|
||||
name: '',
|
||||
text: '"Map Device" "Rarity: Normal"',
|
||||
hotkey: null,
|
||||
hotkey: null
|
||||
},
|
||||
{ id: 6, name: '', text: 'Tane Laboratory', hotkey: null },
|
||||
],
|
||||
{ id: 6, name: '', text: 'Tane Laboratory', hotkey: null }
|
||||
]
|
||||
} as StashSearchWidget,
|
||||
{
|
||||
wmId: 103,
|
||||
@@ -333,90 +333,90 @@ export const defaultConfig = (): Config => ({
|
||||
anchor: {
|
||||
pos: 'tc',
|
||||
x: 50,
|
||||
y: 10,
|
||||
y: 10
|
||||
},
|
||||
images: [{ id: 1, url: 'syndicate.jpg' }],
|
||||
} as widget.ImageStripWidget,
|
||||
],
|
||||
});
|
||||
images: [{ id: 1, url: 'syndicate.jpg' }]
|
||||
} as widget.ImageStripWidget
|
||||
]
|
||||
})
|
||||
|
||||
function upgradeConfig (_config: Config): Config {
|
||||
const config = _config as Omit<Config, 'widgets'> & {
|
||||
widgets: Array<Record<string, any>>;
|
||||
};
|
||||
widgets: Array<Record<string, any>>
|
||||
}
|
||||
|
||||
if (config.configVersion < 3) {
|
||||
config.widgets.push({
|
||||
...defaultConfig().widgets.find((w) => w.wmType === 'image-strip')!,
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1,
|
||||
wmZorder: null,
|
||||
});
|
||||
wmZorder: null
|
||||
})
|
||||
|
||||
config.widgets.push({
|
||||
...defaultConfig().widgets.find((w) => w.wmType === 'delve-grid')!,
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1,
|
||||
wmZorder: null,
|
||||
});
|
||||
wmZorder: null
|
||||
})
|
||||
|
||||
config.widgets.find((w) => w.wmType === 'menu')!.alwaysShow = false;
|
||||
config.widgets.find((w) => w.wmType === 'menu')!.alwaysShow = false
|
||||
|
||||
config.configVersion = 3;
|
||||
config.configVersion = 3
|
||||
}
|
||||
|
||||
if (config.configVersion < 4) {
|
||||
config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
)!.chaosPriceThreshold = 0.05;
|
||||
)!.chaosPriceThreshold = 0.05
|
||||
|
||||
const mapCheck = config.widgets.find((w) => w.wmType === 'map-check')!;
|
||||
(mapCheck as any).selectedStats.forEach((e: any) => {
|
||||
e.matcher = e.matchRef;
|
||||
e.matchRef = undefined;
|
||||
});
|
||||
e.matcher = e.matchRef
|
||||
e.matchRef = undefined
|
||||
})
|
||||
|
||||
{
|
||||
const widgets = config.widgets.filter((w) => w.wmType === 'image-strip')!;
|
||||
const widgets = config.widgets.filter((w) => w.wmType === 'image-strip')!
|
||||
widgets.forEach((imgStrip: any) => {
|
||||
imgStrip.images.forEach((e: any, idx: number) => {
|
||||
e.id = idx;
|
||||
});
|
||||
});
|
||||
e.id = idx
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
config.configVersion = 4;
|
||||
config.configVersion = 4
|
||||
}
|
||||
|
||||
if (config.configVersion < 5) {
|
||||
config.commands.forEach((cmd) => {
|
||||
cmd.send = true;
|
||||
});
|
||||
cmd.send = true
|
||||
})
|
||||
|
||||
config.configVersion = 5;
|
||||
config.configVersion = 5
|
||||
}
|
||||
|
||||
if (config.configVersion < 6) {
|
||||
config.widgets.find((w) => w.wmType === 'price-check')!.showRateLimitState =
|
||||
(config as any).logLevel === 'debug';
|
||||
(config as any).logLevel === 'debug'
|
||||
config.widgets.find((w) => w.wmType === 'price-check')!.apiLatencySeconds =
|
||||
2;
|
||||
2
|
||||
|
||||
config.configVersion = 6;
|
||||
config.configVersion = 6
|
||||
}
|
||||
|
||||
if (config.configVersion < 7) {
|
||||
const mapCheck = config.widgets.find((w) => w.wmType === 'map-check')!;
|
||||
mapCheck.wmType = 'item-check';
|
||||
mapCheck.maps = { selectedStats: mapCheck.selectedStats };
|
||||
const mapCheck = config.widgets.find((w) => w.wmType === 'map-check')!
|
||||
mapCheck.wmType = 'item-check'
|
||||
mapCheck.maps = { selectedStats: mapCheck.selectedStats }
|
||||
mapCheck.selectedStats = undefined;
|
||||
(config as any).itemCheckKey = (config as any).mapCheckKey || null;
|
||||
(config as any).mapCheckKey = undefined;
|
||||
(config as any).mapCheckKey = undefined
|
||||
|
||||
config.configVersion = 7;
|
||||
config.configVersion = 7
|
||||
}
|
||||
|
||||
if (config.configVersion < 8) {
|
||||
const itemCheck = config.widgets.find((w) => w.wmType === 'item-check')!;
|
||||
(itemCheck as ItemCheckWidget).maps.showNewStats = false;
|
||||
(itemCheck as ItemCheckWidget).maps.showNewStats = false
|
||||
itemCheck.maps.selectedStats = (
|
||||
itemCheck as ItemCheckWidget
|
||||
).maps.selectedStats.map((entry) => ({
|
||||
@@ -427,120 +427,120 @@ function upgradeConfig(_config: Config): Config {
|
||||
? 'warning'
|
||||
: (entry as any).valueDesirable
|
||||
? 'desirable'
|
||||
: 'seen',
|
||||
}));
|
||||
: 'seen'
|
||||
}))
|
||||
|
||||
config.configVersion = 8;
|
||||
config.configVersion = 8
|
||||
}
|
||||
|
||||
if (config.configVersion < 9) {
|
||||
config.widgets.find((w) => w.wmType === 'price-check')!.collapseListings =
|
||||
'api';
|
||||
'api'
|
||||
|
||||
config.widgets.find((w) => w.wmType === 'price-check')!.smartInitialSearch =
|
||||
true;
|
||||
true
|
||||
config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
)!.lockedInitialSearch = true;
|
||||
)!.lockedInitialSearch = true
|
||||
|
||||
config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
)!.activateStockFilter = false;
|
||||
)!.activateStockFilter = false
|
||||
|
||||
config.configVersion = 9;
|
||||
config.configVersion = 9
|
||||
}
|
||||
|
||||
if (config.configVersion < 10) {
|
||||
config.widgets.push({
|
||||
...defaultConfig().widgets.find((w) => w.wmType === 'settings')!,
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1,
|
||||
});
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1
|
||||
})
|
||||
|
||||
const priceCheck = config.widgets.find((w) => w.wmType === 'price-check')!;
|
||||
priceCheck.hotkey = (config as any).priceCheckKey;
|
||||
priceCheck.hotkeyHold = (config as any).priceCheckKeyHold;
|
||||
priceCheck.hotkeyLocked = (config as any).priceCheckLocked;
|
||||
priceCheck.showSeller = (config as any).showSeller;
|
||||
priceCheck.searchStatRange = (config as any).searchStatRange;
|
||||
priceCheck.showCursor = (config as any).priceCheckShowCursor;
|
||||
const priceCheck = config.widgets.find((w) => w.wmType === 'price-check')!
|
||||
priceCheck.hotkey = (config as any).priceCheckKey
|
||||
priceCheck.hotkeyHold = (config as any).priceCheckKeyHold
|
||||
priceCheck.hotkeyLocked = (config as any).priceCheckLocked
|
||||
priceCheck.showSeller = (config as any).showSeller
|
||||
priceCheck.searchStatRange = (config as any).searchStatRange
|
||||
priceCheck.showCursor = (config as any).priceCheckShowCursor
|
||||
|
||||
if (priceCheck.chaosPriceThreshold === 0.05) {
|
||||
priceCheck.chaosPriceThreshold = 0;
|
||||
priceCheck.chaosPriceThreshold = 0
|
||||
}
|
||||
|
||||
config.configVersion = 10;
|
||||
config.configVersion = 10
|
||||
}
|
||||
|
||||
if (config.configVersion < 11) {
|
||||
config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
)!.requestPricePrediction = false;
|
||||
)!.requestPricePrediction = false
|
||||
|
||||
config.configVersion = 11;
|
||||
config.configVersion = 11
|
||||
}
|
||||
|
||||
if (config.configVersion < 12) {
|
||||
const afterSettings = config.widgets.findIndex(
|
||||
(w) => w.wmType === 'settings'
|
||||
);
|
||||
)
|
||||
config.widgets.splice(afterSettings + 1, 0, {
|
||||
...defaultConfig().widgets.find((w) => w.wmType === 'item-search')!,
|
||||
wmWants: 'show',
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1,
|
||||
});
|
||||
wmId: Math.max(0, ...config.widgets.map((_) => _.wmId)) + 1
|
||||
})
|
||||
|
||||
config.realm = 'pc-ggg';
|
||||
config.realm = 'pc-ggg'
|
||||
if (config.language === ('zh_TW' as string)) {
|
||||
config.language = 'cmn-Hant';
|
||||
config.language = 'cmn-Hant'
|
||||
}
|
||||
|
||||
config.configVersion = 12;
|
||||
config.configVersion = 12
|
||||
}
|
||||
|
||||
if (config.configVersion < 13) {
|
||||
config.showAttachNotification = true;
|
||||
config.showAttachNotification = true
|
||||
|
||||
config.configVersion = 13;
|
||||
config.configVersion = 13
|
||||
}
|
||||
|
||||
if (config.configVersion < 14) {
|
||||
const imgWidgets = config.widgets.filter(
|
||||
(w) => w.wmType === 'image-strip'
|
||||
) as widget.ImageStripWidget[];
|
||||
) as widget.ImageStripWidget[]
|
||||
imgWidgets.forEach((imgStrip) => {
|
||||
imgStrip.images.forEach((e) => {
|
||||
e.url = e.url.startsWith('app-file://')
|
||||
? e.url.slice('app-file://'.length)
|
||||
: e.url;
|
||||
});
|
||||
});
|
||||
: e.url
|
||||
})
|
||||
})
|
||||
|
||||
const itemCheck = config.widgets.find(
|
||||
(w) => w.wmType === 'item-check'
|
||||
) as ItemCheckWidget;
|
||||
itemCheck.wikiKey = (config as any).wikiKey;
|
||||
itemCheck.poedbKey = null;
|
||||
itemCheck.craftOfExileKey = (config as any).craftOfExileKey;
|
||||
itemCheck.stashSearchKey = null;
|
||||
) as ItemCheckWidget
|
||||
itemCheck.wikiKey = (config as any).wikiKey
|
||||
itemCheck.poedbKey = null
|
||||
itemCheck.craftOfExileKey = (config as any).craftOfExileKey
|
||||
itemCheck.stashSearchKey = null
|
||||
|
||||
config.configVersion = 14;
|
||||
config.configVersion = 14
|
||||
}
|
||||
|
||||
if (config.configVersion < 15) {
|
||||
const priceCheck = config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
) as widget.PriceCheckWidget;
|
||||
priceCheck.builtinBrowser = false;
|
||||
) as widget.PriceCheckWidget
|
||||
priceCheck.builtinBrowser = false
|
||||
|
||||
const itemSearch = config.widgets.find(
|
||||
(w) => w.wmType === 'item-search'
|
||||
) as ItemSearchWidget;
|
||||
itemSearch.ocrGemsKey = null;
|
||||
) as ItemSearchWidget
|
||||
itemSearch.ocrGemsKey = null
|
||||
|
||||
const itemCheck = config.widgets.find(
|
||||
(w) => w.wmType === 'item-check'
|
||||
) as ItemCheckWidget;
|
||||
itemCheck.maps.profile = 1;
|
||||
) as ItemCheckWidget
|
||||
itemCheck.maps.profile = 1
|
||||
for (const stat of itemCheck.maps.selectedStats) {
|
||||
const p1decision =
|
||||
stat.decision === 'danger'
|
||||
@@ -549,114 +549,114 @@ function upgradeConfig(_config: Config): Config {
|
||||
? 'w'
|
||||
: stat.decision === 'desirable'
|
||||
? 'g'
|
||||
: 's';
|
||||
: 's'
|
||||
|
||||
stat.decision = `${p1decision}--`;
|
||||
stat.decision = `${p1decision}--`
|
||||
}
|
||||
|
||||
config.configVersion = 15;
|
||||
config.configVersion = 15
|
||||
}
|
||||
|
||||
if (config.configVersion < 16) {
|
||||
const delve = config.widgets.find(
|
||||
(w) => w.wmType === 'delve-grid'
|
||||
) as widget.DelveGridWidget;
|
||||
delve.toggleKey = (config as any).delveGridKey;
|
||||
) as widget.DelveGridWidget
|
||||
delve.toggleKey = (config as any).delveGridKey
|
||||
|
||||
const itemCheck = config.widgets.find(
|
||||
(w) => w.wmType === 'item-check'
|
||||
) as ItemCheckWidget;
|
||||
itemCheck.hotkey = (config as any).itemCheckKey;
|
||||
) as ItemCheckWidget
|
||||
itemCheck.hotkey = (config as any).itemCheckKey
|
||||
|
||||
if (itemCheck.maps.profile === undefined) {
|
||||
itemCheck.maps.profile = 1;
|
||||
itemCheck.maps.selectedStats = [];
|
||||
itemCheck.maps.profile = 1
|
||||
itemCheck.maps.selectedStats = []
|
||||
}
|
||||
|
||||
config.configVersion = 16;
|
||||
config.configVersion = 16
|
||||
}
|
||||
|
||||
if (config.logKeys === undefined) {
|
||||
config.logKeys = false;
|
||||
config.logKeys = false
|
||||
}
|
||||
|
||||
const priceCheck = config.widgets.find(
|
||||
(w) => w.wmType === 'price-check'
|
||||
) as widget.PriceCheckWidget;
|
||||
) as widget.PriceCheckWidget
|
||||
if (priceCheck.rememberCurrency === undefined) {
|
||||
priceCheck.rememberCurrency = false;
|
||||
priceCheck.rememberCurrency = false
|
||||
}
|
||||
|
||||
for (const widget of config.widgets) {
|
||||
if (widget.wmType === 'stash-search') {
|
||||
(widget as StashSearchWidget).enableHotkeys ??= true;
|
||||
(widget as StashSearchWidget).enableHotkeys ??= true
|
||||
}
|
||||
}
|
||||
|
||||
return config as unknown as Config;
|
||||
return config as unknown as Config
|
||||
}
|
||||
|
||||
function getConfigForHost (): HostConfig {
|
||||
const actions: ShortcutAction[] = [];
|
||||
const actions: ShortcutAction[] = []
|
||||
|
||||
const config = AppConfig();
|
||||
const priceCheck = AppConfig('price-check') as widget.PriceCheckWidget;
|
||||
const config = AppConfig()
|
||||
const priceCheck = AppConfig('price-check') as widget.PriceCheckWidget
|
||||
if (priceCheck.hotkey) {
|
||||
actions.push({
|
||||
shortcut: `${priceCheck.hotkeyHold} + ${priceCheck.hotkey}`,
|
||||
action: { type: 'copy-item', target: 'price-check', focusOverlay: false },
|
||||
keepModKeys: true,
|
||||
});
|
||||
keepModKeys: true
|
||||
})
|
||||
}
|
||||
if (priceCheck.hotkeyLocked) {
|
||||
actions.push({
|
||||
shortcut: priceCheck.hotkeyLocked,
|
||||
action: { type: 'copy-item', target: 'price-check', focusOverlay: true },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'price-check', focusOverlay: true }
|
||||
})
|
||||
}
|
||||
actions.push({
|
||||
shortcut: config.overlayKey,
|
||||
action: { type: 'toggle-overlay' },
|
||||
keepModKeys: true,
|
||||
});
|
||||
const itemCheck = AppConfig('item-check') as ItemCheckWidget;
|
||||
keepModKeys: true
|
||||
})
|
||||
const itemCheck = AppConfig('item-check') as ItemCheckWidget
|
||||
if (itemCheck.wikiKey) {
|
||||
actions.push({
|
||||
shortcut: itemCheck.wikiKey,
|
||||
action: { type: 'copy-item', target: 'open-wiki' },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'open-wiki' }
|
||||
})
|
||||
}
|
||||
if (itemCheck.craftOfExileKey) {
|
||||
actions.push({
|
||||
shortcut: itemCheck.craftOfExileKey,
|
||||
action: { type: 'copy-item', target: 'open-craft-of-exile' },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'open-craft-of-exile' }
|
||||
})
|
||||
}
|
||||
if (itemCheck.poedbKey) {
|
||||
actions.push({
|
||||
shortcut: itemCheck.poedbKey,
|
||||
action: { type: 'copy-item', target: 'open-poedb' },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'open-poedb' }
|
||||
})
|
||||
}
|
||||
if (itemCheck.stashSearchKey) {
|
||||
actions.push({
|
||||
shortcut: itemCheck.stashSearchKey,
|
||||
action: { type: 'copy-item', target: 'search-similar' },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'search-similar' }
|
||||
})
|
||||
}
|
||||
if (itemCheck.hotkey) {
|
||||
actions.push({
|
||||
shortcut: itemCheck.hotkey,
|
||||
action: { type: 'copy-item', target: 'item-check', focusOverlay: true },
|
||||
});
|
||||
action: { type: 'copy-item', target: 'item-check', focusOverlay: true }
|
||||
})
|
||||
}
|
||||
const delveGrid = AppConfig('delve-grid') as widget.DelveGridWidget;
|
||||
const delveGrid = AppConfig('delve-grid') as widget.DelveGridWidget
|
||||
if (delveGrid.toggleKey) {
|
||||
actions.push({
|
||||
shortcut: delveGrid.toggleKey,
|
||||
action: { type: 'trigger-event', target: 'delve-grid' },
|
||||
keepModKeys: true,
|
||||
});
|
||||
keepModKeys: true
|
||||
})
|
||||
}
|
||||
for (const command of config.commands) {
|
||||
if (command.hotkey) {
|
||||
@@ -665,35 +665,35 @@ function getConfigForHost(): HostConfig {
|
||||
action: {
|
||||
type: 'paste-in-chat',
|
||||
text: command.text,
|
||||
send: command.send,
|
||||
},
|
||||
});
|
||||
send: command.send
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
for (const widget of config.widgets) {
|
||||
if (widget.wmType === 'stash-search') {
|
||||
const stashSearch = widget as StashSearchWidget;
|
||||
if (!stashSearch.enableHotkeys) continue;
|
||||
const stashSearch = widget as StashSearchWidget
|
||||
if (!stashSearch.enableHotkeys) continue
|
||||
|
||||
for (const entry of stashSearch.entries) {
|
||||
if (entry.hotkey) {
|
||||
actions.push({
|
||||
shortcut: entry.hotkey,
|
||||
action: { type: 'stash-search', text: entry.text },
|
||||
});
|
||||
action: { type: 'stash-search', text: entry.text }
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (widget.wmType === 'timer') {
|
||||
const stopwatch = widget as widget.StopwatchWidget;
|
||||
const stopwatch = widget as widget.StopwatchWidget
|
||||
if (stopwatch.toggleKey) {
|
||||
actions.push({
|
||||
shortcut: stopwatch.toggleKey,
|
||||
keepModKeys: true,
|
||||
action: {
|
||||
type: 'trigger-event',
|
||||
target: `stopwatch-start-stop:${widget.wmId}`,
|
||||
},
|
||||
});
|
||||
target: `stopwatch-start-stop:${widget.wmId}`
|
||||
}
|
||||
})
|
||||
}
|
||||
if (stopwatch.resetKey) {
|
||||
actions.push({
|
||||
@@ -701,18 +701,18 @@ function getConfigForHost(): HostConfig {
|
||||
keepModKeys: true,
|
||||
action: {
|
||||
type: 'trigger-event',
|
||||
target: `stopwatch-reset:${widget.wmId}`,
|
||||
},
|
||||
});
|
||||
target: `stopwatch-reset:${widget.wmId}`
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (widget.wmType === 'item-search') {
|
||||
const itemSearch = widget as ItemSearchWidget;
|
||||
const itemSearch = widget as ItemSearchWidget
|
||||
if (itemSearch.ocrGemsKey) {
|
||||
actions.push({
|
||||
shortcut: itemSearch.ocrGemsKey,
|
||||
keepModKeys: true,
|
||||
action: { type: 'ocr-text', target: 'heist-gems' },
|
||||
});
|
||||
action: { type: 'ocr-text', target: 'heist-gems' }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -726,6 +726,6 @@ function getConfigForHost(): HostConfig {
|
||||
overlayKey: config.overlayKey,
|
||||
logKeys: config.logKeys,
|
||||
windowTitle: config.windowTitle,
|
||||
language: config.language,
|
||||
};
|
||||
language: config.language
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,80 @@
|
||||
import { computed, shallowRef, readonly } from 'vue';
|
||||
import { createGlobalState } from '@vueuse/core';
|
||||
import { AppConfig, poeWebApi } from '@/web/Config';
|
||||
import { Host } from './IPC';
|
||||
import { computed, shallowRef, readonly } from 'vue'
|
||||
import { createGlobalState } from '@vueuse/core'
|
||||
import { AppConfig } from '@/web/Config'
|
||||
|
||||
// pc-ggg, pc-garena
|
||||
// const PERMANENT_SC = ['Standard', '標準模式']
|
||||
const PERMANENT_HC = ['Hardcore', '專家模式'];
|
||||
const PERMANENT_HC = ['Hardcore', '專家模式']
|
||||
|
||||
interface ApiLeague {
|
||||
id: string;
|
||||
event?: boolean;
|
||||
rules: Array<{ id: string }>;
|
||||
id: string
|
||||
event?: boolean
|
||||
rules: Array<{ id: string }>
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
[4:51:57 PM] error [cors-proxy] net::ERR_BLOCKED_BY_CLIENT (www.pathofexile.com)
|
||||
[4:51:57 PM] error [cors-proxy] net::ERR_BLOCKED_BY_CLIENT (www.pathofexile.com)
|
||||
[4:51:57 PM] error [cors-proxy] net::ERR_BLOCKED_BY_CLIENT (www.pathofexile.com)
|
||||
[4:51:57 PM] error [Shortcuts] Hotkey "Home" reserved by the game will not be registered.
|
||||
[4:51:57 PM] error [GameConfig] Failed to find game configuration file in the default location.
|
||||
[4:51:58 PM] error [cors-proxy] net::ERR_BLOCKED_BY_CLIENT (www.pathofexile.com)
|
||||
*/
|
||||
interface League {
|
||||
id: string
|
||||
isPopular: boolean
|
||||
}
|
||||
|
||||
export const useLeagues = createGlobalState(() => {
|
||||
const isLoading = shallowRef(false)
|
||||
const error = shallowRef<string | null>(null)
|
||||
const tradeLeagues = shallowRef<League[]>([])
|
||||
|
||||
const DEFAULT_POE2_LEAGUES: ApiLeague[] = [
|
||||
{ id: 'Standard', rules: [] },
|
||||
{
|
||||
id: 'Hardcore',
|
||||
rules: [
|
||||
{
|
||||
id: 'Hardcore',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
interface League {
|
||||
id: string;
|
||||
isPopular: boolean;
|
||||
id: 'Hardcore'
|
||||
}
|
||||
|
||||
export const useLeagues = createGlobalState(() => {
|
||||
const isLoading = shallowRef(false);
|
||||
const error = shallowRef<string | null>(null);
|
||||
const tradeLeagues = shallowRef<League[]>([]);
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const selectedId = computed<string | undefined>({
|
||||
get () {
|
||||
return tradeLeagues.value.length ? AppConfig().leagueId : undefined;
|
||||
return tradeLeagues.value.length ? AppConfig().leagueId : undefined
|
||||
},
|
||||
set (id) {
|
||||
AppConfig().leagueId = id;
|
||||
},
|
||||
});
|
||||
AppConfig().leagueId = id
|
||||
}
|
||||
})
|
||||
|
||||
const selected = computed(() => {
|
||||
const { leagueId } = AppConfig();
|
||||
if (!tradeLeagues.value || !leagueId) return undefined;
|
||||
const listed = tradeLeagues.value.find((league) => league.id === leagueId);
|
||||
const { leagueId } = AppConfig()
|
||||
if (!tradeLeagues.value || !leagueId) return undefined
|
||||
const listed = tradeLeagues.value.find((league) => league.id === leagueId)
|
||||
return {
|
||||
id: leagueId,
|
||||
realm: AppConfig().realm,
|
||||
isPopular: !isPrivateLeague(leagueId) && Boolean(listed?.isPopular),
|
||||
};
|
||||
});
|
||||
isPopular: !isPrivateLeague(leagueId) && Boolean(listed?.isPopular)
|
||||
}
|
||||
})
|
||||
|
||||
async function load () {
|
||||
isLoading.value = true;
|
||||
error.value = null;
|
||||
isLoading.value = true
|
||||
error.value = null
|
||||
|
||||
try {
|
||||
const response = await Host.proxy(
|
||||
`${poeWebApi()}/api/leagues?type=main&realm=pc`
|
||||
);
|
||||
if (!response.ok)
|
||||
throw new Error(JSON.stringify(Object.fromEntries(response.headers)));
|
||||
// const response = await Host.proxy(
|
||||
// `${poeWebApi()}/api/leagues?type=main&realm=pc`
|
||||
// );
|
||||
// if (!response.ok)
|
||||
// throw new Error(JSON.stringify(Object.fromEntries(response.headers)));
|
||||
// const leagues: ApiLeague[] = await response.json();
|
||||
const leagues: ApiLeague[] = DEFAULT_POE2_LEAGUES;
|
||||
const leagues: ApiLeague[] = DEFAULT_POE2_LEAGUES
|
||||
tradeLeagues.value = leagues
|
||||
.filter(
|
||||
(league) =>
|
||||
@@ -78,25 +86,25 @@ export const useLeagues = createGlobalState(() => {
|
||||
)
|
||||
)
|
||||
.map((league) => {
|
||||
return { id: league.id, isPopular: true };
|
||||
});
|
||||
return { id: league.id, isPopular: true }
|
||||
})
|
||||
|
||||
const leagueIsAlive = tradeLeagues.value.some(
|
||||
(league) => league.id === selectedId.value
|
||||
);
|
||||
)
|
||||
if (!leagueIsAlive && !isPrivateLeague(selectedId.value ?? '')) {
|
||||
if (tradeLeagues.value.length > 1) {
|
||||
const TMP_CHALLENGE = 1;
|
||||
selectedId.value = tradeLeagues.value[TMP_CHALLENGE].id;
|
||||
const TMP_CHALLENGE = 1
|
||||
selectedId.value = tradeLeagues.value[TMP_CHALLENGE].id
|
||||
} else {
|
||||
const STANDARD = 0;
|
||||
selectedId.value = tradeLeagues.value[STANDARD].id;
|
||||
const STANDARD = 0
|
||||
selectedId.value = tradeLeagues.value[STANDARD].id
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = (e as Error).message;
|
||||
error.value = (e as Error).message
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +114,13 @@ export const useLeagues = createGlobalState(() => {
|
||||
selectedId,
|
||||
selected,
|
||||
list: readonly(tradeLeagues),
|
||||
load,
|
||||
};
|
||||
});
|
||||
load
|
||||
}
|
||||
})
|
||||
|
||||
function isPrivateLeague (id: string) {
|
||||
if (id.includes('Ruthless')) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
return /\(PL\d+\)$/.test(id);
|
||||
return /\(PL\d+\)$/.test(id)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import type { ItemCheckWidget } from './widget.js'
|
||||
import Widget from '../overlay/Widget.vue'
|
||||
import MapCheck from '../map-check/MapCheck.vue'
|
||||
import ItemInfo from './ItemInfo.vue'
|
||||
import ConversionWarningBanner from "../conversion-warn-banner/ConversionWarningBanner.vue";
|
||||
import ConversionWarningBanner from '../conversion-warn-banner/ConversionWarningBanner.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
config: ItemCheckWidget
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Host } from '@/web/background/IPC';
|
||||
import { AppConfig } from '@/web/Config';
|
||||
import { ParsedItem, parseClipboard } from '@/parser';
|
||||
import { Host } from '@/web/background/IPC'
|
||||
import { AppConfig } from '@/web/Config'
|
||||
import { ParsedItem, parseClipboard } from '@/parser'
|
||||
|
||||
const POEDB_LANGS = { en: 'us', ru: 'ru', 'cmn-Hant': 'tw', ko: 'kr' };
|
||||
const POEDB_LANGS = { 'en': 'us', 'ru': 'ru', 'cmn-Hant': 'tw', 'ko': 'kr' }
|
||||
|
||||
export function registerActions () {
|
||||
Host.onEvent('MAIN->CLIENT::item-text', (e) => {
|
||||
@@ -11,44 +11,43 @@ export function registerActions() {
|
||||
'open-wiki',
|
||||
'open-craft-of-exile',
|
||||
'open-poedb',
|
||||
'search-similar',
|
||||
'search-similar'
|
||||
].includes(e.target)
|
||||
)
|
||||
return;
|
||||
const parsed = parseClipboard(e.clipboard);
|
||||
if (!parsed.isOk()) return;
|
||||
) { return }
|
||||
const parsed = parseClipboard(e.clipboard)
|
||||
if (!parsed.isOk()) return
|
||||
|
||||
if (e.target === 'open-wiki') {
|
||||
openWiki(parsed.value);
|
||||
openWiki(parsed.value)
|
||||
} else if (e.target === 'open-craft-of-exile') {
|
||||
openCoE(parsed.value);
|
||||
openCoE(parsed.value)
|
||||
} else if (e.target === 'open-poedb') {
|
||||
openPoedb(parsed.value);
|
||||
openPoedb(parsed.value)
|
||||
} else if (e.target === 'search-similar') {
|
||||
findSimilarItems(parsed.value);
|
||||
findSimilarItems(parsed.value)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
export function openWiki (item: ParsedItem) {
|
||||
window.open(`https://www.poe2wiki.net/wiki/${item.info.refName}`);
|
||||
window.open(`https://www.poe2wiki.net/wiki/${item.info.refName}`)
|
||||
}
|
||||
export function openPoedb (item: ParsedItem) {
|
||||
window.open(
|
||||
`https://poe2db.tw/${POEDB_LANGS[AppConfig().language]}/search?q=${item.info.refName}`
|
||||
);
|
||||
)
|
||||
}
|
||||
export function openCoE (item: ParsedItem) {
|
||||
const encodedClipboard = encodeURIComponent(item.rawText);
|
||||
const encodedClipboard = encodeURIComponent(item.rawText)
|
||||
window.open(
|
||||
`https://craftofexile.com/?game=poe2&eimport=${encodedClipboard}`
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
export function findSimilarItems (item: ParsedItem) {
|
||||
const text = JSON.stringify(item.info.name);
|
||||
const text = JSON.stringify(item.info.name)
|
||||
Host.sendEvent({
|
||||
name: 'CLIENT->MAIN::user-action',
|
||||
payload: { action: 'stash-search', text },
|
||||
});
|
||||
payload: { action: 'stash-search', text }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ import CheckPositionCircle from './CheckPositionCircle.vue'
|
||||
import AppTitleBar from '@/web/ui/AppTitlebar.vue'
|
||||
import ItemQuickPrice from '@/web/ui/ItemQuickPrice.vue'
|
||||
import { PriceCheckWidget, WidgetManager } from '../overlay/interfaces'
|
||||
import ConversionWarningBanner from "../conversion-warn-banner/ConversionWarningBanner.vue";
|
||||
import ConversionWarningBanner from '../conversion-warn-banner/ConversionWarningBanner.vue'
|
||||
|
||||
type ParseError = { name: string; message: string; rawText: ParsedItem['rawText'] }
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ const stats = computed(() => {
|
||||
if (!parsed.roll) {
|
||||
return {
|
||||
text: parsed.translation.string,
|
||||
contribution: contribution,
|
||||
contribution,
|
||||
contributes: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ export function createFilters (
|
||||
}
|
||||
filters.searchRelaxed = {
|
||||
category: item.category,
|
||||
disabled: disabled
|
||||
disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ export function calculatedStatToFilter (
|
||||
? FilterTag.Enchant
|
||||
: FilterTag.Variant,
|
||||
oils: decodeOils(calc),
|
||||
sources: sources,
|
||||
sources,
|
||||
option: {
|
||||
value: sources[0].contributes!.value
|
||||
},
|
||||
@@ -197,7 +197,7 @@ export function calculatedStatToFilter (
|
||||
text: translation.string,
|
||||
tag: (type as unknown) as FilterTag,
|
||||
oils: decodeOils(calc),
|
||||
sources: sources,
|
||||
sources,
|
||||
roll: undefined,
|
||||
disabled: true
|
||||
}
|
||||
@@ -288,7 +288,7 @@ export function calculatedStatToFilter (
|
||||
bounds: (item.rarity === ItemRarity.Unique && roll.min !== roll.max && calc.stat.better !== StatBetter.NotComparable)
|
||||
? filterBounds
|
||||
: undefined,
|
||||
dp: dp,
|
||||
dp,
|
||||
isNegated: false,
|
||||
tradeInvert: calc.stat.trade.inverted
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ export function filterPseudo (ctx: FiltersCreationContext) {
|
||||
const filter = calculatedStatToFilter({
|
||||
stat: STAT_BY_REF(rule.pseudo)!,
|
||||
type: ModifierType.Pseudo,
|
||||
sources: sources
|
||||
sources
|
||||
}, ctx.searchInRange, ctx.item)
|
||||
|
||||
filter.disabled = rule.disabled ?? true
|
||||
|
||||
@@ -257,7 +257,7 @@ function propToFilter (opts: {
|
||||
better: StatBetter.PositiveRoll
|
||||
}
|
||||
const filter = calculatedStatToFilter({
|
||||
stat: stat,
|
||||
stat,
|
||||
type: ModifierType.Pseudo,
|
||||
sources: [{
|
||||
modifier: {
|
||||
@@ -265,7 +265,7 @@ function propToFilter (opts: {
|
||||
stats: []
|
||||
},
|
||||
stat: {
|
||||
stat: stat,
|
||||
stat,
|
||||
translation: stat.matchers[0],
|
||||
roll: {
|
||||
dp: opts.dp ?? false,
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import { ParsedItem } from '@/parser';
|
||||
import { useLeagues } from '@/web/background/Leagues';
|
||||
import { Host } from '@/web/background/IPC';
|
||||
import { Cache } from '../trade/Cache';
|
||||
import { usePoeninja } from '@/web/background/Prices';
|
||||
import { ParsedItem } from '@/parser'
|
||||
import { useLeagues } from '@/web/background/Leagues'
|
||||
import { Host } from '@/web/background/IPC'
|
||||
import { Cache } from '../trade/Cache'
|
||||
import { usePoeninja } from '@/web/background/Prices'
|
||||
|
||||
const cache = new Cache();
|
||||
const cache = new Cache()
|
||||
|
||||
interface PoepricesApiResponse {
|
||||
/* eslint-disable camelcase */ currency: 'chaos' | 'divine' | 'exalt';
|
||||
error: number;
|
||||
error_msg: string;
|
||||
warning_msg: string;
|
||||
max: number;
|
||||
min: number;
|
||||
pred_confidence_score: number;
|
||||
pred_explanation: Array<[string, number]>;
|
||||
/* eslint-disable camelcase */ currency: 'chaos' | 'divine' | 'exalt'
|
||||
error: number
|
||||
error_msg: string
|
||||
warning_msg: string
|
||||
max: number
|
||||
min: number
|
||||
pred_confidence_score: number
|
||||
pred_explanation: Array<[string, number]>
|
||||
}
|
||||
|
||||
export interface RareItemPrice {
|
||||
max: number;
|
||||
min: number;
|
||||
confidence: number;
|
||||
currency: 'chaos' | 'div';
|
||||
max: number
|
||||
min: number
|
||||
confidence: number
|
||||
currency: 'chaos' | 'div'
|
||||
explanation: Array<{
|
||||
name: string;
|
||||
contrib: number;
|
||||
}>;
|
||||
name: string
|
||||
contrib: number
|
||||
}>
|
||||
}
|
||||
|
||||
export async function requestPoeprices (
|
||||
@@ -34,46 +34,46 @@ export async function requestPoeprices(
|
||||
const query = querystring({
|
||||
i: utf8ToBase64(transformItemText(item.rawText)),
|
||||
l: useLeagues().selectedId.value,
|
||||
s: 'awakened-poe-trade', // might be required name here
|
||||
});
|
||||
s: 'awakened-poe-trade' // might be required name here
|
||||
})
|
||||
|
||||
let data = cache.get<PoepricesApiResponse>(query);
|
||||
let data = cache.get<PoepricesApiResponse>(query)
|
||||
if (!data) {
|
||||
const response = await Host.proxy(`www.poeprices.info/api?${query}`);
|
||||
const response = await Host.proxy(`www.poeprices.info/api?${query}`)
|
||||
try {
|
||||
data = (await response.json()) as PoepricesApiResponse;
|
||||
data = (await response.json()) as PoepricesApiResponse
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`${response.status}, poeprices.info API is under load or down.`
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
if (data.error !== 0) {
|
||||
throw new Error(data.error_msg);
|
||||
throw new Error(data.error_msg)
|
||||
}
|
||||
|
||||
cache.set<PoepricesApiResponse>(query, data, 300);
|
||||
cache.set<PoepricesApiResponse>(query, data, 300)
|
||||
}
|
||||
|
||||
if (data.currency === 'exalt') {
|
||||
const { findPriceByQuery, autoCurrency } = usePoeninja();
|
||||
const { findPriceByQuery, autoCurrency } = usePoeninja()
|
||||
const xchgExalted = findPriceByQuery({
|
||||
ns: 'ITEM',
|
||||
name: 'Exalted Orb',
|
||||
variant: undefined,
|
||||
});
|
||||
variant: undefined
|
||||
})
|
||||
if (!xchgExalted) {
|
||||
throw new Error('poeprices.info gave the price in Exalted Orbs.');
|
||||
throw new Error('poeprices.info gave the price in Exalted Orbs.')
|
||||
}
|
||||
const converted = autoCurrency([
|
||||
data.min * xchgExalted.chaos,
|
||||
data.max * xchgExalted.chaos,
|
||||
]);
|
||||
data.min = converted.min;
|
||||
data.max = converted.max;
|
||||
data.currency = converted.currency === 'div' ? 'divine' : 'chaos';
|
||||
data.max * xchgExalted.chaos
|
||||
])
|
||||
data.min = converted.min
|
||||
data.max = converted.max
|
||||
data.currency = converted.currency === 'div' ? 'divine' : 'chaos'
|
||||
} else if (data.currency !== 'divine' && data.currency !== 'chaos') {
|
||||
throw new Error('poeprices.info gave the price in unknown currency.');
|
||||
throw new Error('poeprices.info gave the price in unknown currency.')
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -83,9 +83,9 @@ export async function requestPoeprices(
|
||||
confidence: Math.round(data.pred_confidence_score),
|
||||
explanation: data.pred_explanation.map((expl) => ({
|
||||
name: expl[0],
|
||||
contrib: Math.round(expl[1] * 100),
|
||||
})),
|
||||
};
|
||||
contrib: Math.round(expl[1] * 100)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
export function getExternalLink (item: ParsedItem): string {
|
||||
@@ -93,44 +93,44 @@ export function getExternalLink(item: ParsedItem): string {
|
||||
i: utf8ToBase64(transformItemText(item.rawText)),
|
||||
l: useLeagues().selectedId.value,
|
||||
s: 'awakened-poe-trade',
|
||||
w: 1,
|
||||
});
|
||||
return `https://www.poeprices.info/api?${query}`;
|
||||
w: 1
|
||||
})
|
||||
return `https://www.poeprices.info/api?${query}`
|
||||
}
|
||||
|
||||
export async function sendFeedback (
|
||||
feedback: { text: string; option: 'fair' | 'low' | 'high' },
|
||||
feedback: { text: string, option: 'fair' | 'low' | 'high' },
|
||||
prediction: Pick<PoepricesApiResponse, 'min' | 'max' | 'currency'>,
|
||||
item: ParsedItem
|
||||
): Promise<void> {
|
||||
const body = new FormData();
|
||||
body.append('selector', feedback.option);
|
||||
body.append('feedbacktxt', feedback.text);
|
||||
body.append('qitem_txt', utf8ToBase64(transformItemText(item.rawText)));
|
||||
body.append('source', 'awakened-poe-trade');
|
||||
body.append('min', String(prediction.min));
|
||||
body.append('max', String(prediction.max));
|
||||
body.append('currency', prediction.currency);
|
||||
body.append('league', useLeagues().selectedId.value!);
|
||||
const body = new FormData()
|
||||
body.append('selector', feedback.option)
|
||||
body.append('feedbacktxt', feedback.text)
|
||||
body.append('qitem_txt', utf8ToBase64(transformItemText(item.rawText)))
|
||||
body.append('source', 'awakened-poe-trade')
|
||||
body.append('min', String(prediction.min))
|
||||
body.append('max', String(prediction.max))
|
||||
body.append('currency', prediction.currency)
|
||||
body.append('league', useLeagues().selectedId.value!)
|
||||
// body.append('debug', String(1))
|
||||
|
||||
const response = await Host.proxy('www.poeprices.info/send_feedback', {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
body
|
||||
})
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const text = await response.text();
|
||||
const text = await response.text()
|
||||
// console.assert(text === `"${feedback.option}"`)
|
||||
}
|
||||
|
||||
function utf8ToBase64 (value: string) {
|
||||
return btoa(unescape(encodeURIComponent(value)));
|
||||
return btoa(unescape(encodeURIComponent(value)))
|
||||
}
|
||||
|
||||
function querystring (q: Record<string, any>) {
|
||||
return Object.entries(q)
|
||||
.map((pair) => pair.map(encodeURIComponent).join('='))
|
||||
.join('&');
|
||||
.join('&')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,5 +140,5 @@ function transformItemText(rawText: string) {
|
||||
// this may not account for all cases
|
||||
return rawText
|
||||
.replace(/(?<=\d)(\([^)]+\))/gm, '')
|
||||
.replace(/^\{.+\}$\n/gm, '');
|
||||
.replace(/^\{.+\}$\n/gm, '')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DateTime } from 'luxon';
|
||||
import { Host } from '@/web/background/IPC';
|
||||
import { DateTime } from 'luxon'
|
||||
import { Host } from '@/web/background/IPC'
|
||||
import {
|
||||
TradeResponse,
|
||||
Account,
|
||||
@@ -7,102 +7,102 @@ import {
|
||||
RATE_LIMIT_RULES,
|
||||
adjustRateLimits,
|
||||
tradeTag,
|
||||
preventQueueCreation,
|
||||
} from './common';
|
||||
import { RateLimiter } from './RateLimiter';
|
||||
import { ItemFilters } from '../filters/interfaces';
|
||||
import { ParsedItem } from '@/parser';
|
||||
import { Cache } from './Cache';
|
||||
preventQueueCreation
|
||||
} from './common'
|
||||
import { RateLimiter } from './RateLimiter'
|
||||
import { ItemFilters } from '../filters/interfaces'
|
||||
import { ParsedItem } from '@/parser'
|
||||
import { Cache } from './Cache'
|
||||
|
||||
interface TradeRequest {
|
||||
/* eslint-disable camelcase */ engine: 'new';
|
||||
/* eslint-disable camelcase */ engine: 'new'
|
||||
query: {
|
||||
status: { option: 'online' | 'onlineleague' | 'any' };
|
||||
have: string[];
|
||||
want: string[];
|
||||
minimum?: number;
|
||||
fulfillable?: null;
|
||||
};
|
||||
sort: { have: 'asc' };
|
||||
status: { option: 'online' | 'onlineleague' | 'any' }
|
||||
have: string[]
|
||||
want: string[]
|
||||
minimum?: number
|
||||
fulfillable?: null
|
||||
}
|
||||
sort: { have: 'asc' }
|
||||
}
|
||||
|
||||
interface SearchResult {
|
||||
id: string;
|
||||
result: Record<string, FetchResult>;
|
||||
total: number;
|
||||
id: string
|
||||
result: Record<string, FetchResult>
|
||||
total: number
|
||||
}
|
||||
|
||||
interface FetchResult {
|
||||
id: string;
|
||||
id: string
|
||||
listing: {
|
||||
indexed: string;
|
||||
indexed: string
|
||||
offers: Array<{
|
||||
exchange: {
|
||||
currency: string;
|
||||
amount: number;
|
||||
};
|
||||
currency: string
|
||||
amount: number
|
||||
}
|
||||
item: {
|
||||
amount: number;
|
||||
stock: number;
|
||||
};
|
||||
}>;
|
||||
account: Account;
|
||||
};
|
||||
amount: number
|
||||
stock: number
|
||||
}
|
||||
}>
|
||||
account: Account
|
||||
}
|
||||
}
|
||||
|
||||
export interface PricingResult {
|
||||
id: string;
|
||||
relativeDate: string;
|
||||
exchangeAmount: number;
|
||||
itemAmount: number;
|
||||
stock: number;
|
||||
accountStatus: 'offline' | 'online' | 'afk';
|
||||
isMine: boolean;
|
||||
accountName: string;
|
||||
ign: string;
|
||||
id: string
|
||||
relativeDate: string
|
||||
exchangeAmount: number
|
||||
itemAmount: number
|
||||
stock: number
|
||||
accountStatus: 'offline' | 'online' | 'afk'
|
||||
isMine: boolean
|
||||
accountName: string
|
||||
ign: string
|
||||
}
|
||||
|
||||
const cache = new Cache();
|
||||
const cache = new Cache()
|
||||
|
||||
async function requestTradeResultList (
|
||||
body: TradeRequest,
|
||||
leagueId: string
|
||||
): Promise<SearchResult> {
|
||||
let data = cache.get<SearchResult>([body, leagueId]);
|
||||
let data = cache.get<SearchResult>([body, leagueId])
|
||||
|
||||
if (!data) {
|
||||
preventQueueCreation([{ count: 1, limiters: RATE_LIMIT_RULES.EXCHANGE }]);
|
||||
preventQueueCreation([{ count: 1, limiters: RATE_LIMIT_RULES.EXCHANGE }])
|
||||
|
||||
await RateLimiter.waitMulti(RATE_LIMIT_RULES.EXCHANGE);
|
||||
await RateLimiter.waitMulti(RATE_LIMIT_RULES.EXCHANGE)
|
||||
|
||||
const response = await Host.proxy(
|
||||
`${getTradeEndpoint()}/api/trade2/exchange/${leagueId}`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
body: JSON.stringify(body)
|
||||
}
|
||||
);
|
||||
adjustRateLimits(RATE_LIMIT_RULES.EXCHANGE, response.headers);
|
||||
)
|
||||
adjustRateLimits(RATE_LIMIT_RULES.EXCHANGE, response.headers)
|
||||
|
||||
const _data = (await response.json()) as TradeResponse<SearchResult>;
|
||||
const _data = (await response.json()) as TradeResponse<SearchResult>
|
||||
if (_data.error) {
|
||||
throw new Error(_data.error.message);
|
||||
throw new Error(_data.error.message)
|
||||
} else {
|
||||
data = _data;
|
||||
data = _data
|
||||
}
|
||||
|
||||
cache.set<SearchResult>(
|
||||
[body, leagueId],
|
||||
data,
|
||||
Cache.deriveTtl(...RATE_LIMIT_RULES.EXCHANGE)
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
return data;
|
||||
return data
|
||||
}
|
||||
|
||||
function toPricingResult (
|
||||
@@ -125,15 +125,15 @@ function toPricingResult(
|
||||
? result.listing.account.online.status === 'afk'
|
||||
? 'afk'
|
||||
: 'online'
|
||||
: 'offline',
|
||||
};
|
||||
: 'offline'
|
||||
}
|
||||
}
|
||||
|
||||
export interface BulkSearch {
|
||||
queryId: string;
|
||||
haveTag: string;
|
||||
total: number;
|
||||
listed: PricingResult[];
|
||||
queryId: string
|
||||
haveTag: string
|
||||
total: number
|
||||
listed: PricingResult[]
|
||||
}
|
||||
|
||||
export function createTradeRequest (
|
||||
@@ -144,27 +144,27 @@ export function createTradeRequest(
|
||||
return {
|
||||
engine: 'new',
|
||||
query: {
|
||||
have: have,
|
||||
have,
|
||||
want: [tradeTag(item)!],
|
||||
status: {
|
||||
option: filters.trade.offline
|
||||
? 'any'
|
||||
: filters.trade.onlineInLeague
|
||||
? 'onlineleague'
|
||||
: 'online',
|
||||
: 'online'
|
||||
},
|
||||
minimum:
|
||||
filters.stackSize && !filters.stackSize.disabled
|
||||
? filters.stackSize.value
|
||||
: undefined,
|
||||
: undefined
|
||||
// fulfillable: null
|
||||
},
|
||||
sort: { have: 'asc' },
|
||||
};
|
||||
sort: { have: 'asc' }
|
||||
}
|
||||
}
|
||||
|
||||
const SHOW_RESULTS = 20;
|
||||
const API_FETCH_LIMIT = 100;
|
||||
const SHOW_RESULTS = 20
|
||||
const API_FETCH_LIMIT = 100
|
||||
|
||||
export async function execBulkSearch (
|
||||
item: ParsedItem,
|
||||
@@ -175,23 +175,23 @@ export async function execBulkSearch(
|
||||
const query = await requestTradeResultList(
|
||||
createTradeRequest(filters, item, have),
|
||||
filters.trade.league
|
||||
);
|
||||
)
|
||||
|
||||
const offer = 0;
|
||||
const offer = 0
|
||||
const results = Object.values(query.result).filter(
|
||||
(result) => result.listing.offers.length === 1
|
||||
);
|
||||
)
|
||||
|
||||
const resultByHave = have.map((tradeTag) => {
|
||||
const resultsTag = results.filter(
|
||||
(result) => result.listing.offers[offer].exchange.currency === tradeTag
|
||||
);
|
||||
)
|
||||
|
||||
const loadedOnDemand =
|
||||
tradeTag === 'chaos' &&
|
||||
resultsTag.length < SHOW_RESULTS &&
|
||||
query.total > API_FETCH_LIMIT;
|
||||
if (loadedOnDemand) return null;
|
||||
query.total > API_FETCH_LIMIT
|
||||
if (loadedOnDemand) return null
|
||||
|
||||
const listed = resultsTag
|
||||
.sort(
|
||||
@@ -202,13 +202,13 @@ export async function execBulkSearch(
|
||||
b.listing.offers[offer].item.amount
|
||||
)
|
||||
.slice(0, SHOW_RESULTS)
|
||||
.map((result) => toPricingResult(result, opts, offer));
|
||||
.map((result) => toPricingResult(result, opts, offer))
|
||||
|
||||
const chaosIsLoaded =
|
||||
tradeTag === 'divine' &&
|
||||
resultsTag.length < results.length &&
|
||||
(results.length - resultsTag.length >= SHOW_RESULTS ||
|
||||
query.total <= API_FETCH_LIMIT);
|
||||
query.total <= API_FETCH_LIMIT)
|
||||
|
||||
return {
|
||||
queryId: query.id,
|
||||
@@ -217,9 +217,9 @@ export async function execBulkSearch(
|
||||
total: chaosIsLoaded
|
||||
? resultsTag.length
|
||||
: query.total - (results.length - resultsTag.length),
|
||||
listed: listed,
|
||||
};
|
||||
});
|
||||
|
||||
return resultByHave;
|
||||
listed
|
||||
}
|
||||
})
|
||||
|
||||
return resultByHave
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -104,7 +104,7 @@ export default defineComponent({
|
||||
: autoCurrency(trend.chaos)
|
||||
|
||||
return {
|
||||
price: price,
|
||||
price,
|
||||
change: deltaFromGraph(trend.graph),
|
||||
url: trend.url
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export default defineComponent({
|
||||
function select (info: BaseType) {
|
||||
const newItem: ParsedItem = {
|
||||
...props.item!,
|
||||
info: info
|
||||
info
|
||||
}
|
||||
ctx.emit('identify', newItem)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user