XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix: show endless relic rewards in EOM screen (#2813)

Closes #2812 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2813 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

de9dfb3d
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

5 个文件 +28 -8
Modified src/controllers/api/getVoidProjectionRewardsController.ts +5 -1
@@ -11,7 +11,11 @@ export const getVoidProjectionRewardsController: RequestHandler = async (req, re
11 11
12 12 if (data.ParticipantInfo.QualifiesForReward && !data.ParticipantInfo.HaveRewardResponse) {
13 13 const inventory = await getInventory(accountId);
14 await crackRelic(inventory, data.ParticipantInfo);
14 const reward = await crackRelic(inventory, data.ParticipantInfo);
15 if (!inventory.MissionRelicRewards || inventory.MissionRelicRewards.length >= data.CurrentWave) {
16 inventory.MissionRelicRewards = [];
17 }
18 inventory.MissionRelicRewards.push({ ItemType: reward.type, ItemCount: reward.itemCount });
15 19 await inventory.save();
16 20 }
17 21
Modified src/helpers/relicHelper.ts +3 -0
@@ -54,6 +54,9 @@ export const crackRelic = async (
54 54 (await handleStoreItemAcquisition(reward.type, inventory, reward.itemCount)).InventoryChanges
55 55 );
56 56
57 // Client has picked its own reward (for lack of choice)
58 participant.ChosenRewardOwner = participant.AccountId;
59
57 60 return reward;
58 61 };
59 62
Modified src/models/inventoryModels/inventoryModel.ts +4 -0
@@ -1473,6 +1473,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1473 1473 SubscribedToEmailsPersonalized: { type: Number, default: 0 },
1474 1474 RewardSeed: BigInt,
1475 1475
1476 // Temporary data so we can show all relic rewards from an endless mission at EOM
1477 MissionRelicRewards: { type: [typeCountSchema], default: undefined },
1478
1476 1479 //Credit
1477 1480 RegularCredits: { type: Number, default: 0 },
1478 1481 //Platinum
@@ -1841,6 +1844,7 @@ inventorySchema.set("toJSON", {
1841 1844 delete returnedObject._id;
1842 1845 delete returnedObject.__v;
1843 1846 delete returnedObject.accountOwnerId;
1847 delete returnedObject.MissionRelicRewards;
1844 1848
1845 1849 const inventoryDatabase = returnedObject as Partial<IInventoryDatabase>;
1846 1850 const inventoryResponse = returnedObject as IInventoryClient;
Modified src/services/missionInventoryUpdateService.ts +15 -7
@@ -1334,13 +1334,21 @@ export const addMissionRewards = async (
1334 1334 rngRewardCredits: inventoryChanges.RegularCredits ?? 0
1335 1335 });
1336 1336
1337 if (
1338 voidTearWave &&
1339 voidTearWave.Participants[0].QualifiesForReward &&
1340 !voidTearWave.Participants[0].HaveRewardResponse
1341 ) {
1342 const reward = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges);
1343 MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount });
1337 if (voidTearWave && voidTearWave.Participants[0].QualifiesForReward) {
1338 if (!voidTearWave.Participants[0].HaveRewardResponse) {
1339 // non-endless fissure; giving reward now
1340 const reward = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges);
1341 MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount });
1342 } else if (inventory.MissionRelicRewards) {
1343 // endless fissure; already gave reward(s) but should still show in EOM screen
1344 for (const reward of inventory.MissionRelicRewards) {
1345 MissionRewards.push({
1346 StoreItem: reward.ItemType,
1347 ItemCount: reward.ItemCount
1348 });
1349 }
1350 inventory.MissionRelicRewards = undefined;
1351 }
1344 1352 }
1345 1353
1346 1354 if (strippedItems) {
Modified src/types/inventoryTypes/inventoryTypes.ts +1 -0
@@ -147,6 +147,7 @@ export interface IInventoryDatabase
147 147 LastInventorySync?: Types.ObjectId;
148 148 EndlessXP?: IEndlessXpProgressDatabase[];
149 149 PersonalGoalProgress?: IGoalProgressDatabase[];
150 MissionRelicRewards?: ITypeCount[];
150 151 }
151 152
152 153 export interface IQuestKeyDatabase {