WIP: feat: player skill gains #554
@ -17,7 +17,8 @@ import {
|
||||
IWeaponSkinClient,
|
||||
TEquipmentKey,
|
||||
equipmentKeys,
|
||||
IFusionTreasure
|
||||
IFusionTreasure,
|
||||
IPlayerSkills
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IGenericUpdate } from "../types/genericUpdate";
|
||||
import {
|
||||
@ -721,6 +722,27 @@ 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) => {
|
||||
const {
|
||||
RawUpgrades,
|
||||
@ -731,7 +753,8 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
|
||||
Consumables,
|
||||
|
||||
Recipes,
|
||||
Missions,
|
||||
FusionTreasures
|
||||
FusionTreasures,
|
||||
PlayerSkillGains
|
||||
} = data;
|
||||
const inventory = await getInventory(accountId);
|
||||
|
||||
@ -793,6 +816,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
|
||||
if (Missions) {
|
||||
addMissionComplete(inventory, Missions);
|
||||
}
|
||||
addPlayerSkillGains(inventory, PlayerSkillGains);
|
||||
|
||||
const changedInventory = await inventory.save();
|
||||
return changedInventory.toJSON();
|
||||
|
@ -13,7 +13,8 @@ import {
|
||||
ISeasonChallenge,
|
||||
TSolarMapRegion,
|
||||
TEquipmentKey,
|
||||
IFusionTreasure
|
||||
IFusionTreasure,
|
||||
IPlayerSkills
|
||||
} from "./inventoryTypes/inventoryTypes";
|
||||
|
||||
export interface IArtifactsRequest {
|
||||
@ -70,6 +71,7 @@ export interface IMissionInventoryUpdateRequest {
|
||||
Missions?: IMission;
|
||||
EvolutionProgress?: IEvolutionProgress[];
|
||||
LastRegionPlayed?: TSolarMapRegion;
|
||||
PlayerSkillGains?: IPlayerSkills;
|
||||
|
||||
FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage.
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user
⚠️ Potential issue
Good implementation, but type definition is missing.
The
addPlayerSkillGains
function looks well-implemented and addresses the issue of player skill gains not being saved. However, there's a missing type definition that needs to be addressed.The type
IPlayerSkills
is not defined, which is causing static analysis errors. Please add the type definition or import it from the appropriate file.Consider adding comments to explain the purpose of this function and the different skill types (LPP and LPS) for better code documentation.
Example:
🧰 Tools
🪛 GitHub Check: build (22)
🪛 GitHub Check: build (20)
🪛 GitHub Check: build (18)