返回提交历史
Modified
src/controllers/custom/unlockAllScansController.ts
+66
-4
Modified
src/services/inventoryService.ts
+28
-1
Modified
src/services/missionInventoryUpdateService.ts
+2
-20
XFEstudio/XFESpaceNinjaServer
chore: unlock kuria scans & duviri fragments with "unlock all scans" (#3879)
Re #1250 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3879 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
c9cd6996
代码差异
3 个文件
+96
-25
@@ -3,12 +3,16 @@ import allScans from "../../../static/fixed_responses/allScans.json" with { type
3
3
import { ExportCodex, ExportEnemies } from "warframe-public-export-plus";
4
4
import { getAccountIdForRequest } from "../../services/loginService.ts";
5
5
import { getStats } from "../../services/statsService.ts";
6
import { getInventory } from "../../services/inventoryService.ts";
6
import { getInventory, updateIncentiveStates } from "../../services/inventoryService.ts";
7
7
8
8
export const unlockAllScansController: RequestHandler = async (req, res) => {
9
9
const accountId = await getAccountIdForRequest(req);
10
const [stats, inventory] = await Promise.all([getStats(accountId), getInventory(accountId, "ChallengeProgress")]);
10
const [stats, inventory] = await Promise.all([
11
getStats(accountId),
12
getInventory(accountId, "ChallengeProgress CollectibleSeries")
13
]);
11
14
15
// Unlock all enemy & object scans
12
16
const scanTypes = new Set<string>(allScans);
13
17
for (const type of Object.keys(ExportEnemies.avatars)) {
14
18
scanTypes.add(type);
@@ -16,14 +20,13 @@ export const unlockAllScansController: RequestHandler = async (req, res) => {
16
20
for (const type of Object.keys(ExportCodex.objects)) {
17
21
scanTypes.add(type);
18
22
}
19
20
23
stats.Scans = [];
21
24
for (const type of scanTypes) {
22
25
stats.Scans.push({ type, scans: 9999 });
23
26
}
24
27
28
// Complete the junction scan challenge
25
29
const jsCodex = inventory.ChallengeProgress.find(x => x.Name === "JSCodexScan");
26
27
30
if (jsCodex) {
28
31
jsCodex.Progress = 1;
29
32
} else {
@@ -33,6 +36,65 @@ export const unlockAllScansController: RequestHandler = async (req, res) => {
33
36
});
34
37
}
35
38
39
// Unlock all kuria scans
40
inventory.CollectibleSeries ??= [];
41
let kuriaSeries = inventory.CollectibleSeries.find(
42
x => x.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne"
43
);
44
if (!kuriaSeries) {
45
kuriaSeries =
46
inventory.CollectibleSeries[
47
inventory.CollectibleSeries.push({
48
CollectibleType: "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne",
49
Count: 0,
50
Tracking:
51
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
52
ReqScans: 56,
53
IncentiveStates: [
54
{
55
threshold: 0.5,
56
complete: false,
57
sent: false
58
},
59
{
60
threshold: 0.75,
61
complete: false,
62
sent: false
63
}
64
]
65
}) - 1
66
];
67
}
68
if (kuriaSeries.Count != kuriaSeries.ReqScans) {
69
kuriaSeries.Count = kuriaSeries.ReqScans;
70
kuriaSeries.Tracking =
71
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
72
await updateIncentiveStates(accountId, kuriaSeries);
73
}
74
75
// Unlock all duviri fragments
76
let duviriSeries = inventory.CollectibleSeries.find(
77
x => x.CollectibleType == "/Lotus/Types/Lore/Fragments/DuviriFragments/DuviriCollectibleDeco"
78
);
79
if (!duviriSeries) {
80
duviriSeries =
81
inventory.CollectibleSeries[
82
inventory.CollectibleSeries.push({
83
CollectibleType: "/Lotus/Types/Lore/Fragments/DuviriFragments/DuviriCollectibleDeco",
84
Count: 0,
85
Tracking:
86
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
87
ReqScans: 90,
88
IncentiveStates: []
89
}) - 1
90
];
91
}
92
if (duviriSeries.Count != duviriSeries.ReqScans) {
93
duviriSeries.Count = duviriSeries.ReqScans;
94
duviriSeries.Tracking =
95
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
96
}
97
36
98
await Promise.all([stats.save(), inventory.save()]);
37
99
res.end();
38
100
};
@@ -27,7 +27,8 @@ import type {
27
27
IKubrowPetPrintClient,
28
28
IWeeklyMissionChallengeInfo,
29
29
IKubrowPetEgg,
30
ITauPrequelQuestCustomData
30
ITauPrequelQuestCustomData,
31
ICollectibleEntry
31
32
} from "../types/inventoryTypes/inventoryTypes.ts";
32
33
import { InventorySlot, equipmentKeys } from "../types/inventoryTypes/inventoryTypes.ts";
33
34
import type { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate.ts";
@@ -115,6 +116,9 @@ import type { ITypeCount } from "../types/commonTypes.ts";
115
116
import type { TLoadoutDatabaseDocument } from "../models/inventoryModels/loadoutModel.ts";
116
117
import gameToBuildVersion from "../constants/gameToBuildVersion.ts";
117
118
import suitDefaultUpgrades from "../constants/suitDefaultUpgrades.ts";
119
import kuriaMessage50 from "../../static/fixed_responses/kuriaMessages/fiftyPercent.json" with { type: "json" };
120
import kuriaMessage75 from "../../static/fixed_responses/kuriaMessages/seventyFivePercent.json" with { type: "json" };
121
import kuriaMessage100 from "../../static/fixed_responses/kuriaMessages/oneHundredPercent.json" with { type: "json" };
118
122
119
123
type OperatorAntiqueMeta = {
120
124
focusAbility: string;
@@ -3117,3 +3121,26 @@ export const handleTauMemories = async (inventory: TInventoryDatabaseDocument):
3117
3121
}
3118
3122
}
3119
3123
};
3124
3125
export const updateIncentiveStates = async (
3126
accountId: string | Types.ObjectId,
3127
entry: ICollectibleEntry
3128
): Promise<void> => {
3129
if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") {
3130
const progress = entry.Count / entry.ReqScans;
3131
for (const gate of entry.IncentiveStates) {
3132
gate.complete = progress >= gate.threshold;
3133
if (gate.complete && !gate.sent) {
3134
gate.sent = true;
3135
if (gate.threshold == 0.5) {
3136
await createMessage(accountId, [kuriaMessage50]);
3137
} else {
3138
await createMessage(accountId, [kuriaMessage75]);
3139
}
3140
}
3141
}
3142
if (progress >= 1.0) {
3143
await createMessage(accountId, [kuriaMessage100]);
3144
}
3145
}
3146
};
@@ -50,6 +50,7 @@ import {
50
50
giveNemesisWeaponRecipe,
51
51
updateCurrency,
52
52
updateEntratiVault,
53
updateIncentiveStates,
53
54
updateSyndicate
54
55
} from "./inventoryService.ts";
55
56
import { updateQuestKey } from "./questService.ts";
@@ -71,9 +72,6 @@ import type { IMissionCredits, IMissionReward, INemesisTaxInfo, IRecoveredItemIn
71
72
import { crackRelic, ensureRelicRewardIsCorrect } from "../helpers/relicHelper.ts";
72
73
import type { IMessageCreationTemplate } from "./inboxService.ts";
73
74
import { createMessage } from "./inboxService.ts";
74
import kuriaMessage50 from "../../static/fixed_responses/kuriaMessages/fiftyPercent.json" with { type: "json" };
75
import kuriaMessage75 from "../../static/fixed_responses/kuriaMessages/seventyFivePercent.json" with { type: "json" };
76
import kuriaMessage100 from "../../static/fixed_responses/kuriaMessages/oneHundredPercent.json" with { type: "json" };
77
75
import {
78
76
generateNemesisProfile,
79
77
getInfestedLichItemRewards,
@@ -512,23 +510,7 @@ export const addMissionInventoryUpdates = async (
512
510
if (entry) {
513
511
entry.Count = scan.Count;
514
512
entry.Tracking = scan.Tracking;
515
if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") {
516
const progress = entry.Count / entry.ReqScans;
517
for (const gate of entry.IncentiveStates) {
518
gate.complete = progress >= gate.threshold;
519
if (gate.complete && !gate.sent) {
520
gate.sent = true;
521
if (gate.threshold == 0.5) {
522
await createMessage(inventory.accountOwnerId, [kuriaMessage50]);
523
} else {
524
await createMessage(inventory.accountOwnerId, [kuriaMessage75]);
525
}
526
}
527
}
528
if (progress >= 1.0) {
529
await createMessage(inventory.accountOwnerId, [kuriaMessage100]);
530
}
531
}
513
await updateIncentiveStates(inventory.accountOwnerId, entry);
532
514
} else {
533
515
logger.warn(`${scan.CollectibleType} was not found in inventory, ignoring scans`);
534
516
}