forked from OpenWF/SpaceNinjaServer
Inventory Infrastructure and Example for Suits (#10)
This commit is contained in:
parent
ec95bab507
commit
b3a5479e75
@ -11,7 +11,6 @@
|
|||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-misused-promises": "off",
|
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
"@typescript-eslint/semi": ["error"],
|
"@typescript-eslint/semi": ["error"],
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
12
config.json
12
config.json
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"autoCreateAccount": true,
|
"autoCreateAccount": true,
|
||||||
"buildLabel": "2023.05.25.13.39/oZkc-RIme5c1CCltUfg2gQ",
|
"buildLabel": "2023.05.25.13.39/oZkc-RIme5c1CCltUfg2gQ",
|
||||||
"matchmakingBuildId": "4920386201513015989",
|
"matchmakingBuildId": "4920386201513015989",
|
||||||
"version": "33.0.14",
|
"version": "33.0.14",
|
||||||
"worldSeed": "GWvLyHiw7/Qr/60056xmAmDrn0Y9et2S3BYlLSkLDNBMtumSr3KxWV8He5Jz72yYq3tsY+cd53QeTf+bb54+llGTbYiQF+64BtiLWMVhWP1IUaP4SxWHXojlpQC13op/udHI1whc+8zrxEzzZmv/QlpvigAAbjBDtwu97Df0vgn+YrOKi4G3OhgIkTRocAAzD1P/BGbT8gaKE01H8rXl3+Gq6jCA1O1v800SL6DwKOgMsXVvWp7g2n/tPxJe/j9bmu4XFG0bSa5y5hikLKxvntA/5ut+iogv4MyMBe+TydVxjPqNbkKnby5l4KAL+3inpuPraeg4jcNMt0AwKG8NIQ=="
|
"worldSeed": "GWvLyHiw7/Qr/60056xmAmDrn0Y9et2S3BYlLSkLDNBMtumSr3KxWV8He5Jz72yYq3tsY+cd53QeTf+bb54+llGTbYiQF+64BtiLWMVhWP1IUaP4SxWHXojlpQC13op/udHI1whc+8zrxEzzZmv/QlpvigAAbjBDtwu97Df0vgn+YrOKi4G3OhgIkTRocAAzD1P/BGbT8gaKE01H8rXl3+Gq6jCA1O1v800SL6DwKOgMsXVvWp7g2n/tPxJe/j9bmu4XFG0bSa5y5hikLKxvntA/5ut+iogv4MyMBe+TydVxjPqNbkKnby5l4KAL+3inpuPraeg4jcNMt0AwKG8NIQ==",
|
||||||
|
"skipStoryModeChoice": true,
|
||||||
|
"skipTutorial": true
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
const deleteSessionController: RequestHandler = (_req, res) => {
|
const deleteSessionController: RequestHandler = (_req, res) => {
|
||||||
res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 });
|
res.sendStatus(200);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { deleteSessionController };
|
export { deleteSessionController };
|
||||||
|
@ -1,11 +1,29 @@
|
|||||||
import inventory from "@/static/fixed_responses/inventory.json";
|
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||||
|
import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
|
||||||
|
import { Inventory } from "@/src/models/inventoryModel";
|
||||||
import { Request, RequestHandler, Response } from "express";
|
import { Request, RequestHandler, Response } from "express";
|
||||||
|
|
||||||
const inventoryController: RequestHandler = (request: Request, response: Response) => {
|
const inventoryController: RequestHandler = async (request: Request, response: Response) => {
|
||||||
console.log(request.query);
|
|
||||||
const accountId = request.query.accountId;
|
const accountId = request.query.accountId;
|
||||||
|
|
||||||
|
if (!accountId) {
|
||||||
|
response.status(400).json({ error: "accountId was not provided" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log(accountId);
|
console.log(accountId);
|
||||||
response.json(inventory);
|
|
||||||
|
const inventory = await Inventory.findOne({ accountOwnerId: accountId });
|
||||||
|
|
||||||
|
if (!inventory) {
|
||||||
|
response.status(400).json({ error: "inventory was undefined" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const inventoryJSON = inventory.toJSON();
|
||||||
|
|
||||||
|
const inventoreResponse = toInventoryResponse(inventoryJSON);
|
||||||
|
|
||||||
|
response.json(inventoreResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { inventoryController };
|
export { inventoryController };
|
||||||
|
@ -13,11 +13,8 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
||||||
const body = JSON.parse(request.body); // parse octet stream of json data to json object
|
const body = JSON.parse(request.body); // parse octet stream of json data to json object
|
||||||
const loginRequest = toLoginRequest(body);
|
const loginRequest = toLoginRequest(body);
|
||||||
// console.log(body);
|
|
||||||
//console.log(String.fromCharCode.apiRouterly(null, req.body));
|
|
||||||
|
|
||||||
const account = await Account.findOne({ email: loginRequest.email }); //{ _id: 0, __v: 0 }
|
const account = await Account.findOne({ email: loginRequest.email }); //{ _id: 0, __v: 0 }
|
||||||
console.log("findone", account);
|
|
||||||
|
|
||||||
if (!account && config.autoCreateAccount) {
|
if (!account && config.autoCreateAccount) {
|
||||||
try {
|
try {
|
||||||
@ -32,7 +29,8 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
ConsentNeeded: false,
|
ConsentNeeded: false,
|
||||||
TrackedSettings: []
|
TrackedSettings: []
|
||||||
});
|
});
|
||||||
console.log("CREATED ACCOUNT", newAccount);
|
console.log("creating new account");
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const { email, password, ...databaseAccount } = newAccount;
|
const { email, password, ...databaseAccount } = newAccount;
|
||||||
const newLoginResponse: ILoginResponse = {
|
const newLoginResponse: ILoginResponse = {
|
||||||
...databaseAccount,
|
...databaseAccount,
|
||||||
@ -47,7 +45,6 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
MatchmakingBuildId: config.matchmakingBuildId
|
MatchmakingBuildId: config.matchmakingBuildId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(newLoginResponse);
|
|
||||||
response.json(newLoginResponse);
|
response.json(newLoginResponse);
|
||||||
return;
|
return;
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
@ -77,7 +74,6 @@ const loginController: RequestHandler = async (request, response) => {
|
|||||||
MatchmakingBuildId: config.matchmakingBuildId
|
MatchmakingBuildId: config.matchmakingBuildId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("login response", newLoginResponse);
|
|
||||||
response.json(newLoginResponse);
|
response.json(newLoginResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
9
src/helpers/inventoryHelpers.ts
Normal file
9
src/helpers/inventoryHelpers.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes";
|
||||||
|
|
||||||
|
const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const { accountOwnerId, ...inventoreResponse } = inventoryDatabase;
|
||||||
|
return inventoreResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
export { toInventoryResponse };
|
258
src/models/inventoryModel.ts
Normal file
258
src/models/inventoryModel.ts
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
import { Document, Schema, model } from "mongoose";
|
||||||
|
import { IInventoryDatabase, IInventoryResponse, ISuitDatabase, ISuitDocument, Oid } from "../types/inventoryTypes";
|
||||||
|
|
||||||
|
const polaritySchema = new Schema({
|
||||||
|
Slot: Number,
|
||||||
|
Value: String
|
||||||
|
});
|
||||||
|
|
||||||
|
const abilityOverrideSchema = new Schema({
|
||||||
|
Ability: String,
|
||||||
|
Index: Number
|
||||||
|
});
|
||||||
|
|
||||||
|
const colorSchema = new Schema({
|
||||||
|
t0: Number,
|
||||||
|
t1: Number,
|
||||||
|
t2: Number,
|
||||||
|
t3: Number,
|
||||||
|
en: Number,
|
||||||
|
e1: Number,
|
||||||
|
m0: Number,
|
||||||
|
m1: Number
|
||||||
|
});
|
||||||
|
|
||||||
|
const suitConfigSchema = new Schema({
|
||||||
|
Skins: [String],
|
||||||
|
pricol: colorSchema,
|
||||||
|
attcol: colorSchema,
|
||||||
|
eyecol: colorSchema,
|
||||||
|
sigcol: colorSchema,
|
||||||
|
Upgrades: [String],
|
||||||
|
Songs: [
|
||||||
|
{
|
||||||
|
m: String,
|
||||||
|
b: String,
|
||||||
|
p: String,
|
||||||
|
s: String
|
||||||
|
}
|
||||||
|
],
|
||||||
|
Name: String,
|
||||||
|
AbilityOverride: abilityOverrideSchema,
|
||||||
|
PvpUpgrades: [String],
|
||||||
|
ugly: Boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
suitConfigSchema.set("toJSON", {
|
||||||
|
transform(_document, returnedObject) {
|
||||||
|
delete returnedObject._id;
|
||||||
|
delete returnedObject.__v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const suitSchema = new Schema({
|
||||||
|
ItemType: String,
|
||||||
|
Configs: [suitConfigSchema],
|
||||||
|
UpgradeVer: Number,
|
||||||
|
XP: Number,
|
||||||
|
InfestationDate: Date,
|
||||||
|
Features: Number,
|
||||||
|
Polarity: [polaritySchema],
|
||||||
|
Polarized: Number,
|
||||||
|
ModSlotPurchases: Number,
|
||||||
|
FocusLens: String,
|
||||||
|
UnlockLevel: Number
|
||||||
|
});
|
||||||
|
|
||||||
|
suitSchema.set("toJSON", {
|
||||||
|
transform(_document, returnedObject: ISuitDocument) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
||||||
|
returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid;
|
||||||
|
delete returnedObject._id;
|
||||||
|
delete returnedObject.__v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const inventorySchema = new Schema({
|
||||||
|
accountOwnerId: Schema.Types.ObjectId,
|
||||||
|
SubscribedToEmails: Number,
|
||||||
|
Created: Schema.Types.Mixed,
|
||||||
|
RewardSeed: Number,
|
||||||
|
RegularCredits: Number,
|
||||||
|
PremiumCredits: Number,
|
||||||
|
PremiumCreditsFree: Number,
|
||||||
|
FusionPoints: Number,
|
||||||
|
SuitBin: Schema.Types.Mixed,
|
||||||
|
WeaponBin: Schema.Types.Mixed,
|
||||||
|
SentinelBin: Schema.Types.Mixed,
|
||||||
|
SpaceSuitBin: Schema.Types.Mixed,
|
||||||
|
SpaceWeaponBin: Schema.Types.Mixed,
|
||||||
|
PvpBonusLoadoutBin: Schema.Types.Mixed,
|
||||||
|
PveBonusLoadoutBin: Schema.Types.Mixed,
|
||||||
|
RandomModBin: Schema.Types.Mixed,
|
||||||
|
TradesRemaining: Number,
|
||||||
|
DailyAffiliation: Number,
|
||||||
|
DailyAffiliationPvp: Number,
|
||||||
|
DailyAffiliationLibrary: Number,
|
||||||
|
DailyFocus: Number,
|
||||||
|
GiftsRemaining: Number,
|
||||||
|
HandlerPoints: Number,
|
||||||
|
MiscItems: [Schema.Types.Mixed],
|
||||||
|
ChallengesFixVersion: Number,
|
||||||
|
ChallengeProgress: [Schema.Types.Mixed],
|
||||||
|
RawUpgrades: [Schema.Types.Mixed],
|
||||||
|
ReceivedStartingGear: Boolean,
|
||||||
|
Suits: [suitSchema],
|
||||||
|
LongGuns: [Schema.Types.Mixed],
|
||||||
|
Pistols: [Schema.Types.Mixed],
|
||||||
|
Melee: [Schema.Types.Mixed],
|
||||||
|
Ships: [Schema.Types.Mixed],
|
||||||
|
QuestKeys: [Schema.Types.Mixed],
|
||||||
|
FlavourItems: [Schema.Types.Mixed],
|
||||||
|
Scoops: [Schema.Types.Mixed],
|
||||||
|
TrainingRetriesLeft: Number,
|
||||||
|
LoadOutPresets: Schema.Types.Mixed,
|
||||||
|
CurrentLoadOutIds: [Schema.Types.Mixed],
|
||||||
|
Missions: [Schema.Types.Mixed],
|
||||||
|
RandomUpgradesIdentified: Number,
|
||||||
|
LastRegionPlayed: String,
|
||||||
|
XPInfo: [Schema.Types.Mixed],
|
||||||
|
Recipes: [Schema.Types.Mixed],
|
||||||
|
WeaponSkins: [Schema.Types.Mixed],
|
||||||
|
PendingRecipes: [Schema.Types.Mixed],
|
||||||
|
TrainingDate: Schema.Types.Mixed,
|
||||||
|
PlayerLevel: Number,
|
||||||
|
Upgrades: [Schema.Types.Mixed],
|
||||||
|
EquippedGear: [String],
|
||||||
|
DeathMarks: [String],
|
||||||
|
FusionTreasures: [Schema.Types.Mixed],
|
||||||
|
WebFlags: Schema.Types.Mixed,
|
||||||
|
CompletedAlerts: [String],
|
||||||
|
Consumables: [Schema.Types.Mixed],
|
||||||
|
LevelKeys: [Schema.Types.Mixed],
|
||||||
|
TauntHistory: [Schema.Types.Mixed],
|
||||||
|
StoryModeChoice: String,
|
||||||
|
PeriodicMissionCompletions: [Schema.Types.Mixed],
|
||||||
|
KubrowPetEggs: [Schema.Types.Mixed],
|
||||||
|
LoreFragmentScans: [Schema.Types.Mixed],
|
||||||
|
EquippedEmotes: [String],
|
||||||
|
PendingTrades: [Schema.Types.Mixed],
|
||||||
|
Boosters: [Schema.Types.Mixed],
|
||||||
|
ActiveDojoColorResearch: String,
|
||||||
|
SentientSpawnChanceBoosters: Schema.Types.Mixed,
|
||||||
|
Affiliations: [Schema.Types.Mixed],
|
||||||
|
QualifyingInvasions: [Schema.Types.Mixed],
|
||||||
|
FactionScores: [Number],
|
||||||
|
SpaceSuits: [Schema.Types.Mixed],
|
||||||
|
SpaceMelee: [Schema.Types.Mixed],
|
||||||
|
SpaceGuns: [Schema.Types.Mixed],
|
||||||
|
ArchwingEnabled: Boolean,
|
||||||
|
PendingSpectreLoadouts: [Schema.Types.Mixed],
|
||||||
|
SpectreLoadouts: [Schema.Types.Mixed],
|
||||||
|
SentinelWeapons: [Schema.Types.Mixed],
|
||||||
|
Sentinels: [Schema.Types.Mixed],
|
||||||
|
EmailItems: [Schema.Types.Mixed],
|
||||||
|
CompletedSyndicates: [String],
|
||||||
|
FocusXP: Schema.Types.Mixed,
|
||||||
|
Wishlist: [String],
|
||||||
|
Alignment: Schema.Types.Mixed,
|
||||||
|
CompletedSorties: [String],
|
||||||
|
LastSortieReward: [Schema.Types.Mixed],
|
||||||
|
Drones: [Schema.Types.Mixed],
|
||||||
|
StepSequencers: [Schema.Types.Mixed],
|
||||||
|
ActiveAvatarImageType: String,
|
||||||
|
KubrowPets: [Schema.Types.Mixed],
|
||||||
|
ShipDecorations: [Schema.Types.Mixed],
|
||||||
|
OperatorAmpBin: Schema.Types.Mixed,
|
||||||
|
DailyAffiliationCetus: Number,
|
||||||
|
DailyAffiliationQuills: Number,
|
||||||
|
DiscoveredMarkers: [Schema.Types.Mixed],
|
||||||
|
CompletedJobs: [Schema.Types.Mixed],
|
||||||
|
FocusAbility: String,
|
||||||
|
FocusUpgrades: [Schema.Types.Mixed],
|
||||||
|
OperatorAmps: [Schema.Types.Mixed],
|
||||||
|
HasContributedToDojo: Boolean,
|
||||||
|
HWIDProtectEnabled: Boolean,
|
||||||
|
KubrowPetPrints: [Schema.Types.Mixed],
|
||||||
|
AlignmentReplay: Schema.Types.Mixed,
|
||||||
|
PersonalGoalProgress: [Schema.Types.Mixed],
|
||||||
|
DailyAffiliationSolaris: Number,
|
||||||
|
SpecialItems: [Schema.Types.Mixed],
|
||||||
|
ThemeStyle: String,
|
||||||
|
ThemeBackground: String,
|
||||||
|
ThemeSounds: String,
|
||||||
|
BountyScore: Number,
|
||||||
|
ChallengeInstanceStates: [Schema.Types.Mixed],
|
||||||
|
LoginMilestoneRewards: [String],
|
||||||
|
OperatorLoadOuts: [Schema.Types.Mixed],
|
||||||
|
DailyAffiliationVentkids: Number,
|
||||||
|
DailyAffiliationVox: Number,
|
||||||
|
RecentVendorPurchases: [Schema.Types.Mixed],
|
||||||
|
Hoverboards: [Schema.Types.Mixed],
|
||||||
|
NodeIntrosCompleted: [String],
|
||||||
|
CompletedJobChains: [Schema.Types.Mixed],
|
||||||
|
SeasonChallengeHistory: [Schema.Types.Mixed],
|
||||||
|
MoaPets: [Schema.Types.Mixed],
|
||||||
|
EquippedInstrument: String,
|
||||||
|
InvasionChainProgress: [Schema.Types.Mixed],
|
||||||
|
DataKnives: [Schema.Types.Mixed],
|
||||||
|
NemesisHistory: [Schema.Types.Mixed],
|
||||||
|
LastNemesisAllySpawnTime: Schema.Types.Mixed,
|
||||||
|
Settings: Schema.Types.Mixed,
|
||||||
|
PersonalTechProjects: [Schema.Types.Mixed],
|
||||||
|
CrewShips: [Schema.Types.Mixed],
|
||||||
|
CrewShipSalvageBin: Schema.Types.Mixed,
|
||||||
|
PlayerSkills: Schema.Types.Mixed,
|
||||||
|
CrewShipAmmo: [Schema.Types.Mixed],
|
||||||
|
CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed],
|
||||||
|
CrewShipWeapons: [Schema.Types.Mixed],
|
||||||
|
CrewShipSalvagedWeapons: [Schema.Types.Mixed],
|
||||||
|
CrewShipWeaponSkins: [Schema.Types.Mixed],
|
||||||
|
TradeBannedUntil: Schema.Types.Mixed,
|
||||||
|
PlayedParkourTutorial: Boolean,
|
||||||
|
SubscribedToEmailsPersonalized: Number,
|
||||||
|
MechBin: Schema.Types.Mixed,
|
||||||
|
DailyAffiliationEntrati: Number,
|
||||||
|
DailyAffiliationNecraloid: Number,
|
||||||
|
MechSuits: [Schema.Types.Mixed],
|
||||||
|
InfestedFoundry: Schema.Types.Mixed,
|
||||||
|
BlessingCooldown: Schema.Types.Mixed,
|
||||||
|
CrewMemberBin: Schema.Types.Mixed,
|
||||||
|
CrewShipHarnesses: [Schema.Types.Mixed],
|
||||||
|
CrewShipRawSalvage: [Schema.Types.Mixed],
|
||||||
|
CrewMembers: [Schema.Types.Mixed],
|
||||||
|
AdultOperatorLoadOuts: [Schema.Types.Mixed],
|
||||||
|
LotusCustomization: Schema.Types.Mixed,
|
||||||
|
UseAdultOperatorLoadout: Boolean,
|
||||||
|
DailyAffiliationZariman: Number,
|
||||||
|
NemesisAbandonedRewards: [String],
|
||||||
|
DailyAffiliationKahl: Number,
|
||||||
|
LastInventorySync: Schema.Types.Mixed,
|
||||||
|
NextRefill: Schema.Types.Mixed,
|
||||||
|
ActiveLandscapeTraps: [Schema.Types.Mixed],
|
||||||
|
EvolutionProgress: [Schema.Types.Mixed],
|
||||||
|
RepVotes: [Schema.Types.Mixed],
|
||||||
|
LeagueTickets: [Schema.Types.Mixed],
|
||||||
|
Quests: [Schema.Types.Mixed],
|
||||||
|
Robotics: [Schema.Types.Mixed],
|
||||||
|
UsedDailyDeals: [Schema.Types.Mixed],
|
||||||
|
LibraryPersonalProgress: [Schema.Types.Mixed],
|
||||||
|
CollectibleSeries: [Schema.Types.Mixed],
|
||||||
|
LibraryAvailableDailyTaskInfo: Schema.Types.Mixed,
|
||||||
|
HasResetAccount: Boolean,
|
||||||
|
PendingCoupon: Schema.Types.Mixed,
|
||||||
|
Harvestable: Boolean,
|
||||||
|
DeathSquadable: Boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
inventorySchema.set("toJSON", {
|
||||||
|
transform(_document, returnedObject: ISuitDocument) {
|
||||||
|
delete returnedObject._id;
|
||||||
|
delete returnedObject.__v;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const Suit = model<ISuitDatabase>("Suit", suitSchema);
|
||||||
|
const Inventory = model<IInventoryDatabase>("Inventory", inventorySchema);
|
||||||
|
|
||||||
|
export { Inventory, Suit };
|
25
src/services/inventoryService.ts
Normal file
25
src/services/inventoryService.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Inventory } from "@/src/models/inventoryModel";
|
||||||
|
import new_inventory from "@/static/fixed_responses/postTutorialInventory.json";
|
||||||
|
import config from "@/config.json";
|
||||||
|
import { Types } from "mongoose";
|
||||||
|
|
||||||
|
const createInventory = async (accountOwnerId: Types.ObjectId) => {
|
||||||
|
try {
|
||||||
|
const inventory = new Inventory({ ...new_inventory, accountOwnerId: accountOwnerId });
|
||||||
|
if (config.skipStoryModeChoice) {
|
||||||
|
inventory.StoryModeChoice = "WARFRAME";
|
||||||
|
}
|
||||||
|
if (config.skipTutorial) {
|
||||||
|
inventory.PlayedParkourTutorial = true;
|
||||||
|
inventory.ReceivedStartingGear = true;
|
||||||
|
}
|
||||||
|
await inventory.save();
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
throw new Error(`error creating inventory" ${error.message}`);
|
||||||
|
}
|
||||||
|
throw new Error("error creating inventory that is not of instance Error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { createInventory };
|
@ -1,4 +1,5 @@
|
|||||||
import { Account } from "@/src/models/loginModel";
|
import { Account } from "@/src/models/loginModel";
|
||||||
|
import { createInventory } from "@/src/services/inventoryService";
|
||||||
import { IDatabaseAccount } from "@/src/types/loginTypes";
|
import { IDatabaseAccount } from "@/src/types/loginTypes";
|
||||||
|
|
||||||
const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {
|
const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {
|
||||||
@ -6,10 +7,10 @@ const isCorrectPassword = (requestPassword: string, databasePassword: string): b
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createAccount = async (accountData: IDatabaseAccount) => {
|
const createAccount = async (accountData: IDatabaseAccount) => {
|
||||||
console.log("test", accountData);
|
|
||||||
const account = new Account(accountData);
|
const account = new Account(accountData);
|
||||||
try {
|
try {
|
||||||
await account.save();
|
await account.save();
|
||||||
|
await createInventory(account._id);
|
||||||
return account.toJSON();
|
return account.toJSON();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
1232
src/types/inventoryTypes.ts
Normal file
1232
src/types/inventoryTypes.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ShipOwnerId": "removed",
|
"ShipOwnerId": "647bce8a1caba352f90b6a09",
|
||||||
"Ship": {
|
"Ship": {
|
||||||
"Rooms": [
|
"Rooms": [
|
||||||
{ "Name": "AlchemyRoom", "MaxCapacity": 1600 },
|
{ "Name": "AlchemyRoom", "MaxCapacity": 1600 },
|
||||||
@ -9,7 +9,15 @@
|
|||||||
{ "Name": "OutsideRoom", "MaxCapacity": 1600 },
|
{ "Name": "OutsideRoom", "MaxCapacity": 1600 },
|
||||||
{ "Name": "PersonalQuartersRoom", "MaxCapacity": 1600 }
|
{ "Name": "PersonalQuartersRoom", "MaxCapacity": 1600 }
|
||||||
],
|
],
|
||||||
"ContentUrlSignature": "removed"
|
"ContentUrlSignature": "removed",
|
||||||
|
"Features": [
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem",
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem",
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/SocialMenuFeatureItem",
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/ModsFeatureItem",
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem",
|
||||||
|
"/Lotus/Types/Items/ShipFeatureItems/MercuryNavigationFeatureItem"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"Apartment": {
|
"Apartment": {
|
||||||
"Rooms": [
|
"Rooms": [
|
||||||
|
121
static/fixed_responses/new_inventory.json
Normal file
121
static/fixed_responses/new_inventory.json
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
{
|
||||||
|
"SubscribedToEmails": 0,
|
||||||
|
"Created": { "$date": { "$numberLong": "1685829131" } },
|
||||||
|
"SubscribedToEmailsPersonalized": 0,
|
||||||
|
"RewardSeed": -5604904486637265640,
|
||||||
|
"CrewMemberBin": { "Slots": 3 },
|
||||||
|
"CrewShipSalvageBin": { "Slots": 8 },
|
||||||
|
"DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bb619e15fa43f0ee4b1b1" } }],
|
||||||
|
"FusionPoints": 0,
|
||||||
|
"MechBin": { "Slots": 4 },
|
||||||
|
"OperatorAmpBin": { "Slots": 8 },
|
||||||
|
"PveBonusLoadoutBin": { "Slots": 0 },
|
||||||
|
"PvpBonusLoadoutBin": { "Slots": 0 },
|
||||||
|
"RandomModBin": { "Slots": 15 },
|
||||||
|
"RegularCredits": 0,
|
||||||
|
"SentinelBin": { "Slots": 10 },
|
||||||
|
"SpaceSuitBin": { "Slots": 4 },
|
||||||
|
"SpaceWeaponBin": { "Slots": 4 },
|
||||||
|
"SuitBin": { "Slots": 2 },
|
||||||
|
"WeaponBin": { "Slots": 8 },
|
||||||
|
"LastInventorySync": { "$oid": "647bb5d79f963c9d24668257" },
|
||||||
|
"NextRefill": { "$date": { "$numberLong": "1685829131" } },
|
||||||
|
"ActiveLandscapeTraps": [],
|
||||||
|
"ChallengeProgress": [],
|
||||||
|
"CrewMembers": [],
|
||||||
|
"CrewShips": [],
|
||||||
|
"CrewShipHarnesses": [],
|
||||||
|
"CrewShipSalvagedWeapons": [],
|
||||||
|
"CrewShipSalvagedWeaponSkins": [],
|
||||||
|
"CrewShipWeapons": [],
|
||||||
|
"CrewShipWeaponSkins": [],
|
||||||
|
"DataKnives": [],
|
||||||
|
"DrifterGuns": [],
|
||||||
|
"Drones": [],
|
||||||
|
"Horses": [],
|
||||||
|
"Hoverboards": [],
|
||||||
|
"KubrowPets": [],
|
||||||
|
"KubrowPetEggs": [],
|
||||||
|
"KubrowPetPrints": [],
|
||||||
|
"LongGuns": [],
|
||||||
|
"MechSuits": [],
|
||||||
|
"Melee": [],
|
||||||
|
"MoaPets": [],
|
||||||
|
"OperatorAmps": [],
|
||||||
|
"OperatorLoadOuts": [],
|
||||||
|
"AdultOperatorLoadOuts": [],
|
||||||
|
"KahlLoadOuts": [],
|
||||||
|
"PendingRecipes": [],
|
||||||
|
"PersonalGoalProgress": [],
|
||||||
|
"PersonalTechProjects": [],
|
||||||
|
"Pistols": [],
|
||||||
|
"QualifyingInvasions": [],
|
||||||
|
"RepVotes": [],
|
||||||
|
"Scoops": [],
|
||||||
|
"Sentinels": [],
|
||||||
|
"SentinelWeapons": [],
|
||||||
|
"Ships": [],
|
||||||
|
"SpaceGuns": [],
|
||||||
|
"SpaceMelee": [],
|
||||||
|
"SpaceSuits": [],
|
||||||
|
"SpecialItems": [],
|
||||||
|
"StepSequencers": [],
|
||||||
|
"Suits": [],
|
||||||
|
"Upgrades": [],
|
||||||
|
"WeaponSkins": [],
|
||||||
|
"Boosters": [],
|
||||||
|
"Consumables": [],
|
||||||
|
"EmailItems": [],
|
||||||
|
"FlavourItems": [],
|
||||||
|
"FocusUpgrades": [],
|
||||||
|
"FusionTreasures": [],
|
||||||
|
"LeagueTickets": [],
|
||||||
|
"LevelKeys": [],
|
||||||
|
"LoreFragmentScans": [],
|
||||||
|
"MiscItems": [],
|
||||||
|
"PendingSpectreLoadouts": [],
|
||||||
|
"Quests": [],
|
||||||
|
"QuestKeys": [],
|
||||||
|
"RawUpgrades": [],
|
||||||
|
"Recipes": [],
|
||||||
|
"Robotics": [],
|
||||||
|
"ShipDecorations": [],
|
||||||
|
"SpectreLoadouts": [],
|
||||||
|
"XPInfo": [],
|
||||||
|
"CrewShipAmmo": [],
|
||||||
|
"CrewShipRawSalvage": [],
|
||||||
|
"EvolutionProgress": [],
|
||||||
|
"Missions": [],
|
||||||
|
"TauntHistory": [],
|
||||||
|
"CompletedSyndicates": [],
|
||||||
|
"UsedDailyDeals": [],
|
||||||
|
"DailyAffiliation": 16000,
|
||||||
|
"DailyAffiliationPvp": 16000,
|
||||||
|
"DailyAffiliationLibrary": 16000,
|
||||||
|
"DailyAffiliationCetus": 16000,
|
||||||
|
"DailyAffiliationQuills": 16000,
|
||||||
|
"DailyAffiliationSolaris": 16000,
|
||||||
|
"DailyAffiliationVentkids": 16000,
|
||||||
|
"DailyAffiliationVox": 16000,
|
||||||
|
"DailyAffiliationEntrati": 16000,
|
||||||
|
"DailyAffiliationNecraloid": 16000,
|
||||||
|
"DailyAffiliationZariman": 16000,
|
||||||
|
"DailyAffiliationKahl": 16000,
|
||||||
|
"DailyFocus": 250000,
|
||||||
|
"GiftsRemaining": 8,
|
||||||
|
"LibraryAvailableDailyTaskInfo": {
|
||||||
|
"EnemyTypes": ["/Lotus/Types/Enemies/Orokin/OrokinBladeSawmanAvatar"],
|
||||||
|
"EnemyLocTag": "/Lotus/Language/Game/OrokinBladeSawman",
|
||||||
|
"EnemyIcon": "/Lotus/Interface/Icons/Npcs/Orokin/OrokinBladeSawman.png",
|
||||||
|
"ScansRequired": 4,
|
||||||
|
"RewardStoreItem": "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle",
|
||||||
|
"RewardQuantity": 10,
|
||||||
|
"RewardStanding": 10000
|
||||||
|
},
|
||||||
|
"DuviriInfo": { "Seed": 5898912197983600352, "NumCompletions": 0 },
|
||||||
|
"TradesRemaining": 0,
|
||||||
|
"HasContributedToDojo": false,
|
||||||
|
"HasResetAccount": false,
|
||||||
|
"PendingCoupon": { "Expiry": { "$date": { "$numberLong": "0" } }, "Discount": 0 },
|
||||||
|
"PremiumCreditsFree": 0
|
||||||
|
}
|
145
static/fixed_responses/postTutorialInventory.json
Normal file
145
static/fixed_responses/postTutorialInventory.json
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
{
|
||||||
|
"SubscribedToEmails": 0,
|
||||||
|
"Created": { "$date": { "$numberLong": "1685829131" } },
|
||||||
|
"SubscribedToEmailsPersonalized": 0,
|
||||||
|
"RewardSeed": -5604904486637265640,
|
||||||
|
"CrewMemberBin": { "Slots": 3 },
|
||||||
|
"CrewShipSalvageBin": { "Slots": 8 },
|
||||||
|
"DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bd268c547fe5b2909e715" } }],
|
||||||
|
"FusionPoints": 0,
|
||||||
|
"MechBin": { "Slots": 4 },
|
||||||
|
"OperatorAmpBin": { "Slots": 8 },
|
||||||
|
"PveBonusLoadoutBin": { "Slots": 0 },
|
||||||
|
"PvpBonusLoadoutBin": { "Slots": 0 },
|
||||||
|
"RandomModBin": { "Slots": 15 },
|
||||||
|
"RegularCredits": 3000,
|
||||||
|
"SentinelBin": { "Slots": 10 },
|
||||||
|
"SpaceSuitBin": { "Slots": 4 },
|
||||||
|
"SpaceWeaponBin": { "Slots": 4 },
|
||||||
|
"SuitBin": { "Slots": 1 },
|
||||||
|
"WeaponBin": { "Slots": 5 },
|
||||||
|
"DailyAffiliation": 16000,
|
||||||
|
"DailyAffiliationCetus": 16000,
|
||||||
|
"DailyAffiliationEntrati": 16000,
|
||||||
|
"DailyAffiliationKahl": 16000,
|
||||||
|
"DailyAffiliationLibrary": 16000,
|
||||||
|
"DailyAffiliationNecraloid": 16000,
|
||||||
|
"DailyAffiliationPvp": 16000,
|
||||||
|
"DailyAffiliationQuills": 16000,
|
||||||
|
"DailyAffiliationSolaris": 16000,
|
||||||
|
"DailyAffiliationVentkids": 16000,
|
||||||
|
"DailyAffiliationVox": 16000,
|
||||||
|
"DailyAffiliationZariman": 16000,
|
||||||
|
"DailyFocus": 250000,
|
||||||
|
"DuviriInfo": { "Seed": 5898912197983600352, "NumCompletions": 0 },
|
||||||
|
"GiftsRemaining": 8,
|
||||||
|
"TradesRemaining": 0,
|
||||||
|
"Recipes": [{ "ItemCount": 1, "ItemType": "/Lotus/Types/Recipes/Weapons/BoltonfaBlueprint" }],
|
||||||
|
"SeasonChallengeHistory": [
|
||||||
|
{ "challenge": "SeasonDailySolveCiphers", "id": "001000220000000000000308" },
|
||||||
|
{ "challenge": "SeasonDailyVisitFeaturedDojo", "id": "001000230000000000000316" },
|
||||||
|
{ "challenge": "SeasonDailyKillEnemiesWithRadiation", "id": "001000230000000000000317" },
|
||||||
|
{ "challenge": "SeasonWeeklyCompleteSortie", "id": "001000230000000000000309" },
|
||||||
|
{ "challenge": "SeasonWeeklyVenusBounties", "id": "001000230000000000000310" },
|
||||||
|
{ "challenge": "SeasonWeeklyZarimanBountyHunter", "id": "001000230000000000000311" },
|
||||||
|
{ "challenge": "SeasonWeeklyCatchRarePlainsFish", "id": "001000230000000000000312" },
|
||||||
|
{ "challenge": "SeasonWeeklyKillArchgunEnemies", "id": "001000230000000000000313" },
|
||||||
|
{ "challenge": "SeasonWeeklyHardKillSilverGroveSpecters", "id": "001000230000000000000314" },
|
||||||
|
{ "challenge": "SeasonWeeklyHardKillRopalolyst", "id": "001000230000000000000315" }
|
||||||
|
],
|
||||||
|
"StoryModeChoice": "WARFRAME",
|
||||||
|
"ChallengeProgress": [{ "Progress": 2, "Name": "EMGetKills" }],
|
||||||
|
"ChallengesFixVersion": 6,
|
||||||
|
"ActiveQuest": "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain",
|
||||||
|
"Consumables": [{ "ItemCount": 1, "ItemType": "/Lotus/Types/Restoratives/LisetAutoHack" }],
|
||||||
|
"DataKnives": [{ "ItemType": "/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon", "XP": 450000, "ItemId": { "$oid": "647bd274f22fc794a2cd3d33" } }],
|
||||||
|
"FlavourItems": [
|
||||||
|
{ "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem1" },
|
||||||
|
{ "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem2" },
|
||||||
|
{ "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem3" },
|
||||||
|
{ "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem4" }
|
||||||
|
],
|
||||||
|
"LongGuns": [{ "ItemType": "/Lotus/Weapons/MK1Series/MK1Paris", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"Melee": [{ "ItemType": "/Lotus/Weapons/Tenno/Melee/LongSword/LongSword", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"Pistols": [{ "ItemType": "/Lotus/Weapons/MK1Series/MK1Kunai", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"PlayedParkourTutorial": true,
|
||||||
|
"PremiumCreditsFree": 50,
|
||||||
|
"QuestKeys": [{ "ItemType": "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain" }],
|
||||||
|
"RawUpgrades": [{ "ItemCount": 1, "LastAdded": { "$oid": "6450f9bfe0714a4d6703f05f" }, "ItemType": "/Lotus/Upgrades/Mods/Warframe/AvatarShieldMaxMod" }],
|
||||||
|
"ReceivedStartingGear": true,
|
||||||
|
"Scoops": [{ "ItemType": "/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"Ships": [{ "ItemType": "/Lotus/Types/Items/Ships/DefaultShip", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"Suits": [{ "ItemType": "/Lotus/Powersuits/Volt/Volt", "XP": 0, "Configs": [{}, {}, {}], "UpgradeVer": 101, "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"TrainingRetriesLeft": 0,
|
||||||
|
"WeaponSkins": [{ "ItemType": "/Lotus/Upgrades/Skins/Volt/VoltHelmet", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }],
|
||||||
|
"LastInventorySync": { "$oid": "647bd27cf856530b4f3bf343" },
|
||||||
|
"NextRefill": { "$date": { "$numberLong": "1685829131" } },
|
||||||
|
"ActiveLandscapeTraps": [],
|
||||||
|
"CrewMembers": [],
|
||||||
|
"CrewShips": [],
|
||||||
|
"CrewShipHarnesses": [],
|
||||||
|
"CrewShipSalvagedWeapons": [],
|
||||||
|
"CrewShipSalvagedWeaponSkins": [],
|
||||||
|
"CrewShipWeapons": [],
|
||||||
|
"CrewShipWeaponSkins": [],
|
||||||
|
"DrifterGuns": [],
|
||||||
|
"Drones": [],
|
||||||
|
"Horses": [],
|
||||||
|
"Hoverboards": [],
|
||||||
|
"KubrowPets": [],
|
||||||
|
"KubrowPetEggs": [],
|
||||||
|
"KubrowPetPrints": [],
|
||||||
|
"MechSuits": [],
|
||||||
|
"MoaPets": [],
|
||||||
|
"OperatorAmps": [],
|
||||||
|
"OperatorLoadOuts": [],
|
||||||
|
"AdultOperatorLoadOuts": [],
|
||||||
|
"KahlLoadOuts": [],
|
||||||
|
"PendingRecipes": [],
|
||||||
|
"PersonalGoalProgress": [],
|
||||||
|
"PersonalTechProjects": [],
|
||||||
|
"QualifyingInvasions": [],
|
||||||
|
"RepVotes": [],
|
||||||
|
"Sentinels": [],
|
||||||
|
"SentinelWeapons": [],
|
||||||
|
"SpaceGuns": [],
|
||||||
|
"SpaceMelee": [],
|
||||||
|
"SpaceSuits": [],
|
||||||
|
"SpecialItems": [],
|
||||||
|
"StepSequencers": [],
|
||||||
|
"Upgrades": [],
|
||||||
|
"Boosters": [],
|
||||||
|
"EmailItems": [],
|
||||||
|
"FocusUpgrades": [],
|
||||||
|
"FusionTreasures": [],
|
||||||
|
"LeagueTickets": [],
|
||||||
|
"LevelKeys": [],
|
||||||
|
"LoreFragmentScans": [],
|
||||||
|
"MiscItems": [],
|
||||||
|
"PendingSpectreLoadouts": [],
|
||||||
|
"Quests": [],
|
||||||
|
"Robotics": [],
|
||||||
|
"ShipDecorations": [],
|
||||||
|
"SpectreLoadouts": [],
|
||||||
|
"XPInfo": [],
|
||||||
|
"CrewShipAmmo": [],
|
||||||
|
"CrewShipRawSalvage": [],
|
||||||
|
"EvolutionProgress": [],
|
||||||
|
"Missions": [],
|
||||||
|
"TauntHistory": [],
|
||||||
|
"CompletedSyndicates": [],
|
||||||
|
"UsedDailyDeals": [],
|
||||||
|
"LibraryAvailableDailyTaskInfo": {
|
||||||
|
"EnemyTypes": ["/Lotus/Types/Enemies/Orokin/OrokinBladeSawmanAvatar"],
|
||||||
|
"EnemyLocTag": "/Lotus/Language/Game/OrokinBladeSawman",
|
||||||
|
"EnemyIcon": "/Lotus/Interface/Icons/Npcs/Orokin/OrokinBladeSawman.png",
|
||||||
|
"ScansRequired": 4,
|
||||||
|
"RewardStoreItem": "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle",
|
||||||
|
"RewardQuantity": 10,
|
||||||
|
"RewardStanding": 10000
|
||||||
|
},
|
||||||
|
"HasContributedToDojo": false,
|
||||||
|
"HasResetAccount": false,
|
||||||
|
"PendingCoupon": { "Expiry": { "$date": { "$numberLong": "0" } }, "Discount": 0 },
|
||||||
|
"PremiumCredits": 50
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user