aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-27 18:09:26 -0500
committermat <github@matdoes.dev>2022-03-27 18:09:26 -0500
commitcda39ef5dbb4d53929fba14d0086bf3ddf4d030b (patch)
tree86c3475164133c3a6feb97329f3e7f719d0b2eb1 /src
parente68a3eb9a1d8003098fb6dfdbcc62c674b5bbe12 (diff)
downloadskyblock-api-cda39ef5dbb4d53929fba14d0086bf3ddf4d030b.tar.gz
skyblock-api-cda39ef5dbb4d53929fba14d0086bf3ddf4d030b.tar.bz2
skyblock-api-cda39ef5dbb4d53929fba14d0086bf3ddf4d030b.zip
rename "fire and flames" to "through the campfire"
Diffstat (limited to 'src')
-rw-r--r--src/cleaners/skyblock/harp.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cleaners/skyblock/harp.ts b/src/cleaners/skyblock/harp.ts
index 83862b3..630f734 100644
--- a/src/cleaners/skyblock/harp.ts
+++ b/src/cleaners/skyblock/harp.ts
@@ -18,6 +18,10 @@ export interface HarpData {
songs: HarpSong[]
}
+const renamedSongs = {
+ fire_and_flames: 'through_the_campfire'
+}
+
export async function cleanHarp(data: typedHypixelApi.SkyBlockProfileMember): Promise<HarpData> {
const harpQuestData = data.harp_quest ?? {}
const songs: HarpSong[] = []
@@ -28,7 +32,7 @@ export async function cleanHarp(data: typedHypixelApi.SkyBlockProfileMember): Pr
if (item.startsWith('song_') && item.endsWith('_best_completion')) {
const songName = item.slice('song_'.length, -'_best_completion'.length)
songs.push({
- id: songName,
+ id: renamedSongs[songName] ?? songName,
completions: data.harp_quest[`song_${songName}_completions`] ?? 0,
perfectCompletions: data.harp_quest[`song_${songName}_perfect_completions`] ?? 0,
progress: data.harp_quest[`song_${songName}_best_completion`] ?? 0
@@ -39,17 +43,18 @@ export async function cleanHarp(data: typedHypixelApi.SkyBlockProfileMember): Pr
const missingHarpSongNames = allHarpSongNames.filter(songName => !songs.find(song => song.id === songName))
for (const songName of missingHarpSongNames) {
songs.push({
- id: songName,
+ id: renamedSongs[songName] ?? songName,
completions: 0,
perfectCompletions: 0,
progress: 0
})
}
+ const selectedSongId = harpQuestData.selected_song ? renamedSongs[harpQuestData.selected_song] ?? harpQuestData.selected_song : null
return {
- selected: harpQuestData?.selected_song ? {
- id: harpQuestData.selected_song,
+ selected: selectedSongId ? {
+ id: selectedSongId,
// i'm pretty sure the epoch is always there if the name is
timestamp: harpQuestData.selected_song_epoch ?? 0
} : null,