Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion open-api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2333,6 +2333,13 @@
}
},
"description": "The mapping of each RaidHub versionId to its splash image URLs"
},
"checkpointNames": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "The checkpoint encounter name for each raid activityId, used in lowman tag labels"
}
},
"required": [
Expand All @@ -2353,7 +2360,8 @@
"rankingTiers",
"feats",
"splashUrls",
"versionSplashUrls"
"versionSplashUrls",
"checkpointNames"
],
"additionalProperties": false
},
Expand Down
30 changes: 19 additions & 11 deletions src/routes/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { zFeatDefinition } from "@/schema/components/FeatDefinition"
import { zImageContentData } from "@/schema/components/ImageContentData"
import { zVersionDefinition } from "@/schema/components/VersionDefinition"
import { zNaturalNumber, zNumericalRecordKey } from "@/schema/output"
import { getCheckpointNamesForRaids } from "@/services/manifest/checkpoint-names"
import {
listActivityDefinitions,
listFeatDefinitions,
Expand Down Expand Up @@ -122,7 +123,11 @@ export const manifestRoute = new RaidHubRoute({
.openapi({
description:
"The mapping of each RaidHub versionId to its splash image URLs"
})
}),
checkpointNames: z.record(zNumericalRecordKey(), z.string()).openapi({
description:
"The checkpoint encounter name for each raid activityId, used in lowman tag labels"
})
})
.strict()
}
Expand Down Expand Up @@ -158,6 +163,16 @@ export const manifestRoute = new RaidHubRoute({
versionsForActivity[parseInt(activityId)] = [...set]
})

const listedRaidIds = raids
.sort((a, b) => {
if (+a.isSunset ^ +b.isSunset) {
return a.isSunset ? 1 : -1
} else {
return b.id - a.id
}
})
.map(a => a.id)

return RaidHubRoute.ok({
hashes: Object.fromEntries(
hashes.map(h => [
Expand All @@ -170,15 +185,7 @@ export const manifestRoute = new RaidHubRoute({
),
activityDefinitions: Object.fromEntries(activities.map(data => [data.id, data])),
versionDefinitions: Object.fromEntries(versions.map(data => [data.id, data])),
listedRaidIds: raids
.sort((a, b) => {
if (+a.isSunset ^ +b.isSunset) {
return a.isSunset ? 1 : -1
} else {
return b.id - a.id
}
})
.map(a => a.id),
listedRaidIds,
sunsetRaidIds: raids.filter(a => a.isSunset).map(a => a.id),
prestigeRaidIds: [
...new Set(hashes.filter(h => h.versionId === 3).map(h => h.activityId))
Expand All @@ -198,7 +205,8 @@ export const manifestRoute = new RaidHubRoute({
rankingTiers: TierBreaks,
feats: feats,
splashUrls: splashUrls,
versionSplashUrls: versionSplashUrls
versionSplashUrls: versionSplashUrls,
checkpointNames: getCheckpointNamesForRaids(listedRaidIds)
})
}
})
26 changes: 26 additions & 0 deletions src/services/manifest/checkpoint-names.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** Checkpoint encounter names for lowman tag labels. TODO: move to activity_definition. */
export const CHECKPOINT_NAMES: Readonly<Record<number, string>> = {
1: "Calus",
2: "Argos",
3: "Val Ca'uor",
4: "Queenswalk",
5: "Insurrection Prime",
6: "Gahlran",
7: "Sanctified Mind",
8: "Taniks",
9: "Atheon",
10: "Rhulk",
11: "Oryx",
12: "Nezarec",
13: "Crota",
14: "Witness",
15: "Koregos",
16: "Koregos"
}

export const getCheckpointNamesForRaids = (listedRaidIds: readonly number[]) =>
Object.fromEntries(
listedRaidIds
.map(id => [id, CHECKPOINT_NAMES[id]] as const)
.filter((entry): entry is [number, string] => entry[1] != null)
)
Loading