forked from OpenWF/SpaceNinjaServer
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>
This commit is contained in:
parent
d396fe8b5c
commit
1c82b90033
@ -997,7 +997,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
ShipDecorations: [typeCountSchema],
|
||||
|
||||
//Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components)
|
||||
CrewShipRawSalvage: [Schema.Types.Mixed],
|
||||
CrewShipRawSalvage: [typeCountSchema],
|
||||
|
||||
//Default RailJack
|
||||
CrewShipAmmo: [typeCountSchema],
|
||||
|
@ -928,6 +928,37 @@ export const addConsumables = (inventory: TInventoryDatabaseDocument, itemsArray
|
||||
});
|
||||
};
|
||||
|
||||
export const addCrewShipRawSalvage = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
itemsArray: ITypeCount[] | undefined
|
||||
): void => {
|
||||
const { CrewShipRawSalvage } = inventory;
|
||||
|
||||
itemsArray?.forEach(({ ItemCount, ItemType }) => {
|
||||
const itemIndex = CrewShipRawSalvage.findIndex(i => i.ItemType === ItemType);
|
||||
|
||||
if (itemIndex !== -1) {
|
||||
CrewShipRawSalvage[itemIndex].ItemCount += ItemCount;
|
||||
} else {
|
||||
CrewShipRawSalvage.push({ ItemCount, ItemType });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const addCrewShipAmmo = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined): void => {
|
||||
const { CrewShipAmmo } = inventory;
|
||||
|
||||
itemsArray?.forEach(({ ItemCount, ItemType }) => {
|
||||
const itemIndex = CrewShipAmmo.findIndex(i => i.ItemType === ItemType);
|
||||
|
||||
if (itemIndex !== -1) {
|
||||
CrewShipAmmo[itemIndex].ItemCount += ItemCount;
|
||||
} else {
|
||||
CrewShipAmmo.push({ ItemCount, ItemType });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const addRecipes = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[] | undefined): void => {
|
||||
const { Recipes } = inventory;
|
||||
|
||||
|
@ -6,6 +6,8 @@ import { equipmentKeys, IInventoryDatabase, TEquipmentKey } from "@/src/types/in
|
||||
import {
|
||||
addChallenges,
|
||||
addConsumables,
|
||||
addCrewShipAmmo,
|
||||
addCrewShipRawSalvage,
|
||||
addFocusXpIncreases,
|
||||
addFusionTreasures,
|
||||
addGearExpByCategory,
|
||||
@ -122,6 +124,7 @@ export const addMissionInventoryUpdates = (
|
||||
addMods(inventory, value);
|
||||
break;
|
||||
case "MiscItems":
|
||||
case "BonusMiscItems":
|
||||
addMiscItems(inventory, value);
|
||||
break;
|
||||
case "Consumables":
|
||||
@ -136,6 +139,12 @@ export const addMissionInventoryUpdates = (
|
||||
case "FusionTreasures":
|
||||
addFusionTreasures(inventory, value);
|
||||
break;
|
||||
case "CrewShipRawSalvage":
|
||||
addCrewShipRawSalvage(inventory, value);
|
||||
break;
|
||||
case "CrewShipAmmo":
|
||||
addCrewShipAmmo(inventory, value);
|
||||
break;
|
||||
case "FusionBundles": {
|
||||
let fusionPoints = 0;
|
||||
for (const fusionBundle of value) {
|
||||
@ -195,7 +204,6 @@ export const addMissionRewards = async (
|
||||
) => {
|
||||
if (!rewardInfo) {
|
||||
logger.warn("no reward info provided");
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: check double reward merging
|
||||
@ -287,9 +295,9 @@ function getLevelCreditRewards(nodeName: string): number {
|
||||
//TODO: get dark sektor fixed credit rewards and railjack bonus
|
||||
}
|
||||
|
||||
function getRandomMissionDrops(RewardInfo: IRewardInfo): IRngResult[] {
|
||||
function getRandomMissionDrops(RewardInfo: IRewardInfo | undefined): IRngResult[] {
|
||||
const drops: IRngResult[] = [];
|
||||
if (RewardInfo.node in ExportRegions) {
|
||||
if (RewardInfo && RewardInfo.node in ExportRegions) {
|
||||
const region = ExportRegions[RewardInfo.node];
|
||||
const rewardManifests = region.rewardManifests ?? [];
|
||||
|
||||
|
@ -35,18 +35,23 @@ export interface IUpdateChallengeProgressRequest {
|
||||
}
|
||||
|
||||
export type IMissionInventoryUpdateRequest = {
|
||||
MiscItems?: ITypeCount[];
|
||||
Recipes?: ITypeCount[];
|
||||
FusionBundles?: ITypeCount[];
|
||||
Consumables?: ITypeCount[];
|
||||
FusionBundels?: ITypeCount[];
|
||||
CrewShipRawSalvage?: ITypeCount[];
|
||||
CrewShipAmmo?: ITypeCount[];
|
||||
BonusMiscItems?: ITypeCount[];
|
||||
|
||||
AffiliationChanges?: IAffiliationChange[];
|
||||
crossPlaySetting?: string;
|
||||
rewardsMultiplier?: number;
|
||||
GoalTag: string;
|
||||
LevelKeyName: string;
|
||||
ActiveBoosters?: IBooster[];
|
||||
FusionBundles?: ITypeCount[];
|
||||
RawUpgrades?: IRawUpgrade[];
|
||||
MiscItems?: ITypeCount[];
|
||||
Consumables?: ITypeCount[];
|
||||
FusionTreasures?: IFusionTreasure[];
|
||||
Recipes?: ITypeCount[];
|
||||
QuestKeys?: Omit<IQuestKeyDatabase, "CompletionDate">[];
|
||||
RegularCredits?: number;
|
||||
MissionFailed: boolean;
|
||||
|
Loading…
x
Reference in New Issue
Block a user