Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prod #92

Merged
merged 4 commits into from
Jan 14, 2025
Merged

prod #92

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/layouts/stats/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -49,7 +49,7 @@
<Notice />
{/await}

<SectionsEager />
<Sections />
</div>
</main>
</div>
Expand Down
File renamed without changes.
48 changes: 0 additions & 48 deletions src/lib/sections/SectionsLazy.svelte

This file was deleted.

16 changes: 8 additions & 8 deletions src/lib/server/constants/mining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
9 changes: 8 additions & 1 deletion src/lib/server/stats/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)`);
}
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/stats/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function getPetSkins() {
function replaceVariables(template: string, variables: Record<string, string>) {
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}`;
}

Expand Down
18 changes: 16 additions & 2 deletions src/routes/stats/[ign]/[[profile]]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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();
};
});
</script>

Expand Down
Loading