Skip to content

Commit

Permalink
feat(stats): add museum
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckySoLucky committed Dec 8, 2024
1 parent d116808 commit 60d0b27
Show file tree
Hide file tree
Showing 27 changed files with 800 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { startRedis } from "./lib/server/db/redis";
init();

startMongo().then(() => {
console.log("[MONGO] Mongo started!");
console.log("[MONGO] MongoDB succeesfully connected");
});

startRedis().then(() => {
console.log("[REDIS] Redis started!");
console.log("[REDIS] Redis succeesfully connected");
});

updateNotEnoughUpdatesRepository().then(() => {
Expand Down
1 change: 0 additions & 1 deletion src/lib/constants/NotEnoughUpdates-REPO
Submodule NotEnoughUpdates-REPO deleted from a3a654
8 changes: 4 additions & 4 deletions src/lib/custom_resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ let packConfigHashes: { [key: string]: string } = {};
const outputPacks: OutputResourcePack[] = [];

export async function init() {
console.log(`Custom Resources loading started.`);
console.time(`custom_resources`);
console.log(`[CUSTOM-RESOURCES] Custom Resources loading started.`);
const timeNow = performance.now();

await loadPackConfigs();
let resourcesUpToDate = false;
Expand Down Expand Up @@ -137,8 +137,8 @@ export async function init() {

resourcesReady = true;

console.log(`Custom Resources loading done.`);
console.timeEnd(`custom_resources`);
const packs = new Set(resourcePacks.map((pack) => pack.config.id));
console.log(`[CUSTOM-RESOURCES] Successfully loaded ${packs.size} resource packs in ${(performance.now() - timeNow).toFixed(2)}ms`);
}

async function loadPackConfigs() {
Expand Down
7 changes: 4 additions & 3 deletions src/lib/sections/stats/Inventory.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const pots = profile.items.potion_bag;
const fish = profile.items.fishing_bag;
const quiver = profile.items.quiver;
const museum = profile.items.museum;
const openTab = writable<string>("inv");
Expand Down Expand Up @@ -66,8 +67,8 @@
{
id: "museum",
icon: "/api/head/438cf3f8e54afc3b3f91d20a49f324dca1486007fe545399055524c17941f4dc",
items: [],
hr: 45
items: museum,
hr: 54
}
];
Expand Down Expand Up @@ -106,7 +107,7 @@
{#if tab.hr === index}
<hr class="col-start-1 col-end-10 h-4 border-0" />
{/if}
{#if item.id}
{#if item.texture_path}
<div class="flex aspect-square items-center justify-center rounded bg-text/[0.04]" in:fade|global={{ duration: 300, delay: 5 * (index + 1) }}>
{#if tab.id === "inv"}
<Item piece={{ ...item, rarity: item.rarity ?? "uncommon" }} isInventory={true} />
Expand Down
10 changes: 5 additions & 5 deletions src/lib/server/constants/accessories.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// CREDITS: https://github.com/MattTheCuber (Modified)
import { ITEMS } from "$lib/shared/constants/items";
import type { SpecialAccessory, SpecialAccessoryConstant, allAccessories } from "$types/stats";
import { ITEMS as ALL_ITEMS } from "$lib/shared/constants/items";

let ITEMS = [] as allAccessories[];
let ACCESSORIES = [] as allAccessories[];
function getAccessories() {
const output = [] as allAccessories[];
ALL_ITEMS.forEach((item) => {
ITEMS.forEach((item) => {
if (item.category === "accessory") {
output.push(item as allAccessories);
}
});

ITEMS = output;
ACCESSORIES = output;
}

setTimeout(getAccessories, 60 * 60 * 1000); // 1 hour
Expand Down Expand Up @@ -138,7 +138,7 @@ export const SPECIAL_ACCESSORIES = {
} as Record<string, SpecialAccessoryConstant>;

export function getAllAccessories() {
const output = ITEMS.reduce<allAccessories[]>((accessory, item) => {
const output = ACCESSORIES.reduce<allAccessories[]>((accessory, item) => {
if (ignoredAccessories.includes(item.id)) return accessory;

if (Object.values(ACCESSORY_ALIASES).find((list) => list.includes(item.id))) return accessory;
Expand Down
Loading

0 comments on commit 60d0b27

Please sign in to comment.