merge EndOfMatchUpload conditions
This commit is contained in:
parent
b93a4a6dae
commit
cb89e31c15
@ -77,19 +77,42 @@ export const addMissionInventoryUpdates = async (
|
|||||||
inventoryUpdates: IMissionInventoryUpdateRequest
|
inventoryUpdates: IMissionInventoryUpdateRequest
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
if (
|
if (inventoryUpdates.EndOfMatchUpload) {
|
||||||
inventoryUpdates.EndOfMatchUpload &&
|
if (inventoryUpdates.Missions && inventoryUpdates.Missions.Tag in ExportRegions) {
|
||||||
inventoryUpdates.Missions &&
|
const node = ExportRegions[inventoryUpdates.Missions.Tag];
|
||||||
inventoryUpdates.Missions.Tag in ExportRegions
|
if (node.miscItemFee) {
|
||||||
) {
|
addMiscItems(inventory, [
|
||||||
const node = ExportRegions[inventoryUpdates.Missions.Tag];
|
{
|
||||||
if (node.miscItemFee) {
|
ItemType: node.miscItemFee.ItemType,
|
||||||
addMiscItems(inventory, [
|
ItemCount: node.miscItemFee.ItemCount * -1
|
||||||
{
|
}
|
||||||
ItemType: node.miscItemFee.ItemType,
|
]);
|
||||||
ItemCount: node.miscItemFee.ItemCount * -1
|
}
|
||||||
}
|
}
|
||||||
]);
|
if (
|
||||||
|
inventoryUpdates.MissionFailed &&
|
||||||
|
inventoryUpdates.MissionStatus == "GS_FAILURE" &&
|
||||||
|
inventoryUpdates.ObjectiveReached &&
|
||||||
|
!inventoryUpdates.LockedWeaponGroup
|
||||||
|
) {
|
||||||
|
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!;
|
||||||
|
const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!;
|
||||||
|
const SuitId = new Types.ObjectId(config.s!.ItemId.$oid);
|
||||||
|
|
||||||
|
inventory.BrandedSuits ??= [];
|
||||||
|
if (!inventory.BrandedSuits.find(x => x.equals(SuitId))) {
|
||||||
|
inventory.BrandedSuits.push(SuitId);
|
||||||
|
|
||||||
|
await createMessage(inventory.accountOwnerId, [
|
||||||
|
{
|
||||||
|
sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
|
||||||
|
msg: "/Lotus/Language/G1Quests/BrandedMessage",
|
||||||
|
sub: "/Lotus/Language/G1Quests/BrandedTitle",
|
||||||
|
att: ["/Lotus/Types/Recipes/Components/BrandRemovalBlueprint"],
|
||||||
|
highPriority: true // TOVERIFY: I cannot find any content of this within the last 10 years so I can only assume that highPriority is set (it certainly would make sense), but I just don't know for sure that it is so on live.
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inventoryUpdates.RewardInfo) {
|
if (inventoryUpdates.RewardInfo) {
|
||||||
@ -110,32 +133,6 @@ export const addMissionInventoryUpdates = async (
|
|||||||
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
|
||||||
inventoryUpdates.MissionFailed &&
|
|
||||||
inventoryUpdates.MissionStatus == "GS_FAILURE" &&
|
|
||||||
inventoryUpdates.EndOfMatchUpload &&
|
|
||||||
inventoryUpdates.ObjectiveReached &&
|
|
||||||
!inventoryUpdates.LockedWeaponGroup
|
|
||||||
) {
|
|
||||||
const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!;
|
|
||||||
const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!;
|
|
||||||
const SuitId = new Types.ObjectId(config.s!.ItemId.$oid);
|
|
||||||
|
|
||||||
inventory.BrandedSuits ??= [];
|
|
||||||
if (!inventory.BrandedSuits.find(x => x.equals(SuitId))) {
|
|
||||||
inventory.BrandedSuits.push(SuitId);
|
|
||||||
|
|
||||||
await createMessage(inventory.accountOwnerId, [
|
|
||||||
{
|
|
||||||
sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
|
|
||||||
msg: "/Lotus/Language/G1Quests/BrandedMessage",
|
|
||||||
sub: "/Lotus/Language/G1Quests/BrandedTitle",
|
|
||||||
att: ["/Lotus/Types/Recipes/Components/BrandRemovalBlueprint"],
|
|
||||||
highPriority: true // TOVERIFY: I cannot find any content of this within the last 10 years so I can only assume that highPriority is set (it certainly would make sense), but I just don't know for sure that it is so on live.
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
|
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
logger.error(`Inventory update key ${key} has no value `);
|
logger.error(`Inventory update key ${key} has no value `);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user