From e3f8e0e5b030ec0bf351c9a6ff424d59cd8641f7 Mon Sep 17 00:00:00 2001
From: DarthGigi <47110839+DarthGigi@users.noreply.github.com>
Date: Mon, 13 Jan 2025 14:18:04 +0100
Subject: [PATCH 1/4] refactor(Sections): rename SectionsEager with Sections
and remove SectionsLazy
---
src/lib/layouts/stats/Main.svelte | 4 +-
.../{SectionsEager.svelte => Sections.svelte} | 0
src/lib/sections/SectionsLazy.svelte | 48 -------------------
3 files changed, 2 insertions(+), 50 deletions(-)
rename src/lib/sections/{SectionsEager.svelte => Sections.svelte} (100%)
delete mode 100644 src/lib/sections/SectionsLazy.svelte
diff --git a/src/lib/layouts/stats/Main.svelte b/src/lib/layouts/stats/Main.svelte
index 0fca703b0..a95cf53f8 100644
--- a/src/lib/layouts/stats/Main.svelte
+++ b/src/lib/layouts/stats/Main.svelte
@@ -7,7 +7,7 @@
import PlayerProfile from "$lib/layouts/stats/PlayerProfile.svelte";
import Skills from "$lib/layouts/stats/Skills.svelte";
import Stats from "$lib/layouts/stats/Stats.svelte";
- import SectionsEager from "$lib/sections/SectionsEager.svelte";
+ import Sections from "$lib/sections/Sections.svelte";
import { flyAndScale } from "$lib/shared/utils";
import { itemContent, showItem } from "$lib/stores/internal";
import { Dialog } from "bits-ui";
@@ -49,7 +49,7 @@
{/await}
-
+
diff --git a/src/lib/sections/SectionsEager.svelte b/src/lib/sections/Sections.svelte
similarity index 100%
rename from src/lib/sections/SectionsEager.svelte
rename to src/lib/sections/Sections.svelte
diff --git a/src/lib/sections/SectionsLazy.svelte b/src/lib/sections/SectionsLazy.svelte
deleted file mode 100644
index 3fc6337c7..000000000
--- a/src/lib/sections/SectionsLazy.svelte
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-{#each $sectionOrderPreferences as sectionId (sectionId.id)}
- {@const section = sectionComponents[sectionId.name as SectionName]}
- {#if section}
- {#await section then { default: Component }}
-
- {/await}
- {:else}
-
Something went wrong
- {/if}
-{/each}
From 294f272fa005a1bbca93762dd9b6cae7fe190dcc Mon Sep 17 00:00:00 2001
From: DuckySoLucky
Date: Tue, 14 Jan 2025 17:32:46 +0100
Subject: [PATCH 2/4] fix(stats): missing accessories, and forge item
---
src/lib/server/constants/mining.ts | 16 ++++++++--------
src/lib/server/stats/missing.ts | 9 ++++++++-
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/lib/server/constants/mining.ts b/src/lib/server/constants/mining.ts
index 385ab1161..e0c12b199 100644
--- a/src/lib/server/constants/mining.ts
+++ b/src/lib/server/constants/mining.ts
@@ -2003,14 +2003,14 @@ export const FORGE = {
AMBER_MATERIAL: { name: "Amber Material", duration: 21600000 },
FRIGID_HUSK: { name: "Frigid Husk", duration: 21600000 },
BEJEWELED_COLLAR: { name: "Bejeweled Collar", duration: 7200000 },
- LVL_1_LEGENDARY_MOLE: { name: "[Lvl 1] Mole", duration: 259200000 },
- LVL_1_LEGENDARY_AMMONITE: { name: "[Lvl 1] Ammonite", duration: 259200000 },
- LVL_1_LEGENDARY_PENGUIN: { name: "[Lvl 1] Penguin", duration: 604800000 },
- LVL_1_LEGENDARY_TYRANNOSAURUS: { name: "[Lvl 1] T-Rex", duration: 604800000 },
- LVL_1_LEGENDARY_SPINOSAURUS: { name: "[Lvl 1] Spinosaurus", duration: 604800000 },
- LVL_1_LEGENDARY_GOBLIN: { name: "[Lvl 1] Goblin", duration: 604800000 },
- LVL_1_LEGENDARY_ANKYLOSAURUS: { name: "[Lvl 1] Ankylosaurus", duration: 604800000 },
- LVL_1_LEGENDARY_MAMMOTH: { name: "[Lvl 1] Mammoth", duration: 604800000 },
+ MOLE: { name: "[Lvl 1] Mole", duration: 259200000 },
+ AMMONITE: { name: "[Lvl 1] Ammonite", duration: 259200000 },
+ PENGUIN: { name: "[Lvl 1] Penguin", duration: 604800000 },
+ TYRANNOSAURUS: { name: "[Lvl 1] T-Rex", duration: 604800000 },
+ SPINOSAURUS: { name: "[Lvl 1] Spinosaurus", duration: 604800000 },
+ GOBLIN: { name: "[Lvl 1] Goblin", duration: 604800000 },
+ ANKYLOSAURUS: { name: "[Lvl 1] Ankylosaurus", duration: 604800000 },
+ MAMMOTH: { name: "[Lvl 1] Mammoth", duration: 604800000 },
MITHRIL_DRILL_1: { name: "Mithril Drill SX-R226", duration: 14400000 },
MITHRIL_DRILL_2: { name: "Mithril Drill SX-R326", duration: 30000 },
GEMSTONE_DRILL_1: { name: "Ruby Drill TX-15", duration: 14400000 },
diff --git a/src/lib/server/stats/missing.ts b/src/lib/server/stats/missing.ts
index 0a7b41413..4d864abe2 100644
--- a/src/lib/server/stats/missing.ts
+++ b/src/lib/server/stats/missing.ts
@@ -99,7 +99,7 @@ function getMissing(items: ProcessedItem[], accessories: Accessory[]) {
display_name: ACCESSORY.name ?? null
};
- if ((constants.getUpgradeList(id) && constants.getUpgradeList(id)[0] !== id) || (ACCESSORY as SpecialAccessory).rarities) {
+ if ((constants.getUpgradeList(id).length && constants.getUpgradeList(id)[0] !== id) || (ACCESSORY as SpecialAccessory).rarities) {
upgrades.push(object);
} else {
other.push(object);
@@ -140,6 +140,8 @@ export async function getMissingAccessories(items: Accessories, userProfile: Mem
price = await helper.getItemPrice(item.id);
}
+ item.extra ??= {};
+ item.extra.price = price;
if (price > 0) {
helper.addToItemLore(item, `§7Price: §6${Math.round(price).toLocaleString()} Coins §7(§6${formatNumber(Math.floor(price / helper.getMagicalPower(item.rarity, item.id)))} §7per MP)`);
}
@@ -150,7 +152,12 @@ export async function getMissingAccessories(items: Accessories, userProfile: Mem
item.Damage ??= item.damage;
// item.id ??= item.item_id;
+ const oldTexture = item.texture_path;
+ item.texture_path = null;
helper.applyResourcePack(item, packs);
+ if (item.texture_path === null) {
+ item.texture_path = oldTexture;
+ }
}
(output[key as keyof typeof output] as unknown as ProcessedItem[]).sort((a: ProcessedItem, b: ProcessedItem) => {
From 339212368400f52eec415fb177a58713389335f4 Mon Sep 17 00:00:00 2001
From: DuckySoLucky
Date: Tue, 14 Jan 2025 17:44:41 +0100
Subject: [PATCH 3/4] fix(stats/pets): +- stats
---
src/lib/server/stats/pets.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/server/stats/pets.ts b/src/lib/server/stats/pets.ts
index 24a64b8d0..73ad9808d 100644
--- a/src/lib/server/stats/pets.ts
+++ b/src/lib/server/stats/pets.ts
@@ -59,7 +59,7 @@ function getPetSkins() {
function replaceVariables(template: string, variables: Record) {
return template.replace(/\{(\w+)\}/g, (match, name) => {
// ? NOTE: Needed because NEU doesn't return + in front of stats
- if (isNaN(parseFloat(name)) === true) {
+ if (isNaN(parseFloat(name)) === true && parseInt(variables[name]) > 0) {
return `+${variables[name] ?? match}`;
}
From d7c24c3be20f4be90ff47e1a0e08bb3f7c777d1a Mon Sep 17 00:00:00 2001
From: DuckySoLucky
Date: Tue, 14 Jan 2025 17:50:41 +0100
Subject: [PATCH 4/4] possibly fix mem leak
---
.../stats/[ign]/[[profile]]/+page.svelte | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/routes/stats/[ign]/[[profile]]/+page.svelte b/src/routes/stats/[ign]/[[profile]]/+page.svelte
index 5126d66e1..a98b02397 100644
--- a/src/routes/stats/[ign]/[[profile]]/+page.svelte
+++ b/src/routes/stats/[ign]/[[profile]]/+page.svelte
@@ -14,6 +14,7 @@
// Update the profile context when the data changes
$effect(() => {
+ const abortController = new AbortController();
setProfileCtx(data.user as unknown as ValidStats);
untrack(() => {
@@ -28,10 +29,23 @@
// Update the URL to match the username and cute name
if (current !== wanted) {
const newUrl = page.url.toString().replace(current, wanted);
- // Tick to wait for the router to initialize
- tick().then(() => replaceState(newUrl, page.state));
+
+ // Only proceed if not aborted
+ if (!abortController.signal.aborted) {
+ tick()
+ .then(() => {
+ if (!abortController.signal.aborted) {
+ replaceState(newUrl, page.state);
+ }
+ })
+ .catch(() => {});
+ }
}
});
+
+ return () => {
+ abortController.abort();
+ };
});