forked from OpenWF/SpaceNinjaServer
improve: use equipmentKeys for missionInventoryUpdate's XP logic (#425)
This commit is contained in:
parent
19ba891c21
commit
ec9c2c89c2
@ -14,7 +14,9 @@ import {
|
|||||||
ISeasonChallenge,
|
ISeasonChallenge,
|
||||||
ITypeCount,
|
ITypeCount,
|
||||||
InventorySlot,
|
InventorySlot,
|
||||||
IWeaponSkinClient
|
IWeaponSkinClient,
|
||||||
|
TEquipmentKey,
|
||||||
|
equipmentKeys
|
||||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IGenericUpdate } from "../types/genericUpdate";
|
import { IGenericUpdate } from "../types/genericUpdate";
|
||||||
import {
|
import {
|
||||||
@ -462,7 +464,7 @@ export const addSkin = async (typeName: string, accountId: string): Promise<IWea
|
|||||||
const addGearExpByCategory = (
|
const addGearExpByCategory = (
|
||||||
inventory: IInventoryDatabaseDocument,
|
inventory: IInventoryDatabaseDocument,
|
||||||
gearArray: IEquipmentClient[] | undefined,
|
gearArray: IEquipmentClient[] | undefined,
|
||||||
categoryName: "Pistols" | "LongGuns" | "Melee" | "Suits"
|
categoryName: TEquipmentKey
|
||||||
) => {
|
) => {
|
||||||
const category = inventory[categoryName];
|
const category = inventory[categoryName];
|
||||||
|
|
||||||
@ -619,8 +621,6 @@ const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Comple
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const;
|
|
||||||
|
|
||||||
export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
|
export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
|
||||||
const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions } =
|
const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions } =
|
||||||
data;
|
data;
|
||||||
@ -651,7 +651,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Gear XP
|
// Gear XP
|
||||||
gearKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
|
equipmentKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
|
||||||
|
|
||||||
// Incarnon Challenges
|
// Incarnon Challenges
|
||||||
if (data.EvolutionProgress) {
|
if (data.EvolutionProgress) {
|
||||||
|
@ -44,10 +44,19 @@ export interface IMissionInventoryUpdateRequest {
|
|||||||
rewardsMultiplier?: number;
|
rewardsMultiplier?: number;
|
||||||
ActiveBoosters?: IBooster[];
|
ActiveBoosters?: IBooster[];
|
||||||
AffiliationChanges?: IAffiliationChange[];
|
AffiliationChanges?: IAffiliationChange[];
|
||||||
|
Suits?: IEquipmentClient[];
|
||||||
LongGuns?: IEquipmentClient[];
|
LongGuns?: IEquipmentClient[];
|
||||||
Pistols?: IEquipmentClient[];
|
Pistols?: IEquipmentClient[];
|
||||||
Suits?: IEquipmentClient[];
|
|
||||||
Melee?: IEquipmentClient[];
|
Melee?: IEquipmentClient[];
|
||||||
|
SpecialItems?: IEquipmentClient[];
|
||||||
|
Sentinels?: IEquipmentClient[];
|
||||||
|
SentinelWeapons?: IEquipmentClient[];
|
||||||
|
SpaceSuits?: IEquipmentClient[];
|
||||||
|
SpaceGuns?: IEquipmentClient[];
|
||||||
|
SpaceMelee?: IEquipmentClient[];
|
||||||
|
Hoverboards?: IEquipmentClient[];
|
||||||
|
OperatorAmps?: IEquipmentClient[];
|
||||||
|
MoaPets?: IEquipmentClient[];
|
||||||
FusionBundles?: ITypeCount[];
|
FusionBundles?: ITypeCount[];
|
||||||
RawUpgrades?: IRawUpgrade[];
|
RawUpgrades?: IRawUpgrade[];
|
||||||
MiscItems?: IMiscItem[];
|
MiscItems?: IMiscItem[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user