mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-28 15:45:58 +00:00
refactor
This commit is contained in:
@@ -91,8 +91,8 @@ export default {
|
||||
computed: {
|
||||
showPredictedPrice () {
|
||||
return this.item.rarity === ItemRarity.Rare &&
|
||||
this.item.computed.category !== ItemCategory.Map &&
|
||||
this.item.computed.category !== ItemCategory.ItemisedMonster
|
||||
this.item.category !== ItemCategory.Map &&
|
||||
this.item.category !== ItemCategory.ItemisedMonster
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -42,8 +42,8 @@ export default {
|
||||
showAsActive () {
|
||||
if (
|
||||
this.item.rarity === ItemRarity.Unique ||
|
||||
!this.item.computed.category ||
|
||||
[ItemCategory.Map, ItemCategory.Prophecy, ItemCategory.ItemisedMonster].includes(this.item.computed.category)
|
||||
!this.item.category ||
|
||||
[ItemCategory.Map, ItemCategory.Prophecy, ItemCategory.ItemisedMonster].includes(this.item.category)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
@@ -55,8 +55,8 @@ export default {
|
||||
toggleAccuracy () {
|
||||
if (
|
||||
this.item.rarity === ItemRarity.Unique ||
|
||||
!this.item.computed.category ||
|
||||
[ItemCategory.Map, ItemCategory.Prophecy, ItemCategory.ItemisedMonster].includes(this.item.computed.category)
|
||||
!this.item.category ||
|
||||
[ItemCategory.Map, ItemCategory.Prophecy, ItemCategory.ItemisedMonster].includes(this.item.category)
|
||||
) return
|
||||
|
||||
if (this.filters.category) {
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
} else {
|
||||
this.filters.baseType = undefined
|
||||
this.$set(this.filters, 'category', {
|
||||
value: this.item.computed.category
|
||||
value: this.item.category
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
|
||||
const filters: ItemFilters = {}
|
||||
|
||||
if (item.computed.category === ItemCategory.ItemisedMonster) {
|
||||
if (item.category === ItemCategory.ItemisedMonster) {
|
||||
filters.baseType = {
|
||||
value: item.baseType || item.name
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
}
|
||||
return filters
|
||||
}
|
||||
if (item.computed.category === ItemCategory.Prophecy) {
|
||||
if (item.category === ItemCategory.Prophecy) {
|
||||
filters.name = {
|
||||
value: item.name
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
return filters
|
||||
}
|
||||
|
||||
if (item.computed.category === ItemCategory.Map) {
|
||||
if (item.category === ItemCategory.Map) {
|
||||
filters.baseType = {
|
||||
value: item.baseType || item.name
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
}
|
||||
|
||||
filters.mapTier = {
|
||||
value: item.mapTier!
|
||||
value: item.props.mapTier!
|
||||
}
|
||||
|
||||
// @TODO: juicy corrupted maps
|
||||
@@ -75,9 +75,9 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
value: item.baseType!
|
||||
}
|
||||
} else if (item.rarity === ItemRarity.Rare) {
|
||||
if (item.computed.category) {
|
||||
if (item.category) {
|
||||
filters.category = {
|
||||
value: item.computed.category
|
||||
value: item.category
|
||||
}
|
||||
}
|
||||
// else { never? }
|
||||
@@ -88,9 +88,9 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
}
|
||||
}
|
||||
|
||||
if (item.linkedSockets) {
|
||||
if (item.sockets.linked) {
|
||||
filters.linkedSockets = {
|
||||
value: item.linkedSockets,
|
||||
value: item.sockets.linked,
|
||||
disabled: false
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export function createFilters (item: ParsedItem): ItemFilters {
|
||||
if (item.itemLevel) {
|
||||
if (
|
||||
item.rarity !== ItemRarity.Unique &&
|
||||
item.computed.category !== ItemCategory.Map
|
||||
item.category !== ItemCategory.Map
|
||||
/* @TODO && !isJewel https://pathofexile.gamepedia.com/Jewel#Affixes */
|
||||
) {
|
||||
if (item.itemLevel > 86) {
|
||||
@@ -173,18 +173,18 @@ export function createGemFilters (item: ParsedItem) {
|
||||
|
||||
if (SPECIAL_SUPPORT_GEM.includes(item.name)) {
|
||||
filters.gemLevel = {
|
||||
min: item.gemLevel,
|
||||
max: item.gemLevel
|
||||
min: item.props.gemLevel,
|
||||
max: item.props.gemLevel
|
||||
}
|
||||
} else if (item.gemLevel! >= TradeOpts.GemLevel) {
|
||||
} else if (item.props.gemLevel! >= TradeOpts.GemLevel) {
|
||||
if (TradeOpts.GemLevelRange > 0) {
|
||||
filters.gemLevel = {
|
||||
min: item.gemLevel! - TradeOpts.GemLevelRange,
|
||||
max: item.gemLevel! + TradeOpts.GemLevelRange
|
||||
min: item.props.gemLevel! - TradeOpts.GemLevelRange,
|
||||
max: item.props.gemLevel! + TradeOpts.GemLevelRange
|
||||
}
|
||||
} else {
|
||||
filters.gemLevel = {
|
||||
min: item.gemLevel
|
||||
min: item.props.gemLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,19 +17,21 @@ export interface ParsedItem {
|
||||
physicalDamage?: number[]
|
||||
elementalDamage?: number
|
||||
mapBlighted?: true
|
||||
mapTier?: number
|
||||
gemLevel?: number
|
||||
}
|
||||
mapTier?: number
|
||||
quality?: number
|
||||
linkedSockets?: number // only 5 or 6
|
||||
sockets: {
|
||||
linked?: number // only 5 or 6
|
||||
// @TODO "white?: number"
|
||||
// PoE 4.0 "count?: number"
|
||||
}
|
||||
stackSize?: number
|
||||
isUnidentified: boolean
|
||||
isCorrupted: boolean
|
||||
gemLevel?: number
|
||||
influences: ItemInfluence[]
|
||||
rawText: string
|
||||
modifiers: ItemModifier[]
|
||||
category?: ItemCategory
|
||||
icon?: string
|
||||
computed: {
|
||||
category?: ItemCategory
|
||||
}
|
||||
rawText: string
|
||||
}
|
||||
|
||||
@@ -129,15 +129,15 @@ function normalizeName (_: string[], item: ParsedItem) {
|
||||
}
|
||||
|
||||
if (Prophecies.has(item.name)) {
|
||||
item.computed.category = ItemCategory.Prophecy
|
||||
item.category = ItemCategory.Prophecy
|
||||
} else if (
|
||||
ItemisedMonsters.has(item.name) || // Unique beast
|
||||
(item.baseType && ItemisedMonsters.has(item.baseType)) // Rare beast
|
||||
) {
|
||||
item.computed.category = ItemCategory.ItemisedMonster
|
||||
item.category = ItemCategory.ItemisedMonster
|
||||
} else {
|
||||
const baseType = BaseTypes.get(item.baseType || item.name)
|
||||
item.computed.category = baseType?.category
|
||||
item.category = baseType?.category
|
||||
item.icon = baseType?.icon
|
||||
}
|
||||
|
||||
@@ -146,12 +146,12 @@ function normalizeName (_: string[], item: ParsedItem) {
|
||||
|
||||
function parseMap (section: string[], item: ParsedItem) {
|
||||
if (section[0].startsWith(TAG_MAP_TIER)) {
|
||||
item.mapTier = Number(section[0].substr(TAG_MAP_TIER.length))
|
||||
item.props.mapTier = Number(section[0].substr(TAG_MAP_TIER.length))
|
||||
|
||||
if (item.rarity === ItemRarity.Normal) {
|
||||
if (item.name.startsWith(PREFIX_BLIGHTED)) {
|
||||
item.name = item.name.substr(PREFIX_BLIGHTED.length)
|
||||
item.computed.category = ItemCategory.Map
|
||||
item.category = ItemCategory.Map
|
||||
item.props.mapBlighted = true
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ function parseNamePlate (section: string[]) {
|
||||
isCorrupted: false,
|
||||
modifiers: [],
|
||||
influences: [],
|
||||
computed: {},
|
||||
sockets: {},
|
||||
rawText: undefined!
|
||||
}
|
||||
return item
|
||||
@@ -252,7 +252,7 @@ function parseGem (section: string[], item: ParsedItem) {
|
||||
}
|
||||
if (section[1]?.startsWith(TAG_GEM_LEVEL)) {
|
||||
// "Level: 20 (Max)"
|
||||
item.gemLevel = parseInt(section[1].substr(TAG_GEM_LEVEL.length), 10)
|
||||
item.props.gemLevel = parseInt(section[1].substr(TAG_GEM_LEVEL.length), 10)
|
||||
|
||||
parseQualityNested(section, item)
|
||||
|
||||
@@ -278,13 +278,13 @@ function parseSockets (section: string[], item: ParsedItem) {
|
||||
let sockets = section[0].substr(TAG_SOCKETS.length)
|
||||
sockets = sockets.replace(/[^ -]/g, '#')
|
||||
if (sockets === '#-#-#-#-#-#') {
|
||||
item.linkedSockets = 6
|
||||
item.sockets.linked = 6
|
||||
} else if (
|
||||
sockets === '# #-#-#-#-#' ||
|
||||
sockets === '#-#-#-#-# #' ||
|
||||
sockets === '#-#-#-#-#'
|
||||
) {
|
||||
item.linkedSockets = 5
|
||||
item.sockets.linked = 5
|
||||
}
|
||||
return SECTION_PARSED
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ const CATEGORY_TO_TRADE_ID = new Map([
|
||||
[ItemCategory.Warstaff, 'weapon.warstaff']
|
||||
])
|
||||
|
||||
type FilterBoolean = { option?: 'true' | 'false' }
|
||||
type FilterRange = { min?: number, max?: number }
|
||||
|
||||
interface TradeRequest { /* eslint-disable camelcase */
|
||||
query: {
|
||||
status: { option: 'online' }
|
||||
@@ -45,10 +48,7 @@ interface TradeRequest { /* eslint-disable camelcase */
|
||||
type?: string
|
||||
stats: Array<{
|
||||
type: 'and' | 'if' | 'count',
|
||||
value?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
value?: FilterRange
|
||||
filters: Array<{
|
||||
id: string
|
||||
value?: {
|
||||
@@ -73,70 +73,39 @@ interface TradeRequest { /* eslint-disable camelcase */
|
||||
}
|
||||
socket_filters?: {
|
||||
filters: {
|
||||
links?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
links?: FilterRange
|
||||
}
|
||||
}
|
||||
misc_filters?: {
|
||||
filters: {
|
||||
ilvl?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
quality?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
gem_level?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
corrupted?: {
|
||||
option?: 'true' | 'false'
|
||||
}
|
||||
shaper_item?: { option?: 'true' | 'false' }
|
||||
crusader_item?: { option?: 'true' | 'false' }
|
||||
hunter_item?: { option?: 'true' | 'false' }
|
||||
elder_item?: { option?: 'true' | 'false' }
|
||||
redeemer_item?: { option?: 'true' | 'false' }
|
||||
warlord_item?: { option?: 'true' | 'false' }
|
||||
ilvl?: FilterRange
|
||||
quality?: FilterRange
|
||||
gem_level?: FilterRange
|
||||
corrupted?: FilterBoolean
|
||||
shaper_item?: FilterBoolean
|
||||
crusader_item?: FilterBoolean
|
||||
hunter_item?: FilterBoolean
|
||||
elder_item?: FilterBoolean
|
||||
redeemer_item?: FilterBoolean
|
||||
warlord_item?: FilterBoolean
|
||||
}
|
||||
}
|
||||
armour_filters?: {
|
||||
filters: {
|
||||
ar?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
es?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
ev?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
ar?: FilterRange
|
||||
es?: FilterRange
|
||||
ev?: FilterRange
|
||||
}
|
||||
}
|
||||
weapon_filters?: {
|
||||
filters: {
|
||||
pdps?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
pdps?: FilterRange
|
||||
}
|
||||
}
|
||||
map_filters?: {
|
||||
filters: {
|
||||
map_tier?: {
|
||||
min?: number
|
||||
max?: number
|
||||
}
|
||||
map_blighted?: {
|
||||
option?: 'true' | 'false'
|
||||
}
|
||||
map_tier?: FilterRange
|
||||
map_blighted?: FilterBoolean
|
||||
}
|
||||
}
|
||||
trade_filters: {
|
||||
|
||||
@@ -5,14 +5,14 @@ import { ACCESSORY, ARMOUR, WEAPON } from '../parser/meta'
|
||||
export function isValuableBasetype (item: ParsedItem): boolean {
|
||||
if (
|
||||
!(item.rarity === ItemRarity.Normal || item.rarity === ItemRarity.Magic || item.rarity === ItemRarity.Rare) ||
|
||||
!item.computed.category
|
||||
!item.category
|
||||
) return false
|
||||
|
||||
return (
|
||||
ACCESSORY.has(item.computed.category) ||
|
||||
ARMOUR.has(item.computed.category) ||
|
||||
WEAPON.has(item.computed.category) ||
|
||||
item.computed.category === ItemCategory.Quiver
|
||||
ACCESSORY.has(item.category) ||
|
||||
ARMOUR.has(item.category) ||
|
||||
WEAPON.has(item.category) ||
|
||||
item.category === ItemCategory.Quiver
|
||||
)
|
||||
}
|
||||
|
||||
@@ -22,15 +22,15 @@ export function getDetailsId (item: ParsedItem) {
|
||||
if (item.rarity === ItemRarity.Gem) {
|
||||
return getGemDetailsId(item)!
|
||||
}
|
||||
if (item.computed.category === ItemCategory.Map) {
|
||||
if (item.category === ItemCategory.Map) {
|
||||
if (item.rarity === ItemRarity.Unique) {
|
||||
// @TODO if unidentified get name by baseType
|
||||
return nameToDetailsId(`${item.name} t${item.mapTier}`)
|
||||
return nameToDetailsId(`${item.name} t${item.props.mapTier}`)
|
||||
} else {
|
||||
return nameToDetailsId(`${item.props.mapBlighted ? 'Blighted ' : ''}${item.baseType || item.name} t${item.mapTier} ${LATEST_MAP_VARIANT}`)
|
||||
return nameToDetailsId(`${item.props.mapBlighted ? 'Blighted ' : ''}${item.baseType || item.name} t${item.props.mapTier} ${LATEST_MAP_VARIANT}`)
|
||||
}
|
||||
}
|
||||
if (item.computed.category === ItemCategory.ItemisedMonster) {
|
||||
if (item.category === ItemCategory.ItemisedMonster) {
|
||||
return nameToDetailsId(item.baseType || item.name)
|
||||
}
|
||||
if (item.rarity === ItemRarity.Unique) {
|
||||
@@ -52,7 +52,7 @@ function getGemDetailsId (item: ParsedItem) {
|
||||
return 'portal-1'
|
||||
}
|
||||
if (item.name.startsWith('Awakened')) {
|
||||
return (item.gemLevel === 1)
|
||||
return (item.props.gemLevel === 1)
|
||||
? `${nameToDetailsId(item.name)}-1-20`
|
||||
: undefined
|
||||
}
|
||||
@@ -63,9 +63,9 @@ function getGemDetailsId (item: ParsedItem) {
|
||||
SPECIAL_SUPPORT_GEM.includes(item.name) ||
|
||||
item.name === BRAND_RECALL_GEM ||
|
||||
item.name === BLOOD_AND_SAND_GEM ||
|
||||
item.gemLevel! >= 20
|
||||
item.props.gemLevel! >= 20
|
||||
) {
|
||||
id += `-${item.gemLevel}`
|
||||
id += `-${item.props.gemLevel}`
|
||||
}
|
||||
if (item.quality) {
|
||||
if (
|
||||
@@ -100,8 +100,8 @@ function getBaseTypeDetailsId (item: ParsedItem) {
|
||||
function getUniqueDetailsId (item: ParsedItem) {
|
||||
let id = nameToDetailsId(`${item.name} ${item.baseType}`)
|
||||
|
||||
if (item.linkedSockets) {
|
||||
id += `-${item.linkedSockets}l`
|
||||
if (item.sockets.linked) {
|
||||
id += `-${item.sockets.linked}l`
|
||||
}
|
||||
|
||||
return id
|
||||
|
||||
Reference in New Issue
Block a user