mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-07-08 07:50:45 +00:00
IT IS WORKING!!!!!
This commit is contained in:
@@ -7,14 +7,22 @@ import {
|
||||
OTHER_PSEUDO_STATS,
|
||||
QUALITY_STATS,
|
||||
} from "./calc-q20";
|
||||
import { ARMOUR, WEAPON } from "./meta";
|
||||
|
||||
export function recalculateItemProperties(
|
||||
newItem: ParsedItem,
|
||||
oldItem: ParsedItem,
|
||||
) {
|
||||
const { category } = newItem;
|
||||
const weaponOrArmour = isArmourOrWeaponOrCaster(category);
|
||||
if (weaponOrArmour === undefined || weaponOrArmour === "caster") return;
|
||||
if (newItem.category !== oldItem.category || !newItem.category) return;
|
||||
|
||||
if (ARMOUR.has(newItem.category)) {
|
||||
recalculateArmourProperties(newItem, oldItem);
|
||||
}
|
||||
if (WEAPON.has(newItem.category)) {
|
||||
recalculateWeaponProperties(newItem, oldItem);
|
||||
}
|
||||
}
|
||||
function recalculateWeaponProperties(newItem: ParsedItem, oldItem: ParsedItem) {
|
||||
if (newItem.weaponPHYSICAL) {
|
||||
const base = calcBase(
|
||||
oldItem,
|
||||
@@ -24,6 +32,7 @@ export function recalculateItemProperties(
|
||||
const total = calcTotal(base, newItem, QUALITY_STATS.PHYSICAL_DAMAGE);
|
||||
newItem.weaponPHYSICAL = total;
|
||||
}
|
||||
|
||||
if (newItem.weaponAS) {
|
||||
const base = calcBase(
|
||||
oldItem,
|
||||
@@ -39,6 +48,9 @@ export function recalculateItemProperties(
|
||||
);
|
||||
newItem.weaponAS = total;
|
||||
}
|
||||
}
|
||||
|
||||
function recalculateArmourProperties(newItem: ParsedItem, oldItem: ParsedItem) {
|
||||
if (newItem.armourAR) {
|
||||
const base = calcBase(oldItem, oldItem.armourAR, QUALITY_STATS.ARMOUR);
|
||||
const total = calcTotal(base, newItem, QUALITY_STATS.ARMOUR);
|
||||
@@ -58,6 +70,24 @@ export function recalculateItemProperties(
|
||||
const total = calcTotal(base, newItem, QUALITY_STATS.ENERGY_SHIELD);
|
||||
newItem.armourES = total;
|
||||
}
|
||||
if (newItem.armourRW) {
|
||||
const base = calcBase(
|
||||
oldItem,
|
||||
oldItem.armourRW,
|
||||
QUALITY_STATS.ENERGY_SHIELD,
|
||||
);
|
||||
const total = calcTotal(base, newItem, QUALITY_STATS.ENERGY_SHIELD);
|
||||
newItem.armourRW = total;
|
||||
}
|
||||
if (newItem.armourBLOCK) {
|
||||
const base = calcBase(
|
||||
oldItem,
|
||||
oldItem.armourBLOCK,
|
||||
QUALITY_STATS.ENERGY_SHIELD,
|
||||
);
|
||||
const total = calcTotal(base, newItem, QUALITY_STATS.ENERGY_SHIELD);
|
||||
newItem.armourBLOCK = total;
|
||||
}
|
||||
}
|
||||
|
||||
export function applyEleAugment(
|
||||
|
||||
@@ -12,6 +12,7 @@ import { AppConfig } from "@/web/Config";
|
||||
import { PriceCheckWidget } from "@/web/overlay/widgets";
|
||||
import { StatFilter } from "@/web/price-check/filters/interfaces";
|
||||
import { initUiModFilters } from "../filters/create-stat-filters";
|
||||
import { recalculateItemProperties } from "@/parser/calc-base";
|
||||
|
||||
export function getCategoryGroups(
|
||||
augments: AugmentGroup<BaseType>,
|
||||
@@ -45,6 +46,9 @@ export function useAugment(
|
||||
throw new Error("Augment index out of bounds");
|
||||
}
|
||||
|
||||
// deep copy
|
||||
const oldItem = JSON.parse(JSON.stringify(item)) as ParsedItem;
|
||||
|
||||
// remove old augment stats from item
|
||||
item.newMods = item.newMods.filter(
|
||||
(mod) => !INTERNAL_AUGMENT_TYPES.has(mod.info.type),
|
||||
@@ -54,9 +58,9 @@ export function useAugment(
|
||||
);
|
||||
|
||||
// add augment
|
||||
item.augmentSockets.augments[index] = augment;
|
||||
item.augmentSockets!.augments[index] = augment;
|
||||
// add augment stat to item
|
||||
for (const thisAugment of item.augmentSockets.augments) {
|
||||
for (const thisAugment of item.augmentSockets!.augments) {
|
||||
if (!thisAugment) continue;
|
||||
const modInfo = {
|
||||
// need to keep pre-existing ones marked as non-added
|
||||
@@ -76,6 +80,8 @@ export function useAugment(
|
||||
// need to fix the filters now
|
||||
console.log(stats);
|
||||
|
||||
recalculateItemProperties(item, oldItem);
|
||||
|
||||
const config = AppConfig<PriceCheckWidget>("price-check")!;
|
||||
|
||||
stats = initUiModFilters(item, {
|
||||
|
||||
Reference in New Issue
Block a user