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, "skipTutorial": true,
"unlockAllMissions": true, "unlockAllMissions": true,
"unlockAllQuests": false, "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 { 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 // eslint-disable-next-line @typescript-eslint/no-misused-promises
const getShipController: RequestHandler = async (req, res) => { export const getShipController: RequestHandler = async (req, res) => {
const accountId = req.query.accountId; const accountId = parseString(req.query.accountId);
const ship = await Ship.findOne({ ShipOwnerId: accountId }).populate<{ const personalRooms = await getPersonalRooms(accountId);
LoadOutInventory: { LoadOutPresets: ILoadoutDatabase }; const loadout = await getLoadout(accountId);
}>("LoadOutInventory.LoadOutPresets"); const ship = await getShip(accountId, "ShipInteriorColors ShipAttachments SkinFlavourItem");
if (!ship) { const getShipResponse: IGetShipResponse = {
res.status(500).json({ error: "error finding a corresponding ship" }); ShipOwnerId: accountId,
return; 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 = [ res.json(getShipResponse);
"/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);
}; };
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 allMissions from "@/static/fixed_responses/allMissions.json";
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json"; import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; 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 inventoryController: RequestHandler = async (request: Request, response: Response) => {
const accountId = request.query.accountId; const accountId = request.query.accountId;
@ -15,24 +17,701 @@ const inventoryController: RequestHandler = async (request: Request, response: R
return; return;
} }
const inventory = await Inventory.findOne({ accountOwnerId: accountId }).populate<{ const inventory = await Inventory.findOne({ accountOwnerId: accountId })
LoadOutPresets: ILoadoutDatabase; .populate<{
}>("LoadOutPresets"); LoadOutPresets: ILoadoutDatabase;
}>("LoadOutPresets")
.populate<{ Ships: IShipInventory }>("Ships", "-ShipInteriorColors -ShipAttachments -SkinFlavourItem");
if (!inventory) { if (!inventory) {
response.status(400).json({ error: "inventory was undefined" }); response.status(400).json({ error: "inventory was undefined" });
return; 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 //TODO: make a function that converts from database representation to client
const inventoryJSON = inventory.toJSON(); const inventoryJSON = inventory.toJSON();
console.log(inventoryJSON.Ships);
const inventoryResponse = toInventoryResponse(inventoryJSON); const inventoryResponse = toInventoryResponse(inventoryJSON);
if (config.unlockAllMissions) inventoryResponse.Missions = allMissions; if (config.unlockAllMissions) inventoryResponse.Missions = allMissions;
if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys; 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 }; export { inventoryController };

View File

@ -51,7 +51,7 @@ const loginController: RequestHandler = async (request, response) => {
return; return;
} catch (error: unknown) { } catch (error: unknown) {
if (error instanceof Error) { 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, IInventoryDatabase,
IBooster, IBooster,
IInventoryResponse, IInventoryResponse,
IInventoryDatabaseDocument,
ISlots, ISlots,
IGenericItem, IGenericItem,
IMailbox, IMailbox,
@ -21,9 +20,7 @@ import {
IChallengeProgress, IChallengeProgress,
IStepSequencer, IStepSequencer,
IAffiliation, IAffiliation,
IShip,
INotePacks, INotePacks,
IShipExterior,
ICompletedJobChain, ICompletedJobChain,
ISeasonChallengeHistory, ISeasonChallengeHistory,
IPlayerSkills, IPlayerSkills,
@ -108,7 +105,7 @@ const abilityOverrideSchema = new Schema<IAbilityOverride>({
Ability: String, Ability: String,
Index: Number Index: Number
}); });
const colorSchema = new Schema<IColor>( export const colorSchema = new Schema<IColor>(
{ {
t0: Number, t0: Number,
t1: Number, t1: Number,
@ -457,33 +454,6 @@ const affiliationsSchema = new Schema<IAffiliation>(
{ _id: false } { _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>( const completedJobChainsSchema = new Schema<ICompletedJobChain>(
{ {
LocationTag: String, LocationTag: String,
@ -773,7 +743,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
Horses: [GenericItemSchema], Horses: [GenericItemSchema],
//LandingCraft like Liset //LandingCraft like Liset
Ships: [shipSchema], Ships: { type: [Schema.Types.ObjectId], ref: "Ships" },
// /Lotus/Types/Items/ShipDecos/ // /Lotus/Types/Items/ShipDecos/
ShipDecorations: [typeCountSchema], ShipDecorations: [typeCountSchema],

View File

@ -93,4 +93,4 @@ type loadoutDocumentProps = {
type loadoutModelType = Model<ILoadoutDatabase, {}, 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 { Model, Schema, StringSchemaDefinition, Types, model } from "mongoose";
import { IShip } from "../types/shipTypes"; import { IApartment, IPlacedDecosDatabase, IRooms, IShipDatabase } from "../types/shipTypes";
import { IOid } from "../types/commonTypes"; import { toOid } from "@/src/helpers/inventoryHelpers";
import { loadoutSchema } from "@/src/models/inventoryModels/loadoutModel"; 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, Type: String,
MaxCapacity: Number Pos: [Number],
}, Rot: [Number]
{ _id: false }
);
const shipSchema = new Schema(
{
Rooms: [roomSchema],
Features: [String],
ContentUrlSignature: String
}, },
{ id: false } { id: false }
); );
shipSchema.virtual("ShipId").get(function () { placedDecosSchema.virtual("id").get(function (this: IPlacedDecosDatabase) {
return { $oid: this._id.toString() } satisfies IOid; return toOid(this._id);
}); });
shipSchema.set("toJSON", { placedDecosSchema.set("toJSON", {
virtuals: true, virtuals: true,
transform(_document, returnedObject) { transform(_document, returnedObject) {
delete returnedObject._id; delete returnedObject._id;
} }
}); });
const apartmentSchema = new Schema({ const roomSchema = new Schema(
Rooms: [roomSchema], {
FavouriteLoadouts: [Schema.Types.Mixed] 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) { transform(_document, returnedObject) {
const shipResponse = returnedObject as IShipInventory;
const shipDatabase = returnedObject as IShipDatabase;
delete returnedObject._id; delete returnedObject._id;
} delete returnedObject.__v;
}); delete returnedObject.ShipOwnerId;
console.log(shipResponse.ShipExterior);
const shipDatabaseSchema = new Schema<IShip>({ if (shipResponse.ShipExterior) {
ShipOwnerId: Schema.Types.ObjectId, shipResponse.ShipExterior = {
Ship: shipSchema, Colors: shipDatabase.ShipExteriorColors,
Apartment: apartmentSchema, ShipAttachments: shipDatabase.ShipAttachments,
LoadOutInventory: { SkinFlavourItem: shipDatabase.SkinFlavourItem
LoadOutPresets: { };
type: Schema.Types.ObjectId,
ref: "Loadout"
} }
} }
}); });
shipDatabaseSchema.set("toJSON", { shipSchema.set("toObject", {
transform(_document, returnedObject) { virtuals: true
delete returnedObject._id;
delete returnedObject.__v;
}
}); });
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 { inventorySlotsController } from "@/src/controllers/api/inventorySlotsController";
import { startRecipeController } from "@/src/controllers/api/startRecipeController"; import { startRecipeController } from "@/src/controllers/api/startRecipeController";
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController"; 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(); const apiRouter = express.Router();
@ -65,6 +67,8 @@ apiRouter.get("/setBootLocation.php", setBootLocationController);
// post // post
// eslint-disable-next-line @typescript-eslint/no-misused-promises // 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("/claimCompletedRecipe.php", claimCompletedRecipeController);
apiRouter.post("/startRecipe.php", startRecipeController); apiRouter.post("/startRecipe.php", startRecipeController);
apiRouter.post("/inventorySlots.php", inventorySlotsController); apiRouter.post("/inventorySlots.php", inventorySlotsController);

View File

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

View File

@ -3,7 +3,9 @@ import { createInventory } from "@/src/services/inventoryService";
import { IDatabaseAccount } from "@/src/types/loginTypes"; import { IDatabaseAccount } from "@/src/types/loginTypes";
import { createShip } from "./shipService"; import { createShip } from "./shipService";
import { Types } from "mongoose"; 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 => { const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {
return requestPassword === databasePassword; return requestPassword === databasePassword;
@ -14,8 +16,9 @@ const createAccount = async (accountData: IDatabaseAccount) => {
try { try {
await account.save(); await account.save();
const loadoutId = await createLoadout(account._id); const loadoutId = await createLoadout(account._id);
await createInventory(account._id, loadoutId); const shipId = await createShip(account._id);
await createShip(account._id, loadoutId); await createInventory(account._id, { loadOutPresetId: loadoutId, ship: shipId });
await createPersonalRooms(account._id, shipId);
return account.toJSON(); return account.toJSON();
} catch (error) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {
@ -28,7 +31,16 @@ const createAccount = async (accountData: IDatabaseAccount) => {
export { isCorrectPassword, createAccount }; export { isCorrectPassword, createAccount };
export const createLoadout = async (accountId: Types.ObjectId) => { export const createLoadout = async (accountId: Types.ObjectId) => {
const loadout = new LoadoutModel({ loadoutOwnerId: accountId }); const loadout = new Loadout({ loadoutOwnerId: accountId });
const savedLoadout = await loadout.save(); const savedLoadout = await loadout.save();
return savedLoadout._id; 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, IOperatorConfigEntry,
ISaveLoadoutRequestNoUpgradeVer ISaveLoadoutRequestNoUpgradeVer
} from "@/src/types/saveLoadoutTypes"; } 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 { getInventory } from "@/src/services/inventoryService";
import { IOid } from "@/src/types/commonTypes"; import { IOid } from "@/src/types/commonTypes";
import { Types } from "mongoose"; import { Types } from "mongoose";
@ -60,7 +60,7 @@ export const handleInventoryItemConfigChange = async (
} }
case "LoadOuts": { case "LoadOuts": {
logger.debug("loadout received"); logger.debug("loadout received");
const loadout = await LoadoutModel.findOne({ loadoutOwnerId: accountId }); const loadout = await Loadout.findOne({ loadoutOwnerId: accountId });
if (!loadout) { if (!loadout) {
throw new Error("loadout not found"); throw new Error("loadout not found");
} }

View File

@ -1,15 +1,23 @@
import { Ship } from "@/src/models/shipModel"; 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"; import { Types } from "mongoose";
const createShip = async (accountOwnerId: Types.ObjectId, loadoutId: Types.ObjectId) => { export const createShip = async (accountOwnerId: Types.ObjectId) => {
try { try {
const ship = new Ship({ const ship = new Ship({
...new_ship, ItemType: "/Lotus/Types/Items/Ships/DefaultShip",
ShipOwnerId: accountOwnerId, 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) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {
throw new Error(`error creating ship" ${error.message}`); 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"; } 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";
import { Colour } from "warframe-items";
//Document extends will be deleted soon. TODO: delete and migrate uses to ... //Document extends will be deleted soon. TODO: delete and migrate uses to ...
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
export interface IInventoryDatabase export interface IInventoryDatabase
extends Omit< extends Omit<
IInventoryResponse, IInventoryResponse,
"TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes" | "Created" | "QuestKeys" | "BlessingCooldown" | "TrainingDate"
| "LoadOutPresets"
| "Mailbox"
| "PendingRecipes"
| "Created"
| "QuestKeys"
| "BlessingCooldown"
| "Ships"
> { > {
accountOwnerId: Types.ObjectId; accountOwnerId: Types.ObjectId;
Created: Date; Created: Date;
@ -27,6 +35,7 @@ export interface IInventoryDatabase
PendingRecipes: IPendingRecipe[]; PendingRecipes: IPendingRecipe[];
QuestKeys: IQuestKeyDatabase[]; QuestKeys: IQuestKeyDatabase[];
BlessingCooldown: Date; BlessingCooldown: Date;
Ships: Types.ObjectId[];
} }
export interface IInventoryResponseDocument extends IInventoryResponse, Document {} export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
@ -140,7 +149,7 @@ export interface IInventoryResponse {
LongGuns: IWeaponDatabase[]; LongGuns: IWeaponDatabase[];
Pistols: IWeaponDatabase[]; Pistols: IWeaponDatabase[];
Melee: IWeaponDatabase[]; Melee: IWeaponDatabase[];
Ships: IShip[]; Ships: IShipInventory[];
QuestKeys: IQuestKeyResponse[]; QuestKeys: IQuestKeyResponse[];
FlavourItems: IFlavourItem[]; FlavourItems: IFlavourItem[];
Scoops: IGenericItem[]; Scoops: IGenericItem[];
@ -450,7 +459,7 @@ export interface ICustomization {
export interface IShipExterior { export interface IShipExterior {
SkinFlavourItem: string; SkinFlavourItem: string;
Colors: IShipExteriorColors; Colors: IColor;
ShipAttachments?: IShipAttachments; ShipAttachments?: IShipAttachments;
} }
@ -1016,7 +1025,7 @@ export interface ISettings {
TradingRulesConfirmed: boolean; TradingRulesConfirmed: boolean;
} }
export interface IShip { export interface IShipInventory {
ItemType: string; ItemType: string;
ShipExterior: IShipExterior; ShipExterior: IShipExterior;
AirSupportPower: string; AirSupportPower: string;

View File

@ -1,30 +1,74 @@
import { Types } from "mongoose"; import { Schema, Types } from "mongoose";
import { IOid } from "@/src/types/commonTypes"; 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 { export interface IGetShipResponse {
ShipOwnerId: Types.ObjectId; ShipOwnerId: string;
Ship: IShipResponse; Ship: IShip;
Apartment: IApartment; Apartment: IApartment;
LoadOutInventory: { LoadOutPresets: Types.ObjectId }; LoadOutInventory: { LoadOutPresets: Types.ObjectId };
} }
export interface IShipResponse extends IShipDatabase { export interface IShipAttachments {
ShipId: IOid; HOOD_ORNAMENT: string;
} }
export interface IShipDatabase { export interface IShipInterior {
Rooms: IRooms[]; Colors: IColor;
ShipAttachments: IShipAttachments;
SkinFlavourItem: string;
}
export interface IShip {
Features: string[]; Features: string[];
ShipId: IOid;
ShipInterior: IShipInterior;
Rooms: IRooms[];
ContentUrlSignature: string; 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 { export interface IRooms {
Name: string; Name: string;
MaxCapacity: number; MaxCapacity: number;
PlacedDecos?: IPlacedDecosDatabase[];
}
export interface IPlants {
PlantType: string;
EndTime: IOid;
PlotIndex: number;
}
export interface IPlanters {
Name: string;
Plants: IPlants[];
} }
export interface IApartment { export interface IApartment {
Gardening: { Planters: IPlanters[] };
Rooms: IRooms[]; Rooms: IRooms[];
FavouriteLoadouts: string[]; 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": { "ItemType": "/Lotus/Types/Items/Ships/DefaultShip",
"Features": [ "AirSupportPower": "/Lotus/Types/Restoratives/LisetAutoHack",
"/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem", "ShipExterior": {
"/Lotus/Types/Items/ShipFeatureItems/ArsenalFeatureItem", "Colors": {
"/Lotus/Types/Items/ShipFeatureItems/SocialMenuFeatureItem", "t0": 3828063,
"/Lotus/Types/Items/ShipFeatureItems/ModsFeatureItem", "t1": 13529661,
"/Lotus/Types/Items/ShipFeatureItems/FoundryFeatureItem", "t2": 10767646,
"/Lotus/Types/Items/ShipFeatureItems/MercuryNavigationFeatureItem" "t3": 7216189,
], "m0": 9773092,
"ShipId": { "$oid": "removed" }, "en": 9773092
"Rooms": [ },
{ "Name": "AlchemyRoom", "MaxCapacity": 1600 }, "ShipAttachments": { "HOOD_ORNAMENT": "" },
{ "Name": "BridgeRoom", "MaxCapacity": 1600 }, "SkinFlavourItem": "/Lotus/Upgrades/Skins/Liset/LisetSkinFlavourItemDefault"
{ "Name": "LisetRoom", "MaxCapacity": 1000 },
{ "Name": "OperatorChamberRoom", "MaxCapacity": 1600 },
{ "Name": "OutsideRoom", "MaxCapacity": 1600 },
{ "Name": "PersonalQuartersRoom", "MaxCapacity": 1600 }
],
"ContentUrlSignature": "removed"
}, },
"Apartment": { "ItemId": { "$oid": "6450f9bfe0714a4d6703f05e" }
"Rooms": [
{ "Name": "ElevatorLanding", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomA", "MaxCapacity": 1000 },
{ "Name": "ApartmentRoomB", "MaxCapacity": 1600 },
{ "Name": "ApartmentRoomC", "MaxCapacity": 1600 },
{ "Name": "DuviriHallway", "MaxCapacity": 1600 }
],
"FavouriteLoadouts": []
}
} }