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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

feat: obtaining crewship related items on mission update (#897)

Reviewed-on: http://209.141.38.3/OpenWF/SpaceNinjaServer/pulls/897 Reviewed-by: Sainan <sainan@calamity.inc> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>

1c82b900
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

4 个文件 +52 -8
Modified src/models/inventoryModels/inventoryModel.ts +1 -1
@@ -997,7 +997,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
997 997 ShipDecorations: [typeCountSchema],
998 998
999 999 //Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components)
1000 CrewShipRawSalvage: [Schema.Types.Mixed],
1000 CrewShipRawSalvage: [typeCountSchema],
1001 1001
1002 1002 //Default RailJack
1003 1003 CrewShipAmmo: [typeCountSchema],
Modified src/services/inventoryService.ts +31 -0
@@ -928,6 +928,37 @@ export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray
928 928 });
929 929 };
930 930
931 export const addCrewShipRawSalvage = (
932 inventory: TInventoryDatabaseDocument,
933 itemsArray: ITypeCount[] | undefined
934 ): void => {
935 const { CrewShipRawSalvage } = inventory;
936
937 itemsArray?.forEach(({ ItemCount, ItemType }) => {
938 const itemIndex = CrewShipRawSalvage.findIndex(i => i.ItemType === ItemType);
939
940 if (itemIndex !== -1) {
941 CrewShipRawSalvage[itemIndex].ItemCount += ItemCount;
942 } else {
943 CrewShipRawSalvage.push({ ItemCount, ItemType });
944 }
945 });
946 };
947
948 export const addCrewShipAmmo = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined): void => {
949 const { CrewShipAmmo } = inventory;
950
951 itemsArray?.forEach(({ ItemCount, ItemType }) => {
952 const itemIndex = CrewShipAmmo.findIndex(i => i.ItemType === ItemType);
953
954 if (itemIndex !== -1) {
955 CrewShipAmmo[itemIndex].ItemCount += ItemCount;
956 } else {
957 CrewShipAmmo.push({ ItemCount, ItemType });
958 }
959 });
960 };
961
931 962 export const addRecipes = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined): void => {
932 963 const { Recipes } = inventory;
933 964
Modified src/services/missionInventoryUpdateService.ts +11 -3
@@ -6,6 +6,8 @@ import { equipmentKeys, IInventoryDatabase, TEquipmentKey } from "@/src/types/in
6 6 import {
7 7 addChallenges,
8 8 addConsumables,
9 addCrewShipAmmo,
10 addCrewShipRawSalvage,
9 11 addFocusXpIncreases,
10 12 addFusionTreasures,
11 13 addGearExpByCategory,
@@ -122,6 +124,7 @@ export const addMissionInventoryUpdates = (
122 124 addMods(inventory, value);
123 125 break;
124 126 case "MiscItems":
127 case "BonusMiscItems":
125 128 addMiscItems(inventory, value);
126 129 break;
127 130 case "Consumables":
@@ -136,6 +139,12 @@ export const addMissionInventoryUpdates = (
136 139 case "FusionTreasures":
137 140 addFusionTreasures(inventory, value);
138 141 break;
142 case "CrewShipRawSalvage":
143 addCrewShipRawSalvage(inventory, value);
144 break;
145 case "CrewShipAmmo":
146 addCrewShipAmmo(inventory, value);
147 break;
139 148 case "FusionBundles": {
140 149 let fusionPoints = 0;
141 150 for (const fusionBundle of value) {
@@ -195,7 +204,6 @@ export const addMissionRewards = async (
195 204 ) => {
196 205 if (!rewardInfo) {
197 206 logger.warn("no reward info provided");
198 return;
199 207 }
200 208
201 209 //TODO: check double reward merging
@@ -287,9 +295,9 @@ function getLevelCreditRewards(nodeName: string): number {
287 295 //TODO: get dark sektor fixed credit rewards and railjack bonus
288 296 }
289 297
290 function getRandomMissionDrops(RewardInfo: IRewardInfo): IRngResult[] {
298 function getRandomMissionDrops(RewardInfo: IRewardInfo | undefined): IRngResult[] {
291 299 const drops: IRngResult[] = [];
292 if (RewardInfo.node in ExportRegions) {
300 if (RewardInfo && RewardInfo.node in ExportRegions) {
293 301 const region = ExportRegions[RewardInfo.node];
294 302 const rewardManifests = region.rewardManifests ?? [];
295 303
Modified src/types/requestTypes.ts +9 -4
@@ -35,18 +35,23 @@ export interface IUpdateChallengeProgressRequest {
35 35 }
36 36
37 37 export type IMissionInventoryUpdateRequest = {
38 MiscItems?: ITypeCount[];
39 Recipes?: ITypeCount[];
40 FusionBundles?: ITypeCount[];
41 Consumables?: ITypeCount[];
42 FusionBundels?: ITypeCount[];
43 CrewShipRawSalvage?: ITypeCount[];
44 CrewShipAmmo?: ITypeCount[];
45 BonusMiscItems?: ITypeCount[];
46
38 47 AffiliationChanges?: IAffiliationChange[];
39 48 crossPlaySetting?: string;
40 49 rewardsMultiplier?: number;
41 50 GoalTag: string;
42 51 LevelKeyName: string;
43 52 ActiveBoosters?: IBooster[];
44 FusionBundles?: ITypeCount[];
45 53 RawUpgrades?: IRawUpgrade[];
46 MiscItems?: ITypeCount[];
47 Consumables?: ITypeCount[];
48 54 FusionTreasures?: IFusionTreasure[];
49 Recipes?: ITypeCount[];
50 55 QuestKeys?: Omit<IQuestKeyDatabase, "CompletionDate">[];
51 56 RegularCredits?: number;
52 57 MissionFailed: boolean;