mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-19 11:15:50 +00:00
fix runes kinda
This commit is contained in:
@@ -182,7 +182,7 @@ async function loadItems(language: string, isTest = false) {
|
||||
|
||||
RUNE_LIST = Array.from(
|
||||
ITEMS_ITERATOR('"craftable": {"category": "SoulCore"}'),
|
||||
);
|
||||
).filter((r) => r.rune && r.rune.armour?.tradeId && r.rune.weapon?.tradeId);
|
||||
}
|
||||
|
||||
async function loadStats(language: string, isTest = false) {
|
||||
@@ -309,7 +309,9 @@ export function loadUltraLateItems(
|
||||
) {
|
||||
RUNE_LIST = Array.from(
|
||||
ITEMS_ITERATOR('"craftable": {"category": "SoulCore"}'),
|
||||
).filter(runeFilter);
|
||||
)
|
||||
.filter((r) => r.rune && r.rune.armour?.tradeId && r.rune.weapon?.tradeId)
|
||||
.filter(runeFilter);
|
||||
|
||||
RUNE_DATA_BY_RUNE = runesToLookup(RUNE_LIST);
|
||||
|
||||
@@ -347,14 +349,17 @@ function runesToLookupTradeId(runeList: BaseType[]): RuneDataByTradeId {
|
||||
if (!rune.rune) continue;
|
||||
for (const runeStat in rune.rune) {
|
||||
const { string: text, values, tradeId } = rune.rune[runeStat];
|
||||
runeDataByRune[tradeId[0]] = {
|
||||
if (!runeDataByRune[tradeId[0]]) {
|
||||
runeDataByRune[tradeId[0]] = [];
|
||||
}
|
||||
runeDataByRune[tradeId[0]].push({
|
||||
rune: rune.name,
|
||||
baseStat: text,
|
||||
values,
|
||||
id: tradeId[0],
|
||||
type: runeStat,
|
||||
icon: rune.icon,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -289,12 +289,12 @@ export interface RuneDataByRune {
|
||||
[rune: string]: RuneData[];
|
||||
}
|
||||
export interface RuneDataByTradeId {
|
||||
[tradeId: string]: {
|
||||
[tradeId: string]: Array<{
|
||||
rune: string;
|
||||
baseStat: string;
|
||||
values: number[];
|
||||
id: string;
|
||||
type: string;
|
||||
icon: string;
|
||||
};
|
||||
}>;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
ITEM_BY_REF,
|
||||
STAT_BY_MATCH_STR,
|
||||
BaseType,
|
||||
RUNE_SINGLE_VALUE,
|
||||
ITEM_BY_TRANSLATED,
|
||||
} from "@/assets/data";
|
||||
import { ModifierType, StatCalculated, sumStatsByModType } from "./modifiers";
|
||||
@@ -1010,6 +1009,7 @@ function applyRuneSockets(item: ParsedItem) {
|
||||
// If we have any rune sockets
|
||||
if (item.runeSockets) {
|
||||
// Count current mods that are of type Rune
|
||||
|
||||
const runeMods = item.newMods.filter(
|
||||
(mod) => mod.info.type === ModifierType.Rune,
|
||||
);
|
||||
@@ -1026,10 +1026,11 @@ function applyRuneSockets(item: ParsedItem) {
|
||||
})
|
||||
.flat();
|
||||
|
||||
const potentialEmptySockets =
|
||||
Math.max(item.runeSockets.normal, item.runeSockets.current) -
|
||||
runes.reduce((x, y) => x + y, 0);
|
||||
|
||||
// HACK: fix since I can't detect how many exist due to rune tiers
|
||||
const tempFix = runes.reduce((x, y) => x + y, 0) > 0;
|
||||
const potentialEmptySockets = tempFix
|
||||
? 0
|
||||
: Math.max(item.runeSockets.normal, item.runeSockets.current);
|
||||
item.runeSockets.empty = potentialEmptySockets;
|
||||
}
|
||||
}
|
||||
@@ -1613,15 +1614,16 @@ export function isArmourOrWeapon(
|
||||
|
||||
function runeCount(mod: ParsedModifier, statCalc: StatCalculated): number {
|
||||
if (mod.info.type !== ModifierType.Rune) return 0;
|
||||
const runeTradeId = statCalc.stat.trade.ids[ModifierType.Rune][0];
|
||||
const runeSingle = RUNE_SINGLE_VALUE[runeTradeId];
|
||||
// HACK: fix since I can't detect how many exist due to rune tiers
|
||||
// const runeTradeId = statCalc.stat.trade.ids[ModifierType.Rune][0];
|
||||
// const runeSingle = RUNE_SINGLE_VALUE[runeTradeId];
|
||||
|
||||
// Calculate how many of this rune are in the item
|
||||
const runeAppliedValue = statCalc.sources[0].contributes!.value;
|
||||
const runeSingleValue = runeSingle.values[0];
|
||||
const totalRunes = Math.floor(runeAppliedValue / runeSingleValue);
|
||||
// // Calculate how many of this rune are in the item
|
||||
// const runeAppliedValue = statCalc.sources[0].contributes!.value;
|
||||
// const runeSingleValue = runeSingle.values[0];
|
||||
// const totalRunes = Math.floor(runeAppliedValue / runeSingleValue);
|
||||
|
||||
return totalRunes;
|
||||
return 1;
|
||||
}
|
||||
|
||||
export function replaceHashWithValues(template: string, values: number[]) {
|
||||
|
||||
@@ -251,16 +251,27 @@ export function tryParseTranslation(
|
||||
}
|
||||
: undefined,
|
||||
fromAddedRune:
|
||||
modType === ModifierType.AddedRune
|
||||
? ITEM_BY_REF(
|
||||
"ITEM",
|
||||
RUNE_DATA_BY_TRADE_ID[found.stat.trade.ids.rune[0]].rune,
|
||||
)![0]
|
||||
: undefined,
|
||||
modType === ModifierType.AddedRune ? getRune(found.stat) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getRune(stat: Stat): BaseType | undefined {
|
||||
if (
|
||||
!stat.trade.ids ||
|
||||
!stat.trade.ids.rune ||
|
||||
stat.trade.ids.rune.length === 0
|
||||
)
|
||||
return;
|
||||
|
||||
const tradeId = stat.trade.ids.rune[0];
|
||||
// HACK: temp fix for icons
|
||||
const runes = RUNE_DATA_BY_TRADE_ID[tradeId];
|
||||
const rune = runes.find((r) => r.icon !== "%NOT_FOUND%") ?? runes[0];
|
||||
const runesWithSameTradeId = ITEM_BY_REF("ITEM", rune.rune)!;
|
||||
return runesWithSameTradeId[0];
|
||||
}
|
||||
|
||||
export function getRollOrMinmaxAvg(values: number[]): number {
|
||||
if (values.length === 2) {
|
||||
return (values[0] + values[1]) / 2;
|
||||
|
||||
@@ -33,9 +33,9 @@ export const useLeagues = createGlobalState(() => {
|
||||
},
|
||||
],
|
||||
},
|
||||
{ id: "Hunt", rules: [] },
|
||||
{ id: "Dawn of the Hunt", rules: [] },
|
||||
{
|
||||
id: "Hunt Hardcore",
|
||||
id: "HC Dawn of the Hunt",
|
||||
rules: [
|
||||
{
|
||||
id: "Hardcore",
|
||||
|
||||
@@ -39,7 +39,14 @@
|
||||
:class="$style['qualityLabel']"
|
||||
class="self-center"
|
||||
>
|
||||
<img :src="showRuneNotice" class="min-w-5 min-h-5 w-5 h-5" />
|
||||
<img
|
||||
:src="
|
||||
showRuneNotice === '%NOT_FOUND%'
|
||||
? '/images/404.png'
|
||||
: showRuneNotice
|
||||
"
|
||||
class="min-w-5 min-h-5 w-5 h-5"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="showQ20Notice" :class="$style['qualityLabel']">
|
||||
{{ t("item.prop_quality", [calcQuality]) }}
|
||||
@@ -187,9 +194,12 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
const showRuneNotice = computed(() => {
|
||||
if (props.filter.sources.some((source) => source.stat.fromAddedRune))
|
||||
return props.filter.sources.find((source) => source.stat.fromAddedRune)
|
||||
?.stat.fromAddedRune?.icon;
|
||||
if (props.filter.sources.some((source) => source.stat.fromAddedRune)) {
|
||||
const i = props.filter.sources.find(
|
||||
(source) => source.stat.fromAddedRune,
|
||||
)?.stat.fromAddedRune?.icon;
|
||||
return i;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -368,7 +368,8 @@ export default defineComponent({
|
||||
return props.item.runeSockets && props.item.runeSockets.empty > 0;
|
||||
}),
|
||||
getRuneImage(rune: string) {
|
||||
return RUNE_DATA_BY_RUNE[rune][0].icon;
|
||||
const icon = RUNE_DATA_BY_RUNE[rune][0].icon;
|
||||
return icon === "%NOT_FOUND%" ? "/images/404.png" : icon;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
>
|
||||
<div class="flex items-center justify-center shrink-0 w-8 h-8">
|
||||
<slot>
|
||||
<img :src="icon" class="max-w-full max-h-full" />
|
||||
<img
|
||||
:src="icon == '%NOT_FOUND%' ? '/images/404.png' : icon"
|
||||
class="max-w-full max-h-full"
|
||||
/>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="mb-1 cursor-pointer pl-1">
|
||||
|
||||
@@ -27,6 +27,7 @@ export function handleApplyItemEdits(
|
||||
editType?: ItemEditorType,
|
||||
) {
|
||||
if (filterStorage.length !== 0) return;
|
||||
console.log("FILLLLLLLLLLLLLLLLLLLL");
|
||||
// Testing with just one stat
|
||||
const newFilters = createNewStatFilter(item, currencyItem ?? "Iron Rune");
|
||||
if (!newFilters) return;
|
||||
@@ -57,6 +58,7 @@ export function handleRemoveItemEdits(
|
||||
filterStorage: StatFilter[],
|
||||
) {
|
||||
// reset back to normal
|
||||
console.log("REMOVE");
|
||||
for (const filterToApply of filterStorage) {
|
||||
// get on/off state of old filter
|
||||
const oldFilter = filters.find(
|
||||
|
||||
Reference in New Issue
Block a user