mirror of
https://github.com/thepeacockproject/Peacock
synced 2024-11-22 22:12:45 +01:00
Fix contract creation bugs (#133)
* Skip unknown mission stories * Disable saving created contracts on the tutorial * Update platformEntitlements.ts Signed-off-by: Reece Dunham <me@rdil.rocks> * Use relative import pathing --------- Signed-off-by: Reece Dunham <me@rdil.rocks> Co-authored-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
parent
e538854b10
commit
b4ca8ab690
@ -357,6 +357,9 @@ function getContractOpportunityData(
|
|||||||
|
|
||||||
if (contract.Metadata.Opportunities) {
|
if (contract.Metadata.Opportunities) {
|
||||||
for (const ms of contract.Metadata.Opportunities) {
|
for (const ms of contract.Metadata.Opportunities) {
|
||||||
|
if (!Object.keys(missionStories).includes(ms)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
missionStories[ms].PreviouslyCompleted =
|
missionStories[ms].PreviouslyCompleted =
|
||||||
ms in userData.Extensions.opportunityprogression
|
ms in userData.Extensions.opportunityprogression
|
||||||
const current = fastClone(missionStories[ms])
|
const current = fastClone(missionStories[ms])
|
||||||
|
@ -23,6 +23,7 @@ import { getUserData } from "../databaseHandler"
|
|||||||
import { generateUserCentric } from "./dataGen"
|
import { generateUserCentric } from "./dataGen"
|
||||||
import { controller } from "../controller"
|
import { controller } from "../controller"
|
||||||
import { createLocationsData } from "../menus/destinations"
|
import { createLocationsData } from "../menus/destinations"
|
||||||
|
import { contractCreationTutorialId } from "../utils"
|
||||||
|
|
||||||
export function contractsModeHome(req: RequestWithJwt, res: Response): void {
|
export function contractsModeHome(req: RequestWithJwt, res: Response): void {
|
||||||
const contractsHomeTemplate = getConfig("ContractsTemplate", false)
|
const contractsHomeTemplate = getConfig("ContractsTemplate", false)
|
||||||
@ -30,7 +31,7 @@ export function contractsModeHome(req: RequestWithJwt, res: Response): void {
|
|||||||
const userData = getUserData(req.jwt.unique_name, req.gameVersion)
|
const userData = getUserData(req.jwt.unique_name, req.gameVersion)
|
||||||
|
|
||||||
const contractCreationTutorial = controller.resolveContract(
|
const contractCreationTutorial = controller.resolveContract(
|
||||||
"d7e2607c-6916-48e2-9588-976c7d8998bb",
|
contractCreationTutorialId,
|
||||||
)
|
)
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import { Response, Router } from "express"
|
import { Response, Router } from "express"
|
||||||
import {
|
import {
|
||||||
|
contractCreationTutorialId,
|
||||||
gameDifficulty,
|
gameDifficulty,
|
||||||
PEACOCKVERSTRING,
|
PEACOCKVERSTRING,
|
||||||
unlockOrderComparer,
|
unlockOrderComparer,
|
||||||
@ -187,7 +188,7 @@ menuDataRouter.get("/Hub", (req: RequestWithJwt, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const contractCreationTutorial = controller.resolveContract(
|
const contractCreationTutorial = controller.resolveContract(
|
||||||
"d7e2607c-6916-48e2-9588-976c7d8998bb",
|
contractCreationTutorialId,
|
||||||
)!
|
)!
|
||||||
|
|
||||||
const locations = getVersionedConfig<PeacockLocationsData>(
|
const locations = getVersionedConfig<PeacockLocationsData>(
|
||||||
@ -1477,7 +1478,7 @@ preMenuDataRouter.get(
|
|||||||
|
|
||||||
menuDataRouter.get("/contractsearchpage", (req: RequestWithJwt, res) => {
|
menuDataRouter.get("/contractsearchpage", (req: RequestWithJwt, res) => {
|
||||||
const createContractTutorial = controller.resolveContract(
|
const createContractTutorial = controller.resolveContract(
|
||||||
"d7e2607c-6916-48e2-9588-976c7d8998bb",
|
contractCreationTutorialId,
|
||||||
)
|
)
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
@ -1641,7 +1642,8 @@ menuDataRouter.get("/contractcreation/create", (req: RequestWithJwt, res) => {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ContractConditions: complications(timeLimitStr),
|
ContractConditions: complications(timeLimitStr),
|
||||||
PublishingDisabled: false,
|
PublishingDisabled:
|
||||||
|
sesh.contractId === contractCreationTutorialId,
|
||||||
Creator: req.jwt.unique_name,
|
Creator: req.jwt.unique_name,
|
||||||
ContractId: cUuid,
|
ContractId: cUuid,
|
||||||
ContractPublicId: joined,
|
ContractPublicId: joined,
|
||||||
|
@ -65,7 +65,10 @@ export function getDestinationCompletion(
|
|||||||
|
|
||||||
let opportunityCompletedCount = 0
|
let opportunityCompletedCount = 0
|
||||||
for (const ms in userData.Extensions.opportunityprogression) {
|
for (const ms in userData.Extensions.opportunityprogression) {
|
||||||
if (missionStories[ms].Location === parent.Id) {
|
if (
|
||||||
|
Object.keys(missionStories).includes(ms) &&
|
||||||
|
missionStories[ms].Location === parent.Id
|
||||||
|
) {
|
||||||
opportunityCompletedCount++
|
opportunityCompletedCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,9 @@ export async function planningView(
|
|||||||
const isForReset = req.query.resetescalation === "true"
|
const isForReset = req.query.resetescalation === "true"
|
||||||
|
|
||||||
for (const ms in userData.Extensions.opportunityprogression) {
|
for (const ms in userData.Extensions.opportunityprogression) {
|
||||||
missionStories[ms].PreviouslyCompleted = true
|
if (Object.keys(missionStories).includes(ms)) {
|
||||||
|
missionStories[ms].PreviouslyCompleted = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isForReset) {
|
if (isForReset) {
|
||||||
|
@ -51,6 +51,8 @@ export const uuidRegex =
|
|||||||
|
|
||||||
export const contractTypes = ["featured", "usercreated", "creation"]
|
export const contractTypes = ["featured", "usercreated", "creation"]
|
||||||
|
|
||||||
|
export const contractCreationTutorialId = "d7e2607c-6916-48e2-9588-976c7d8998bb"
|
||||||
|
|
||||||
export async function checkForUpdates(): Promise<void> {
|
export async function checkForUpdates(): Promise<void> {
|
||||||
if (getFlag("updateChecking") === false) {
|
if (getFlag("updateChecking") === false) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user