psesudo only ele

This commit is contained in:
kvan7
2024-12-17 17:46:24 -06:00
parent 252109f1bd
commit a9ccb01d99
9 changed files with 1454 additions and 77 deletions
+1
View File
@@ -1,3 +1,4 @@
{"ref": "+# total maximum Spirit", "better": 1, "id": "base_maximum_spirit", "matchers": [{"string": "# to maximum Spirit", "negate": false}], "trade": {"ids": {"pseudo": ["pseudo.pseudo_total_spirit"]}}}
{"ref": "# Life Regenerated per Second", "better": 1, "matchers": [{"string": "# Life Regenerated per Second "}], "trade": {"ids": {"pseudo": ["pseudo.pseudo_total_life_regen"]}}}
{"ref": "#% increased Cold Damage", "better": 1, "id": "cold_damage_+%", "matchers": [{"string": "#% increased Cold Damage", "negate": false}, {"string": "#% reduced Cold Damage", "negate": true}], "trade": {"ids": {"explicit": ["explicit.stat_3291658075"], "pseudo": ["pseudo.pseudo_increased_cold_damage"]}}}
{"ref": "#% increased Cold Spell Damage", "better": 1, "matchers": [{"string": "#% increased Cold Spell Damage "}], "trade": {"ids": {"pseudo": ["pseudo.pseudo_increased_cold_spell_damage"]}}}
@@ -0,0 +1,760 @@
{
"pseudo.pseudo_total_elemental_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_fire_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_cold_resistance": {
"filters": [
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
}
]
},
"pseudo.pseudo_total_lightning_resistance": {
"filters": [
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
}
]
},
"pseudo.pseudo_total_chaos_resistance": {
"filters": [
{
"id": "explicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
}
]
},
"pseudo.pseudo_total_all_attributes": {
"filters": [
{
"id": "explicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_dexterity": {
"filters": [
{
"id": "explicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_strength": {
"filters": [
{
"id": "explicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_intelligence": {
"filters": [
{
"id": "explicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_life": {
"filters": [
{
"id": "explicit.stat_3299347043",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3299347043",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_3299347043",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_mana": {
"filters": [
{
"id": "explicit.stat_1050105434",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1050105434",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1050105434",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo_total_energy_shield": {
"filters": [
{
"id": "explicit.stat_4052037485",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3489782002",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3489782002",
"value": {
"weight": 1
},
"disabled": false
}
]
},
"pseudo.pseudo_total_attack_speed": {
"filters": [
{
"id": "explicit.stat_210067635",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_681332047",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_681332047",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_210067635",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_cast_speed": {
"filters": [
{
"id": "explicit.stat_2891184298",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2891184298",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_movement_speed": {
"filters": [
{
"id": "explicit.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "enchant.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_physical_damage": {
"filters": [
{
"id": "explicit.stat_1509134228",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1509134228",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_elemental_damage": {
"filters": [
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"disabled": false
},
"pseudo.pseudo_increased_fire_damage": {
"filters": [
{
"id": "explicit.stat_3962278098",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_cold_damage": {
"filters": [
{
"id": "explicit.stat_3291658075",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_lightning_damage": {
"filters": [
{
"id": "explicit.stat_2231156303",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_spell_damage": {
"filters": [
{
"id": "explicit.stat_2974417149",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_fire_spell_damage": {
"filters": [],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_cold_spell_damage": {
"filters": [],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_lightning_spell_damage": {
"filters": [],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_mana_regen": {
"filters": [
{
"id": "explicit.stat_789117908",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_789117908",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_789117908",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight"
}
}
+620
View File
@@ -0,0 +1,620 @@
{
"pseudo.pseudo_total_elemental_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_fire_resistance": {
"filters": [
{
"id": "explicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3372524247",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_cold_resistance": {
"filters": [
{
"id": "explicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4220027924",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_lightning_resistance": {
"filters": [
{
"id": "explicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1671376347",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_chaos_resistance": {
"filters": [
{
"id": "explicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2923486259",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_all_attributes": {
"filters": [
{
"id": "explicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_dexterity": {
"filters": [
{
"id": "explicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3261801346",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_strength": {
"filters": [
{
"id": "explicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_4080418644",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_intelligence": {
"filters": [
{
"id": "explicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_328541901",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_life": {
"filters": [
{
"id": "explicit.stat_3299347043",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3299347043",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_mana": {
"filters": [
{
"id": "explicit.stat_1050105434",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_1050105434",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo_total_energy_shield": {
"filters": [
{
"id": "explicit.stat_4052037485",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3489782002",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3489782002",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_attack_speed": {
"filters": [
{
"id": "explicit.stat_210067635",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_681332047",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_681332047",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_cast_speed": {
"filters": [
{
"id": "explicit.stat_2891184298",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2891184298",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_movement_speed": {
"filters": [
{
"id": "explicit.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "enchant.stat_2250533757",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_physical_damage": {
"filters": [
{
"id": "explicit.stat_1509134228",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "rune.stat_1509134228",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_elemental_damage": {
"filters": [
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_fire_damage": {
"filters": [
{
"id": "explicit.stat_3962278098",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_cold_damage": {
"filters": [
{
"id": "explicit.stat_3291658075",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_lightning_damage": {
"filters": [
{
"id": "explicit.stat_2231156303",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "explicit.stat_3141070085",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_increased_mana_regen": {
"filters": [
{
"id": "explicit.stat_789117908",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_789117908",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
},
"pseudo.pseudo_total_spirit": {
"filters": [
{
"id": "explicit.stat_3981240776",
"value": {
"weight": 1
},
"disabled": false
},
{
"id": "implicit.stat_3981240776",
"value": {
"weight": 1
},
"disabled": false
}
],
"type": "weight",
"value": {
"min": 0
}
}
}
+6 -21
View File
@@ -2,19 +2,19 @@ import fnv1a from "@sindresorhus/fnv1a";
import type {
BaseType,
DropEntry,
PseudoIdToTradeRequest,
Stat,
StatMatcher,
TranslationDict,
} from "./interfaces";
import { PSEUDO_RULES, PseudoRule } from "../../web/price-check/filters/pseudo";
export * from "./interfaces";
export let ITEM_DROP: DropEntry[];
export let CLIENT_STRINGS: TranslationDict;
export let CLIENT_STRINGS_REF: TranslationDict;
export let APP_PATRONS: Array<{ from: string; months: number; style: number }>;
export let PSEUDO_ID_TO_TRADE_REQUEST: PseudoIdToTradeRequest;
export let ITEM_BY_TRANSLATED = (
ns: BaseType["namespace"],
@@ -41,16 +41,6 @@ export let STATS_ITERATOR = function* (
andIncludes?: string[],
): Generator<Stat> {};
export const pseudoRules: Record<string, string> = {};
export function populatePseudoRules(rules: PseudoRule[]) {
for (const rule of rules) {
if (rule.pseudoPseudo) {
pseudoRules[rule.pseudo] = rule.pseudoPseudo;
}
}
}
function dataBinarySearch(
data: Uint32Array,
value: number,
@@ -194,14 +184,6 @@ async function loadStats(language: string) {
);
STAT_BY_REF = function (ref: string) {
if (ref in pseudoRules) {
console.log("FOUND PSEUDO RULE", ref);
return {
ref: ref,
translation: { string: pseudoRules[ref] },
isFakePseudo: true,
};
}
let start = dataBinarySearch(
indexRef,
Number(fnv1a(ref, { size: 32 })),
@@ -243,7 +225,6 @@ async function loadStats(language: string) {
const DELAYED_STAT_VALIDATION = new Set<string>();
export function stat(text: string) {
DELAYED_STAT_VALIDATION.add(text);
console.log("adding: " + text);
return text;
}
@@ -260,6 +241,10 @@ export async function init(lang: string) {
await fetch(`${import.meta.env.BASE_URL}data/patrons.json`)
).json();
PSEUDO_ID_TO_TRADE_REQUEST = await (
await fetch(`${import.meta.env.BASE_URL}data/pseudo-pseudo.json`)
).json();
await loadForLang(lang);
let failed = false;
+21 -1
View File
@@ -30,7 +30,7 @@ export interface Stat {
[type: string]: string[];
};
};
isFakePseudo?: true;
// isFakePseudo?: true;
}
export interface DropEntry {
@@ -186,3 +186,23 @@ export interface TranslationDict {
CHAT_WHISPER_FROM: RegExp;
CHAT_WEBTRADE_GEM: RegExp;
}
export interface Filter {
id: string;
value: {
weight: number;
};
disabled: boolean;
}
export interface PseudoIdToTradeRequest {
[id: string]: {
filters: Filter[];
type: "weight";
value: {
min?: number;
max?: number;
};
disabled?: boolean;
};
}
@@ -190,12 +190,6 @@ export function calculatedStatToFilter(
percent: number,
item: ParsedItem,
): StatFilter {
console.log(
"CALCULATED STAT TO FILTER============================================================",
);
console.log("calc", calc);
console.log("percent", percent);
console.log("item", item);
const { stat, sources, type } = calc;
let filter: StatFilter;
@@ -1,6 +1,6 @@
import {
populatePseudoRules,
pseudoRules,
// populatePseudoRules,
// pseudoRules,
stat,
STAT_BY_REF,
} from "@/assets/data";
@@ -34,7 +34,7 @@ const RESISTANCES_INFO = [
// ref: stat("+#% to Cold and Lightning Resistances"),
// elements: ["cold", "lightning"],
// },
// { ref: stat("+#% to Chaos Resistance"), elements: [], chaos: true },
// { ref: stat("+#% to Chaos Resistance"), elements: [""], chaos: true },
// {
// ref: stat("+#% to Fire and Chaos Resistances"),
// elements: ["fire"],
@@ -62,7 +62,7 @@ const RESISTANCES_INFO = [
// { ref: stat("+# to Dexterity and Intelligence"), attributes: ["dex", "int"] },
// ];
export interface PseudoRule {
interface PseudoRule {
group?: string;
pseudo: string;
disabled?: boolean;
@@ -73,42 +73,37 @@ export interface PseudoRule {
required?: boolean;
}>;
mutate?: (filter: StatFilter) => void;
pseudoPseudo: string;
}
export const PSEUDO_RULES: PseudoRule[] = [
const PSEUDO_RULES: PseudoRule[] = [
{
pseudo: stat("+#% total Elemental Resistance"),
disabled: false,
stats: RESISTANCES_INFO.filter((info) => info.elements.length).map(
(info) => ({ ref: info.ref, multiplier: info.elements.length }),
),
pseudoPseudo: "pseudo_pseudo.pseudo_count_elemental_resistances",
},
// {
// pseudo: stat("+#% total to Fire Resistance"),
// group: "to_x_ele_res",
// stats: RESISTANCES_INFO.filter((info) =>
// info.elements.includes("fire"),
// ).map((info) => ({ ref: info.ref })),
// pseudoPseudo: "pseudo_pseudo.pseudo_total_to_fire_resistance",
// },
// {
// pseudo: stat("+#% total to Cold Resistance"),
// group: "to_x_ele_res",
// stats: RESISTANCES_INFO.filter((info) =>
// info.elements.includes("cold"),
// ).map((info) => ({ ref: info.ref })),
// pseudoPseudo: "pseudo_pseudo.pseudo_total_to_cold_resistance",
// },
// {
// pseudo: stat("+#% total to Lightning Resistance"),
// group: "to_x_ele_res",
// stats: RESISTANCES_INFO.filter((info) =>
// info.elements.includes("lightning"),
// ).map((info) => ({ ref: info.ref })),
// pseudoPseudo: "pseudo_pseudo.pseudo_total_to_lightning_resistance",
// },
{
pseudo: stat("+#% total to Fire Resistance"),
group: "to_x_ele_res",
stats: RESISTANCES_INFO.filter((info) =>
info.elements.includes("fire"),
).map((info) => ({ ref: info.ref })),
},
{
pseudo: stat("+#% total to Cold Resistance"),
group: "to_x_ele_res",
stats: RESISTANCES_INFO.filter((info) =>
info.elements.includes("cold"),
).map((info) => ({ ref: info.ref })),
},
{
pseudo: stat("+#% total to Lightning Resistance"),
group: "to_x_ele_res",
stats: RESISTANCES_INFO.filter((info) =>
info.elements.includes("lightning"),
).map((info) => ({ ref: info.ref })),
},
// {
// pseudo: stat("+#% total to Chaos Resistance"),
// stats: RESISTANCES_INFO.filter((info) => info.chaos === true).map(
@@ -124,7 +119,6 @@ export const PSEUDO_RULES: PseudoRule[] = [
// filter.disabled = false;
// }
// },
// pseudoPseudo: "pseudo_pseudo.pseudo_total_to_chaos_resistance",
// },
// {
// pseudo: stat("+# total to all Attributes"),
@@ -175,6 +169,10 @@ export const PSEUDO_RULES: PseudoRule[] = [
// ],
// },
// {
// pseudo: stat("+# total maximum Spirit"),
// stats: [{ ref: stat("+# to Spirit") }],
// },
// {
// pseudo: stat("#% total increased maximum Energy Shield"),
// stats: [{ ref: stat("#% increased maximum Energy Shield") }],
// },
@@ -328,12 +326,6 @@ export const PSEUDO_RULES: PseudoRule[] = [
];
export function filterPseudo(ctx: FiltersCreationContext) {
if (Object.keys(pseudoRules).length === 0) {
console.log("pseudoRules empty");
populatePseudoRules(PSEUDO_RULES);
}
console.log("filterPseudo ================================================");
console.log("CONTEXT", ctx);
const filterByGroup = new Map<string, StatFilter[]>();
rulesLoop: for (const rule of PSEUDO_RULES) {
@@ -351,11 +343,9 @@ export function filterPseudo(ctx: FiltersCreationContext) {
},
};
});
console.log("sources", sources);
if (!sources.length) continue;
if (rule.stats.some((s) => s.required)) {
console.log("some stat required");
for (const stat of rule.stats) {
if (
stat.required &&
@@ -365,7 +355,6 @@ export function filterPseudo(ctx: FiltersCreationContext) {
}
}
}
console.log("RULE", rule);
const filter = calculatedStatToFilter(
{
@@ -28,10 +28,6 @@ export function apiToSatisfySearch(
stats: StatFilter[],
filters: ItemFilters,
): "trade" | "bulk" {
console.log(
"apiToSatisfySearch ================================================",
);
console.log("item", item, "filter", filters, "stats", stats);
if (stats.some((s) => !s.disabled)) {
return "trade";
}
@@ -16,7 +16,7 @@ import {
RATE_LIMIT_RULES,
preventQueueCreation,
} from "./common";
import { STAT_BY_REF } from "@/assets/data";
import { PSEUDO_ID_TO_TRADE_REQUEST, STAT_BY_REF } from "@/assets/data";
import { RateLimiter } from "./RateLimiter";
import { ModifierType } from "@/parser/modifiers";
import { Cache } from "./Cache";
@@ -105,7 +105,7 @@ interface TradeRequest {
name?: string | { discriminator: string; option: string };
type?: string | { discriminator: string; option: string };
stats: Array<{
type: "and" | "if" | "count" | "not";
type: "and" | "if" | "count" | "not" | "weight";
value?: FilterRange;
filters: Array<{
id: string;
@@ -113,6 +113,7 @@ interface TradeRequest {
min?: number;
max?: number;
option?: number | string;
weight?: number;
};
disabled?: boolean;
}>;
@@ -299,6 +300,7 @@ export function createTradeRequest(
);
}
// Search by category not base type?
const activeSearch =
filters.searchRelaxed && !filters.searchRelaxed.disabled
? filters.searchRelaxed
@@ -427,6 +429,7 @@ export function createTradeRequest(
// BREAK ==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
// Meta internal stuff, crafting as empty and setting dps/pdps/edps
for (const stat of stats) {
if (stat.tradeId[0] === "item.has_empty_modifier") {
const TARGET_ID = {
@@ -663,7 +666,9 @@ export function createTradeRequest(
const qAnd = query.stats[0];
for (const stat of stats) {
if (stat.tradeId.length === 1) {
if (stat.tradeId[0].startsWith("pseudo.")) {
query.stats.push(pseudoPseudoToQuery(stat.tradeId[0], stat));
} else if (stat.tradeId.length === 1) {
qAnd.filters.push(tradeIdToQuery(stat.tradeId[0], stat));
} else {
query.stats.push({
@@ -699,7 +704,7 @@ export async function requestTradeResultList(
{
method: "POST",
headers: {
"Accept": "application/json",
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(body),
@@ -844,3 +849,10 @@ function nameToQuery(name: string, filters: ItemFilters) {
};
}
}
function pseudoPseudoToQuery(id: string, stat: StatFilter) {
const filter = PSEUDO_ID_TO_TRADE_REQUEST[id];
filter["value"] = { ...getMinMax(stat.roll) };
filter["disabled"] = stat.disabled;
return filter;
}