diff --git a/components/menuData.ts b/components/menuData.ts index 8d735ce7..f50d9ee2 100644 --- a/components/menuData.ts +++ b/components/menuData.ts @@ -66,6 +66,7 @@ import { contractsModeHome } from "./contracts/contractsModeRouting" import random from "random" import { getUserData } from "./databaseHandler" import { + createMainOpportunityTile, createPlayNextTile, getSeasonId, orderedMissions, @@ -1274,6 +1275,8 @@ menuDataRouter.get( ), ) } + + cats.push(createMainOpportunityTile(req.query.contractId)) } //#endregion diff --git a/components/menus/playnext.ts b/components/menus/playnext.ts index f52e8b77..6060e336 100644 --- a/components/menus/playnext.ts +++ b/components/menus/playnext.ts @@ -16,9 +16,14 @@ * along with this program. If not, see . */ +import { getConfig } from "../configSwizzleManager" import { generateUserCentric } from "../contracts/dataGen" import { controller } from "../controller" -import type { GameVersion, PlayNextCampaignDetails } from "../types/types" +import type { + GameVersion, + MissionStory, + PlayNextCampaignDetails, +} from "../types/types" export const orderedMissions: string[] = [ "00000000-0000-0000-0000-000000000200", @@ -105,3 +110,34 @@ export function createPlayNextTile( ], } } + +/** + * Generates tiles for recommended mission stories given a contract ID. + * + * @param contractId The contract ID. + * @returns The tile object. + */ +export function createMainOpportunityTile(contractId: string) { + const contractData = controller.resolveContract(contractId) + + const missionStories = getConfig>( + "MissionStories", + false, + ) + + return { + CategoryType: "MainOpportunity", + CategoryName: "UI_PLAYNEXT_MAINOPPORTUNITY_CATEGORY_NAME", + Items: (contractData.Metadata.Opportunities || []) + .filter((value) => missionStories[value].IsMainOpportunity) + .map((value) => ({ + ItemType: null, + ContentType: "Opportunity", + Content: { + RepositoryId: value, + ContractId: contractId, + }, + CategoryType: "MainOpportunity", + })), + } +}