change Oils data storage, add support for Rings

This commit is contained in:
Alexander Drozdov
2022-06-09 16:13:24 +03:00
parent 6cc8ce71f8
commit 6a3994e218
11 changed files with 327 additions and 714 deletions
-422
View File
@@ -1,422 +0,0 @@
{
"oils": [
"Tainted Oil",
"Clear Oil",
"Sepia Oil",
"Amber Oil",
"Verdant Oil",
"Teal Oil",
"Azure Oil",
"Indigo Oil",
"Violet Oil",
"Crimson Oil",
"Black Oil",
"Opalescent Oil",
"Silver Oil",
"Golden Oil"
],
"recipes": {
"6": [1, 6, 10],
"529": [1, 3, 6],
"544": [2, 7, 11],
"570": [5, 5, 11],
"861": [4, 8, 10],
"1006": [2, 2, 11],
"1325": [5, 13, 13],
"1340": [3, 4, 10],
"1382": [4, 4, 4],
"1405": [1, 6, 9],
"1568": [3, 11, 11],
"2225": [1, 1, 11],
"2550": [4, 4, 6],
"2715": [3, 3, 4],
"2959": [7, 10, 13],
"3309": [2, 3, 11],
"3452": [4, 11, 13],
"4177": [12, 12, 13],
"4207": [7, 11, 11],
"4481": [4, 6, 12],
"4833": [9, 11, 11],
"4854": [7, 8, 12],
"4940": [2, 3, 10],
"5126": [4, 8, 8],
"5289": [2, 4, 6],
"5430": [3, 10, 10],
"5456": [1, 3, 3],
"5624": [10, 13, 13],
"5823": [3, 9, 10],
"6233": [1, 4, 9],
"6237": [2, 2, 9],
"6289": [3, 9, 13],
"6615": [1, 1, 12],
"6770": [1, 5, 10],
"6799": [11, 13, 13],
"6967": [4, 6, 10],
"7069": [1, 7, 11],
"7085": [1, 3, 8],
"7136": [5, 10, 11],
"7263": [1, 3, 13],
"7440": [1, 3, 7],
"7555": [10, 11, 11],
"7688": [1, 4, 13],
"7918": [8, 8, 8],
"8001": [1, 4, 7],
"8135": [1, 1, 8],
"8458": [5, 9, 11],
"8833": [9, 11, 13],
"8920": [1, 5, 12],
"9015": [6, 9, 11],
"9055": [6, 11, 11],
"9194": [8, 8, 12],
"9261": [10, 10, 10],
"9432": [2, 8, 10],
"9535": [1, 4, 12],
"9567": [6, 8, 9],
"9788": [3, 9, 9],
"9864": [1, 5, 13],
"10016": [3, 4, 6],
"10115": [1, 6, 6],
"10153": [1, 1, 5],
"10511": [9, 9, 11],
"10542": [1, 2, 5],
"10835": [2, 5, 6],
"11420": [1, 9, 10],
"11645": [6, 8, 13],
"11730": [1, 10, 13],
"11784": [3, 5, 8],
"11820": [7, 13, 13],
"11924": [4, 6, 13],
"12143": [4, 5, 13],
"12702": [3, 3, 3],
"12795": [4, 4, 11],
"12809": [1, 2, 11],
"12878": [4, 9, 11],
"13164": [2, 5, 10],
"13922": [2, 13, 13],
"14001": [7, 7, 9],
"14606": [4, 8, 9],
"14665": [3, 3, 11],
"14813": [3, 8, 10],
"15027": [1, 1, 2],
"15046": [2, 8, 9],
"15085": [3, 6, 10],
"15290": [7, 12, 12],
"15344": [1, 2, 8],
"15400": [11, 12, 12],
"15437": [3, 7, 12],
"15614": [8, 10, 11],
"15711": [1, 4, 11],
"15842": [4, 9, 10],
"15852": [3, 12, 13],
"16236": [1, 3, 9],
"16243": [2, 4, 4],
"16246": [6, 13, 13],
"16703": [1, 10, 11],
"17171": [4, 6, 9],
"17608": [3, 4, 8],
"18025": [2, 3, 3],
"18174": [5, 5, 5],
"18703": [8, 8, 10],
"18707": [4, 5, 12],
"18769": [2, 8, 13],
"18865": [2, 8, 11],
"19069": [8, 12, 12],
"19103": [4, 10, 10],
"19144": [4, 5, 6],
"19506": [1, 4, 4],
"19730": [1, 7, 10],
"19858": [5, 11, 12],
"19897": [1, 9, 12],
"20528": [4, 12, 12],
"20832": [3, 5, 5],
"20835": [1, 3, 11],
"21228": [10, 11, 12],
"21297": [4, 4, 12],
"21330": [5, 5, 13],
"21389": [6, 9, 12],
"21413": [1, 4, 10],
"21435": [1, 1, 6],
"21460": [5, 12, 12],
"21602": [2, 3, 12],
"21634": [3, 12, 12],
"21958": [5, 10, 12],
"21973": [2, 4, 5],
"22356": [8, 10, 12],
"22535": [13, 13, 13],
"22702": [6, 10, 11],
"22972": [5, 5, 9],
"23038": [6, 6, 6],
"23066": [9, 10, 13],
"23690": [1, 3, 4],
"24050": [9, 9, 9],
"24067": [2, 2, 6],
"24133": [6, 9, 13],
"24256": [1, 2, 6],
"24324": [4, 6, 11],
"24362": [1, 4, 8],
"24383": [5, 5, 10],
"24721": [5, 10, 10],
"24858": [5, 7, 9],
"25058": [6, 11, 12],
"25178": [2, 6, 10],
"25367": [1, 2, 12],
"25409": [8, 9, 12],
"25411": [9, 12, 12],
"25439": [7, 7, 10],
"25456": [6, 9, 10],
"25738": [2, 7, 9],
"25970": [1, 10, 10],
"26023": [5, 10, 13],
"26096": [4, 5, 9],
"26294": [6, 6, 12],
"26557": [5, 8, 9],
"26564": [4, 7, 12],
"26620": [9, 10, 10],
"26866": [6, 6, 10],
"26960": [5, 7, 10],
"27119": [11, 12, 13],
"27137": [6, 6, 13],
"27163": [3, 3, 12],
"27190": [3, 3, 6],
"27203": [2, 9, 13],
"27301": [1, 4, 6],
"27308": [6, 10, 10],
"27611": [4, 9, 12],
"27788": [11, 11, 12],
"27929": [2, 5, 5],
"28503": [2, 4, 12],
"28754": [10, 11, 13],
"28878": [2, 4, 7],
"29049": [3, 5, 12],
"29381": [4, 12, 13],
"29861": [3, 6, 6],
"30160": [2, 2, 4],
"30225": [2, 2, 10],
"30302": [4, 11, 12],
"30439": [1, 1, 13],
"30471": [5, 9, 10],
"30693": [4, 5, 7],
"31033": [1, 4, 5],
"31257": [2, 12, 13],
"31359": [1, 8, 12],
"31508": [8, 8, 9],
"31513": [7, 9, 11],
"31585": [7, 10, 11],
"32059": [3, 4, 11],
"32176": [2, 9, 11],
"32227": [2, 10, 11],
"32245": [2, 2, 2],
"32345": [1, 1, 1],
"32455": [2, 9, 10],
"32932": [12, 12, 12],
"33082": [4, 5, 8],
"33287": [3, 5, 11],
"33435": [6, 6, 9],
"33545": [6, 9, 9],
"33582": [4, 6, 8],
"33718": [5, 9, 13],
"33725": [5, 8, 12],
"33777": [5, 5, 12],
"33903": [2, 4, 10],
"34009": [2, 11, 12],
"34173": [9, 10, 12],
"34506": [6, 12, 13],
"34591": [7, 7, 12],
"34601": [2, 2, 3],
"34661": [8, 9, 10],
"34666": [2, 4, 11],
"34973": [3, 10, 13],
"35233": [3, 5, 6],
"35436": [3, 6, 8],
"35663": [1, 6, 11],
"35685": [5, 6, 9],
"35894": [4, 4, 10],
"35958": [2, 10, 13],
"36281": [6, 8, 12],
"36490": [1, 8, 9],
"36687": [1, 11, 11],
"36736": [5, 7, 8],
"36859": [5, 5, 6],
"36874": [1, 1, 3],
"36915": [5, 6, 8],
"36949": [9, 9, 12],
"37078": [2, 3, 4],
"37326": [10, 10, 12],
"37403": [3, 7, 10],
"37504": [3, 8, 8],
"37647": [8, 11, 13],
"38246": [3, 7, 13],
"38516": [2, 2, 5],
"38706": [10, 10, 11],
"38849": [3, 6, 12],
"38922": [2, 3, 13],
"39530": [1, 12, 13],
"39657": [1, 8, 8],
"39743": [5, 8, 11],
"39761": [1, 3, 12],
"39986": [9, 10, 11],
"40645": [4, 6, 6],
"40743": [2, 10, 12],
"40849": [1, 8, 13],
"41119": [2, 8, 12],
"41137": [7, 9, 10],
"41307": [4, 10, 13],
"41420": [7, 11, 12],
"41472": [10, 12, 12],
"41476": [5, 5, 8],
"41595": [2, 7, 12],
"41989": [4, 11, 11],
"42009": [1, 13, 13],
"42041": [4, 10, 12],
"42443": [6, 12, 12],
"42649": [3, 5, 13],
"42686": [2, 3, 6],
"42720": [2, 4, 8],
"42795": [4, 9, 9],
"42804": [4, 5, 5],
"42917": [3, 5, 9],
"43385": [2, 5, 12],
"43689": [2, 2, 13],
"44102": [2, 5, 8],
"44103": [6, 10, 13],
"44207": [1, 2, 10],
"44347": [3, 3, 10],
"44562": [1, 6, 12],
"44788": [2, 2, 8],
"44824": [5, 6, 11],
"44955": [4, 8, 11],
"44988": [2, 12, 12],
"45067": [3, 3, 5],
"45317": [2, 9, 9],
"45329": [3, 8, 13],
"45608": [1, 1, 9],
"45803": [5, 7, 13],
"46408": [1, 5, 6],
"46471": [7, 7, 7],
"46842": [6, 10, 12],
"46904": [1, 12, 12],
"46965": [1, 5, 5],
"47065": [6, 11, 13],
"47306": [3, 8, 11],
"47471": [1, 11, 12],
"47484": [3, 4, 5],
"47743": [4, 4, 9],
"48298": [4, 4, 13],
"48438": [8, 11, 11],
"48556": [6, 6, 11],
"48614": [3, 10, 12],
"48698": [9, 12, 13],
"48807": [2, 11, 13],
"48823": [2, 9, 12],
"49254": [1, 9, 11],
"49318": [1, 5, 11],
"49379": [8, 8, 11],
"49416": [6, 8, 10],
"49445": [5, 7, 11],
"49459": [4, 8, 12],
"49538": [3, 5, 10],
"49621": [1, 8, 10],
"49772": [3, 6, 9],
"49969": [6, 8, 8],
"50029": [4, 13, 13],
"50197": [1, 2, 4],
"50338": [6, 8, 11],
"50690": [2, 3, 7],
"50858": [2, 6, 11],
"51108": [8, 10, 13],
"51212": [2, 3, 9],
"51440": [1, 9, 13],
"51559": [6, 6, 8],
"51748": [2, 10, 10],
"51881": [2, 4, 9],
"52031": [8, 10, 10],
"52090": [3, 10, 11],
"52157": [3, 3, 8],
"52230": [2, 3, 5],
"52282": [9, 13, 13],
"52714": [1, 1, 4],
"53013": [1, 2, 13],
"53042": [1, 3, 10],
"53114": [10, 12, 13],
"53118": [11, 11, 13],
"53493": [1, 1, 10],
"53573": [9, 9, 13],
"53757": [2, 3, 8],
"53759": [1, 6, 13],
"53802": [9, 9, 10],
"54142": [5, 6, 10],
"54268": [1, 8, 11],
"54629": [9, 11, 12],
"54694": [8, 9, 9],
"54713": [1, 7, 12],
"54776": [1, 11, 13],
"54791": [2, 6, 6],
"55114": [3, 8, 9],
"55380": [2, 6, 9],
"55485": [5, 8, 13],
"55772": [4, 10, 11],
"56029": [1, 2, 2],
"56094": [5, 11, 11],
"56207": [1, 5, 8],
"56276": [2, 5, 13],
"56359": [5, 6, 6],
"56648": [3, 3, 13],
"56716": [2, 6, 13],
"57006": [3, 13, 13],
"57199": [2, 2, 12],
"57839": [2, 6, 12],
"57900": [3, 9, 11],
"58032": [7, 8, 11],
"58198": [8, 9, 13],
"58218": [1, 10, 12],
"58449": [8, 8, 13],
"58831": [4, 8, 13],
"58921": [3, 4, 13],
"59151": [2, 4, 13],
"59556": [1, 6, 8],
"59605": [5, 8, 8],
"59766": [3, 11, 13],
"59866": [2, 6, 8],
"60002": [4, 4, 5],
"60031": [12, 13, 13],
"60180": [1, 2, 3],
"60501": [5, 6, 13],
"60619": [1, 2, 9],
"60737": [4, 5, 11],
"61039": [4, 7, 11],
"61198": [8, 12, 13],
"61308": [3, 6, 11],
"61689": [3, 9, 12],
"61981": [3, 6, 13],
"61982": [2, 8, 8],
"62094": [3, 8, 12],
"62577": [5, 12, 13],
"62596": [3, 11, 12],
"63033": [7, 8, 9],
"63150": [1, 3, 5],
"63207": [3, 4, 12],
"63251": [10, 10, 13],
"63422": [5, 11, 13],
"63635": [3, 4, 9],
"63727": [5, 6, 12],
"63921": [2, 5, 9],
"63933": [4, 4, 8],
"63944": [2, 11, 11],
"63976": [1, 9, 9],
"64077": [1, 5, 9],
"64217": [8, 13, 13],
"64355": [7, 8, 10],
"64395": [5, 9, 12],
"64882": [8, 9, 11],
"65053": [5, 8, 10],
"65093": [3, 3, 9],
"65097": [8, 11, 12],
"65107": [2, 5, 7],
"65108": [11, 11, 11],
"65210": [4, 9, 13],
"65224": [3, 4, 4],
"65273": [4, 5, 10],
"65308": [2, 5, 11],
"65502": [5, 9, 9]
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -1,11 +1,10 @@
import fnv1a from '@bensjoberg/fnv1a'
import type { BaseType, BlightRecipes, DropEntry, Stat, StatMatcher, TranslationDict } from './interfaces'
import type { BaseType, DropEntry, Stat, StatMatcher, TranslationDict } from './interfaces'
import { AppConfig } from '@/web/Config'
export * from './interfaces'
export let ITEM_DROP: DropEntry[]
export let BLIGHT_RECIPES: BlightRecipes
export let CLIENT_STRINGS: TranslationDict
export let CLIENT_STRINGS_REF: TranslationDict
@@ -139,7 +138,6 @@ export function stat (text: string) {
{ /* eslint-disable no-eval */
CLIENT_STRINGS = (await eval(`import('${process.env.BASE_URL}data/${language}/client_strings.js')`)).default
CLIENT_STRINGS_REF = (await eval(`import('${process.env.BASE_URL}data/en/client_strings.js')`)).default
BLIGHT_RECIPES = await (await fetch(`${process.env.BASE_URL}data/blight-recipes.json`)).json()
ITEM_DROP = await (await fetch(`${process.env.BASE_URL}data/item-drop.json`)).json()
}
})()
+2 -7
View File
@@ -5,6 +5,7 @@ export interface StatMatcher {
advanced?: string
negate?: true
value?: number
oils?: string // Amulet anointment
}
export enum StatBetter {
@@ -20,6 +21,7 @@ export interface Stat {
better: StatBetter
fromAreaMods?: true
fromHeistAreaMods?: true
anointments?: Array<{ roll: number, oils: string }> // Ring anointments
trade: {
inverted?: true
option?: true
@@ -34,13 +36,6 @@ export interface DropEntry {
items: string[]
}
export interface BlightRecipes {
oils: string[]
recipes: {
[statValue: number]: number[]
}
}
export interface BaseType {
name: string
refName: string
@@ -206,7 +206,7 @@ export default defineComponent({
tag: computed(() => props.filter.tag),
// TODO: change
changeStep: computed(() => props.filter.roll!.dp ? 0.01 : 1),
showInputs: computed(() => props.filter.roll != null),
showInputs: computed(() => props.filter.roll != null && !props.filter.oils),
fontSize: computed(() => AppConfig().fontSize),
isDisabled: computed(() => props.filter.disabled),
text: computed(() => t(props.filter.text)),
@@ -15,7 +15,7 @@
import { defineComponent, PropType, computed } from 'vue'
import { StatFilter } from './interfaces'
import { autoCurrency, findPriceByQuery } from '@/web/background/Prices'
import { BLIGHT_RECIPES, ITEM_BY_REF } from '@/assets/data'
import { ITEM_BY_REF } from '@/assets/data'
import ItemQuickPrice from '@/web/ui/ItemQuickPrice.vue'
export default defineComponent({
@@ -28,14 +28,10 @@ export default defineComponent({
},
setup (props) {
const result = computed(() => {
if (props.filter.statRef !== 'Allocates #') return null
if (!props.filter.oils) return null
const roll = props.filter.option!.value
const oils = (BLIGHT_RECIPES.recipes[roll] ?? [])
.map(idx => BLIGHT_RECIPES.oils[idx])
.map(oilName => ITEM_BY_REF('ITEM', oilName)?.[0])
if (!oils.length) return null
const oils = props.filter.oils
.map(oilName => ITEM_BY_REF('ITEM', oilName)![0])
let totalChaos: number | undefined = 0
for (const oil of oils) {
@@ -5,6 +5,7 @@ import { FilterTag, ItemHasEmptyModifier, StatFilter } from './interfaces'
import { filterPseudo } from './pseudo'
import { applyRules as applyAtzoatlRules } from './pseudo/atzoatl-rules'
import { filterItemProp } from './pseudo/item-property'
import { decodeOils } from './pseudo/anointments'
import { StatBetter } from '@/assets/data'
export interface FiltersCreationContext {
@@ -164,6 +165,7 @@ export function calculatedStatToFilter (
tag: (type === ModifierType.Enchant)
? FilterTag.Enchant
: FilterTag.Variant,
oils: decodeOils(calc),
sources: sources,
option: {
value: sources[0].contributes!.value
@@ -180,6 +182,7 @@ export function calculatedStatToFilter (
statRef: stat.ref,
text: translation.string,
tag: (type as unknown) as FilterTag,
oils: decodeOils(calc),
sources: sources,
roll: undefined,
disabled: true
@@ -82,6 +82,7 @@ export interface StatFilter {
statRef: string
text: string
tag: FilterTag
oils?: string[]
sources: StatCalculated['sources']
roll?: {
value: number
@@ -0,0 +1,42 @@
import { ModifierType, StatCalculated } from '@/parser/modifiers'
const OILS = [
'Clear Oil',
'Sepia Oil',
'Amber Oil',
'Verdant Oil',
'Teal Oil',
'Azure Oil',
'Indigo Oil',
'Violet Oil',
'Crimson Oil',
'Black Oil',
'Opalescent Oil',
'Silver Oil',
'Golden Oil'
]
export function decodeOils (calc: StatCalculated): string[] | undefined {
if (calc.type !== ModifierType.Enchant) return
// try Amulet enchant
let encoded = calc.sources[0].stat.translation.oils
// else try Ring enchant
if (!encoded && calc.stat.anointments) {
if (calc.stat.anointments.length === 1) {
encoded = calc.stat.anointments[0].oils
} else {
encoded = calc.stat.anointments.find(anoint =>
anoint.roll === calc.sources[0].stat.roll?.value)?.oils
}
}
if (!encoded) return
const decoded = encoded
.split(',')
.map(Number)
.sort((a, b) => b - a) // [Golden Oil ... Clear Oil]
.map(idx => OILS[idx])
return decoded
}