This commit is contained in:
Ordis 2024-02-16 22:40:00 +01:00
parent 91ced2c75b
commit c8c75e2431
20 changed files with 1167 additions and 218 deletions

View File

@ -8,5 +8,6 @@
"skipTutorial": true,
"unlockAllMissions": true,
"unlockAllQuests": false,
"infiniteResources": true
"infiniteResources": true,
"unlockallShipFeatures": true
}

View File

@ -1,90 +1,60 @@
import { Ship } from "@/src/models/shipModel";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
import { RequestHandler } from "express";
import config from "@/config.json";
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
import { parseString } from "@/src/helpers/general";
import { getShip } from "@/src/services/shipService";
import { PersonalRooms } from "@/src/models/shipModel";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { logger } from "@/src/utils/logger";
import { toOid } from "@/src/helpers/inventoryHelpers";
import { IGetShipResponse } from "@/src/types/shipTypes";
// eslint-disable-next-line @typescript-eslint/no-misused-promises
const getShipController: RequestHandler = async (req, res) => {
const accountId = req.query.accountId;
const ship = await Ship.findOne({ ShipOwnerId: accountId }).populate<{
LoadOutInventory: { LoadOutPresets: ILoadoutDatabase };
}>("LoadOutInventory.LoadOutPresets");
export const getShipController: RequestHandler = async (req, res) => {
const accountId = parseString(req.query.accountId);
const personalRooms = await getPersonalRooms(accountId);
const loadout = await getLoadout(accountId);
const ship = await getShip(accountId, "ShipInteriorColors ShipAttachments SkinFlavourItem");
if (!ship) {
res.status(500).json({ error: "error finding a corresponding ship" });
return;
const getShipResponse: IGetShipResponse = {
ShipOwnerId: accountId,
LoadOutInventory: { LoadOutPresets: loadout.toJSON() },
Ship: {
...personalRooms.toJSON().Ship,
ShipId: toOid(personalRooms.activeShipId),
ShipInterior: {
Colors: ship.ShipInteriorColors,
ShipAttachments: ship.ShipAttachments,
SkinFlavourItem: ship.SkinFlavourItem
}
},
Apartment: personalRooms.Apartment
};
if (config.unlockallShipFeatures) {
getShipResponse.Ship.Features = allShipFeatures;
}
ship.Ship.Features = [
"/Lotus/Types/Items/ShipFeatureItems/AdvancedOrdisFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/AlchemyRoomFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/AlertsFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/CeresNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ClanFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ErisNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EuropaNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryConcurrentBuildFormaFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/JupiterNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarketTierOneFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarketTierTwoFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarsNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MercuryNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsFusionFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsTransmuteFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/NeptuneNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PhobosNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PlutoNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodBraceFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHullFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleLeftFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleRightFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackTailFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/RailjackCephalonShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/RailjackKeyShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SaturnNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SednaNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SocialMenuFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SolarChartFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/UranusNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/VenusNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/VoidProjectionFeatureItem"
];
res.json(ship);
res.json(getShipResponse);
};
export { getShipController };
export const getLoadout = async (accountId: string) => {
const loadout = await Loadout.findOne({ loadoutOwnerId: accountId });
if (!loadout) {
logger.error(`loadout not found for account ${accountId}`);
throw new Error("loadout not found");
}
return loadout;
};
export const getPersonalRooms = async (accountId: string) => {
const personalRooms = await PersonalRooms.findOne({ personalRoomsOwnerId: accountId });
if (!personalRooms) {
logger.error(`personal rooms not found for account ${accountId}`);
throw new Error("personal rooms not found");
}
return personalRooms;
};

View File

@ -6,6 +6,8 @@ import config from "@/config.json";
import allMissions from "@/static/fixed_responses/allMissions.json";
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
import { Ship } from "@/src/models/shipModel";
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
const inventoryController: RequestHandler = async (request: Request, response: Response) => {
const accountId = request.query.accountId;
@ -15,24 +17,701 @@ const inventoryController: RequestHandler = async (request: Request, response: R
return;
}
const inventory = await Inventory.findOne({ accountOwnerId: accountId }).populate<{
LoadOutPresets: ILoadoutDatabase;
}>("LoadOutPresets");
const inventory = await Inventory.findOne({ accountOwnerId: accountId })
.populate<{
LoadOutPresets: ILoadoutDatabase;
}>("LoadOutPresets")
.populate<{ Ships: IShipInventory }>("Ships", "-ShipInteriorColors -ShipAttachments -SkinFlavourItem");
if (!inventory) {
response.status(400).json({ error: "inventory was undefined" });
return;
}
console.log(inventory.Ships);
// const ships = await Ship.find({ _id: { $in: inventory.Ships } });
//TODO: make a function that converts from database representation to client
const inventoryJSON = inventory.toJSON();
console.log(inventoryJSON.Ships);
const inventoryResponse = toInventoryResponse(inventoryJSON);
if (config.unlockAllMissions) inventoryResponse.Missions = allMissions;
if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys;
response.json(inventoryResponse);
(inventoryResponse.ShipDecorations = [
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ChildDrawingA"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ChildDrawingB"
},
{
ItemCount: 85,
ItemType: "/Lotus/Types/Items/ShipDecos/GlyphPictureFrame"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ChildDrawingC"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ChildDrawingD"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ChildDrawingF"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/OrbiterPictureFrameB"
},
{
ItemCount: 13,
ItemType: "/Lotus/Types/Items/ShipDecos/ConclaveHeartOroOrnament"
},
{
ItemCount: 18,
ItemType: "/Lotus/Types/Items/ShipDecos/Vignettes/Enemies/TeralystAFItem"
},
{
ItemCount: 10,
ItemType: "/Lotus/Types/Items/ShipDecos/Vignettes/Enemies/TeralystBigAFItem"
},
{
ItemCount: 6,
ItemType: "/Lotus/Types/Items/ShipDecos/Vignettes/Enemies/TeralystRainAFItem"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/Vignettes/Warframes/WarframeAFItem"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/PedistalPrime"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropEidolonShard"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropSentientCore"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyKubrodonUncommon"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyVirminkCommon"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyHorrasqueCommon"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyKubrodonCommon"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyKubrodonRare"
},
{
ItemCount: 10,
ItemType: "/Lotus/Types/Items/ShipDecos/Vignettes/Enemies/ArachnoidCamperAFItem"
},
{
ItemCount: 3,
ItemType: "/Lotus/Types/Items/ShipDecos/KubrowBust"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/KavatBust"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/RelayHydroidBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyDesertSkate"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationC"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationD"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardGauss"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationE"
},
{
ItemCount: 3,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationF"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardGrendel"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardAtlas"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/KubrowToyB"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationG"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationH"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyThumper"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyThumperMedium"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardIvara"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardNova"
},
{
ItemCount: 5,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationB"
},
{
ItemCount: 5,
ItemType: "/Lotus/Types/Items/ShipDecos/BaroKiTeerDecorationA"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ExcaliburArchwingBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusShip/LisetPropGreedCoinGold"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusShip/LisetPropGreedCoinBlue"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefA"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyKuvaFortressBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyEarthBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyMercuryBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyVenusBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyLuaBronze"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefB"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyPhobosBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyMarsBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyCeresBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyJupiterBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyEuropaBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophySaturnBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFBeastMasterBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFChargerBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFEngineerBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFGruntBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFHealerBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFHeavyBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFHellionBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFSniperBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFTankBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyUranusBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefC"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyPlutoBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyErisBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophySednaBronze"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyDerelictBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyNeptuneBronze"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFRollerFloofRucksack"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFRollerFloofBeach"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFRollerFloof"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFRollerFloofRainbow"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/WFRollerFloofMorning"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefD"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefE"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CorpusGreedReliefF"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/ResourceDecoItemArgonCrystal"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/KuvaMetaBallOrnament"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/SUToolBox"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/SUTechToolA"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConG"
},
{
ItemCount: 5,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConE"
},
{
ItemCount: 8,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConI"
},
{
ItemCount: 8,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConF"
},
{
ItemCount: 3,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConJ"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyDeimosBronze"
},
{
ItemCount: 5,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConC"
},
{
ItemCount: 5,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConB"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConD"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConH"
},
{
ItemCount: 4,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardTennoConA"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/SUToolBoxLarge"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/SUFoodBox"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank01Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank02Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank03Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank04Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank05Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank06Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank07Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank08Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank09Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank10Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank11Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank12Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank13Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank14Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank15Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank16Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank17Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank18Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank19Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank20Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank21Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank22Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank23Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank24Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank25Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank26Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank27Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank28Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank29Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank30Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Events/TickerValentineWings"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyTicker"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/WeGame/LuckyKavat"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/WeGame/LuckyKavatWhite"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardSevagoth"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/WraithQuestRewardDeco"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/Deimos/PlushyMoonMonsterCommon"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/OrbiterPictureFrameBaro"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/YareliMerulinaBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank31Trophy"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/TarotCardYareli"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/YareliBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropBallasSwordSheath"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/HeartOfDeimosAlbumCoverPoster"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/StalkerBobbleHead"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/GarvLatroxPoster"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Conquera2021Deco"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/TheNewWarKahlCommunityDisplay"
},
{
ItemCount: 2,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/TheNewWarTeshinCommunityDisplay"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/NewWar/LisetPropBallasStaff"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/NewWar/LisetPropFamilyPortrait"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropNarmerMandolin"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropGrineerCutter"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/Deimos/PlushySunMonsterCommon"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropGrineerFlak"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/CNY2021Poster"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Plushies/PlushyTiger"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/LisetPropGyrePulseDecoration"
},
{
ItemCount: 1,
ItemType: "/Lotus/Types/Items/ShipDecos/Venus/PrideCommunityDisplay"
}
]),
// (inventoryResponse.Ships = [
// {
// ItemType: "/Lotus/Types/Items/Ships/BlueSkyShip",
// ShipExterior: {
// SkinFlavourItem: "/Lotus/Upgrades/Skins/Liset/LisetBlueSkySkinStalker",
// Colors: {
// t0: 0,
// t1: 5703424,
// t2: 0,
// t3: 5703424,
// m0: 16742665,
// en: 16742665
// }
// },
// AirSupportPower: "/Lotus/Types/Restoratives/LisetMedStation",
// ItemId: {
// $oid: "5b9ee83aa38e4a3fb7235e39"
// }
// },
// {
// ItemType: "/Lotus/Types/Items/Ships/NoraShip",
// AirSupportPower: "/Lotus/Types/Restoratives/LisetMedStation",
// ShipExterior: {
// Colors: {
// t0: 5703424,
// t1: 5703424,
// t2: 0,
// t3: 5703424,
// m0: 16742665,
// en: 16742665
// },
// SkinFlavourItem: "/Lotus/Upgrades/Skins/Liset/ZephyrDeluxeShipSkin",
// ShipAttachments: {
// HOOD_ORNAMENT: "/Lotus/Upgrades/Skins/Liset/MasteryHoodOrnament"
// }
// },
// ItemId: {
// $oid: "5ef21701e56e414c3e5d39f5"
// }
// }
// ]);
response.json(inventoryResponse);
};
export { inventoryController };

View File

@ -51,7 +51,7 @@ const loginController: RequestHandler = async (request, response) => {
return;
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error("error creating account", error);
throw new Error(`error creating account ${error.message}`);
}
}
}

