Update 33.6.8 + mastery training (#55)
This commit is contained in:
parent
67b7338381
commit
b8e49c40af
@ -1,8 +1,8 @@
|
||||
{
|
||||
"autoCreateAccount": true,
|
||||
"buildLabel": "2023.08.31.08.49/GF1WtVJD8oH48xuIF4Cm-A",
|
||||
"matchmakingBuildId": "2303555329115379348",
|
||||
"version": "33.6.7",
|
||||
"buildLabel": "2023.08.31.08.49/brZhF2aVfaQsmU9STfvSqQ",
|
||||
"matchmakingBuildId": "5359904157077190191",
|
||||
"version": "33.6.8",
|
||||
"worldSeed": "Y7nz7/N46OXUuG0UFBiaQhuY59a8IR8fIpwPJu3Uw0y0WGqS1BTISQ3FiQ4RV2Q4L19X7rr9864tDFU2xklR+PvdayCI+/+07iHK2LzxoaSRysylW/3U5rINPDLA4akw5LwsMltL3VuEyxvn9MXKamUO27i+lP5Bsg6Fbmx4UwgqOjQaYMjAqPn0yy+VY6vZsQJFCCLM5wDghhpcwDuTFzakKiq4N5nKPc7+VPNDRKE6qlMzPRt9DCzrtpakn6/WdFecmt9Gzl/HFe1fmZSYE1bEbvL93d1Nvi391YZNLIlRqSg/h+Hirbw8pT7xxbgsXVyJo/TbyivwyQt/ay70Vw==",
|
||||
"skipStoryModeChoice": true,
|
||||
"skipTutorial": true,
|
||||
|
14
src/constants/timeConstants.ts
Normal file
14
src/constants/timeConstants.ts
Normal file
@ -0,0 +1,14 @@
|
||||
const millisecondsPerSecond = 1000;
|
||||
const secondsPerMinute = 60;
|
||||
const minutesPerHour = 60;
|
||||
const hoursPerDay = 24;
|
||||
|
||||
const unixMinute = secondsPerMinute * millisecondsPerSecond;
|
||||
const unixHour = unixMinute * minutesPerHour;
|
||||
const unixDay = hoursPerDay * unixHour;
|
||||
|
||||
export const unixTimesInMs = {
|
||||
minute: unixMinute,
|
||||
hour: unixHour,
|
||||
day: unixDay
|
||||
};
|
@ -23,12 +23,12 @@ const inventoryController: RequestHandler = async (request: Request, response: R
|
||||
|
||||
const inventoryJSON = inventory.toJSON();
|
||||
|
||||
const inventoreResponse = toInventoryResponse(inventoryJSON);
|
||||
const inventoryResponse = toInventoryResponse(inventoryJSON);
|
||||
|
||||
if (config.testMission) inventoreResponse.Missions = testMissions;
|
||||
if (config.testQuestKey) inventoreResponse.QuestKeys = testQuestKeys;
|
||||
if (config.testMission) inventoryResponse.Missions = testMissions;
|
||||
if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys;
|
||||
|
||||
response.json(inventoreResponse);
|
||||
response.json(inventoryResponse);
|
||||
};
|
||||
|
||||
export { inventoryController };
|
||||
|
44
src/controllers/api/trainingResultController.ts
Normal file
44
src/controllers/api/trainingResultController.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { parseString } from "@/src/helpers/general";
|
||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||
import { Inventory } from "@/src/models/inventoryModel";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { IMongoDate } from "@/src/types/commonTypes";
|
||||
import { RequestHandler } from "express";
|
||||
import { unixTimesInMs } from "@/src/constants/timeConstants";
|
||||
|
||||
interface ITrainingResultsRequest {
|
||||
numLevelsGained: number;
|
||||
}
|
||||
|
||||
interface ITrainingResultsResponse {
|
||||
NewTrainingDate: IMongoDate;
|
||||
NewLevel: number;
|
||||
InventoryChanges: any[];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
const trainingResultController: RequestHandler = async (req, res): Promise<void> => {
|
||||
const accountId = parseString(req.query.accountId);
|
||||
|
||||
const trainingResults = getJSONfromString(req.body.toString()) as ITrainingResultsRequest;
|
||||
|
||||
const inventory = await getInventory(accountId);
|
||||
|
||||
inventory.TrainingDate = new Date(Date.now() + unixTimesInMs.day);
|
||||
|
||||
if (trainingResults.numLevelsGained == 1) {
|
||||
inventory.PlayerLevel += 1;
|
||||
}
|
||||
|
||||
const changedinventory = await inventory.save();
|
||||
|
||||
res.json({
|
||||
NewTrainingDate: {
|
||||
$date: { $numberLong: changedinventory.TrainingDate.getTime().toString() }
|
||||
},
|
||||
NewLevel: trainingResults.numLevelsGained == 1 ? changedinventory.PlayerLevel : inventory.PlayerLevel,
|
||||
InventoryChanges: []
|
||||
} satisfies ITrainingResultsResponse);
|
||||
};
|
||||
|
||||
export { trainingResultController };
|
@ -3,9 +3,6 @@ import config from "@/config.json";
|
||||
import worldState from "@/static/fixed_responses/worldState.json";
|
||||
|
||||
const worldStateController: RequestHandler = (_req, res) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
worldState.WorldSeed = config.worldSeed;
|
||||
worldState.BuildLabel = config.buildLabel;
|
||||
res.json(worldState);
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RequestHandler } from "express";
|
||||
|
||||
const uploadController: RequestHandler = (_req, res) => {
|
||||
res.json({});
|
||||
res.status(200).end();
|
||||
};
|
||||
|
||||
export { uploadController };
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
// a schema's toJSON is responsible for changing Oid and Date to their corresponding Response versions __id to "ItemId":{"$oid":"6450f720bc562ebf030222d4"}, and a Date to "date":{"$date":{"$numberLong":"unix timestamp"})
|
||||
const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { accountOwnerId, ...inventoreResponse } = inventoryDatabase;
|
||||
return inventoreResponse;
|
||||
const { accountOwnerId, ...inventoryResponse } = inventoryDatabase;
|
||||
return inventoryResponse as unknown as IInventoryResponse;
|
||||
};
|
||||
|
||||
export { toInventoryResponse };
|
||||
|
@ -4,10 +4,13 @@ import {
|
||||
IRawUpgrade,
|
||||
IMiscItem,
|
||||
IInventoryDatabase,
|
||||
IBooster
|
||||
IBooster,
|
||||
IInventoryResponse,
|
||||
IInventoryDatabaseDocument,
|
||||
IInventoryResponseDocument
|
||||
} from "../types/inventoryTypes/inventoryTypes";
|
||||
import { IOid } from "../types/commonTypes";
|
||||
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
|
||||
import { IMongoDate, IOid } from "../types/commonTypes";
|
||||
import { ISuitDatabase, ISuitDocument } from "@/src/types/inventoryTypes/SuitTypes";
|
||||
import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
|
||||
|
||||
const abilityOverrideSchema = new Schema({
|
||||
@ -25,7 +28,7 @@ const colorSchema = new Schema({
|
||||
m1: Number
|
||||
});
|
||||
|
||||
const longGunConfigSchema = new Schema({
|
||||
const weaponConfigSchema = new Schema({
|
||||
Skins: [String],
|
||||
pricol: colorSchema,
|
||||
attcol: colorSchema,
|
||||
@ -57,7 +60,7 @@ const longGunConfigSchema = new Schema({
|
||||
|
||||
const WeaponSchema = new Schema({
|
||||
ItemType: String,
|
||||
Configs: [longGunConfigSchema],
|
||||
Configs: [weaponConfigSchema],
|
||||
UpgradeVer: Number,
|
||||
XP: Number,
|
||||
Features: Number,
|
||||
@ -188,7 +191,7 @@ FlavourItemSchema.set("toJSON", {
|
||||
}
|
||||
});
|
||||
|
||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
|
||||
const inventorySchema = new Schema<IInventoryDatabaseDocument, InventoryDocumentProps>({
|
||||
accountOwnerId: Schema.Types.ObjectId,
|
||||
SubscribedToEmails: Number,
|
||||
Created: Schema.Types.Mixed,
|
||||
@ -235,7 +238,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
|
||||
Recipes: [Schema.Types.Mixed],
|
||||
WeaponSkins: [Schema.Types.Mixed],
|
||||
PendingRecipes: [Schema.Types.Mixed],
|
||||
TrainingDate: Schema.Types.Mixed,
|
||||
TrainingDate: Date,
|
||||
PlayerLevel: Number,
|
||||
Upgrades: [Upgrade],
|
||||
EquippedGear: [String],
|
||||
@ -364,6 +367,14 @@ inventorySchema.set("toJSON", {
|
||||
transform(_document, returnedObject) {
|
||||
delete returnedObject._id;
|
||||
delete returnedObject.__v;
|
||||
|
||||
const trainingDate = (returnedObject as IInventoryDatabaseDocument).TrainingDate;
|
||||
|
||||
(returnedObject as IInventoryResponse).TrainingDate = {
|
||||
$date: {
|
||||
$numberLong: trainingDate.getTime().toString()
|
||||
}
|
||||
} satisfies IMongoDate;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -29,6 +29,7 @@ import { updateSessionGetController, updateSessionPostController } from "@/src/c
|
||||
import { viewController } from "@/src/controllers/api/viewController";
|
||||
import { joinSessionController } from "@/src/controllers/api/joinSessionController";
|
||||
import { saveLoadoutController } from "@/src/controllers/api/saveLoadout";
|
||||
import { trainingResultController } from "@/src/controllers/api/trainingResultController";
|
||||
import { artifactsController } from "../controllers/api/artifactsController";
|
||||
|
||||
import express from "express";
|
||||
@ -73,4 +74,6 @@ apiRouter.post("/genericUpdate.php", genericUpdateController);
|
||||
apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
|
||||
apiRouter.post("/joinSession.php", joinSessionController);
|
||||
apiRouter.post("/saveLoadout.php", saveLoadoutController);
|
||||
apiRouter.post("/trainingResult.php", trainingResultController);
|
||||
|
||||
export { apiRouter };
|
||||
|
@ -38,7 +38,7 @@ const createInventory = async (accountOwnerId: Types.ObjectId) => {
|
||||
|
||||
//const updateInventory = async (accountOwnerId: Types.ObjectId, inventoryChanges: any) => {};
|
||||
|
||||
const getInventory = async (accountOwnerId: string) => {
|
||||
export const getInventory = async (accountOwnerId: string) => {
|
||||
const inventory = await Inventory.findOne({ accountOwnerId: accountOwnerId });
|
||||
|
||||
if (!inventory) {
|
||||
|
@ -1,3 +1,9 @@
|
||||
export interface IOid {
|
||||
$oid: string;
|
||||
}
|
||||
|
||||
export interface IMongoDate {
|
||||
$date: {
|
||||
$numberLong: string;
|
||||
};
|
||||
}
|
||||
|
@ -1,19 +1,21 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Document, Types } from "mongoose";
|
||||
import { IOid } from "../commonTypes";
|
||||
import { IOid, IMongoDate } from "../commonTypes";
|
||||
import { IAbilityOverride, IColor, FocusSchool, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
|
||||
import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
|
||||
|
||||
export interface IInventoryDatabase extends IInventoryResponse {
|
||||
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
|
||||
export interface IInventoryDatabase extends Omit<IInventoryResponse, "TrainingDate"> {
|
||||
accountOwnerId: Types.ObjectId;
|
||||
TrainingDate: Date;
|
||||
}
|
||||
|
||||
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
|
||||
export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
|
||||
|
||||
export interface IInventoryResponse {
|
||||
SubscribedToEmails: number;
|
||||
Created: Date;
|
||||
Created: IMongoDate;
|
||||
RewardSeed: number;
|
||||
RegularCredits: number;
|
||||
PremiumCredits: number;
|
||||
@ -57,7 +59,7 @@ export interface IInventoryResponse {
|
||||
Recipes: IConsumable[];
|
||||
WeaponSkins: IWeaponSkin[];
|
||||
PendingRecipes: IPendingRecipe[];
|
||||
TrainingDate: Date;
|
||||
TrainingDate: IMongoDate;
|
||||
PlayerLevel: number;
|
||||
Upgrades: ICrewShipSalvagedWeaponSkin[];
|
||||
EquippedGear: string[];
|
||||
@ -134,7 +136,7 @@ export interface IInventoryResponse {
|
||||
InvasionChainProgress: IInvasionChainProgress[];
|
||||
DataKnives: IDataKnife[];
|
||||
NemesisHistory: INemesisHistory[];
|
||||
LastNemesisAllySpawnTime: Date;
|
||||
LastNemesisAllySpawnTime: IMongoDate;
|
||||
Settings: ISettings;
|
||||
PersonalTechProjects: IPersonalTechProject[];
|
||||
CrewShips: ICrewShip[];
|
||||
@ -145,7 +147,7 @@ export interface IInventoryResponse {
|
||||
CrewShipWeapons: ICrewShipWeapon[];
|
||||
CrewShipSalvagedWeapons: ICrewShipWeapon[];
|
||||
CrewShipWeaponSkins: ICrewShipSalvagedWeaponSkin[];
|
||||
TradeBannedUntil: Date;
|
||||
TradeBannedUntil: IMongoDate;
|
||||
PlayedParkourTutorial: boolean;
|
||||
SubscribedToEmailsPersonalized: number;
|
||||
MechBin: ICrewMemberBinClass;
|
||||
@ -153,7 +155,7 @@ export interface IInventoryResponse {
|
||||
DailyAffiliationNecraloid: number;
|
||||
MechSuits: IMechSuit[];
|
||||
InfestedFoundry: IInfestedFoundry;
|
||||
BlessingCooldown: Date;
|
||||
BlessingCooldown: IMongoDate;
|
||||
CrewMemberBin: ICrewMemberBinClass;
|
||||
CrewShipHarnesses: ICrewShipHarness[];
|
||||
CrewShipRawSalvage: IConsumable[];
|
||||
@ -165,7 +167,7 @@ export interface IInventoryResponse {
|
||||
NemesisAbandonedRewards: string[];
|
||||
DailyAffiliationKahl: number;
|
||||
LastInventorySync: IOid;
|
||||
NextRefill: Date;
|
||||
NextRefill: IMongoDate;
|
||||
ActiveLandscapeTraps: any[];
|
||||
EvolutionProgress: any[];
|
||||
RepVotes: any[];
|
||||
@ -206,10 +208,6 @@ export interface IAlignment {
|
||||
Alignment: number;
|
||||
}
|
||||
|
||||
export interface IDate {
|
||||
$date: { $numberLong: string };
|
||||
}
|
||||
|
||||
export interface IBooster {
|
||||
ExpiryDate: number;
|
||||
ItemType: string;
|
||||
@ -270,7 +268,7 @@ export interface ICrewMember {
|
||||
ItemType: string;
|
||||
NemesisFingerprint: number;
|
||||
Seed: number;
|
||||
HireDate: Date;
|
||||
HireDate: IMongoDate;
|
||||
AssignedRole: number;
|
||||
SkillEfficiency: ISkillEfficiency;
|
||||
WeaponConfigIdx: number;
|
||||
@ -430,7 +428,7 @@ export interface IDrone {
|
||||
ItemType: string;
|
||||
CurrentHP: number;
|
||||
ItemId: IOid;
|
||||
RepairStart?: Date;
|
||||
RepairStart?: IMongoDate;
|
||||
}
|
||||
|
||||
export interface IEmailItem {
|
||||
@ -518,7 +516,7 @@ export interface IInvasionChainProgress {
|
||||
|
||||
export interface IKubrowPetEgg {
|
||||
ItemType: KubrowPetEggItemType;
|
||||
ExpirationDate: Date;
|
||||
ExpirationDate: IMongoDate;
|
||||
ItemId: IOid;
|
||||
}
|
||||
|
||||
@ -571,7 +569,7 @@ export interface IKubrowPet {
|
||||
Polarized?: number;
|
||||
Polarity?: IPolarity[];
|
||||
Features?: number;
|
||||
InfestationDate?: Date;
|
||||
InfestationDate?: IMongoDate;
|
||||
InfestationDays?: number;
|
||||
InfestationType?: string;
|
||||
ItemId: IOid;
|
||||
@ -591,7 +589,7 @@ export interface IDetails {
|
||||
HasCollar: boolean;
|
||||
PrintsRemaining: number;
|
||||
Status: Status;
|
||||
HatchDate: Date;
|
||||
HatchDate: IMongoDate;
|
||||
DominantTraits: ITraits;
|
||||
RecessiveTraits: ITraits;
|
||||
IsMale: boolean;
|
||||
@ -734,7 +732,7 @@ export interface IMission {
|
||||
Completes: number;
|
||||
Tier?: number;
|
||||
Tag: string;
|
||||
RewardsCooldownTime?: Date;
|
||||
RewardsCooldownTime?: IMongoDate;
|
||||
}
|
||||
|
||||
export interface IMoaPet {
|
||||
@ -759,7 +757,7 @@ export interface INemesisHistory {
|
||||
BirthNode: BirthNode;
|
||||
Rank: number;
|
||||
k: boolean;
|
||||
d: Date;
|
||||
d: IMongoDate;
|
||||
GuessHistory?: number[];
|
||||
currentGuess?: number;
|
||||
Traded?: boolean;
|
||||
@ -808,13 +806,13 @@ export interface IOperatorLoadOut {
|
||||
}
|
||||
|
||||
export interface IPendingCoupon {
|
||||
Expiry: Date;
|
||||
Expiry: IMongoDate;
|
||||
Discount: number;
|
||||
}
|
||||
|
||||
export interface IPendingRecipe {
|
||||
ItemType: string;
|
||||
CompletionDate: Date;
|
||||
CompletionDate: IMongoDate;
|
||||
ItemId: IOid;
|
||||
}
|
||||
|
||||
@ -872,8 +870,8 @@ export enum GivingSlotOrderInfo {
|
||||
LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod"
|
||||
}
|
||||
|
||||
export interface IPeriodicMissionCompletion {
|
||||
date: Date;
|
||||
export interface PeriodicMissionCompletion {
|
||||
date: IMongoDate;
|
||||
tag: string;
|
||||
count?: number;
|
||||
}
|
||||
@ -892,7 +890,7 @@ export interface IPersonalTechProject {
|
||||
ReqCredits: number;
|
||||
ItemType: string;
|
||||
ReqItems: IConsumable[];
|
||||
CompletionDate?: Date;
|
||||
CompletionDate?: IMongoDate;
|
||||
ItemId: IOid;
|
||||
ProductCategory?: string;
|
||||
CategoryItemId?: IOid;
|
||||
@ -919,7 +917,7 @@ export interface IQuestKey {
|
||||
unlock?: boolean;
|
||||
Completed?: boolean;
|
||||
ItemType: string;
|
||||
CompletionDate?: Date;
|
||||
CompletionDate?: IMongoDate;
|
||||
}
|
||||
|
||||
export interface IProgress {
|
||||
@ -1096,15 +1094,15 @@ export interface IWebFlags {
|
||||
activeBuyPlat: number;
|
||||
noShow2FA: boolean;
|
||||
Tennocon2018Digital: boolean;
|
||||
VisitPrimeAccess: Date;
|
||||
VisitTennocon2019: Date;
|
||||
enteredSC2019: Date;
|
||||
VisitPrimeVault: Date;
|
||||
VisitBuyPlatinum: Date;
|
||||
ClickedSku_640_Page__en_buyplatinum: Date;
|
||||
ClickedSku_640_Page__buyplatinum: Date;
|
||||
VisitStarterPack: Date;
|
||||
VisitPrimeAccess: IMongoDate;
|
||||
VisitTennocon2019: IMongoDate;
|
||||
enteredSC2019: IMongoDate;
|
||||
VisitPrimeVault: IMongoDate;
|
||||
VisitBuyPlatinum: IMongoDate;
|
||||
ClickedSku_640_Page__en_buyplatinum: IMongoDate;
|
||||
ClickedSku_640_Page__buyplatinum: IMongoDate;
|
||||
VisitStarterPack: IMongoDate;
|
||||
Tennocon2020Digital: boolean;
|
||||
Anniversary2021: boolean;
|
||||
HitDownloadBtn: Date;
|
||||
HitDownloadBtn: IMongoDate;
|
||||
}
|
||||
|
@ -96,6 +96,8 @@
|
||||
"AdultOperatorLoadOuts": [],
|
||||
"KahlLoadOuts": [],
|
||||
"PendingRecipes": [],
|
||||
"TrainingDate": 0,
|
||||
"PlayerLevel": 0,
|
||||
"PersonalGoalProgress": [],
|
||||
"PersonalTechProjects": [],
|
||||
"QualifyingInvasions": [],
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user