feat: save InvasionProgress/QualifyingInvasions
This commit is contained in:
parent
da6067ec43
commit
09d1c23df2
@ -91,7 +91,9 @@ import {
|
|||||||
ICrewMemberSkill,
|
ICrewMemberSkill,
|
||||||
ICrewMemberSkillEfficiency,
|
ICrewMemberSkillEfficiency,
|
||||||
ICrewMemberDatabase,
|
ICrewMemberDatabase,
|
||||||
ICrewMemberClient
|
ICrewMemberClient,
|
||||||
|
IInvasionProgressDatabase,
|
||||||
|
IInvasionProgressClient
|
||||||
} from "../../types/inventoryTypes/inventoryTypes";
|
} from "../../types/inventoryTypes/inventoryTypes";
|
||||||
import { IOid } from "../../types/commonTypes";
|
import { IOid } from "../../types/commonTypes";
|
||||||
import {
|
import {
|
||||||
@ -683,6 +685,27 @@ questKeysSchema.set("toJSON", {
|
|||||||
|
|
||||||
export const fusionTreasuresSchema = new Schema<IFusionTreasure>().add(typeCountSchema).add({ Sockets: Number });
|
export const fusionTreasuresSchema = new Schema<IFusionTreasure>().add(typeCountSchema).add({ Sockets: Number });
|
||||||
|
|
||||||
|
const invasionProgressSchema = new Schema<IInvasionProgressDatabase>(
|
||||||
|
{
|
||||||
|
invasionId: Schema.Types.ObjectId,
|
||||||
|
Delta: Number,
|
||||||
|
AttackerScore: Number,
|
||||||
|
DefenderScore: Number
|
||||||
|
},
|
||||||
|
{ _id: false }
|
||||||
|
);
|
||||||
|
|
||||||
|
invasionProgressSchema.set("toJSON", {
|
||||||
|
transform(_doc, obj) {
|
||||||
|
const db = obj as IInvasionProgressDatabase;
|
||||||
|
const client = obj as IInvasionProgressClient;
|
||||||
|
|
||||||
|
client._id = toOid(db.invasionId);
|
||||||
|
delete obj.invasionId;
|
||||||
|
delete obj.__v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
|
const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
|
||||||
{
|
{
|
||||||
ItemType: String,
|
ItemType: String,
|
||||||
@ -1473,7 +1496,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
SentientSpawnChanceBoosters: Schema.Types.Mixed,
|
SentientSpawnChanceBoosters: Schema.Types.Mixed,
|
||||||
|
|
||||||
QualifyingInvasions: [Schema.Types.Mixed],
|
QualifyingInvasions: [invasionProgressSchema],
|
||||||
FactionScores: [Number],
|
FactionScores: [Number],
|
||||||
|
|
||||||
// https://warframe.fandom.com/wiki/Specter_(Tenno)
|
// https://warframe.fandom.com/wiki/Specter_(Tenno)
|
||||||
|
@ -530,6 +530,26 @@ export const addMissionInventoryUpdates = async (
|
|||||||
inventoryChanges.RegularCredits -= value;
|
inventoryChanges.RegularCredits -= value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "InvasionProgress": {
|
||||||
|
for (const clientProgress of value) {
|
||||||
|
const dbProgress = inventory.QualifyingInvasions.find(x =>
|
||||||
|
x.invasionId.equals(clientProgress._id.$oid)
|
||||||
|
);
|
||||||
|
if (dbProgress) {
|
||||||
|
dbProgress.Delta += clientProgress.Delta;
|
||||||
|
dbProgress.AttackerScore += clientProgress.AttackerScore;
|
||||||
|
dbProgress.DefenderScore += clientProgress.DefenderScore;
|
||||||
|
} else {
|
||||||
|
inventory.QualifyingInvasions.push({
|
||||||
|
invasionId: new Types.ObjectId(clientProgress._id.$oid),
|
||||||
|
Delta: clientProgress.Delta,
|
||||||
|
AttackerScore: clientProgress.AttackerScore,
|
||||||
|
DefenderScore: clientProgress.DefenderScore
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Equipment XP updates
|
// Equipment XP updates
|
||||||
if (equipmentKeys.includes(key as TEquipmentKey)) {
|
if (equipmentKeys.includes(key as TEquipmentKey)) {
|
||||||
|
@ -50,6 +50,7 @@ export interface IInventoryDatabase
|
|||||||
| "LastSortieReward"
|
| "LastSortieReward"
|
||||||
| "LastLiteSortieReward"
|
| "LastLiteSortieReward"
|
||||||
| "CrewMembers"
|
| "CrewMembers"
|
||||||
|
| "QualifyingInvasions"
|
||||||
| TEquipmentKey
|
| TEquipmentKey
|
||||||
>,
|
>,
|
||||||
InventoryDatabaseEquipment {
|
InventoryDatabaseEquipment {
|
||||||
@ -85,6 +86,7 @@ export interface IInventoryDatabase
|
|||||||
LastSortieReward?: ILastSortieRewardDatabase[];
|
LastSortieReward?: ILastSortieRewardDatabase[];
|
||||||
LastLiteSortieReward?: ILastSortieRewardDatabase[];
|
LastLiteSortieReward?: ILastSortieRewardDatabase[];
|
||||||
CrewMembers: ICrewMemberDatabase[];
|
CrewMembers: ICrewMemberDatabase[];
|
||||||
|
QualifyingInvasions: IInvasionProgressDatabase[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuestKeyDatabase {
|
export interface IQuestKeyDatabase {
|
||||||
@ -272,7 +274,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
|
|||||||
SentientSpawnChanceBoosters: ISentientSpawnChanceBoosters;
|
SentientSpawnChanceBoosters: ISentientSpawnChanceBoosters;
|
||||||
SupportedSyndicate?: string;
|
SupportedSyndicate?: string;
|
||||||
Affiliations: IAffiliation[];
|
Affiliations: IAffiliation[];
|
||||||
QualifyingInvasions: any[];
|
QualifyingInvasions: IInvasionProgressClient[];
|
||||||
FactionScores: number[];
|
FactionScores: number[];
|
||||||
ArchwingEnabled?: boolean;
|
ArchwingEnabled?: boolean;
|
||||||
PendingSpectreLoadouts?: ISpectreLoadout[];
|
PendingSpectreLoadouts?: ISpectreLoadout[];
|
||||||
@ -675,6 +677,17 @@ export interface IInvasionChainProgress {
|
|||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IInvasionProgressClient {
|
||||||
|
_id: IOid;
|
||||||
|
Delta: number;
|
||||||
|
AttackerScore: number;
|
||||||
|
DefenderScore: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IInvasionProgressDatabase extends Omit<IInvasionProgressClient, "_id"> {
|
||||||
|
invasionId: Types.ObjectId;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IKubrowPetEggClient {
|
export interface IKubrowPetEggClient {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
ExpirationDate: IMongoDate; // seems to be set to 7 days ahead @ 0 UTC
|
ExpirationDate: IMongoDate; // seems to be set to 7 days ahead @ 0 UTC
|
||||||
|
@ -19,7 +19,8 @@ import {
|
|||||||
ICollectibleEntry,
|
ICollectibleEntry,
|
||||||
IDiscoveredMarker,
|
IDiscoveredMarker,
|
||||||
ILockedWeaponGroupClient,
|
ILockedWeaponGroupClient,
|
||||||
ILoadOutPresets
|
ILoadOutPresets,
|
||||||
|
IInvasionProgressClient
|
||||||
} from "./inventoryTypes/inventoryTypes";
|
} from "./inventoryTypes/inventoryTypes";
|
||||||
import { IGroup } from "./loginTypes";
|
import { IGroup } from "./loginTypes";
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ export type IMissionInventoryUpdateRequest = {
|
|||||||
};
|
};
|
||||||
wagerTier?: number; // the index
|
wagerTier?: number; // the index
|
||||||
creditsFee?: number; // the index
|
creditsFee?: number; // the index
|
||||||
|
InvasionProgress?: IInvasionProgressClient[];
|
||||||
} & {
|
} & {
|
||||||
[K in TEquipmentKey]?: IEquipmentClient[];
|
[K in TEquipmentKey]?: IEquipmentClient[];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user