feat: sortie reward (#1692)

May work somewhat for lite sorties, didn't test that. They'd also need some extra handling with regards to the archon shards with their dynamic probabilities.

Reviewed-on: OpenWF/SpaceNinjaServer#1692
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-04-17 08:02:13 -07:00 committed by Sainan
parent 419096f603
commit e38d52fb1b
4 changed files with 55 additions and 4 deletions

View File

@ -86,7 +86,9 @@ import {
IWeeklyMission,
ILockedWeaponGroupDatabase,
IPersonalTechProjectDatabase,
IPersonalTechProjectClient
IPersonalTechProjectClient,
ILastSortieRewardDatabase,
ILastSortieRewardClient
} from "../../types/inventoryTypes/inventoryTypes";
import { IOid } from "../../types/commonTypes";
import {
@ -1202,6 +1204,28 @@ const alignmentSchema = new Schema<IAlignment>(
{ _id: false }
);
const lastSortieRewardSchema = new Schema<ILastSortieRewardDatabase>(
{
SortieId: Schema.Types.ObjectId,
StoreItem: String,
Manifest: String
},
{ _id: false }
);
lastSortieRewardSchema.set("toJSON", {
virtuals: true,
transform(_doc, obj) {
const db = obj as ILastSortieRewardDatabase;
const client = obj as ILastSortieRewardClient;
client.SortieId = toOid(db.SortieId);
delete obj._id;
delete obj.__v;
}
});
const lockedWeaponGroupSchema = new Schema<ILockedWeaponGroupDatabase>(
{
s: Schema.Types.ObjectId,
@ -1419,7 +1443,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
//https://warframe.fandom.com/wiki/Sortie
CompletedSorties: [String],
LastSortieReward: [Schema.Types.Mixed],
LastSortieReward: { type: [lastSortieRewardSchema], default: undefined },
LastLiteSortieReward: { type: [lastSortieRewardSchema], default: undefined },
// Resource Extractor Drones
Drones: [droneSchema],

View File

@ -584,6 +584,16 @@ export const addMissionRewards = async (
const AffiliationMods: IAffiliationMods[] = [];
let SyndicateXPItemReward;
if (rewardInfo.sortieTag == "Final") {
inventory.LastSortieReward = [
{
SortieId: new Types.ObjectId(rewardInfo.sortieId!.split("_")[1]),
StoreItem: MissionRewards[0].StoreItem,
Manifest: "/Lotus/Types/Game/MissionDecks/SortieRewards"
}
];
}
let missionCompletionCredits = 0;
//inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display
if (levelKeyName) {
@ -943,6 +953,10 @@ function getLevelCreditRewards(node: IRegion): number {
function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | undefined): IMissionReward[] {
const drops: IMissionReward[] = [];
if (RewardInfo.sortieTag == "Final") {
const drop = getRandomRewardByChance(ExportRewards["/Lotus/Types/Game/MissionDecks/SortieRewards"][0])!;
drops.push({ StoreItem: drop.type, ItemCount: drop.itemCount });
}
if (RewardInfo.periodicMissionTag?.startsWith("HardDaily")) {
drops.push({
StoreItem: "/Lotus/StoreItems/Types/Items/MiscItems/SteelEssence",

View File

@ -47,6 +47,8 @@ export interface IInventoryDatabase
| "BrandedSuits"
| "LockedWeaponGroup"
| "PersonalTechProjects"
| "LastSortieReward"
| "LastLiteSortieReward"
| TEquipmentKey
>,
InventoryDatabaseEquipment {
@ -79,6 +81,8 @@ export interface IInventoryDatabase
BrandedSuits?: Types.ObjectId[];
LockedWeaponGroup?: ILockedWeaponGroupDatabase;
PersonalTechProjects: IPersonalTechProjectDatabase[];
LastSortieReward?: ILastSortieRewardDatabase[];
LastLiteSortieReward?: ILastSortieRewardDatabase[];
}
export interface IQuestKeyDatabase {
@ -277,7 +281,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
Wishlist: string[];
Alignment?: IAlignment;
CompletedSorties: string[];
LastSortieReward: ILastSortieReward[];
LastSortieReward?: ILastSortieRewardClient[];
LastLiteSortieReward?: ILastSortieRewardClient[];
Drones: IDroneClient[];
StepSequencers: IStepSequencer[];
ActiveAvatarImageType: string;
@ -724,12 +729,16 @@ export enum Status {
StatusStasis = "STATUS_STASIS"
}
export interface ILastSortieReward {
export interface ILastSortieRewardClient {
SortieId: IOid;
StoreItem: string;
Manifest: string;
}
export interface ILastSortieRewardDatabase extends Omit<ILastSortieRewardClient, "SortieId"> {
SortieId: Types.ObjectId;
}
export interface ILibraryDailyTaskInfo {
EnemyTypes: string[];
EnemyLocTag: string;

View File

@ -129,6 +129,9 @@ export type IMissionInventoryUpdateRequest = {
export interface IRewardInfo {
node: string;
sortieId?: string;
sortieTag?: string;
sortiePrereqs?: string[];
VaultsCracked?: number; // for Spy missions
rewardTier?: number;
nightmareMode?: boolean;