Skip to content

Commit

Permalink
Merge pull request #27 from SkyCryptWebsite:feat/collections
Browse files Browse the repository at this point in the history
feat: add collections
  • Loading branch information
DarthGigi authored Nov 24, 2024
2 parents 0f65a1b + c29217c commit 2bebffd
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 54 deletions.
81 changes: 27 additions & 54 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,60 +183,33 @@
unicode-range:
/* ✪ dungeon-star */
U+272A,
/* ⍟ dungeon-master-star (no longer used) */
U+235F,
/* ⚔ attack-speed */
U+2694,
/* ☣ critical-chance */
U+2623,
/* ☠ critical-damage */
U+2620,
/* ❈ defense */
U+2748,
/* ☘ fortune */
U+2618,
/* ⫽ ferocity */
U+2AFD,
/* ❤ health */
U+2764,
/* ✎ intelligence */
U+270E,
/* ✯ magic-find */
U+272F,
/* ⸕ mining-speed */
U+2E15,
/* ♣ pet-luck */
U+2663,
/* ✧ pristine */
U+2727,
/* α sea-creature-chance */
U+03B1,
/* ✦ speed */
U+2726,
/* ❁ strength */
U+2741,
/* ๑ ability-damage */
U+0E51,
/* ➊ 1-dungeon-star */
U+278A,
/* ➋ 2-dungeon-star */
U+278B,
/* ➌ 3-dungeon-star */
U+278C,
/* ➍ 4-dungeon-star */
U+278D,
/* ➎ 5-dungeon-star */
U+278E,
/* ❂ true-defense, */
U+2742,
/* ⸎ soulflow */
U+2E0E,
/* ᠅ powder, */
U+1805,
/* ✿ dye, */
U+273F,
/* ⚚ dungeon-upgrade, */
U+269A;
/* ⍟ dungeon-master-star (no longer used) */ U+235F,
/* ⚔ attack-speed */ U+2694,
/* ☣ critical-chance */ U+2623,
/* ☠ critical-damage */ U+2620,
/* ❈ defense */ U+2748,
/* ☘ fortune */ U+2618,
/* ⫽ ferocity */ U+2AFD,
/* ❤ health */ U+2764,
/* ✎ intelligence */ U+270E,
/* ✯ magic-find */ U+272F,
/* ⸕ mining-speed */ U+2E15,
/* ♣ pet-luck */ U+2663,
/* ✧ pristine */ U+2727,
/* α sea-creature-chance */ U+03B1,
/* ✦ speed */ U+2726,
/* ❁ strength */ U+2741,
/* ๑ ability-damage */ U+0E51,
/* ➊ 1-dungeon-star */ U+278A,
/* ➋ 2-dungeon-star */ U+278B,
/* ➌ 3-dungeon-star */ U+278C,
/* ➍ 4-dungeon-star */ U+278D,
/* ➎ 5-dungeon-star */ U+278E,
/* ❂ true-defense, */ U+2742,
/* ⸎ soulflow */ U+2E0E,
/* ᠅ powder, */ U+1805,
/* ✿ dye, */ U+273F,
/* ⚚ dungeon-upgrade, */ U+269A;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib/layouts/stats/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import Accessories from "$lib/sections/stats/Accessories.svelte";
import Armor from "$lib/sections/stats/Armor.svelte";
import Bestiary from "$lib/sections/stats/Bestiary.svelte";
import Collections from "$lib/sections/stats/Collections.svelte";
import Dungeons from "$lib/sections/stats/Dungeons.svelte";
import Inventory from "$lib/sections/stats/Inventory.svelte";
import Minions from "$lib/sections/stats/Minions.svelte";
Expand Down Expand Up @@ -36,6 +37,7 @@
<Slayer />
<Minions />
<Bestiary />
<Collections />
</main>

<svg xmlns="http://www.w3.org/2000/svg" height="0" width="0" style="position: fixed;">
Expand Down
62 changes: 62 additions & 0 deletions src/lib/sections/stats/Collections.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<script lang="ts">
import AdditionStat from "$lib/components/AdditionStat.svelte";
import Chip from "$lib/components/Chip.svelte";
import Items from "$lib/layouts/stats/Items.svelte";
import { cn } from "$lib/utils";
import type { Stats as StatsType } from "$types/stats";
import { format } from "numerable";
import { getContext } from "svelte";
const profile = getContext<StatsType>("profile");
const collections = profile.collections;
</script>

<Items title="Collections" class="flex-col">
<div slot="text">
<AdditionStat text="Maxed Collections" data="{collections.maxedCollections} / {collections.totalCollections}" />
</div>
{#each Object.entries(collections.categories) as [_, data]}
<div class="flex items-center gap-1 text-base font-semibold uppercase">
<h3 class="text-xl">{data.name}</h3>
{#if data.maxTiers === data.totalTiers}
<span class="text-gold">Max!</span>
{:else}
<span class="text-text/80">({data.maxTiers} / {data.totalTiers} max)</span>
{/if}
</div>

<div class="flex flex-wrap gap-4">
{#each data.items as item}
{@const hasUnlocked = item.amount}
{@const hasMaxed = item.tier === item.maxTier}
<Chip image={{ src: item.texture }} class={cn("h-fit w-fit", { "opacity-50": !hasUnlocked })} variant="tooltip">
<div class={cn("flex flex-col")}>
<div class="font-bold">
<span class={cn(hasMaxed ? "text-maxed" : "opacity-60")}>{item.name}</span>
<span class={cn({ "text-gold": hasMaxed })}>{item.tier}</span>
<div class="text-sm">
<span class="opacity-60">Amount:</span>
<span class="text-text">{format(item.amount)}</span>
</div>
</div>
</div>
<div slot="tooltip" class="text-sm font-bold">
<div class="mb-4">
{#each item.amounts as user}
<span class="opacity-85">
{user.username}:
</span>
<span class="text-text">{format(user.amount)}</span>
{/each}
</div>
<div>
<span class="opacity-85"> Total: </span>
<span class="text-text opacity-100">{format(item.amount)}</span>
</div>
</div>
</Chip>
{/each}
</div>
{/each}
</Items>

0 comments on commit 2bebffd

Please sign in to comment.