Implements gaining Intrinsics

This commit is contained in:
VampireKitten 2024-10-15 22:22:49 +02:00
parent 76964585eb
commit 1c7f8d599f
2 changed files with 12 additions and 1 deletions

View File

@ -721,6 +721,14 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple
} }
}; };
const addPlayerSkillGains = (inventory: IInventoryDatabaseDocument, PlayerSkillGains: IPlayerSkills | undefined) => {
if (PlayerSkillGains) {
inventory.PlayerSkills ??= { LPP_SPACE: 0, LPP_DRIFTER: 0, LPS_NONE: 0, LPS_PILOTING: 0, LPS_GUNNERY: 0, LPS_TACTICAL: 0, LPS_ENGINEERING: 0, LPS_COMMAND: 0, LPS_DRIFT_COMBAT: 0, LPS_DRIFT_RIDING: 0, LPS_DRIFT_OPPORTUNITY: 0, LPS_DRIFT_ENDURANCE: 0 };
inventory.PlayerSkills.LPP_SPACE += PlayerSkillGains.LPP_SPACE;
inventory.PlayerSkills.LPP_DRIFTER += PlayerSkillGains.LPP_DRIFTER;
}
};
export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => { export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
const { const {
RawUpgrades, RawUpgrades,
@ -731,7 +739,8 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
Consumables, Consumables,
Recipes, Recipes,
Missions, Missions,
FusionTreasures FusionTreasures,
PlayerSkillGains
} = data; } = data;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
@ -793,6 +802,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
if (Missions) { if (Missions) {
addMissionComplete(inventory, Missions); addMissionComplete(inventory, Missions);
} }
addPlayerSkillGains(inventory, PlayerSkillGains);
const changedInventory = await inventory.save(); const changedInventory = await inventory.save();
return changedInventory.toJSON(); return changedInventory.toJSON();

View File

@ -70,6 +70,7 @@ export interface IMissionInventoryUpdateRequest {
Missions?: IMission; Missions?: IMission;
EvolutionProgress?: IEvolutionProgress[]; EvolutionProgress?: IEvolutionProgress[];
LastRegionPlayed?: TSolarMapRegion; LastRegionPlayed?: TSolarMapRegion;
PlayerSkillGains?: IPlayerSkills;
FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage. FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage.
} }