aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-21 20:20:17 -0500
committermat <github@matdoes.dev>2022-03-21 20:20:17 -0500
commitdfb5b8dce49ab268df945e29441bd57ab5a8d15a (patch)
treebdd6523b5a4c2a7b701d5dbc69d948b72b809fb9
parent9850eb69b6d0c9b7742145dd8be481d064d3f82e (diff)
downloadskyblock-stats-dfb5b8dce49ab268df945e29441bd57ab5a8d15a.tar.gz
skyblock-stats-dfb5b8dce49ab268df945e29441bd57ab5a8d15a.tar.bz2
skyblock-stats-dfb5b8dce49ab268df945e29441bd57ab5a8d15a.zip
show personal vault icon when it's the only inv
-rw-r--r--src/lib/minecraft/inventory.ts61
-rw-r--r--src/lib/sections/Inventories.svelte62
-rw-r--r--src/routes/player/[player]/[profile].svelte13
3 files changed, 72 insertions, 64 deletions
diff --git a/src/lib/minecraft/inventory.ts b/src/lib/minecraft/inventory.ts
index 9c78259..563e96a 100644
--- a/src/lib/minecraft/inventory.ts
+++ b/src/lib/minecraft/inventory.ts
@@ -34,6 +34,67 @@ const INVENTORIES = {
personal_vault: 'personal_vault_contents'
}
+export const inventoryIconMap: Record<string, string | Item> = {
+ inventory: {
+ id: 'SKYBLOCK_MENU',
+ vanillaId: 'nether_star',
+ display: { name: 'SkyBlock Menu' },
+ },
+ ender_chest: {
+ vanillaId: 'ender_chest',
+ display: { name: '\\u00a7aEnder Chest' },
+ },
+ talisman_bag: {
+ vanillaId: 'skull:3',
+ display: { name: 'Accessory Bag' },
+ headTexture: '961a918c0c49ba8d053e522cb91abc74689367b4d8aa06bfc1ba9154730985ff',
+ },
+ potion_bag: {
+ vanillaId: 'skull:3',
+ display: { name: 'Potion Bag' },
+ headTexture: '9f8b82427b260d0a61e6483fc3b2c35a585851e08a9a9df372548b4168cc817c',
+ },
+ fishing_bag: {
+ vanillaId: 'skull:3',
+ display: { name: 'Fishing Bag' },
+ headTexture: 'eb8e297df6b8dffcf135dba84ec792d420ad8ecb458d144288572a84603b1631',
+ },
+ quiver: {
+ vanillaId: 'skull:3',
+ display: {
+ name: 'Quiver',
+ },
+ headTexture: '4cb3acdc11ca747bf710e59f4c8e9b3d949fdd364c6869831ca878f0763d1787',
+ },
+ wardrobe: {
+ vanillaId: 'leather_chestplate',
+ display: {
+ name: '\\u00a7aWardrobe',
+ },
+ },
+ trick_or_treat_bag: {
+ vanillaId: 'skull:3',
+ display: {
+ name: 'Trick or Treat Bag',
+ },
+ headTexture: 'e50f712e877dfd910c97f3819a200a05d49ee6b83b592686e099b9ecd443f228',
+ },
+ personal_vault: {
+ vanillaId: 'iron_door',
+ display: {
+ lore: [
+ '§7Store your valuable items in a',
+ '§7safe place that only you can',
+ '§7access!',
+ '',
+ '§eClick to view!',
+ ],
+ name: '§aPersonal Vault',
+ },
+ },
+}
+
+
export type Inventories = { [name in keyof typeof INVENTORIES]: Item[] }
export function itemToUrl(item: Item, pack?: skyblockAssets.MatcherFile): string {
diff --git a/src/lib/sections/Inventories.svelte b/src/lib/sections/Inventories.svelte
index 6d5ff71..27bdd72 100644
--- a/src/lib/sections/Inventories.svelte
+++ b/src/lib/sections/Inventories.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { skyblockItemToUrl, type Item } from '$lib/minecraft/inventory'
+ import { inventoryIconMap, skyblockItemToUrl, type Item } from '$lib/minecraft/inventory'
import Inventory from '$lib/minecraft/Inventory.svelte'
import type { MatcherFile } from 'skyblock-assets'
import { cleanId } from '$lib/utils'
@@ -12,66 +12,6 @@
if (inventoryName !== 'armor') displayingInventories.push(inventoryName)
let selectedInventoryName: string = displayingInventories[0]
-
- const inventoryIconMap: Record<string, string | Item> = {
- inventory: {
- id: 'SKYBLOCK_MENU',
- vanillaId: 'nether_star',
- display: { name: 'SkyBlock Menu' },
- },
- ender_chest: {
- vanillaId: 'ender_chest',
- display: { name: '\\u00a7aEnder Chest' },
- },
- talisman_bag: {
- vanillaId: 'skull:3',
- display: { name: 'Accessory Bag' },
- headTexture: '961a918c0c49ba8d053e522cb91abc74689367b4d8aa06bfc1ba9154730985ff',
- },
- potion_bag: {
- vanillaId: 'skull:3',
- display: { name: 'Potion Bag' },
- headTexture: '9f8b82427b260d0a61e6483fc3b2c35a585851e08a9a9df372548b4168cc817c',
- },
- fishing_bag: {
- vanillaId: 'skull:3',
- display: { name: 'Fishing Bag' },
- headTexture: 'eb8e297df6b8dffcf135dba84ec792d420ad8ecb458d144288572a84603b1631',
- },
- quiver: {
- vanillaId: 'skull:3',
- display: {
- name: 'Quiver',
- },
- headTexture: '4cb3acdc11ca747bf710e59f4c8e9b3d949fdd364c6869831ca878f0763d1787',
- },
- wardrobe: {
- vanillaId: 'leather_chestplate',
- display: {
- name: '\\u00a7aWardrobe',
- },
- },
- trick_or_treat_bag: {
- vanillaId: 'skull:3',
- display: {
- name: 'Trick or Treat Bag',
- },
- headTexture: 'e50f712e877dfd910c97f3819a200a05d49ee6b83b592686e099b9ecd443f228',
- },
- personal_vault: {
- vanillaId: 'iron_door',
- display: {
- lore: [
- '§7Store your valuable items in a',
- '§7safe place that only you can',
- '§7access!',
- '',
- '§eClick to view!',
- ],
- name: '§aPersonal Vault',
- },
- },
- }
</script>
{#if displayingInventories.length > 1}
diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte
index e6d5482..4d4761b 100644
--- a/src/routes/player/[player]/[profile].svelte
+++ b/src/routes/player/[player]/[profile].svelte
@@ -24,29 +24,30 @@
</script>
<script lang="ts">
+ import { inventoryIconMap, skyblockItemToUrl } from '$lib/minecraft/inventory'
import Leaderboards from '$lib/sections/Leaderboards.svelte'
import Inventories from '$lib/sections/Inventories.svelte'
import Collections from '$lib/sections/Collections.svelte'
+ import { chooseDefaultBackground } from '$lib/backgrounds'
import BackgroundImage from '$lib/BackgroundImage.svelte'
import type { CleanMemberProfile } from '$lib/APITypes'
import Username from '$lib/minecraft/Username.svelte'
import StatList from '$lib/sections/StatList.svelte'
import Infobox from '$lib/sections/Infobox.svelte'
import Minions from '$lib/sections/Minions.svelte'
+ import Slayers from '$lib/sections/Slayers.svelte'
import type { MatcherFile } from 'skyblock-assets'
import Collapsible from '$lib/Collapsible.svelte'
import Skills from '$lib/sections/Skills.svelte'
import { generateInfobox } from '$lib/profile'
import Zones from '$lib/sections/Zones.svelte'
import Armor from '$lib/sections/Armor.svelte'
+ import Bank from '$lib/sections/Bank.svelte'
import Header from '$lib/Header.svelte'
import Emoji from '$lib/Emoji.svelte'
import { cleanId } from '$lib/utils'
import Head from '$lib/Head.svelte'
import Toc from '$lib/Toc.svelte'
- import { chooseDefaultBackground } from '$lib/backgrounds'
- import Slayers from '$lib/sections/Slayers.svelte'
- import Bank from '$lib/sections/Bank.svelte'
export let data: CleanMemberProfile
export let pack: MatcherFile
@@ -135,6 +136,12 @@
{#if data.member.inventories?.inventory}
Inventories
{:else}
+ <img
+ class="inventory-tab-icon"
+ loading="lazy"
+ src={skyblockItemToUrl(inventoryIconMap.personal_vault, pack)}
+ alt={cleanId('personal_vault')}
+ />
Personal Vault
{/if}
</h2>