Skip to content

Commit

Permalink
dev to prod (#67)
Browse files Browse the repository at this point in the history
* fix(wardobe): moblie and pic ui

* update(themes): add fallbacks and fix styling

* style(navbar): dark/light mode

* style(navbar): fix conditional

* style(skills/fishing): fix gold trophy fish color

* fix(accessories/enrichments): compare at lower case

* fix(dungeons): healer class

* fix(inventory): show count

* fix(pets): total xp progress

* feat(mining): bump hotm tree (#63)

* fix(activepet): display name instead of type

* style(mining/crystals): color when placed/found

* fix(misc/dragons): format fastest kill time

* fix(collections): new line inbetween users in tooltip

* feat(stats): item container preview (#59)

* feat(stats): item container preview

* fix(container-preview): update styling

* refactor(containedItem): clean code

---------

Co-authored-by: zickles <zicklesistaken@gmail.com>

* fix(pets): display name

* fix(items/armor): armor_name

* yes

* fix(pets): montezuma pet

* feat(pets/display_name): skinned name

* fix(minions): dupe tiers

* fix(hotm): wrong symbol

* fix(inventory): printing open tab

* fix(misc/auctions): null check total sold and bought

* fix(skills/farming): null check farming tools

* refactor(dungeons/bestrun): played -> completed

* fix(armor): display set name

* fix(stats): percentage

* fix(stats): crit chacne

* fix(stats): make empty profiles look better and some other small fixes

* fix: get rid of console.log()

* feat(collections): add completions to dungeon collections

* feat(fishing/trophyFish): add progress

* feat(seo): integrate svelte-seo for improved SEO management

* Filled Map Fix (#60)

* Programmer Art Fix

Fixes some items which were using 1.14+ textures, and adds vanilla textures for null blocks

* feat(items): add museum viewing & packs

* fix(style): prettier

* Filled Map Fix

Added texture and properties for the Filled Map item

---------

Co-authored-by: DuckySoLucky <robertkovac160@gmail.com>
Co-authored-by: Zickles <76439587+Zickles@users.noreply.github.com>

* fix(accessories: alias dupes

* fix(mining): crystal nucleus runs

* fix(pets): pet score

* fix(mining/forge): ending time

* fix(pets/petscore): montezume pet

* fix(items/museum): forgot to pass disabled packs here

* refactor: update ABOUT

* refactor(SEO): embed

* fix(pets): montezuma

---------

Co-authored-by: zickles <zicklesistaken@gmail.com>
Co-authored-by: DarthGigi <47110839+DarthGigi@users.noreply.github.com>
Co-authored-by: Zickles <76439587+Zickles@users.noreply.github.com>
Co-authored-by: ic22487 <ic22487Gaming@gmail.com>
  • Loading branch information
5 people authored Dec 30, 2024
1 parent 96ad480 commit 4bcbd89
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 105 deletions.
70 changes: 30 additions & 40 deletions src/lib/components/SEO.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { getProfileCtx } from "$ctx/profile.svelte";
import { formatNumber, removeFormatting } from "$lib/shared/helper";
import { formatNumber, removeFormatting, titleCase } from "$lib/shared/helper";
import type { Skill } from "$types/stats";
import { formatDistanceToNowStrict } from "date-fns";
import SvelteSeo from "svelte-seo";
Expand Down Expand Up @@ -41,56 +41,39 @@
// Skyblock Level
if (profile.skyblock_level.xp !== 0 && profile.skyblock_level.level !== 0) {
output += `🌟 Skyblock Level: ${(profile.skyblock_level.level + profile.skyblock_level.progress).toFixed(0)}\n`;
}
// Armor
if (profile.items.armor?.set_name !== undefined) {
output += `🛡️ ${removeFormatting(profile.items.armor.set_name)}\n`;
output += `🌟 Skyblock Level: ${formatNumber(profile.skyblock_level.levelWithProgress)}\n`;
}
// Sword
if (profile.items.weapons?.highest_priority_weapon !== undefined) {
output += `🗡️ ${removeFormatting(profile.items.weapons.highest_priority_weapon.display_name)}\n`;
}
// Skills
const skills = (profile.skills?.skills ?? {}) as Record<string, Skill>;
if (skills !== undefined) {
const skill = Object.keys(skills).sort((a, b) => skills[b].xp - skills[a].xp)[0];
if (skills[skill].level !== undefined) {
output += `${skillEmojis[skill]} ${skill.charAt(0).toUpperCase() + skill.slice(1)} ${skills[skill].level}\n`;
}
// Armor
if (profile.items.armor?.set_name !== undefined) {
output += `🛡️ ${removeFormatting(profile.items.armor.set_name)}\n`;
}
// Pet
if (profile.pets?.pets !== undefined) {
const activePet = profile.pets.pets.find((a) => a.active);
if (activePet !== undefined) {
output += `🐾 ${(activePet.rarity ?? "common").charAt(0).toUpperCase() + (activePet.rarity ?? "common").slice(1)} ${activePet.display_name} (Lvl ${activePet.level})\n`;
output += `🐾 [LvL ${activePet.level}] ${titleCase(activePet.rarity ?? "common")} ${activePet.display_name} \n`;
}
}
// Line break
output += "\n";
// Slayers
if (profile.slayer?.totalSlayerExp > 0) {
output += "🤺 Slayer: ";
const slayerOrder = ["zombie", "spider", "wolf", "enderman", "vampire", "blaze"];
for (const slayer of slayerOrder) {
if (profile.slayer.data[slayer] === undefined) {
continue;
}
// Skills
const skills = (profile.skills?.skills ?? {}) as Record<string, Skill>;
if (skills !== undefined) {
output += "📚 Skills: ";
const slayerInfo = profile.slayer.data[slayer];
if (slayerInfo.level.level === 0) {
continue;
for (const skill in skills) {
if (skills[skill].level !== undefined) {
output += `${skillEmojis[skill]} ${skills[skill].level} `;
}
output += `${slayerEmojis[slayer]} ${slayerInfo.level.level} `;
}
output += "\n";
Expand All @@ -100,7 +83,7 @@
if (profile.dungeons !== undefined) {
const dungeonsLevel = profile.dungeons?.level?.level;
if (dungeonsLevel > 0) {
output += `${skillEmojis["dungeons"]} Catacombs: ${dungeonsLevel}\n`;
output += `${skillEmojis["dungeons"]} Dungeons: ${dungeonsLevel} `;
}
const classes = profile.dungeons?.classes?.classes;
Expand All @@ -113,22 +96,29 @@
output += "\n";
}
output += "\n";
// Slayers
if (profile.slayer?.totalSlayerExp > 0) {
output += "🤺 Slayer: ";
if (profile.skills?.averageSkillLevel || profile.dungeons?.classes?.classAverage) {
// Skill Average
if (profile.skills.averageSkillLevel !== undefined) {
output += `📚 Avg Skill Level: ${profile.skills.averageSkillLevel.toFixed(2)}\n`;
}
const slayerOrder = ["zombie", "spider", "wolf", "enderman", "vampire", "blaze"];
for (const slayer of slayerOrder) {
if (profile.slayer.data[slayer] === undefined) {
continue;
}
const slayerInfo = profile.slayer.data[slayer];
if (slayerInfo.level.level === 0) {
continue;
}
// Dungeons classs average
if (profile.dungeons?.classes?.classAverage) {
output += `⚔️ Avg Class Level: ${profile.dungeons?.classes?.classAverage.toFixed(2)}\n`;
output += `${slayerEmojis[slayer]} ${slayerInfo.level.level} `;
}
output += "\n";
}
output += "\n";
// Networth, Bank & purse
if (profile.stats.networth.noInventory === false) {
output += `💸 Networth: ${formatNumber(profile.stats.networth.networth)}\n`;
Expand Down
38 changes: 9 additions & 29 deletions src/lib/components/header/Info.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,12 @@
</ul>
</li>
<li>
Libraries:
<ul>
<li>
<Button.Root class="font-semibold text-link" rel="noreferrer" href="https://twemoji.twitter.com/" target="_blank">Twemoji</Button.Root>
by
<span class="text-text/70">Twitter</span>
</li>
<li>
<Button.Root class="font-semibold text-link" rel="noreferrer" href="https://github.com/bs-community/skinview3d/" target="_blank">skinview3d</Button.Root>
by <span class="text-text/70">Blessing Skin</span>
</li>
</ul>
3D Skin View: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://github.com/bs-community/skinview3d/" target="_blank">Blessing Skin</Button.Root>
by <span class="text-text/70">SkyHelper</span>
</li>
<li>
Weight Calculations:
<ul>
<li>
<Button.Root class="font-semibold text-link" rel="noreferrer" href="https://github.com/Senither/hypixel-skyblock-facade" target="_blank">Hypixel SkyBlock Facade</Button.Root>
by <span class="text-text/70">Senither</span>
</li>
<li>
<Button.Root class="font-semibold text-link" rel="noreferrer" href="https://github.com/Antonio32A/lilyweight" target="_blank">lilyweight</Button.Root>
by <span class="text-text/70">LappySheep</span> and <span class="text-text/70">Antonio32A</span>
</li>
<li>
<Button.Root class="font-semibold text-link" rel="noreferrer" href="https://elitebot.dev/" target="_blank">Farming Weight</Button.Root>
by
<span class="text-text/70">Elite</span>
</li>
</ul>
Farming Weight: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://elitebot.dev/" target="_blank">Elite</Button.Root>
by <span class="text-text/70">SkyHelper</span>
</li>
<li>
Networth: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://www.npmjs.com/package/skyhelper-networth" target="_blank">SkyHelper Networth</Button.Root>
Expand All @@ -117,9 +93,13 @@
by <span class="text-text/70">Hypixel</span>
</li>
<li>
Data: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://api.hypixel.net/" target="_blank">Hypixel API</Button.Root>
Player Data: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://api.hypixel.net/" target="_blank">Hypixel API</Button.Root>
by <span class="text-text/70">Hypixel</span>
</li>
<li>
Game Data: <Button.Root class="font-semibold text-link" rel="noreferrer" href="https://github.com/NotEnoughUpdates/NotEnoughUpdates-REPO" target="_blank">NotEnoughUpdates-REPO</Button.Root>
by <span class="text-text/70">NEU</span>
</li>
</ul>
{/snippet}

Expand Down
12 changes: 12 additions & 0 deletions src/lib/server/constants/accessories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,15 @@ export const RECOMBABLE_ACCESSORIES_COUNT = new Set(
export function getUpgradeList(id: string) {
return accessoryUpgrades.find((list) => list.includes(id)) ?? [];
}

export function getBaseIdFromAlias(id: string) {
for (const [base, aliases] of Object.entries(ACCESSORY_ALIASES)) {
if (aliases.includes(id) === false) {
continue;
}

return base;
}

return id;
}
1 change: 1 addition & 0 deletions src/lib/server/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export function getRawLore(text: string) {
*/
export function titleCase(s: string) {
return s
.toLowerCase()
.replaceAll("_", " ")
.split(" ")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
Expand Down
25 changes: 1 addition & 24 deletions src/lib/server/stats/accessories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function getAccessories(userProfile: Member, items: GetItemsItems,
const id = helper.getId(accessory);
const rarity = accessory.rarity ?? "common";

const duplicates = accessories.filter((a) => helper.getId(a) === id);
const duplicates = accessories.filter((a) => constants.getBaseIdFromAlias(helper.getId(a)) === constants.getBaseIdFromAlias(id));
if (duplicates.length > 1) {
for (const duplicate of duplicates) {
if (constants.RARITIES.indexOf(duplicate.rarity ?? "common") < constants.RARITIES.indexOf(rarity)) {
Expand All @@ -81,29 +81,6 @@ export async function getAccessories(userProfile: Member, items: GetItemsItems,
accessory.isInactive = false;
}
}

const ACCESSORY_ALIASES = constants.ACCESSORY_ALIASES;
if (id in ACCESSORY_ALIASES || Object.values(ACCESSORY_ALIASES).flat().includes(id)) {
const alias = Object.keys(ACCESSORY_ALIASES).find((key) => ACCESSORY_ALIASES[key].includes(id));
if (!alias) {
continue;
}

const aliases = [alias, ACCESSORY_ALIASES[alias]].flat();
for (const a of accessories) {
if (aliases.includes(helper.getId(a)) && a !== accessory) {
if (a.tag.display.Lore.at(-1)?.includes("§7Inactive: §cAlias of") === false) {
helper.addToItemLore(a, ["", `§7Inactive: §cAlias of ${accessory.display_name}`]);
}

a.isInactive = true;
}
}

accessory.isInactive = false;
accessory.tag.display.Lore.pop();
accessory.tag.display.Lore.pop();
}
}

for (const accessory of accessories) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/stats/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export async function getItems(userProfile: Member, userMuseum: MuseumRaw | null
}
}

output.museumItems = userMuseum ? await decodeMusemItems(userMuseum, []) : null;
output.museumItems = userMuseum ? await decodeMusemItems(userMuseum, packs) : null;

output.armor = getArmor(output.armor);
output.equipment = getEquipment(output.equipment);
Expand Down
17 changes: 9 additions & 8 deletions src/lib/server/stats/mining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ function getForge(userProfile: Member) {
const output = [];

const quickForgeLevel = userProfile.mining_core?.nodes?.forge_time ?? 0;
const quickForge = userProfile.mining_core?.nodes?.toggle_forge_time ? (quickForgeLevel <= 19 ? 0.1 + quickForgeLevel * 0.005 : 0.3) : 0;
const quickForge = quickForgeLevel ? (quickForgeLevel <= 19 ? 100 + quickForgeLevel * 5 : 300) / 10 : 0;

for (const item of Object.values(userProfile.forge?.forge_processes?.forge_1 ?? {})) {
output.push({
id: item.id,
name: constants.FORGE[item.id].name,
slot: item.slot,
startingTime: item.startTime,
endingTime: item.startTime + constants.FORGE[item.id].duration - constants.FORGE[item.id].duration * quickForge,
endingTime: item.startTime + constants.FORGE[item.id].duration - constants.FORGE[item.id].duration * (quickForge / 100),
duration: constants.FORGE[item.id].duration - constants.FORGE[item.id].duration * quickForge
});
}
Expand All @@ -75,11 +75,12 @@ function getForge(userProfile: Member) {
export function getMining(userProfile: Member, player: Player, packs: string[]) {
const HOTM = getLevelByXp(userProfile.mining_core?.experience, { type: "hotm" });
const totalTokens = calcHotmTokens(HOTM.level, userProfile.mining_core?.nodes?.special_0 ?? 0);
const crystalNucleusRuns = Math.min(
...Object.values(userProfile.mining_core?.crystals ?? {})
.filter((x) => x.total_placed)
.map((x) => x.total_placed ?? 0)
);

const crystalNucleusRuns = Object.values(userProfile.mining_core?.crystals ?? {})
.filter((x) => x.total_placed)
.map((x) => x.total_placed ?? 0);

const crystalNucleusRunsAmount = crystalNucleusRuns.length ? Math.min(...crystalNucleusRuns) : 0;

return {
level: HOTM,
Expand All @@ -99,7 +100,7 @@ export function getMining(userProfile: Member, player: Player, packs: string[])
},
crystalHollows: {
crystalHollowsLastAccess: userProfile.mining_core?.greater_mines_last_access,
nucleusRuns: crystalNucleusRuns,
nucleusRuns: crystalNucleusRunsAmount,
progress: getCrystalNucleusRunData(userProfile)
},
powder: {
Expand Down
10 changes: 7 additions & 3 deletions src/lib/server/stats/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function getProfilePets(userProfile: Member, pets: Pet[]) {

const outputPet = {
type: pet.type,
display_name: helper.titleCase(pet.type.replaceAll("_", " ")),
display_name: helper.titleCase(pet.type),
rarity: pet.tier,
active: pet.active,
price: pet.price,
Expand Down Expand Up @@ -187,7 +187,7 @@ function getProfilePets(userProfile: Member, pets: Pet[]) {
}

if (line === "§7Rift Time: §a+100s") {
outputPet.lore.push(`§7Rift Time: §a+${soulPieces * 15}s`);
outputPet.lore.push(`§7Rift Time: §a+${10 + soulPieces * 15}s`);
continue;
}

Expand Down Expand Up @@ -324,9 +324,13 @@ function getMissingPets(userProfile: Member, pets: ProcessedPet[], gameMode: str
function getPetScore(pets: ProcessedPet[]) {
const highestRarity = {} as Record<string, number>;
const highestLevel = {} as Record<string, number>;

const petData = NEU_CONSTANTS.get("pets");
for (const pet of pets) {
// ? NOTE: FRACTURED_MONTEZUMA_SOUL is a rift pet so it's not accounted in the calculation
if (pet.type === "FRACTURED_MONTEZUMA_SOUL") {
continue;
}

const rarityIndex = constants.RARITIES.indexOf(pet.rarity.toLowerCase()) + 1;
if (rarityIndex > (highestRarity[pet.type] ?? 0)) {
highestRarity[pet.type] = rarityIndex;
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/raw/profile/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export type Contest = {

export type Leveling = {
experience: number;
highest_pet_score?: number;
};

export type MemberProfile = {
Expand Down

0 comments on commit 4bcbd89

Please sign in to comment.