返回提交历史
Added
src/controllers/api/startCollectibleEntryController.ts
+27
-0
Modified
src/models/inventoryModels/inventoryModel.ts
+24
-2
Modified
src/routes/api.ts
+2
-0
Modified
src/services/missionInventoryUpdateService.ts
+32
-0
Modified
src/types/inventoryTypes/inventoryTypes.ts
+2
-2
Modified
src/types/requestTypes.ts
+3
-1
Added
static/fixed_responses/kuriaMessages/fiftyPercent.json
+7
-0
Added
static/fixed_responses/kuriaMessages/oneHundredPercent.json
+8
-0
Added
static/fixed_responses/kuriaMessages/seventyFivePercent.json
+7
-0
XFEstudio/XFESpaceNinjaServer
feat: collectible series (#1025)
Closes #712 a bit unsure about the inbox messages, but otherwise it should be working Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1025
da2b50d5
代码差异
9 个文件
+112
-5
@@ -0,0 +1,27 @@
1
import { getJSONfromString } from "@/src/helpers/stringHelpers";
2
import { getInventory } from "@/src/services/inventoryService";
3
import { getAccountIdForRequest } from "@/src/services/loginService";
4
import { IIncentiveState } from "@/src/types/inventoryTypes/inventoryTypes";
5
import { RequestHandler } from "express";
6
7
export const startCollectibleEntryController: RequestHandler = async (req, res) => {
8
const accountId = await getAccountIdForRequest(req);
9
const inventory = await getInventory(accountId);
10
const request = getJSONfromString<IStartCollectibleEntryRequest>(String(req.body));
11
inventory.CollectibleSeries ??= [];
12
inventory.CollectibleSeries.push({
13
CollectibleType: request.target,
14
Count: 0,
15
Tracking: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
16
ReqScans: request.reqScans,
17
IncentiveStates: request.other
18
});
19
await inventory.save();
20
res.status(200).end();
21
};
22
23
interface IStartCollectibleEntryRequest {
24
target: string;
25
reqScans: number;
26
other: IIncentiveState[];
27
}
@@ -71,7 +71,9 @@ import {
71
71
ILibraryDailyTaskInfo,
72
72
IDroneDatabase,
73
73
IDroneClient,
74
IAlignment
74
IAlignment,
75
ICollectibleEntry,
76
IIncentiveState
75
77
} from "../../types/inventoryTypes/inventoryTypes";
76
78
import { IOid } from "../../types/commonTypes";
77
79
import {
@@ -943,6 +945,26 @@ const calenderProgressSchema = new Schema<ICalendarProgress>(
943
945
{ _id: false }
944
946
);
945
947
948
const incentiveStateSchema = new Schema<IIncentiveState>(
949
{
950
threshold: Number,
951
complete: Boolean,
952
sent: Boolean
953
},
954
{ _id: false }
955
);
956
957
const collectibleEntrySchema = new Schema<ICollectibleEntry>(
958
{
959
CollectibleType: String,
960
Count: Number,
961
Tracking: String,
962
ReqScans: Number,
963
IncentiveStates: [incentiveStateSchema]
964
},
965
{ _id: false }
966
);
967
946
968
const pendingCouponSchema = new Schema<IPendingCouponDatabase>(
947
969
{
948
970
Expiry: { type: Date, default: new Date(0) },
@@ -1286,7 +1308,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1286
1308
RecentVendorPurchases: [Schema.Types.Mixed],
1287
1309
Robotics: [Schema.Types.Mixed],
1288
1310
UsedDailyDeals: [Schema.Types.Mixed],
1289
CollectibleSeries: [Schema.Types.Mixed],
1311
CollectibleSeries: { type: [collectibleEntrySchema], default: undefined },
1290
1312
HasResetAccount: { type: Boolean, default: false },
1291
1313
1292
1314
//Discount Coupon
@@ -76,6 +76,7 @@ import { setShipFavouriteLoadoutController } from "@/src/controllers/api/setShip
76
76
import { setSupportedSyndicateController } from "@/src/controllers/api/setSupportedSyndicateController";
77
77
import { setWeaponSkillTreeController } from "@/src/controllers/api/setWeaponSkillTreeController";
78
78
import { shipDecorationsController } from "@/src/controllers/api/shipDecorationsController";
79
import { startCollectibleEntryController } from "@/src/controllers/api/startCollectibleEntryController";
79
80
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
80
81
import { startLibraryDailyTaskController } from "@/src/controllers/api/startLibraryDailyTaskController";
81
82
import { startLibraryPersonalTargetController } from "@/src/controllers/api/startLibraryPersonalTargetController";
@@ -181,6 +182,7 @@ apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
181
182
apiRouter.post("/setShipFavouriteLoadout.php", setShipFavouriteLoadoutController);
182
183
apiRouter.post("/setWeaponSkillTree.php", setWeaponSkillTreeController);
183
184
apiRouter.post("/shipDecorations.php", shipDecorationsController);
185
apiRouter.post("/startCollectibleEntry.php", startCollectibleEntryController);
184
186
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
185
187
apiRouter.post("/startRecipe.php", startRecipeController);
186
188
apiRouter.post("/stepSequencers.php", stepSequencersController);
@@ -34,6 +34,10 @@ import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryType
34
34
import { handleStoreItemAcquisition } from "./purchaseService";
35
35
import { IMissionReward } from "../types/missionTypes";
36
36
import { crackRelic } from "@/src/helpers/relicHelper";
37
import { createMessage } from "./inboxService";
38
import kuriaMessage50 from "@/static/fixed_responses/kuriaMessages/fiftyPercent.json";
39
import kuriaMessage75 from "@/static/fixed_responses/kuriaMessages/seventyFivePercent.json";
40
import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPercent.json";
37
41
38
42
const getRotations = (rotationCount: number): number[] => {
39
43
if (rotationCount === 0) return [0];
@@ -201,6 +205,34 @@ export const addMissionInventoryUpdates = (
201
205
}
202
206
});
203
207
break;
208
case "CollectibleScans":
209
value.forEach(scan => {
210
const entry = inventory.CollectibleSeries?.find(x => x.CollectibleType == scan.CollectibleType);
211
if (entry) {
212
entry.Count = scan.Count;
213
entry.Tracking = scan.Tracking;
214
if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") {
215
const progress = entry.Count / entry.ReqScans;
216
entry.IncentiveStates.forEach(gate => {
217
gate.complete = progress >= gate.threshold;
218
if (gate.complete && !gate.sent) {
219
gate.sent = true;
220
if (gate.threshold == 0.5) {
221
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage50]);
222
} else {
223
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage75]);
224
}
225
}
226
});
227
if (progress >= 1.0) {
228
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage100]);
229
}
230
}
231
} else {
232
logger.warn(`${scan.CollectibleType} was not found in inventory, ignoring scans`);
233
}
234
});
235
break;
204
236
case "Upgrades":
205
237
value.forEach(clientUpgrade => {
206
238
const upgrade = inventory.Upgrades.id(clientUpgrade.ItemId.$oid)!;
@@ -315,7 +315,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
315
315
UsedDailyDeals: any[];
316
316
LibraryPersonalTarget: string;
317
317
LibraryPersonalProgress: ILibraryPersonalProgress[];
318
CollectibleSeries: ICollectibleSery[];
318
CollectibleSeries?: ICollectibleEntry[];
319
319
LibraryAvailableDailyTaskInfo?: ILibraryDailyTaskInfo;
320
320
LibraryActiveDailyTaskInfo?: ILibraryDailyTaskInfo;
321
321
HasResetAccount: boolean;
@@ -364,7 +364,7 @@ export interface IChallengeProgress {
364
364
Completed?: string[];
365
365
}
366
366
367
export interface ICollectibleSery {
367
export interface ICollectibleEntry {
368
368
CollectibleType: string;
369
369
Count: number;
370
370
Tracking: string;
@@ -15,7 +15,8 @@ import {
15
15
IPlayerSkills,
16
16
IQuestKeyDatabase,
17
17
ILoreFragmentScan,
18
IUpgradeClient
18
IUpgradeClient,
19
ICollectibleEntry
19
20
} from "./inventoryTypes/inventoryTypes";
20
21
21
22
export interface IThemeUpdateRequest {
@@ -99,6 +100,7 @@ export type IMissionInventoryUpdateRequest = {
99
100
CodexScanCount: number;
100
101
Standing: number;
101
102
}[];
103
CollectibleScans?: ICollectibleEntry[];
102
104
Upgrades?: IUpgradeClient[]; // riven challenge progress
103
105
} & {
104
106
[K in TEquipmentKey]?: IEquipmentClient[];
@@ -0,0 +1,7 @@
1
{
2
"sub": "/Lotus/Language/Oddities/SeriesOne50PercentInboxMessageSubject",
3
"sndr": "/Lotus/Language/Menu/ScribeName",
4
"msg": "/Lotus/Language/Oddities/SeriesOne50PercentInboxMessage",
5
"icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png",
6
"att": ["/Lotus/Upgrades/Skins/Clan/OrokittyBadgeItem"]
7
}
@@ -0,0 +1,8 @@
1
{
2
"sub": "/Lotus/Language/Oddities/SeriesOneRewardSubject",
3
"sndr": "/Lotus/Language/Menu/ScribeName",
4
"msg": "/Lotus/Language/Oddities/SeriesOneRewardInboxMessage",
5
"icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png",
6
"att": ["/Lotus/Types/Items/ShipDecos/OrokinFelisBobbleHead"],
7
"highPriority": true
8
}
@@ -0,0 +1,7 @@
1
{
2
"sub": "/Lotus/Language/Oddities/SeriesOne75PercentInboxMessageSubject",
3
"sndr": "/Lotus/Language/Menu/ScribeName",
4
"msg": "/Lotus/Language/Oddities/SeriesOne75PercentInboxMessage",
5
"icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png",
6
"att": ["/Lotus/Types/StoreItems/AvatarImages/AvatarImageOroKitty"]
7
}