View File

@ -0,0 +1,18 @@
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
export const setShipCustomizationsController: RequestHandler = (_req, res) => {
try {
res.send(200);
handleSetShipDecorations();
} catch (error: unknown) {
if (error instanceof Error) {
logger.error(`error in saveLoadoutController: ${error.message}`);
res.status(400).json({ error: error.message });
} else {
res.status(400).json({ error: "unknown error" });
}
}
function handleSetShipDecorations() {}
};

View File

@ -0,0 +1,76 @@
import { getPersonalRooms } from "@/src/controllers/api/getShipController";
import { parseString } from "@/src/helpers/general";
import { getShip } from "@/src/services/shipService";
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
import { Types } from "mongoose";
// eslint-disable-next-line @typescript-eslint/no-misused-promises
export const shipDecorationsController: RequestHandler = async (req, res) => {
const accountId = parseString(req.query.accountId);
const shipDecorationsRequest = JSON.parse(req.body as string) as IShipDecorationsRequest;
console.log(shipDecorationsRequest);
try {
const placedDecoration = await handleSetShipDecorations(accountId, shipDecorationsRequest);
res.send(placedDecoration);
} catch (error: unknown) {
if (error instanceof Error) {
logger.error(`error in saveLoadoutController: ${error.message}`);
res.status(400).json({ error: error.message });
}
}
};
const handleSetShipDecorations = async (
accountId: string,
placedDecoration: IShipDecorationsRequest
): Promise<IShipDecorationsResponse> => {
const personalRooms = await getPersonalRooms(accountId);
console.log(placedDecoration);
const room = personalRooms.Ship.Rooms.find(room => room.Name === placedDecoration.Room);
//TODO: check whether to remove from shipitems
if (placedDecoration.RemoveId) {
room?.PlacedDecos?.pull({ _id: placedDecoration.RemoveId });
await personalRooms.save();
return {
DecoId: placedDecoration.RemoveId,
Room: placedDecoration.Room,
IsApartment: placedDecoration.IsApartment,
MaxCapacityIncrease: 0
};
}
// TODO: handle capacity
const decoId = new Types.ObjectId();
room?.PlacedDecos?.push({
Type: placedDecoration.Type,
Pos: placedDecoration.Pos,
Rot: placedDecoration.Rot,
_id: decoId
});
await personalRooms.save();
return { DecoId: decoId.toString(), Room: placedDecoration.Room, IsApartment: placedDecoration.IsApartment };
};
export interface IShipDecorationsRequest {
Type: string;
Pos: [number, number, number];
Rot: [number, number, number];
Room: string;
IsApartment: boolean;
RemoveId: string;
}
export interface IShipDecorationsResponse {
DecoId: string;
Room: string;
IsApartment: boolean;
MaxCapacityIncrease?: number;
}

