返回提交历史
Modified
src/models/inventoryModels/inventoryModel.ts
+25
-2
Modified
src/services/missionInventoryUpdateService.ts
+20
-0
Modified
src/types/inventoryTypes/inventoryTypes.ts
+14
-1
Modified
src/types/requestTypes.ts
+3
-1
XFEstudio/SpaceNinjaServer
feat: save InvasionProgress/QualifyingInvasions (#1719)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1719 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
8b0ba0b8
代码差异
4 个文件
+62
-4
@@ -92,7 +92,9 @@ import {
92
92
ICrewMemberSkillEfficiency,
93
93
ICrewMemberDatabase,
94
94
ICrewMemberClient,
95
ISortieRewardAttenuation
95
ISortieRewardAttenuation,
96
IInvasionProgressDatabase,
97
IInvasionProgressClient
96
98
} from "../../types/inventoryTypes/inventoryTypes";
97
99
import { IOid } from "../../types/commonTypes";
98
100
import {
@@ -684,6 +686,27 @@ questKeysSchema.set("toJSON", {
684
686
685
687
export const fusionTreasuresSchema = new Schema<IFusionTreasure>().add(typeCountSchema).add({ Sockets: Number });
686
688
689
const invasionProgressSchema = new Schema<IInvasionProgressDatabase>(
690
{
691
invasionId: Schema.Types.ObjectId,
692
Delta: Number,
693
AttackerScore: Number,
694
DefenderScore: Number
695
},
696
{ _id: false }
697
);
698
699
invasionProgressSchema.set("toJSON", {
700
transform(_doc, obj) {
701
const db = obj as IInvasionProgressDatabase;
702
const client = obj as IInvasionProgressClient;
703
704
client._id = toOid(db.invasionId);
705
delete obj.invasionId;
706
delete obj.__v;
707
}
708
});
709
687
710
const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
688
711
{
689
712
ItemType: String,
@@ -1482,7 +1505,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1482
1505
1483
1506
SentientSpawnChanceBoosters: Schema.Types.Mixed,
1484
1507
1485
QualifyingInvasions: [Schema.Types.Mixed],
1508
QualifyingInvasions: [invasionProgressSchema],
1486
1509
FactionScores: [Number],
1487
1510
1488
1511
// https://warframe.fandom.com/wiki/Specter_(Tenno)
@@ -532,6 +532,26 @@ export const addMissionInventoryUpdates = async (
532
532
inventoryChanges.RegularCredits -= value;
533
533
break;
534
534
}
535
case "InvasionProgress": {
536
for (const clientProgress of value) {
537
const dbProgress = inventory.QualifyingInvasions.find(x =>
538
x.invasionId.equals(clientProgress._id.$oid)
539
);
540
if (dbProgress) {
541
dbProgress.Delta += clientProgress.Delta;
542
dbProgress.AttackerScore += clientProgress.AttackerScore;
543
dbProgress.DefenderScore += clientProgress.DefenderScore;
544
} else {
545
inventory.QualifyingInvasions.push({
546
invasionId: new Types.ObjectId(clientProgress._id.$oid),
547
Delta: clientProgress.Delta,
548
AttackerScore: clientProgress.AttackerScore,
549
DefenderScore: clientProgress.DefenderScore
550
});
551
}
552
}
553
break;
554
}
535
555
default:
536
556
// Equipment XP updates
537
557
if (equipmentKeys.includes(key as TEquipmentKey)) {
@@ -50,6 +50,7 @@ export interface IInventoryDatabase
50
50
| "LastSortieReward"
51
51
| "LastLiteSortieReward"
52
52
| "CrewMembers"
53
| "QualifyingInvasions"
53
54
| TEquipmentKey
54
55
>,
55
56
InventoryDatabaseEquipment {
@@ -85,6 +86,7 @@ export interface IInventoryDatabase
85
86
LastSortieReward?: ILastSortieRewardDatabase[];
86
87
LastLiteSortieReward?: ILastSortieRewardDatabase[];
87
88
CrewMembers: ICrewMemberDatabase[];
89
QualifyingInvasions: IInvasionProgressDatabase[];
88
90
}
89
91
90
92
export interface IQuestKeyDatabase {
@@ -272,7 +274,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
272
274
SentientSpawnChanceBoosters: ISentientSpawnChanceBoosters;
273
275
SupportedSyndicate?: string;
274
276
Affiliations: IAffiliation[];
275
QualifyingInvasions: any[];
277
QualifyingInvasions: IInvasionProgressClient[];
276
278
FactionScores: number[];
277
279
ArchwingEnabled?: boolean;
278
280
PendingSpectreLoadouts?: ISpectreLoadout[];
@@ -676,6 +678,17 @@ export interface IInvasionChainProgress {
676
678
count: number;
677
679
}
678
680
681
export interface IInvasionProgressClient {
682
_id: IOid;
683
Delta: number;
684
AttackerScore: number;
685
DefenderScore: number;
686
}
687
688
export interface IInvasionProgressDatabase extends Omit<IInvasionProgressClient, "_id"> {
689
invasionId: Types.ObjectId;
690
}
691
679
692
export interface IKubrowPetEggClient {
680
693
ItemType: string;
681
694
ExpirationDate: IMongoDate; // seems to be set to 7 days ahead @ 0 UTC
@@ -19,7 +19,8 @@ import {
19
19
ICollectibleEntry,
20
20
IDiscoveredMarker,
21
21
ILockedWeaponGroupClient,
22
ILoadOutPresets
22
ILoadOutPresets,
23
IInvasionProgressClient
23
24
} from "./inventoryTypes/inventoryTypes";
24
25
import { IGroup } from "./loginTypes";
25
26
@@ -123,6 +124,7 @@ export type IMissionInventoryUpdateRequest = {
123
124
};
124
125
wagerTier?: number; // the index
125
126
creditsFee?: number; // the index
127
InvasionProgress?: IInvasionProgressClient[];
126
128
} & {
127
129
[K in TEquipmentKey]?: IEquipmentClient[];
128
130
};