2023-06-01 17:08:05 -07:00
|
|
|
import { RequestHandler } from "express";
|
2023-08-31 14:29:09 +04:00
|
|
|
import { missionInventoryUpdate } from "@/src/services/inventoryService";
|
2023-09-05 07:37:30 -05:00
|
|
|
import { IMissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
|
2023-08-31 14:29:09 +04:00
|
|
|
/*
|
|
|
|
- [ ] crossPlaySetting
|
|
|
|
- [ ] rewardsMultiplier
|
|
|
|
- [ ] ActiveBoosters
|
|
|
|
- [x] LongGuns
|
|
|
|
- [x] Pistols
|
|
|
|
- [x] Suits
|
|
|
|
- [x] Melee
|
|
|
|
- [x] RawUpgrades
|
|
|
|
- [x] MiscItems
|
|
|
|
- [x] RegularCredits
|
|
|
|
- [ ] RandomUpgradesIdentified
|
|
|
|
- [ ] MissionFailed
|
|
|
|
- [ ] MissionStatus
|
|
|
|
- [ ] CurrentLoadOutIds
|
|
|
|
- [ ] AliveTime
|
|
|
|
- [ ] MissionTime
|
|
|
|
- [ ] Missions
|
|
|
|
- [ ] CompletedAlerts
|
|
|
|
- [ ] LastRegionPlayed
|
|
|
|
- [ ] GameModeId
|
|
|
|
- [ ] hosts
|
|
|
|
- [x] ChallengeProgress
|
|
|
|
- [ ] SeasonChallengeHistory
|
2023-09-05 07:37:30 -05:00
|
|
|
- [ ] PS (Passive anti-cheat data which includes your username, module list, process list, and system name.)
|
2023-08-31 14:29:09 +04:00
|
|
|
- [ ] ActiveDojoColorResearch
|
|
|
|
- [ ] RewardInfo
|
|
|
|
- [ ] ReceivedCeremonyMsg
|
|
|
|
- [ ] LastCeremonyResetDate
|
2023-09-05 07:37:30 -05:00
|
|
|
- [ ] MissionPTS (Used to validate the mission/alive time above.)
|
|
|
|
- [ ] RepHash (A hash from the replication manager/RepMgr Unknown what it does.)
|
2023-08-31 14:29:09 +04:00
|
|
|
- [ ] EndOfMatchUpload
|
|
|
|
- [ ] ObjectiveReached
|
|
|
|
- [ ] FpsAvg
|
|
|
|
- [ ] FpsMin
|
|
|
|
- [ ] FpsMax
|
|
|
|
- [ ] FpsSamples
|
|
|
|
*/
|
2023-06-01 17:08:05 -07:00
|
|
|
|
2023-08-31 14:29:09 +04:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
|
|
const missionInventoryUpdateController: RequestHandler = async (req, res) => {
|
|
|
|
const id = req.query.accountId as string;
|
|
|
|
|
2023-09-05 07:37:30 -05:00
|
|
|
const [data] = String(req.body).split("\n");
|
2023-08-31 14:29:09 +04:00
|
|
|
|
|
|
|
try {
|
2023-09-05 07:37:30 -05:00
|
|
|
const parsedData = JSON.parse(data) as IMissionInventoryUpdate;
|
|
|
|
if (typeof parsedData !== "object") throw new Error("Invalid data format");
|
2023-08-31 14:29:09 +04:00
|
|
|
await missionInventoryUpdate(parsedData, id);
|
|
|
|
} catch (err) {
|
|
|
|
console.error("Error parsing JSON data:", err);
|
|
|
|
}
|
|
|
|
|
2023-09-05 07:37:30 -05:00
|
|
|
// TODO - Return the updated inventory the way the game does it.
|
2023-06-01 17:08:05 -07:00
|
|
|
res.json({});
|
|
|
|
};
|
|
|
|
|
|
|
|
export { missionInventoryUpdateController };
|