diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cleaners/skyblock/harp.ts | 13 |
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, |