fix: conservation standing changes not showing in progress screen
This commit is contained in:
parent
be8baf0f9b
commit
429d1e555e
@ -2,7 +2,11 @@ import type { RequestHandler } from "express";
|
|||||||
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
|
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
|
||||||
import { getAccountForRequest } from "../../services/loginService.ts";
|
import { getAccountForRequest } from "../../services/loginService.ts";
|
||||||
import type { IMissionInventoryUpdateRequest } from "../../types/requestTypes.ts";
|
import type { IMissionInventoryUpdateRequest } from "../../types/requestTypes.ts";
|
||||||
import { addMissionInventoryUpdates, addMissionRewards } from "../../services/missionInventoryUpdateService.ts";
|
import {
|
||||||
|
addMissionInventoryUpdates,
|
||||||
|
addMissionRewards,
|
||||||
|
handleConservation
|
||||||
|
} from "../../services/missionInventoryUpdateService.ts";
|
||||||
import { getInventory } from "../../services/inventoryService.ts";
|
import { getInventory } from "../../services/inventoryService.ts";
|
||||||
import { getInventoryResponse } from "./inventoryController.ts";
|
import { getInventoryResponse } from "./inventoryController.ts";
|
||||||
import { logger } from "../../utils/logger.ts";
|
import { logger } from "../../utils/logger.ts";
|
||||||
@ -94,6 +98,7 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
SyndicateXPItemReward,
|
SyndicateXPItemReward,
|
||||||
ConquestCompletedMissionsCount
|
ConquestCompletedMissionsCount
|
||||||
} = await addMissionRewards(account, inventory, missionReport, firstCompletion);
|
} = await addMissionRewards(account, inventory, missionReport, firstCompletion);
|
||||||
|
handleConservation(inventory, missionReport, AffiliationMods); // Conservation reports have GS_SUCCESS
|
||||||
|
|
||||||
if (missionReport.EndOfMatchUpload) {
|
if (missionReport.EndOfMatchUpload) {
|
||||||
inventory.RewardSeed = generateRewardSeed();
|
inventory.RewardSeed = generateRewardSeed();
|
||||||
|
|||||||
@ -517,48 +517,6 @@ export const addMissionInventoryUpdates = async (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "CapturedAnimals": {
|
|
||||||
for (const capturedAnimal of value) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
||||||
const meta = ExportAnimals[capturedAnimal.AnimalType]?.conservation;
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
||||||
if (meta) {
|
|
||||||
if (capturedAnimal.NumTags) {
|
|
||||||
addMiscItems(inventory, [
|
|
||||||
{
|
|
||||||
ItemType: meta.itemReward,
|
|
||||||
ItemCount: capturedAnimal.NumTags * capturedAnimal.Count
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (capturedAnimal.NumExtraRewards) {
|
|
||||||
if (meta.woundedAnimalReward) {
|
|
||||||
addMiscItems(inventory, [
|
|
||||||
{
|
|
||||||
ItemType: meta.woundedAnimalReward,
|
|
||||||
ItemCount: capturedAnimal.NumExtraRewards * capturedAnimal.Count
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
logger.warn(
|
|
||||||
`client attempted to claim unknown extra rewards for conservation of ${capturedAnimal.AnimalType}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (meta.standingReward) {
|
|
||||||
const syndicateTag =
|
|
||||||
inventoryUpdates.Missions!.Tag == "SolNode129" ? "SolarisSyndicate" : "CetusSyndicate";
|
|
||||||
const standing =
|
|
||||||
[2, 1.5, 1][capturedAnimal.CaptureRating] * meta.standingReward * capturedAnimal.Count;
|
|
||||||
logger.debug(`adding ${standing} standing to ${syndicateTag} for conservation`);
|
|
||||||
addStanding(inventory, syndicateTag, standing);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.warn(`ignoring conservation of unknown AnimalType: ${capturedAnimal.AnimalType}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "KubrowPetEggs": {
|
case "KubrowPetEggs": {
|
||||||
for (const egg of value) {
|
for (const egg of value) {
|
||||||
inventory.KubrowPetEggs.push({
|
inventory.KubrowPetEggs.push({
|
||||||
@ -963,7 +921,7 @@ interface AddMissionRewardsReturnType {
|
|||||||
MissionRewards: IMissionReward[];
|
MissionRewards: IMissionReward[];
|
||||||
inventoryChanges?: IInventoryChanges;
|
inventoryChanges?: IInventoryChanges;
|
||||||
credits?: IMissionCredits;
|
credits?: IMissionCredits;
|
||||||
AffiliationMods?: IAffiliationMods[];
|
AffiliationMods: IAffiliationMods[];
|
||||||
SyndicateXPItemReward?: number;
|
SyndicateXPItemReward?: number;
|
||||||
ConquestCompletedMissionsCount?: number;
|
ConquestCompletedMissionsCount?: number;
|
||||||
}
|
}
|
||||||
@ -1142,7 +1100,7 @@ export const addMissionRewards = async (
|
|||||||
if (!rewardInfo) {
|
if (!rewardInfo) {
|
||||||
//TODO: if there is a case where you can have credits collected during a mission but no rewardInfo, add credits needs to be handled earlier
|
//TODO: if there is a case where you can have credits collected during a mission but no rewardInfo, add credits needs to be handled earlier
|
||||||
logger.debug(`Mission ${missions!.Tag} did not have Reward Info `);
|
logger.debug(`Mission ${missions!.Tag} did not have Reward Info `);
|
||||||
return { MissionRewards: [] };
|
return { MissionRewards: [], AffiliationMods: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: check double reward merging
|
//TODO: check double reward merging
|
||||||
@ -2254,6 +2212,54 @@ function getRandomMissionDrops(
|
|||||||
return drops;
|
return drops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const handleConservation = (
|
||||||
|
inventory: TInventoryDatabaseDocument,
|
||||||
|
missionReport: IMissionInventoryUpdateRequest,
|
||||||
|
AffiliationMods: IAffiliationMods[]
|
||||||
|
): void => {
|
||||||
|
if (missionReport.CapturedAnimals) {
|
||||||
|
for (const capturedAnimal of missionReport.CapturedAnimals) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
|
const meta = ExportAnimals[capturedAnimal.AnimalType]?.conservation;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
|
if (meta) {
|
||||||
|
if (capturedAnimal.NumTags) {
|
||||||
|
addMiscItems(inventory, [
|
||||||
|
{
|
||||||
|
ItemType: meta.itemReward,
|
||||||
|
ItemCount: capturedAnimal.NumTags * capturedAnimal.Count
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (capturedAnimal.NumExtraRewards) {
|
||||||
|
if (meta.woundedAnimalReward) {
|
||||||
|
addMiscItems(inventory, [
|
||||||
|
{
|
||||||
|
ItemType: meta.woundedAnimalReward,
|
||||||
|
ItemCount: capturedAnimal.NumExtraRewards * capturedAnimal.Count
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
logger.warn(
|
||||||
|
`client attempted to claim unknown extra rewards for conservation of ${capturedAnimal.AnimalType}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (meta.standingReward) {
|
||||||
|
addStanding(
|
||||||
|
inventory,
|
||||||
|
missionReport.Missions!.Tag == "SolNode129" ? "SolarisSyndicate" : "CetusSyndicate",
|
||||||
|
[2, 1.5, 1][capturedAnimal.CaptureRating] * meta.standingReward * capturedAnimal.Count,
|
||||||
|
AffiliationMods
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn(`ignoring conservation of unknown AnimalType: ${capturedAnimal.AnimalType}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const corruptedMods = [
|
const corruptedMods = [
|
||||||
"/Lotus/StoreItems/Upgrades/Mods/Melee/DualStat/CorruptedHeavyDamageChargeSpeedMod", // Corrupt Charge
|
"/Lotus/StoreItems/Upgrades/Mods/Melee/DualStat/CorruptedHeavyDamageChargeSpeedMod", // Corrupt Charge
|
||||||
"/Lotus/StoreItems/Upgrades/Mods/Pistol/DualStat/CorruptedCritDamagePistol", // Hollow Point
|
"/Lotus/StoreItems/Upgrades/Mods/Pistol/DualStat/CorruptedCritDamagePistol", // Hollow Point
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user