Compare commits
No commits in common. "d0f6650c41520c39bfccc5ca283373014778fcae" and "b93a4a6dae15e29d872b04c75b3f921af84d4b33" have entirely different histories.
d0f6650c41
...
b93a4a6dae
@ -538,9 +538,15 @@ export const addItem = async (
|
||||
if (!key) return {};
|
||||
return { QuestKeys: [key] };
|
||||
} else {
|
||||
const levelKeyChanges = [{ ItemType: typeName, ItemCount: quantity }];
|
||||
addLevelKeys(inventory, levelKeyChanges);
|
||||
return { LevelKeys: levelKeyChanges };
|
||||
const key = { ItemType: typeName, ItemCount: quantity };
|
||||
|
||||
const index = inventory.LevelKeys.findIndex(levelKey => levelKey.ItemType == typeName);
|
||||
if (index != -1) {
|
||||
inventory.LevelKeys[index].ItemCount += quantity;
|
||||
} else {
|
||||
inventory.LevelKeys.push(key);
|
||||
}
|
||||
return { LevelKeys: [key] };
|
||||
}
|
||||
}
|
||||
if (typeName in ExportDrones) {
|
||||
@ -1234,10 +1240,6 @@ export const addRecipes = (inventory: TInventoryDatabaseDocument, itemsArray: IT
|
||||
applyArrayChanges(inventory.Recipes, itemsArray);
|
||||
};
|
||||
|
||||
export const addLevelKeys = (inventory: TInventoryDatabaseDocument, itemsArray: ITypeCount[]): void => {
|
||||
applyArrayChanges(inventory.LevelKeys, itemsArray);
|
||||
};
|
||||
|
||||
export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawUpgrade[]): void => {
|
||||
const { RawUpgrades } = inventory;
|
||||
|
||||
|
@ -22,7 +22,6 @@ import {
|
||||
addFusionTreasures,
|
||||
addGearExpByCategory,
|
||||
addItem,
|
||||
addLevelKeys,
|
||||
addMiscItems,
|
||||
addMissionComplete,
|
||||
addMods,
|
||||
@ -78,8 +77,11 @@ export const addMissionInventoryUpdates = async (
|
||||
inventoryUpdates: IMissionInventoryUpdateRequest
|
||||
): Promise<IInventoryChanges> => {
|
||||
const inventoryChanges: IInventoryChanges = {};
|
||||
if (inventoryUpdates.EndOfMatchUpload) {
|
||||
if (inventoryUpdates.Missions && inventoryUpdates.Missions.Tag in ExportRegions) {
|
||||
if (
|
||||
inventoryUpdates.EndOfMatchUpload &&
|
||||
inventoryUpdates.Missions &&
|
||||
inventoryUpdates.Missions.Tag in ExportRegions
|
||||
) {
|
||||
const node = ExportRegions[inventoryUpdates.Missions.Tag];
|
||||
if (node.miscItemFee) {
|
||||
addMiscItems(inventory, [
|
||||
@ -90,19 +92,28 @@ export const addMissionInventoryUpdates = async (
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (inventoryUpdates.KeyToRemove) {
|
||||
if (!inventoryUpdates.KeyOwner || inventory.accountOwnerId.equals(inventoryUpdates.KeyOwner)) {
|
||||
addLevelKeys(inventory, [
|
||||
{
|
||||
ItemType: inventoryUpdates.KeyToRemove,
|
||||
ItemCount: -1
|
||||
if (inventoryUpdates.RewardInfo) {
|
||||
if (inventoryUpdates.RewardInfo.periodicMissionTag) {
|
||||
const tag = inventoryUpdates.RewardInfo.periodicMissionTag;
|
||||
const existingCompletion = inventory.PeriodicMissionCompletions.find(completion => completion.tag === tag);
|
||||
|
||||
if (existingCompletion) {
|
||||
existingCompletion.date = new Date();
|
||||
} else {
|
||||
inventory.PeriodicMissionCompletions.push({
|
||||
tag: tag,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (inventoryUpdates.RewardInfo.NemesisAbandonedRewards) {
|
||||
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
||||
}
|
||||
}
|
||||
if (
|
||||
inventoryUpdates.MissionFailed &&
|
||||
inventoryUpdates.MissionStatus == "GS_FAILURE" &&
|
||||
inventoryUpdates.EndOfMatchUpload &&
|
||||
inventoryUpdates.ObjectiveReached &&
|
||||
!inventoryUpdates.LockedWeaponGroup
|
||||
) {
|
||||
@ -125,25 +136,6 @@ export const addMissionInventoryUpdates = async (
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventoryUpdates.RewardInfo) {
|
||||
if (inventoryUpdates.RewardInfo.periodicMissionTag) {
|
||||
const tag = inventoryUpdates.RewardInfo.periodicMissionTag;
|
||||
const existingCompletion = inventory.PeriodicMissionCompletions.find(completion => completion.tag === tag);
|
||||
|
||||
if (existingCompletion) {
|
||||
existingCompletion.date = new Date();
|
||||
} else {
|
||||
inventory.PeriodicMissionCompletions.push({
|
||||
tag: tag,
|
||||
date: new Date()
|
||||
});
|
||||
}
|
||||
}
|
||||
if (inventoryUpdates.RewardInfo.NemesisAbandonedRewards) {
|
||||
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
||||
}
|
||||
}
|
||||
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
|
||||
if (value === undefined) {
|
||||
logger.error(`Inventory update key ${key} has no value `);
|
||||
|
@ -49,9 +49,6 @@ export type IMissionInventoryUpdateRequest = {
|
||||
rewardsMultiplier?: number;
|
||||
GoalTag: string;
|
||||
LevelKeyName: string;
|
||||
KeyOwner?: string;
|
||||
KeyRemovalHash?: string;
|
||||
KeyToRemove?: string;
|
||||
ActiveBoosters?: IBooster[];
|
||||
RawUpgrades?: IRawUpgrade[];
|
||||
FusionTreasures?: IFusionTreasure[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user