forked from OpenWF/SpaceNinjaServer
		
	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:
		
							parent
							
								
									419096f603
								
							
						
					
					
						commit
						e38d52fb1b
					
				@ -86,7 +86,9 @@ import {
 | 
				
			|||||||
    IWeeklyMission,
 | 
					    IWeeklyMission,
 | 
				
			||||||
    ILockedWeaponGroupDatabase,
 | 
					    ILockedWeaponGroupDatabase,
 | 
				
			||||||
    IPersonalTechProjectDatabase,
 | 
					    IPersonalTechProjectDatabase,
 | 
				
			||||||
    IPersonalTechProjectClient
 | 
					    IPersonalTechProjectClient,
 | 
				
			||||||
 | 
					    ILastSortieRewardDatabase,
 | 
				
			||||||
 | 
					    ILastSortieRewardClient
 | 
				
			||||||
} from "../../types/inventoryTypes/inventoryTypes";
 | 
					} from "../../types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IOid } from "../../types/commonTypes";
 | 
					import { IOid } from "../../types/commonTypes";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
@ -1202,6 +1204,28 @@ const alignmentSchema = new Schema<IAlignment>(
 | 
				
			|||||||
    { _id: false }
 | 
					    { _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>(
 | 
					const lockedWeaponGroupSchema = new Schema<ILockedWeaponGroupDatabase>(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        s: Schema.Types.ObjectId,
 | 
					        s: Schema.Types.ObjectId,
 | 
				
			||||||
@ -1419,7 +1443,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        //https://warframe.fandom.com/wiki/Sortie
 | 
					        //https://warframe.fandom.com/wiki/Sortie
 | 
				
			||||||
        CompletedSorties: [String],
 | 
					        CompletedSorties: [String],
 | 
				
			||||||
        LastSortieReward: [Schema.Types.Mixed],
 | 
					        LastSortieReward: { type: [lastSortieRewardSchema], default: undefined },
 | 
				
			||||||
 | 
					        LastLiteSortieReward: { type: [lastSortieRewardSchema], default: undefined },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Resource Extractor Drones
 | 
					        // Resource Extractor Drones
 | 
				
			||||||
        Drones: [droneSchema],
 | 
					        Drones: [droneSchema],
 | 
				
			||||||
 | 
				
			|||||||
@ -584,6 +584,16 @@ export const addMissionRewards = async (
 | 
				
			|||||||
    const AffiliationMods: IAffiliationMods[] = [];
 | 
					    const AffiliationMods: IAffiliationMods[] = [];
 | 
				
			||||||
    let SyndicateXPItemReward;
 | 
					    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;
 | 
					    let missionCompletionCredits = 0;
 | 
				
			||||||
    //inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display
 | 
					    //inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display
 | 
				
			||||||
    if (levelKeyName) {
 | 
					    if (levelKeyName) {
 | 
				
			||||||
@ -943,6 +953,10 @@ function getLevelCreditRewards(node: IRegion): number {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | undefined): IMissionReward[] {
 | 
					function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | undefined): IMissionReward[] {
 | 
				
			||||||
    const drops: 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")) {
 | 
					    if (RewardInfo.periodicMissionTag?.startsWith("HardDaily")) {
 | 
				
			||||||
        drops.push({
 | 
					        drops.push({
 | 
				
			||||||
            StoreItem: "/Lotus/StoreItems/Types/Items/MiscItems/SteelEssence",
 | 
					            StoreItem: "/Lotus/StoreItems/Types/Items/MiscItems/SteelEssence",
 | 
				
			||||||
 | 
				
			|||||||
@ -47,6 +47,8 @@ export interface IInventoryDatabase
 | 
				
			|||||||
            | "BrandedSuits"
 | 
					            | "BrandedSuits"
 | 
				
			||||||
            | "LockedWeaponGroup"
 | 
					            | "LockedWeaponGroup"
 | 
				
			||||||
            | "PersonalTechProjects"
 | 
					            | "PersonalTechProjects"
 | 
				
			||||||
 | 
					            | "LastSortieReward"
 | 
				
			||||||
 | 
					            | "LastLiteSortieReward"
 | 
				
			||||||
            | TEquipmentKey
 | 
					            | TEquipmentKey
 | 
				
			||||||
        >,
 | 
					        >,
 | 
				
			||||||
        InventoryDatabaseEquipment {
 | 
					        InventoryDatabaseEquipment {
 | 
				
			||||||
@ -79,6 +81,8 @@ export interface IInventoryDatabase
 | 
				
			|||||||
    BrandedSuits?: Types.ObjectId[];
 | 
					    BrandedSuits?: Types.ObjectId[];
 | 
				
			||||||
    LockedWeaponGroup?: ILockedWeaponGroupDatabase;
 | 
					    LockedWeaponGroup?: ILockedWeaponGroupDatabase;
 | 
				
			||||||
    PersonalTechProjects: IPersonalTechProjectDatabase[];
 | 
					    PersonalTechProjects: IPersonalTechProjectDatabase[];
 | 
				
			||||||
 | 
					    LastSortieReward?: ILastSortieRewardDatabase[];
 | 
				
			||||||
 | 
					    LastLiteSortieReward?: ILastSortieRewardDatabase[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IQuestKeyDatabase {
 | 
					export interface IQuestKeyDatabase {
 | 
				
			||||||
@ -277,7 +281,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
				
			|||||||
    Wishlist: string[];
 | 
					    Wishlist: string[];
 | 
				
			||||||
    Alignment?: IAlignment;
 | 
					    Alignment?: IAlignment;
 | 
				
			||||||
    CompletedSorties: string[];
 | 
					    CompletedSorties: string[];
 | 
				
			||||||
    LastSortieReward: ILastSortieReward[];
 | 
					    LastSortieReward?: ILastSortieRewardClient[];
 | 
				
			||||||
 | 
					    LastLiteSortieReward?: ILastSortieRewardClient[];
 | 
				
			||||||
    Drones: IDroneClient[];
 | 
					    Drones: IDroneClient[];
 | 
				
			||||||
    StepSequencers: IStepSequencer[];
 | 
					    StepSequencers: IStepSequencer[];
 | 
				
			||||||
    ActiveAvatarImageType: string;
 | 
					    ActiveAvatarImageType: string;
 | 
				
			||||||
@ -724,12 +729,16 @@ export enum Status {
 | 
				
			|||||||
    StatusStasis = "STATUS_STASIS"
 | 
					    StatusStasis = "STATUS_STASIS"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ILastSortieReward {
 | 
					export interface ILastSortieRewardClient {
 | 
				
			||||||
    SortieId: IOid;
 | 
					    SortieId: IOid;
 | 
				
			||||||
    StoreItem: string;
 | 
					    StoreItem: string;
 | 
				
			||||||
    Manifest: string;
 | 
					    Manifest: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface ILastSortieRewardDatabase extends Omit<ILastSortieRewardClient, "SortieId"> {
 | 
				
			||||||
 | 
					    SortieId: Types.ObjectId;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ILibraryDailyTaskInfo {
 | 
					export interface ILibraryDailyTaskInfo {
 | 
				
			||||||
    EnemyTypes: string[];
 | 
					    EnemyTypes: string[];
 | 
				
			||||||
    EnemyLocTag: string;
 | 
					    EnemyLocTag: string;
 | 
				
			||||||
 | 
				
			|||||||
@ -129,6 +129,9 @@ export type IMissionInventoryUpdateRequest = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface IRewardInfo {
 | 
					export interface IRewardInfo {
 | 
				
			||||||
    node: string;
 | 
					    node: string;
 | 
				
			||||||
 | 
					    sortieId?: string;
 | 
				
			||||||
 | 
					    sortieTag?: string;
 | 
				
			||||||
 | 
					    sortiePrereqs?: string[];
 | 
				
			||||||
    VaultsCracked?: number; // for Spy missions
 | 
					    VaultsCracked?: number; // for Spy missions
 | 
				
			||||||
    rewardTier?: number;
 | 
					    rewardTier?: number;
 | 
				
			||||||
    nightmareMode?: boolean;
 | 
					    nightmareMode?: boolean;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user