fix: loc-pin saving
This commit is contained in:
		
							parent
							
								
									76964585eb
								
							
						
					
					
						commit
						b543392f34
					
				@ -36,7 +36,10 @@ import {
 | 
			
		||||
    IPeriodicMissionCompletionDatabase,
 | 
			
		||||
    IPeriodicMissionCompletionResponse,
 | 
			
		||||
    ILoreFragmentScan,
 | 
			
		||||
    IEvolutionProgress
 | 
			
		||||
    IEvolutionProgress,
 | 
			
		||||
    ICustomMarkers,
 | 
			
		||||
    IMarkerInfo,
 | 
			
		||||
    IMarker
 | 
			
		||||
} from "../../types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { IOid } from "../../types/commonTypes";
 | 
			
		||||
import {
 | 
			
		||||
@ -578,6 +581,35 @@ const evolutionProgressSchema = new Schema<IEvolutionProgress>(
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const markerSchema = new Schema<IMarker>(
 | 
			
		||||
    {
 | 
			
		||||
        anchorName: String,
 | 
			
		||||
        color: Number,
 | 
			
		||||
        label: String,
 | 
			
		||||
        x: Number,
 | 
			
		||||
        y: Number,
 | 
			
		||||
        z: Number,
 | 
			
		||||
        showInHud: Boolean
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const markerInfoSchema = new Schema<IMarkerInfo>(
 | 
			
		||||
    {
 | 
			
		||||
        icon: String,
 | 
			
		||||
        markers: [markerSchema]
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const CustomMarkersSchema = new Schema<ICustomMarkers>(
 | 
			
		||||
    {
 | 
			
		||||
        tag: String,
 | 
			
		||||
        markerInfos: [markerInfoSchema]
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
    {
 | 
			
		||||
        accountOwnerId: Schema.Types.ObjectId,
 | 
			
		||||
@ -900,6 +932,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Incarnon
 | 
			
		||||
        EvolutionProgress: { type: [evolutionProgressSchema], default: undefined },
 | 
			
		||||
 | 
			
		||||
        //https://warframe.fandom.com/wiki/Loc-Pin
 | 
			
		||||
        CustomMarkers: [CustomMarkersSchema],
 | 
			
		||||
 | 
			
		||||
        //Unknown and system
 | 
			
		||||
        DuviriInfo: DuviriInfoSchema,
 | 
			
		||||
        Mailbox: MailboxSchema,
 | 
			
		||||
 | 
			
		||||
@ -731,7 +731,11 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
 | 
			
		||||
        Consumables,
 | 
			
		||||
        Recipes,
 | 
			
		||||
        Missions,
 | 
			
		||||
        FusionTreasures
 | 
			
		||||
        FusionTreasures,
 | 
			
		||||
        AffiliationChanges,
 | 
			
		||||
        EvolutionProgress,
 | 
			
		||||
        LastRegionPlayed,
 | 
			
		||||
        CustomMarkers
 | 
			
		||||
    } = data;
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
 | 
			
		||||
@ -742,7 +746,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
 | 
			
		||||
    inventory.FusionPoints += FusionPoints || 0;
 | 
			
		||||
 | 
			
		||||
    // syndicate
 | 
			
		||||
    data.AffiliationChanges?.forEach(affiliation => {
 | 
			
		||||
    AffiliationChanges?.forEach(affiliation => {
 | 
			
		||||
        const syndicate = inventory.Affiliations.find(x => x.Tag == affiliation.Tag);
 | 
			
		||||
        if (syndicate !== undefined) {
 | 
			
		||||
            syndicate.Standing =
 | 
			
		||||
@ -763,8 +767,8 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
 | 
			
		||||
    equipmentKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
 | 
			
		||||
 | 
			
		||||
    // Incarnon Challenges
 | 
			
		||||
    if (data.EvolutionProgress) {
 | 
			
		||||
        for (const evoProgress of data.EvolutionProgress) {
 | 
			
		||||
    if (EvolutionProgress) {
 | 
			
		||||
        for (const evoProgress of EvolutionProgress) {
 | 
			
		||||
            const entry = inventory.EvolutionProgress
 | 
			
		||||
                ? inventory.EvolutionProgress.find(entry => entry.ItemType == evoProgress.ItemType)
 | 
			
		||||
                : undefined;
 | 
			
		||||
@ -779,8 +783,22 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // LastRegionPlayed
 | 
			
		||||
    if (data.LastRegionPlayed) {
 | 
			
		||||
        inventory.LastRegionPlayed = data.LastRegionPlayed;
 | 
			
		||||
    if (LastRegionPlayed) {
 | 
			
		||||
        inventory.LastRegionPlayed = LastRegionPlayed;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (CustomMarkers) {
 | 
			
		||||
        CustomMarkers.forEach(markers => {
 | 
			
		||||
            const map = inventory.CustomMarkers
 | 
			
		||||
                ? inventory.CustomMarkers.find(entry => entry.tag == markers.tag)
 | 
			
		||||
                : undefined;
 | 
			
		||||
            if (map) {
 | 
			
		||||
                map.markerInfos = markers.markerInfos;
 | 
			
		||||
            } else {
 | 
			
		||||
                inventory.CustomMarkers ??= [];
 | 
			
		||||
                inventory.CustomMarkers.push(markers);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // other
 | 
			
		||||
 | 
			
		||||
@ -277,6 +277,7 @@ export interface IInventoryResponse {
 | 
			
		||||
    LastInventorySync: IOid;
 | 
			
		||||
    NextRefill: IMongoDate; // Next time argon crystals will have a decay tick
 | 
			
		||||
    FoundToday?: IMiscItem[]; // for Argon Crystals
 | 
			
		||||
    CustomMarkers: ICustomMarkers[];
 | 
			
		||||
    ActiveLandscapeTraps: any[];
 | 
			
		||||
    EvolutionProgress?: IEvolutionProgress[];
 | 
			
		||||
    RepVotes: any[];
 | 
			
		||||
@ -916,3 +917,23 @@ export interface IEvolutionProgress {
 | 
			
		||||
    Rank: number;
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ICustomMarkers {
 | 
			
		||||
    tag: string;
 | 
			
		||||
    markerInfos: IMarkerInfo[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IMarkerInfo {
 | 
			
		||||
    icon: string;
 | 
			
		||||
    markers: IMarker[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IMarker {
 | 
			
		||||
    anchorName: string;
 | 
			
		||||
    color: number;
 | 
			
		||||
    label?: string;
 | 
			
		||||
    x: number;
 | 
			
		||||
    y: number;
 | 
			
		||||
    z: number;
 | 
			
		||||
    showInHud: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,8 @@ import {
 | 
			
		||||
    ISeasonChallenge,
 | 
			
		||||
    TSolarMapRegion,
 | 
			
		||||
    TEquipmentKey,
 | 
			
		||||
    IFusionTreasure
 | 
			
		||||
    IFusionTreasure,
 | 
			
		||||
    ICustomMarkers
 | 
			
		||||
} from "./inventoryTypes/inventoryTypes";
 | 
			
		||||
 | 
			
		||||
export interface IArtifactsRequest {
 | 
			
		||||
@ -70,6 +71,7 @@ export interface IMissionInventoryUpdateRequest {
 | 
			
		||||
    Missions?: IMission;
 | 
			
		||||
    EvolutionProgress?: IEvolutionProgress[];
 | 
			
		||||
    LastRegionPlayed?: TSolarMapRegion;
 | 
			
		||||
    CustomMarkers?: ICustomMarkers[];
 | 
			
		||||
 | 
			
		||||
    FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user