Update 33.6.8 + mastery training #55

Merged
OrdisPrime merged 31 commits from masteryTraining into main 2023-09-11 04:20:07 -07:00
14 changed files with 1283 additions and 1517 deletions

View File

@ -1,8 +1,8 @@
{ {
"autoCreateAccount": true, "autoCreateAccount": true,
"buildLabel": "2023.08.31.08.49/GF1WtVJD8oH48xuIF4Cm-A", "buildLabel": "2023.08.31.08.49/brZhF2aVfaQsmU9STfvSqQ",
"matchmakingBuildId": "2303555329115379348", "matchmakingBuildId": "5359904157077190191",
"version": "33.6.7", "version": "33.6.8",
"worldSeed": "Y7nz7/N46OXUuG0UFBiaQhuY59a8IR8fIpwPJu3Uw0y0WGqS1BTISQ3FiQ4RV2Q4L19X7rr9864tDFU2xklR+PvdayCI+/+07iHK2LzxoaSRysylW/3U5rINPDLA4akw5LwsMltL3VuEyxvn9MXKamUO27i+lP5Bsg6Fbmx4UwgqOjQaYMjAqPn0yy+VY6vZsQJFCCLM5wDghhpcwDuTFzakKiq4N5nKPc7+VPNDRKE6qlMzPRt9DCzrtpakn6/WdFecmt9Gzl/HFe1fmZSYE1bEbvL93d1Nvi391YZNLIlRqSg/h+Hirbw8pT7xxbgsXVyJo/TbyivwyQt/ay70Vw==", "worldSeed": "Y7nz7/N46OXUuG0UFBiaQhuY59a8IR8fIpwPJu3Uw0y0WGqS1BTISQ3FiQ4RV2Q4L19X7rr9864tDFU2xklR+PvdayCI+/+07iHK2LzxoaSRysylW/3U5rINPDLA4akw5LwsMltL3VuEyxvn9MXKamUO27i+lP5Bsg6Fbmx4UwgqOjQaYMjAqPn0yy+VY6vZsQJFCCLM5wDghhpcwDuTFzakKiq4N5nKPc7+VPNDRKE6qlMzPRt9DCzrtpakn6/WdFecmt9Gzl/HFe1fmZSYE1bEbvL93d1Nvi391YZNLIlRqSg/h+Hirbw8pT7xxbgsXVyJo/TbyivwyQt/ay70Vw==",
"skipStoryModeChoice": true, "skipStoryModeChoice": true,
"skipTutorial": true, "skipTutorial": true,

View 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
};

View File

@ -23,12 +23,12 @@ const inventoryController: RequestHandler = async (request: Request, response: R
const inventoryJSON = inventory.toJSON(); const inventoryJSON = inventory.toJSON();
const inventoreResponse = toInventoryResponse(inventoryJSON); const inventoryResponse = toInventoryResponse(inventoryJSON);
if (config.testMission) inventoreResponse.Missions = testMissions; if (config.testMission) inventoryResponse.Missions = testMissions;
if (config.testQuestKey) inventoreResponse.QuestKeys = testQuestKeys; if (config.testQuestKey) inventoryResponse.QuestKeys = testQuestKeys;
response.json(inventoreResponse); response.json(inventoryResponse);
}; };
export { inventoryController }; export { inventoryController };

View 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 };

View File

@ -3,9 +3,6 @@ import config from "@/config.json";
import worldState from "@/static/fixed_responses/worldState.json"; import worldState from "@/static/fixed_responses/worldState.json";
const worldStateController: RequestHandler = (_req, res) => { 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); res.json(worldState);
}; };

View File

@ -1,7 +1,7 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
const uploadController: RequestHandler = (_req, res) => { const uploadController: RequestHandler = (_req, res) => {
res.json({}); res.status(200).end();
}; };
export { uploadController }; export { uploadController };

View File

@ -1,9 +1,10 @@
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes"; 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 => { const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { accountOwnerId, ...inventoreResponse } = inventoryDatabase; const { accountOwnerId, ...inventoryResponse } = inventoryDatabase;
return inventoreResponse; return inventoryResponse as unknown as IInventoryResponse;
}; };
export { toInventoryResponse }; export { toInventoryResponse };

View File

