mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-28 15:45:58 +00:00
@@ -58,6 +58,7 @@ body:
|
||||
label: Version
|
||||
description: What version of EE2 are you running? You can see this in Settings -> About
|
||||
options:
|
||||
- 0.16.1
|
||||
- 0.16.0
|
||||
- 0.15.8
|
||||
- 0.15.7
|
||||
@@ -69,7 +70,7 @@ body:
|
||||
- 0.15.1
|
||||
- 0.15.0
|
||||
- Change me
|
||||
default: 10
|
||||
default: 11
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#  Exiled Exchange 2
|
||||
|
||||
[](https://tooomm.github.io/github-release-stats/?username=kvan7&repository=Exiled-Exchange-2)
|
||||
[](https://tooomm.github.io/github-release-stats/?username=kvan7&repository=Exiled-Exchange-2)
|
||||
[](https://github.com/Kvan7/Exiled-Exchange-2/releases/latest)
|
||||
[](https://github.com/Kvan7/Exiled-Exchange-2/commits/dev/)
|
||||
[](https://translate.codeberg.org/engage/exiled-exchange-2/)
|
||||
|
||||
@@ -20,7 +20,7 @@ export default defineConfig({
|
||||
},
|
||||
themeConfig: {
|
||||
// logo: 'TODO', https://github.com/vuejs/vitepress/issues/1401
|
||||
appVersion: '0.16.0',
|
||||
appVersion: '0.16.1',
|
||||
github: {
|
||||
releasesUrl: 'https://github.com/Kvan7/Exiled-Exchange-2/releases'
|
||||
},
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "exiled-exchange-2",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "exiled-exchange-2",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.1",
|
||||
"dependencies": {
|
||||
"electron-overlay-window": "4.0.2",
|
||||
"uiohook-napi": "1.5.x"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "exiled-exchange-2",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "node build/script.mjs",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { init } from "@/assets/data";
|
||||
import { ItemCategory } from "@/parser";
|
||||
import { ParsedModifier } from "@/parser/advanced-mod-desc";
|
||||
import { ModifierType } from "@/parser/modifiers";
|
||||
import { ModifierType, StatCalculated } from "@/parser/modifiers";
|
||||
import { __testExports } from "@/parser/Parser";
|
||||
import { createTestItem, makeCalcStat } from "@specs/helper";
|
||||
import { setupTests } from "@specs/vitest.setup";
|
||||
@@ -42,6 +42,160 @@ describe("determineAugments", () => {
|
||||
|
||||
expect(result.map((augment) => augment.refName)).toEqual(expectedRef);
|
||||
});
|
||||
|
||||
it("handles range mods correctly", () => {
|
||||
const mod = {
|
||||
info: {
|
||||
type: "rune",
|
||||
tags: [],
|
||||
},
|
||||
stats: [
|
||||
{
|
||||
stat: {
|
||||
ref: "Adds # to # Lightning Damage",
|
||||
better: 1,
|
||||
matchers: [
|
||||
{
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
],
|
||||
trade: {
|
||||
ids: {
|
||||
explicit: ["explicit.stat_3336890334"],
|
||||
fractured: ["fractured.stat_3336890334"],
|
||||
enchant: ["enchant.stat_3336890334"],
|
||||
rune: ["rune.stat_3336890334"],
|
||||
desecrated: ["desecrated.stat_3336890334"],
|
||||
crafted: ["crafted.stat_3336890334"],
|
||||
},
|
||||
},
|
||||
id: "local_minimum_added_lightning_damage",
|
||||
},
|
||||
translation: {
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
roll: {
|
||||
unscalable: false,
|
||||
dp: false,
|
||||
value: 15.5,
|
||||
min: 15.5,
|
||||
max: 15.5,
|
||||
},
|
||||
},
|
||||
],
|
||||
} as unknown as ParsedModifier;
|
||||
|
||||
const statCalcs = [
|
||||
{
|
||||
stat: {
|
||||
ref: "Adds # to # Lightning Damage",
|
||||
better: 1,
|
||||
matchers: [
|
||||
{
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
],
|
||||
trade: {
|
||||
ids: {
|
||||
explicit: ["explicit.stat_3336890334"],
|
||||
fractured: ["fractured.stat_3336890334"],
|
||||
enchant: ["enchant.stat_3336890334"],
|
||||
rune: ["rune.stat_3336890334"],
|
||||
desecrated: ["desecrated.stat_3336890334"],
|
||||
crafted: ["crafted.stat_3336890334"],
|
||||
},
|
||||
},
|
||||
id: "local_minimum_added_lightning_damage",
|
||||
},
|
||||
type: "rune",
|
||||
sources: [
|
||||
{
|
||||
modifier: {
|
||||
info: {
|
||||
type: "rune",
|
||||
tags: [],
|
||||
},
|
||||
stats: [
|
||||
{
|
||||
stat: {
|
||||
ref: "Adds # to # Lightning Damage",
|
||||
better: 1,
|
||||
matchers: [
|
||||
{
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
],
|
||||
trade: {
|
||||
ids: {
|
||||
explicit: ["explicit.stat_3336890334"],
|
||||
fractured: ["fractured.stat_3336890334"],
|
||||
enchant: ["enchant.stat_3336890334"],
|
||||
rune: ["rune.stat_3336890334"],
|
||||
desecrated: ["desecrated.stat_3336890334"],
|
||||
crafted: ["crafted.stat_3336890334"],
|
||||
},
|
||||
},
|
||||
id: "local_minimum_added_lightning_damage",
|
||||
},
|
||||
translation: {
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
roll: {
|
||||
unscalable: false,
|
||||
dp: false,
|
||||
value: 15.5,
|
||||
min: 15.5,
|
||||
max: 15.5,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
stat: {
|
||||
stat: {
|
||||
ref: "Adds # to # Lightning Damage",
|
||||
better: 1,
|
||||
matchers: [
|
||||
{
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
],
|
||||
trade: {
|
||||
ids: {
|
||||
explicit: ["explicit.stat_3336890334"],
|
||||
fractured: ["fractured.stat_3336890334"],
|
||||
enchant: ["enchant.stat_3336890334"],
|
||||
rune: ["rune.stat_3336890334"],
|
||||
desecrated: ["desecrated.stat_3336890334"],
|
||||
crafted: ["crafted.stat_3336890334"],
|
||||
},
|
||||
},
|
||||
id: "local_minimum_added_lightning_damage",
|
||||
},
|
||||
translation: {
|
||||
string: "Adds # to # Lightning Damage",
|
||||
},
|
||||
roll: {
|
||||
unscalable: false,
|
||||
dp: false,
|
||||
value: 15.5,
|
||||
min: 15.5,
|
||||
max: 15.5,
|
||||
},
|
||||
},
|
||||
contributes: {
|
||||
value: 15.5,
|
||||
min: 15.5,
|
||||
max: 15.5,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
] as unknown as StatCalculated[];
|
||||
const result = __testExports.determineAugments(mod, statCalcs);
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].refName).toEqual("Greater Storm Rune");
|
||||
});
|
||||
});
|
||||
|
||||
describe("BFS", () => {
|
||||
@@ -73,6 +227,18 @@ describe("BFS", () => {
|
||||
expect(result).toEqual(expected);
|
||||
},
|
||||
);
|
||||
|
||||
it("should not infinite loop", () => {
|
||||
const result = __testExports.modifiedBfs(100, [], Array(100).fill(0));
|
||||
|
||||
expect(result).toHaveLength(0);
|
||||
}, 50);
|
||||
|
||||
it("should not infinite loop2", () => {
|
||||
const result = __testExports.modifiedBfs(15.5, [], Array(4).fill(1));
|
||||
|
||||
expect(result).toHaveLength(0);
|
||||
}, 50);
|
||||
});
|
||||
|
||||
describe("parseAugmentSockets", () => {
|
||||
|
||||
@@ -44,7 +44,7 @@ import { calcPropPercentile, QUALITY_STATS } from "./calc-q20";
|
||||
import { AppConfig } from "@/web/Config";
|
||||
import { buildEditorItems, getSavedAugments } from "./augment-builder";
|
||||
import { useAugment } from "@/web/price-check/item-editor/augment";
|
||||
import { combinations } from "./utils";
|
||||
import { avg, combinations } from "./utils";
|
||||
|
||||
type SectionParseResult =
|
||||
| "SECTION_PARSED"
|
||||
@@ -2116,6 +2116,7 @@ function modifiedBfs(
|
||||
available: number[],
|
||||
): number[] | null {
|
||||
if (remaining === 0) return [...combo];
|
||||
if (combo.length >= 7 || available.length > 8) return [];
|
||||
|
||||
let best: number[] | null = null;
|
||||
for (const augValue of available) {
|
||||
@@ -2209,7 +2210,7 @@ function determineAugments(
|
||||
if (augment.values.length === 1) return augment.values[0];
|
||||
|
||||
// stats like "# to # added Lightning Damage"
|
||||
if ((augment.baseStat.match(/#/) || []).length > 1) {
|
||||
if ((augment.baseStat.match(/#/g) || []).length > 1) {
|
||||
const sum = augment.values.reduce((a, b) => a + b, 0);
|
||||
return sum / augment.values.length || 0;
|
||||
}
|
||||
@@ -2224,8 +2225,9 @@ function determineAugments(
|
||||
modifiedBfs(augmentAppliedValue[0], [], availableAugmentValues) ?? [];
|
||||
|
||||
return likelyValues.map((v) => {
|
||||
const augment = possibleAugments.find((aug) =>
|
||||
aug.values.some((augVal) => augVal === v),
|
||||
const augment = possibleAugments.find(
|
||||
(aug) =>
|
||||
aug.values.some((augVal) => augVal === v) || avg(aug.values) === v,
|
||||
)!;
|
||||
return ITEM_BY_REF("ITEM", augment.refName)![0];
|
||||
});
|
||||
|
||||
@@ -4,3 +4,7 @@ export function combinations<T>(arr: T[]): T[][] {
|
||||
[[]],
|
||||
);
|
||||
}
|
||||
|
||||
export function avg(arr: number[]): number {
|
||||
return arr.reduce((a, b) => a + b, 0) / arr.length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user