View File

@ -6,7 +6,6 @@ import {
IInventoryDatabase,
IBooster,
IInventoryResponse,
IInventoryDatabaseDocument,
ISlots,
IGenericItem,
IMailbox,
@ -21,9 +20,7 @@ import {
IChallengeProgress,
IStepSequencer,
IAffiliation,
IShip,
INotePacks,
IShipExterior,
ICompletedJobChain,
ISeasonChallengeHistory,
IPlayerSkills,
@ -108,7 +105,7 @@ const abilityOverrideSchema = new Schema<IAbilityOverride>({
Ability: String,
Index: Number
});
const colorSchema = new Schema<IColor>(
export const colorSchema = new Schema<IColor>(
{
t0: Number,
t1: Number,
@ -457,33 +454,6 @@ const affiliationsSchema = new Schema<IAffiliation>(
{ _id: false }
);
const shipExteriorSchema = new Schema<IShipExterior>(
{
SkinFlavourItem: String,
Colors: colorSchema, //TODO: perhaps too many colors here
ShipAttachments: { HOOD_ORNAMENT: String }
},
{ _id: false }
);
const shipSchema = new Schema<IShip>({
ItemType: String,
ShipExterior: shipExteriorSchema,
AirSupportPower: String
});
shipSchema.virtual("ItemId").get(function () {
return { $oid: this._id.toString() };
});
shipSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
delete returnedObject.__v;
}
});
const completedJobChainsSchema = new Schema<ICompletedJobChain>(
{
LocationTag: String,
@ -773,7 +743,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
Horses: [GenericItemSchema],
//LandingCraft like Liset
Ships: [shipSchema],
Ships: { type: [Schema.Types.ObjectId], ref: "Ships" },
// /Lotus/Types/Items/ShipDecos/
ShipDecorations: [typeCountSchema],

View File

@ -93,4 +93,4 @@ type loadoutDocumentProps = {
type loadoutModelType = Model<ILoadoutDatabase, {}, loadoutDocumentProps>;
export const LoadoutModel = model<ILoadoutDatabase, loadoutModelType>("Loadout", loadoutSchema);
export const Loadout = model<ILoadoutDatabase, loadoutModelType>("Loadout", loadoutSchema);

View File

@ -1,66 +1,112 @@
import { Schema, model } from "mongoose";
import { IShip } from "../types/shipTypes";
import { IOid } from "../types/commonTypes";
import { loadoutSchema } from "@/src/models/inventoryModels/loadoutModel";
import { Model, Schema, StringSchemaDefinition, Types, model } from "mongoose";
import { IApartment, IPlacedDecosDatabase, IRooms, IShipDatabase } from "../types/shipTypes";
import { toOid } from "@/src/helpers/inventoryHelpers";
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
const roomSchema = new Schema(
const placedDecosSchema = new Schema<IPlacedDecosDatabase>(
{
Name: String,
MaxCapacity: Number
},
{ _id: false }
);
const shipSchema = new Schema(
{
Rooms: [roomSchema],
Features: [String],
ContentUrlSignature: String
Type: String,
Pos: [Number],
Rot: [Number]
},
{ id: false }
);
shipSchema.virtual("ShipId").get(function () {
return { $oid: this._id.toString() } satisfies IOid;
placedDecosSchema.virtual("id").get(function (this: IPlacedDecosDatabase) {
return toOid(this._id);
});
shipSchema.set("toJSON", {
placedDecosSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
}
});
const apartmentSchema = new Schema({
Rooms: [roomSchema],
FavouriteLoadouts: [Schema.Types.Mixed]
const roomSchema = new Schema(
{
Name: String,
MaxCapacity: Number,
PlacedDecos: [placedDecosSchema]
},
{ _id: false }
);
const shipSchema = new Schema<IShipDatabase>(
{
ItemType: String,
ShipOwnerId: Schema.Types.ObjectId,
ShipInteriorColors: colorSchema,
ShipExteriorColors: colorSchema,
AirSupportPower: String,
ShipAttachments: { HOOD_ORNAMENT: String },
SkinFlavourItem: String
},
{ id: false }
);
shipSchema.virtual("ItemId").get(function () {
return toOid(this._id);
});
apartmentSchema.set("toJSON", {
shipSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
const shipResponse = returnedObject as IShipInventory;
const shipDatabase = returnedObject as IShipDatabase;
delete returnedObject._id;
}
});
const shipDatabaseSchema = new Schema<IShip>({
ShipOwnerId: Schema.Types.ObjectId,
Ship: shipSchema,
Apartment: apartmentSchema,
LoadOutInventory: {
LoadOutPresets: {
type: Schema.Types.ObjectId,
ref: "Loadout"
delete returnedObject.__v;
delete returnedObject.ShipOwnerId;
console.log(shipResponse.ShipExterior);
if (shipResponse.ShipExterior) {
shipResponse.ShipExterior = {
Colors: shipDatabase.ShipExteriorColors,
ShipAttachments: shipDatabase.ShipAttachments,
SkinFlavourItem: shipDatabase.SkinFlavourItem
};
}
}
});
shipDatabaseSchema.set("toJSON", {
transform(_document, returnedObject) {
delete returnedObject._id;
delete returnedObject.__v;
}
shipSchema.set("toObject", {
virtuals: true
});
const Ship = model<IShip>("Ship", shipDatabaseSchema);
const apartmentSchema = new Schema<IApartment>(
{
Rooms: [roomSchema],
FavouriteLoadouts: [Schema.Types.Mixed]
},
{ _id: false }
);
export { Ship };
export const Ship = model("Ships", shipSchema);
export interface IPersonalRooms {
personalRoomsOwnerId: Types.ObjectId;
activeShipId: Types.ObjectId;
Ship: { Features: string[]; Rooms: IRooms[]; ContentUrlSignature: string };
Apartment: IApartment;
}
const orbiterSchema = new Schema({ Features: [String], Rooms: [roomSchema], ContentUrlSignature: String });
export const personalRoomsSchema = new Schema<IPersonalRooms>({
personalRoomsOwnerId: Schema.Types.ObjectId,
activeShipId: Schema.Types.ObjectId,
Ship: orbiterSchema,
Apartment: apartmentSchema
});
type RoomsType = { Name: string; MaxCapacity: number; PlacedDecos: Types.DocumentArray<IPlacedDecosDatabase> };
type PersonalRoomsDocumentProps = {
Ship: {
Features: string[];
Rooms: RoomsType[];
};
};
type PersonalRoomsModelType = Model<IPersonalRooms, {}, PersonalRoomsDocumentProps>;
export const PersonalRooms = model<IPersonalRooms, PersonalRoomsModelType>("PersonalRooms", personalRoomsSchema);

View File

@ -37,6 +37,8 @@ import { focusController } from "@/src/controllers/api/focusController";
import { inventorySlotsController } from "@/src/controllers/api/inventorySlotsController";
import { startRecipeController } from "@/src/controllers/api/startRecipeController";
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController";
import { shipDecorationsController } from "@/src/controllers/api/shipDecorationsController";
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
const apiRouter = express.Router();
@ -65,6 +67,8 @@ apiRouter.get("/setBootLocation.php", setBootLocationController);
// post
// eslint-disable-next-line @typescript-eslint/no-misused-promises
apiRouter.post("/shipDecorations.php", shipDecorationsController);
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
apiRouter.post("/startRecipe.php", startRecipeController);
apiRouter.post("/inventorySlots.php", inventorySlotsController);

View File

@ -19,12 +19,16 @@ import { IArtifactsRequest, IMissionInventoryUpdateRequest } from "../types/requ
import { logger } from "@/src/utils/logger";
import { WeaponTypeInternal } from "@/src/services/itemDataService";
export const createInventory = async (accountOwnerId: Types.ObjectId, loadOutPresetId: Types.ObjectId) => {
export const createInventory = async (
accountOwnerId: Types.ObjectId,
defaultItemReferences: { loadOutPresetId: Types.ObjectId; ship: Types.ObjectId }
) => {
try {
const inventory = new Inventory({
...new_inventory,
accountOwnerId: accountOwnerId,
LoadOutPresets: loadOutPresetId
LoadOutPresets: defaultItemReferences.loadOutPresetId,
Ships: [defaultItemReferences.ship]
});
if (config.skipStoryModeChoice) {
inventory.StoryModeChoice = "WARFRAME";

View File

@ -3,7 +3,9 @@ import { createInventory } from "@/src/services/inventoryService";
import { IDatabaseAccount } from "@/src/types/loginTypes";
import { createShip } from "./shipService";
import { Types } from "mongoose";
import { LoadoutModel } from "@/src/models/inventoryModels/loadoutModel";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { PersonalRooms } from "@/src/models/shipModel";
import new_personal_rooms from "@/static/fixed_responses/personalRooms.json";
const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {
return requestPassword === databasePassword;
@ -14,8 +16,9 @@ const createAccount = async (accountData: IDatabaseAccount) => {
try {
await account.save();
const loadoutId = await createLoadout(account._id);
await createInventory(account._id, loadoutId);
await createShip(account._id, loadoutId);
const shipId = await createShip(account._id);
await createInventory(account._id, { loadOutPresetId: loadoutId, ship: shipId });
await createPersonalRooms(account._id, shipId);
return account.toJSON();
} catch (error) {
if (error instanceof Error) {
@ -28,7 +31,16 @@ const createAccount = async (accountData: IDatabaseAccount) => {
export { isCorrectPassword, createAccount };
export const createLoadout = async (accountId: Types.ObjectId) => {
const loadout = new LoadoutModel({ loadoutOwnerId: accountId });
const loadout = new Loadout({ loadoutOwnerId: accountId });
const savedLoadout = await loadout.save();
return savedLoadout._id;
};
export const createPersonalRooms = async (accountId: Types.ObjectId, shipId: Types.ObjectId) => {
const personalRooms = new PersonalRooms({
...new_personal_rooms,
personalRoomsOwnerId: accountId,
activeShipId: shipId
});
await personalRooms.save();
};

View File

View File

@ -5,7 +5,7 @@ import {
IOperatorConfigEntry,
ISaveLoadoutRequestNoUpgradeVer
} from "@/src/types/saveLoadoutTypes";
import { LoadoutModel } from "@/src/models/inventoryModels/loadoutModel";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { getInventory } from "@/src/services/inventoryService";
import { IOid } from "@/src/types/commonTypes";
import { Types } from "mongoose";
@ -60,7 +60,7 @@ export const handleInventoryItemConfigChange = async (
}
case "LoadOuts": {
logger.debug("loadout received");
const loadout = await LoadoutModel.findOne({ loadoutOwnerId: accountId });
const loadout = await Loadout.findOne({ loadoutOwnerId: accountId });
if (!loadout) {
throw new Error("loadout not found");
}

View File

@ -1,15 +1,23 @@
import { Ship } from "@/src/models/shipModel";
import new_ship from "@/static/fixed_responses/ship.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
import { logger } from "@/src/utils/logger";
import { Types } from "mongoose";
const createShip = async (accountOwnerId: Types.ObjectId, loadoutId: Types.ObjectId) => {
export const createShip = async (accountOwnerId: Types.ObjectId) => {
try {
const ship = new Ship({
...new_ship,
ItemType: "/Lotus/Types/Items/Ships/DefaultShip",
ShipOwnerId: accountOwnerId,
LoadOutInventory: { LoadOutPresets: loadoutId }
ShipInteriorColors: {
t0: 3828063,
t1: 2502747
},
ShipAttachments: { HOOD_ORNAMENT: "" },
SkinFlavourItem: "/Lotus/Upgrades/Skins/Liset/LisetSkinFlavourItemDefault"
});
await ship.save();
const newShip = await ship.save();
console.log(newShip);
return newShip._id;
} catch (error) {
if (error instanceof Error) {
throw new Error(`error creating ship" ${error.message}`);
@ -18,4 +26,26 @@ const createShip = async (accountOwnerId: Types.ObjectId, loadoutId: Types.Objec
}
};
export { createShip };
export const getShip = async (shipOwnerId: string, fieldSelection: string = "") => {
const ship = await Ship.findOne({ ShipOwnerId: shipOwnerId }, fieldSelection);
if (!ship) {
logger.error(`error finding a ship for account ${shipOwnerId}`);
throw new Error(`error finding a ship for account ${shipOwnerId}`);
}
return ship;
};
export const getShipLean = async (shipOwnerId: string) => {
const ship = await Ship.findOne({ ShipOwnerId: shipOwnerId }).lean().populate<{
LoadOutInventory: { LoadOutPresets: ILoadoutDatabase };
}>("LoadOutInventory.LoadOutPresets");
if (!ship) {
logger.error(`error finding a ship for account ${shipOwnerId}`);
throw new Error(`error finding a ship for account ${shipOwnerId}`);
}
return ship;
};

View File

@ -11,13 +11,21 @@ import {
} from "@/src/types/inventoryTypes/commonInventoryTypes";
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
import { Colour } from "warframe-items";
//Document extends will be deleted soon. TODO: delete and migrate uses to ...
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
export interface IInventoryDatabase
extends Omit<
IInventoryResponse,
"TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes" | "Created" | "QuestKeys" | "BlessingCooldown"
| "TrainingDate"
| "LoadOutPresets"
| "Mailbox"
| "PendingRecipes"
| "Created"
| "QuestKeys"
| "BlessingCooldown"
| "Ships"
> {
accountOwnerId: Types.ObjectId;
Created: Date;
@ -27,6 +35,7 @@ export interface IInventoryDatabase
PendingRecipes: IPendingRecipe[];
QuestKeys: IQuestKeyDatabase[];
BlessingCooldown: Date;
Ships: Types.ObjectId[];
}
export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
@ -140,7 +149,7 @@ export interface IInventoryResponse {
LongGuns: IWeaponDatabase[];
Pistols: IWeaponDatabase[];
Melee: IWeaponDatabase[];
Ships: IShip[];
Ships: IShipInventory[];
QuestKeys: IQuestKeyResponse[];
FlavourItems: IFlavourItem[];
Scoops: IGenericItem[];
@ -450,7 +459,7 @@ export interface ICustomization {
export interface IShipExterior {
SkinFlavourItem: string;
Colors: IShipExteriorColors;
Colors: IColor;
ShipAttachments?: IShipAttachments;
}
@ -1016,7 +1025,7 @@ export interface ISettings {
TradingRulesConfirmed: boolean;
}
export interface IShip {
export interface IShipInventory {
ItemType: string;
ShipExterior: IShipExterior;
AirSupportPower: string;

View File

@ -1,30 +1,74 @@
import { Types } from "mongoose";
import { Schema, Types } from "mongoose";
import { IOid } from "@/src/types/commonTypes";
import { IColor } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
import { ILoadoutClient } from "@/src/types/saveLoadoutTypes";
export interface IShip {
ShipOwnerId: Types.ObjectId;
Ship: IShipResponse;
export interface IGetShipResponse {
ShipOwnerId: string;
Ship: IShip;
Apartment: IApartment;
LoadOutInventory: { LoadOutPresets: Types.ObjectId };
}
export interface IShipResponse extends IShipDatabase {
ShipId: IOid;
export interface IShipAttachments {
HOOD_ORNAMENT: string;
}
export interface IShipDatabase {
Rooms: IRooms[];
export interface IShipInterior {
Colors: IColor;
ShipAttachments: IShipAttachments;
SkinFlavourItem: string;
}
export interface IShip {
Features: string[];
ShipId: IOid;
ShipInterior: IShipInterior;
Rooms: IRooms[];
ContentUrlSignature: string;
}
// TODO: add Apartment.Gardening
export interface IShipDatabase {
ItemType: string;
ShipOwnerId: Schema.Types.ObjectId;
ShipInteriorColors: IColor;
ShipExteriorColors: IColor;
AirSupportPower: string;
ShipAttachments: IShipAttachments;
SkinFlavourItem: string;
}
export interface IRooms {
Name: string;
MaxCapacity: number;
PlacedDecos?: IPlacedDecosDatabase[];
}
export interface IPlants {
PlantType: string;
EndTime: IOid;
PlotIndex: number;
}
export interface IPlanters {
Name: string;
Plants: IPlants[];
}
export interface IApartment {
Gardening: { Planters: IPlanters[] };
Rooms: IRooms[];
FavouriteLoadouts: string[];
}
export interface IPlacedDecosDatabase {
Type: string;
Pos: [number, number, number];
Rot: [number, number, number];
_id: Types.ObjectId;
}
export interface IPlacedDecosClient extends Omit<IPlacedDecosDatabase, "_id"> {
id: IOid;
}

View File

@ -0,0 +1,69 @@
[
"/Lotus/Types/Items/ShipFeatureItems/AdvancedOrdisFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/AlchemyRoomFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/AlertsFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/CeresNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ClanFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/EidolonArchwingFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ErisNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/EuropaNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryConcurrentBuildFormaFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/FoundryVesselUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryCatbrowUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/GeneticFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryArchonShardFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryItem",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/InfestedFoundryUpgradeFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/JupiterNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarketTierOneFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarketTierTwoFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MarsNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/MercuryNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsFusionFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ModsTransmuteFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/NeptuneNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/PersonalQuartersFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PhobosNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/PlutoNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodBraceFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHoodFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackHullFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleLeftFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackNacelleRightFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/DamagedRailjackTailFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodBraceFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHoodFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackHullFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleLeftFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackNacelleRightFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/Railjack/RailjackTailFeatureItemBlueprint",
"/Lotus/Types/Items/ShipFeatureItems/RailjackCephalonShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/RailjackKeyShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SaturnNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SednaNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/ShipFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SocialMenuFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/SolarChartFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/UranusNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/VenusNavigationFeatureItem",
"/Lotus/Types/Items/ShipFeatureItems/VoidProjectionFeatureItem"
]

View File

@ -0,0 +1,32 @@
{
"Ship": {
"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"
],
"Rooms": [
{ "Name": "AlchemyRoom", "MaxCapacity": 1600 },
{ "Name": "BridgeRoom", "MaxCapacity": 1600 },
{ "Name": "LisetRoom", "MaxCapacity": 1000 },
{ "Name": "OperatorChamberRoom", "MaxCapacity": 1600 },
{ "Name": "OutsideRoom", "MaxCapacity": 1600 },
{ "Name": "PersonalQuartersRoom", "MaxCapacity": 1600 }
],
"ContentUrlSignature": "removed"
},
"Apartment": {
"Rooms": [
{ "Name": "ElevatorLanding", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomA", "MaxCapacity": 1000 },
{ "Name": "ApartmentRoomB", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomC", "MaxCapacity": 1600 },
{ "Name": "DuviriHallway", "MaxCapacity": 1600 }
],
"FavouriteLoadouts": [],
"Gardening": []
}
}

View File

@ -1,32 +1,17 @@
{
"Ship": {
"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"
],
"ShipId": { "$oid": "removed" },
"Rooms": [
{ "Name": "AlchemyRoom", "MaxCapacity": 1600 },
{ "Name": "BridgeRoom", "MaxCapacity": 1600 },
{ "Name": "LisetRoom", "MaxCapacity": 1000 },
{ "Name": "OperatorChamberRoom", "MaxCapacity": 1600 },
{ "Name": "OutsideRoom", "MaxCapacity": 1600 },
{ "Name": "PersonalQuartersRoom", "MaxCapacity": 1600 }
],
"ContentUrlSignature": "removed"
"ItemType": "/Lotus/Types/Items/Ships/DefaultShip",
"AirSupportPower": "/Lotus/Types/Restoratives/LisetAutoHack",
"ShipExterior": {
"Colors": {
"t0": 3828063,
"t1": 13529661,
"t2": 10767646,
"t3": 7216189,
"m0": 9773092,
"en": 9773092
},
"ShipAttachments": { "HOOD_ORNAMENT": "" },
"SkinFlavourItem": "/Lotus/Upgrades/Skins/Liset/LisetSkinFlavourItemDefault"
},
"Apartment": {
"Rooms": [
{ "Name": "ElevatorLanding", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomA", "MaxCapacity": 1000 },
{ "Name": "ApartmentRoomB", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomC", "MaxCapacity": 1600 },
{ "Name": "DuviriHallway", "MaxCapacity": 1600 }
],
"FavouriteLoadouts": []
}
"ItemId": { "$oid": "6450f9bfe0714a4d6703f05e" }
}