Slight unification to 2016 stashpoint logic
Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
parent
ba3e8e1f96
commit
da1d1e4818
|
@ -28,25 +28,31 @@ import { log, LogLevel } from "../loggingInterop"
|
||||||
import { createInventory } from "../inventory"
|
import { createInventory } from "../inventory"
|
||||||
import { getFlag } from "../flags"
|
import { getFlag } from "../flags"
|
||||||
import { loadouts } from "../loadouts"
|
import { loadouts } from "../loadouts"
|
||||||
|
import { StashpointQueryH2016, StashpointSlotName } from "../types/gameSchemas"
|
||||||
|
|
||||||
const legacyMenuDataRouter = Router()
|
const legacyMenuDataRouter = Router()
|
||||||
|
|
||||||
legacyMenuDataRouter.get(
|
legacyMenuDataRouter.get(
|
||||||
"/stashpoint",
|
"/stashpoint",
|
||||||
(req: RequestWithJwt<{ contractid: string; slotname: string }>, res) => {
|
(req: RequestWithJwt<StashpointQueryH2016>, res) => {
|
||||||
// stashpoint?contractid=4e45e91a-94ca-4d89-89fc-1b250e608e73&stashpoint=&allowlargeitems=true&slotname=concealedweapon2
|
|
||||||
if (!uuidRegex.test(req.query.contractid)) {
|
if (!uuidRegex.test(req.query.contractid)) {
|
||||||
res.status(400).send("contract id was not a uuid")
|
res.status(400).send("contract id was not a uuid")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const contractData = controller.resolveContract(req.query.contractid)
|
if (typeof req.query.slotname !== "string") {
|
||||||
if (!contractData) {
|
res.status(400).send("invalid slot data")
|
||||||
res.status(404).send()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadoutSlots = [
|
const contractData = controller.resolveContract(req.query.contractid)
|
||||||
|
|
||||||
|
if (!contractData) {
|
||||||
|
res.status(404).send("contract not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadoutSlots: StashpointSlotName[] = [
|
||||||
"carriedweapon",
|
"carriedweapon",
|
||||||
"carrieditem",
|
"carrieditem",
|
||||||
"concealedweapon",
|
"concealedweapon",
|
||||||
|
@ -226,6 +232,11 @@ legacyMenuDataRouter.get(
|
||||||
req: RequestWithJwt<{ contractSessionId: string; contractId: string }>,
|
req: RequestWithJwt<{ contractSessionId: string; contractId: string }>,
|
||||||
res,
|
res,
|
||||||
) => {
|
) => {
|
||||||
|
if (typeof req.query.contractId !== "string") {
|
||||||
|
res.status(400).send("invalid contractId")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// debriefingchallenges?contractSessionId=00000000000000-00000000-0000-0000-0000-000000000001&contractId=dd906289-7c32-427f-b689-98ae645b407f
|
// debriefingchallenges?contractSessionId=00000000000000-00000000-0000-0000-0000-000000000001&contractId=dd906289-7c32-427f-b689-98ae645b407f
|
||||||
res.json({
|
res.json({
|
||||||
template: getConfig("LegacyDebriefingChallengesTemplate", false),
|
template: getConfig("LegacyDebriefingChallengesTemplate", false),
|
||||||
|
|
|
@ -21,6 +21,16 @@ export type MissionEndRequestQuery = Partial<{
|
||||||
masteryUnlockableId?: string
|
masteryUnlockableId?: string
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
export type StashpointSlotName =
|
||||||
|
| "gear"
|
||||||
|
| "disguise"
|
||||||
|
| "stashpoint"
|
||||||
|
| "carriedweapon"
|
||||||
|
| "carrieditem"
|
||||||
|
| "concealedweapon"
|
||||||
|
| "concealedweapon2"
|
||||||
|
| string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query that the game sends for the stashpoint route.
|
* Query that the game sends for the stashpoint route.
|
||||||
*/
|
*/
|
||||||
|
@ -30,12 +40,22 @@ export type StashpointQuery = Partial<{
|
||||||
* Can be a number or a UUID.
|
* Can be a number or a UUID.
|
||||||
*/
|
*/
|
||||||
slotid: number | string
|
slotid: number | string
|
||||||
slotname: "gear" | "disguise" | "stashpoint" | string
|
slotname: StashpointSlotName
|
||||||
stashpoint?: string
|
stashpoint?: string
|
||||||
allowlargeitems: "true" | "false"
|
allowlargeitems: "true" | "false"
|
||||||
allowcontainers: "true" | "false"
|
allowcontainers: "true" | "false"
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query that the game sends for the stashpoint route in H2016.
|
||||||
|
*
|
||||||
|
* @see StashpointQuery
|
||||||
|
*/
|
||||||
|
export type StashpointQueryH2016 = Omit<
|
||||||
|
StashpointQuery,
|
||||||
|
"allowcontainers" | "slotid"
|
||||||
|
>
|
||||||
|
|
||||||
export type PlanningQuery = Partial<{
|
export type PlanningQuery = Partial<{
|
||||||
contractid: string
|
contractid: string
|
||||||
resetescalation: string
|
resetescalation: string
|
||||||
|
|
Loading…
Reference in New Issue