@ -4,10 +4,13 @@ import {
IRawUpgrade, IRawUpgrade,
IMiscItem, IMiscItem,
IInventoryDatabase, IInventoryDatabase,
IBooster IBooster,
IInventoryResponse,
IInventoryDatabaseDocument,
IInventoryResponseDocument
} from "../types/inventoryTypes/inventoryTypes"; } from "../types/inventoryTypes/inventoryTypes";
import { IOid } from "../types/commonTypes"; import { IMongoDate, IOid } from "../types/commonTypes";
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitDatabase, ISuitDocument } from "@/src/types/inventoryTypes/SuitTypes";
import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
const abilityOverrideSchema = new Schema({ const abilityOverrideSchema = new Schema({
@ -25,7 +28,7 @@ const colorSchema = new Schema({
m1: Number m1: Number
}); });
const longGunConfigSchema = new Schema({ const weaponConfigSchema = new Schema({
Skins: [String], Skins: [String],
pricol: colorSchema, pricol: colorSchema,
attcol: colorSchema, attcol: colorSchema,
@ -57,7 +60,7 @@ const longGunConfigSchema = new Schema({
const WeaponSchema = new Schema({ const WeaponSchema = new Schema({
ItemType: String, ItemType: String,
Configs: [longGunConfigSchema], Configs: [weaponConfigSchema],
UpgradeVer: Number, UpgradeVer: Number,
XP: Number, XP: Number,
Features: 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, accountOwnerId: Schema.Types.ObjectId,
SubscribedToEmails: Number, SubscribedToEmails: Number,
Created: Schema.Types.Mixed, Created: Schema.Types.Mixed,
@ -235,7 +238,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
Recipes: [Schema.Types.Mixed], Recipes: [Schema.Types.Mixed],
WeaponSkins: [Schema.Types.Mixed], WeaponSkins: [Schema.Types.Mixed],
PendingRecipes: [Schema.Types.Mixed], PendingRecipes: [Schema.Types.Mixed],
TrainingDate: Schema.Types.Mixed, TrainingDate: Date,
PlayerLevel: Number, PlayerLevel: Number,
Upgrades: [Upgrade], Upgrades: [Upgrade],
EquippedGear: [String], EquippedGear: [String],
@ -364,6 +367,14 @@ inventorySchema.set("toJSON", {
transform(_document, returnedObject) { transform(_document, returnedObject) {
delete returnedObject._id; delete returnedObject._id;
delete returnedObject.__v; delete returnedObject.__v;
const trainingDate = (returnedObject as IInventoryDatabaseDocument).TrainingDate;
(returnedObject as IInventoryResponse).TrainingDate = {
$date: {
$numberLong: trainingDate.getTime().toString()
}
} satisfies IMongoDate;
} }
}); });

View File

@ -29,6 +29,7 @@ import { updateSessionGetController, updateSessionPostController } from "@/src/c
import { viewController } from "@/src/controllers/api/viewController"; import { viewController } from "@/src/controllers/api/viewController";
import { joinSessionController } from "@/src/controllers/api/joinSessionController"; import { joinSessionController } from "@/src/controllers/api/joinSessionController";
import { saveLoadoutController } from "@/src/controllers/api/saveLoadout"; import { saveLoadoutController } from "@/src/controllers/api/saveLoadout";
import { trainingResultController } from "@/src/controllers/api/trainingResultController";
import { artifactsController } from "../controllers/api/artifactsController"; import { artifactsController } from "../controllers/api/artifactsController";
import express from "express"; import express from "express";
@ -73,4 +74,6 @@ apiRouter.post("/genericUpdate.php", genericUpdateController);
apiRouter.post("/rerollRandomMod.php", rerollRandomModController); apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
apiRouter.post("/joinSession.php", joinSessionController); apiRouter.post("/joinSession.php", joinSessionController);
apiRouter.post("/saveLoadout.php", saveLoadoutController); apiRouter.post("/saveLoadout.php", saveLoadoutController);
apiRouter.post("/trainingResult.php", trainingResultController);
export { apiRouter }; export { apiRouter };

View File

@ -38,7 +38,7 @@ const createInventory = async (accountOwnerId: Types.ObjectId) => {
//const updateInventory = async (accountOwnerId: Types.ObjectId, inventoryChanges: any) => {}; //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 }); const inventory = await Inventory.findOne({ accountOwnerId: accountOwnerId });
if (!inventory) { if (!inventory) {

View File

@ -1,3 +1,9 @@
export interface IOid { export interface IOid {
$oid: string; $oid: string;
} }
export interface IMongoDate {
$date: {
$numberLong: string;
};
}

View File

@ -1,19 +1,21 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { Document, Types } from "mongoose"; 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 { IAbilityOverride, IColor, FocusSchool, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; 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; accountOwnerId: Types.ObjectId;
TrainingDate: Date;
} }
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
export interface IInventoryResponse { export interface IInventoryResponse {
SubscribedToEmails: number; SubscribedToEmails: number;
Created: Date; Created: IMongoDate;
RewardSeed: number; RewardSeed: number;
RegularCredits: number; RegularCredits: number;
PremiumCredits: number; PremiumCredits: number;
@ -57,7 +59,7 @@ export interface IInventoryResponse {
Recipes: IConsumable[]; Recipes: IConsumable[];
WeaponSkins: IWeaponSkin[]; WeaponSkins: IWeaponSkin[];
PendingRecipes: IPendingRecipe[]; PendingRecipes: IPendingRecipe[];
TrainingDate: Date; TrainingDate: IMongoDate;
PlayerLevel: number; PlayerLevel: number;
Upgrades: ICrewShipSalvagedWeaponSkin[]; Upgrades: ICrewShipSalvagedWeaponSkin[];
EquippedGear: string[]; EquippedGear: string[];
@ -134,7 +136,7 @@ export interface IInventoryResponse {
InvasionChainProgress: IInvasionChainProgress[]; InvasionChainProgress: IInvasionChainProgress[];
DataKnives: IDataKnife[]; DataKnives: IDataKnife[];
NemesisHistory: INemesisHistory[]; NemesisHistory: INemesisHistory[];
LastNemesisAllySpawnTime: Date; LastNemesisAllySpawnTime: IMongoDate;
Settings: ISettings; Settings: ISettings;
PersonalTechProjects: IPersonalTechProject[]; PersonalTechProjects: IPersonalTechProject[];
CrewShips: ICrewShip[]; CrewShips: ICrewShip[];
@ -145,7 +147,7 @@ export interface IInventoryResponse {
CrewShipWeapons: ICrewShipWeapon[]; CrewShipWeapons: ICrewShipWeapon[];
CrewShipSalvagedWeapons: ICrewShipWeapon[]; CrewShipSalvagedWeapons: ICrewShipWeapon[];
CrewShipWeaponSkins: ICrewShipSalvagedWeaponSkin[]; CrewShipWeaponSkins: ICrewShipSalvagedWeaponSkin[];
TradeBannedUntil: Date; TradeBannedUntil: IMongoDate;
PlayedParkourTutorial: boolean; PlayedParkourTutorial: boolean;
SubscribedToEmailsPersonalized: number; SubscribedToEmailsPersonalized: number;
MechBin: ICrewMemberBinClass; MechBin: ICrewMemberBinClass;
@ -153,7 +155,7 @@ export interface IInventoryResponse {
DailyAffiliationNecraloid: number; DailyAffiliationNecraloid: number;
MechSuits: IMechSuit[]; MechSuits: IMechSuit[];
InfestedFoundry: IInfestedFoundry; InfestedFoundry: IInfestedFoundry;
BlessingCooldown: Date; BlessingCooldown: IMongoDate;
CrewMemberBin: ICrewMemberBinClass; CrewMemberBin: ICrewMemberBinClass;
CrewShipHarnesses: ICrewShipHarness[]; CrewShipHarnesses: ICrewShipHarness[];
CrewShipRawSalvage: IConsumable[]; CrewShipRawSalvage: IConsumable[];
@ -165,7 +167,7 @@ export interface IInventoryResponse {
NemesisAbandonedRewards: string[]; NemesisAbandonedRewards: string[];
DailyAffiliationKahl: number; DailyAffiliationKahl: number;
LastInventorySync: IOid; LastInventorySync: IOid;
NextRefill: Date; NextRefill: IMongoDate;
ActiveLandscapeTraps: any[]; ActiveLandscapeTraps: any[];
EvolutionProgress: any[]; EvolutionProgress: any[];
RepVotes: any[]; RepVotes: any[];
@ -206,10 +208,6 @@ export interface IAlignment {
Alignment: number; Alignment: number;
} }
export interface IDate {
$date: { $numberLong: string };
}
export interface IBooster { export interface IBooster {
ExpiryDate: number; ExpiryDate: number;
ItemType: string; ItemType: string;
@ -270,7 +268,7 @@ export interface ICrewMember {
ItemType: string; ItemType: string;
NemesisFingerprint: number; NemesisFingerprint: number;
Seed: number; Seed: number;
HireDate: Date; HireDate: IMongoDate;
AssignedRole: number; AssignedRole: number;
SkillEfficiency: ISkillEfficiency; SkillEfficiency: ISkillEfficiency;
WeaponConfigIdx: number; WeaponConfigIdx: number;
@ -430,7 +428,7 @@ export interface IDrone {
ItemType: string; ItemType: string;
CurrentHP: number; CurrentHP: number;
ItemId: IOid; ItemId: IOid;
RepairStart?: Date; RepairStart?: IMongoDate;
} }
export interface IEmailItem { export interface IEmailItem {
@ -518,7 +516,7 @@ export interface IInvasionChainProgress {
export interface IKubrowPetEgg { export interface IKubrowPetEgg {
ItemType: KubrowPetEggItemType; ItemType: KubrowPetEggItemType;
ExpirationDate: Date; ExpirationDate: IMongoDate;
ItemId: IOid; ItemId: IOid;
} }
@ -571,7 +569,7 @@ export interface IKubrowPet {
Polarized?: number; Polarized?: number;
Polarity?: IPolarity[]; Polarity?: IPolarity[];
Features?: number; Features?: number;
InfestationDate?: Date; InfestationDate?: IMongoDate;
InfestationDays?: number; InfestationDays?: number;
InfestationType?: string; InfestationType?: string;
ItemId: IOid; ItemId: IOid;
@ -591,7 +589,7 @@ export interface IDetails {
HasCollar: boolean; HasCollar: boolean;
PrintsRemaining: number; PrintsRemaining: number;
Status: Status; Status: Status;
HatchDate: Date; HatchDate: IMongoDate;
DominantTraits: ITraits; DominantTraits: ITraits;
RecessiveTraits: ITraits; RecessiveTraits: ITraits;
IsMale: boolean; IsMale: boolean;
@ -734,7 +732,7 @@ export interface IMission {
Completes: number; Completes: number;
Tier?: number; Tier?: number;
Tag: string; Tag: string;
RewardsCooldownTime?: Date; RewardsCooldownTime?: IMongoDate;
} }
export interface IMoaPet { export interface IMoaPet {
@ -759,7 +757,7 @@ export interface INemesisHistory {
BirthNode: BirthNode; BirthNode: BirthNode;
Rank: number; Rank: number;
k: boolean; k: boolean;
d: Date; d: IMongoDate;
GuessHistory?: number[]; GuessHistory?: number[];
currentGuess?: number; currentGuess?: number;
Traded?: boolean; Traded?: boolean;
@ -808,13 +806,13 @@ export interface IOperatorLoadOut {
} }
export interface IPendingCoupon { export interface IPendingCoupon {
Expiry: Date; Expiry: IMongoDate;
Discount: number; Discount: number;
} }
export interface IPendingRecipe { export interface IPendingRecipe {
ItemType: string; ItemType: string;
CompletionDate: Date; CompletionDate: IMongoDate;
ItemId: IOid; ItemId: IOid;
} }
@ -872,8 +870,8 @@ export enum GivingSlotOrderInfo {
LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod" LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod"
} }
export interface IPeriodicMissionCompletion { export interface PeriodicMissionCompletion {
date: Date; date: IMongoDate;
tag: string; tag: string;
count?: number; count?: number;
} }
@ -892,7 +890,7 @@ export interface IPersonalTechProject {
ReqCredits: number; ReqCredits: number;
ItemType: string; ItemType: string;
ReqItems: IConsumable[]; ReqItems: IConsumable[];
CompletionDate?: Date; CompletionDate?: IMongoDate;
ItemId: IOid; ItemId: IOid;
ProductCategory?: string; ProductCategory?: string;
CategoryItemId?: IOid; CategoryItemId?: IOid;
@ -919,7 +917,7 @@ export interface IQuestKey {
unlock?: boolean; unlock?: boolean;
Completed?: boolean; Completed?: boolean;
ItemType: string; ItemType: string;
CompletionDate?: Date; CompletionDate?: IMongoDate;
} }
export interface IProgress { export interface IProgress {
@ -1096,15 +1094,15 @@ export interface IWebFlags {
activeBuyPlat: number; activeBuyPlat: number;
noShow2FA: boolean; noShow2FA: boolean;
Tennocon2018Digital: boolean; Tennocon2018Digital: boolean;
VisitPrimeAccess: Date; VisitPrimeAccess: IMongoDate;
VisitTennocon2019: Date; VisitTennocon2019: IMongoDate;
enteredSC2019: Date; enteredSC2019: IMongoDate;
VisitPrimeVault: Date; VisitPrimeVault: IMongoDate;
VisitBuyPlatinum: Date; VisitBuyPlatinum: IMongoDate;
ClickedSku_640_Page__en_buyplatinum: Date; ClickedSku_640_Page__en_buyplatinum: IMongoDate;
ClickedSku_640_Page__buyplatinum: Date; ClickedSku_640_Page__buyplatinum: IMongoDate;
VisitStarterPack: Date; VisitStarterPack: IMongoDate;
Tennocon2020Digital: boolean; Tennocon2020Digital: boolean;
Anniversary2021: boolean; Anniversary2021: boolean;
HitDownloadBtn: Date; HitDownloadBtn: IMongoDate;
} }

View File

@ -96,6 +96,8 @@
"AdultOperatorLoadOuts": [], "AdultOperatorLoadOuts": [],
"KahlLoadOuts": [], "KahlLoadOuts": [],
"PendingRecipes": [], "PendingRecipes": [],
"TrainingDate": 0,
"PlayerLevel": 0,
"PersonalGoalProgress": [], "PersonalGoalProgress": [],
"PersonalTechProjects": [], "PersonalTechProjects": [],
"QualifyingInvasions": [], "QualifyingInvasions": [],

File diff suppressed because it is too large Load Diff