feat: Ship Customizations, Personal Rooms (Orbiter, Apartment) #132

Merged
OrdisPrime merged 4 commits from ship-customizations into main 2024-02-18 04:58:43 -08:00
19 changed files with 296 additions and 842 deletions
Showing only changes of commit 25a552eb1b - Show all commits

View File

@ -7,7 +7,8 @@
"skipStoryModeChoice": true,
"skipTutorial": true,
"unlockAllMissions": true,
"unlockAllQuests": false,
"unlockAllQuests": true,
"infiniteResources": true,
"unlockallShipFeatures": true
"unlockallShipFeatures": true,
"unlockAllShipDecorations": true
}

View File

@ -3,7 +3,7 @@ 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 { PersonalRooms } from "@/src/models/personalRoomsModel";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { logger } from "@/src/utils/logger";
import { toOid } from "@/src/helpers/inventoryHelpers";
@ -14,7 +14,7 @@ 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");
const ship = await getShip(personalRooms.activeShipId, "ShipInteriorColors ShipAttachments SkinFlavourItem");
const getShipResponse: IGetShipResponse = {
ShipOwnerId: accountId,

View File

@ -5,8 +5,8 @@ import { Request, RequestHandler, Response } from "express";
import config from "@/config.json";
import allMissions from "@/static/fixed_responses/allMissions.json";
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
import allShipDecorations from "@/static/fixed_responses/shipDecorations.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) => {
@ -21,16 +21,13 @@ const inventoryController: RequestHandler = async (request: Request, response: R
.populate<{
LoadOutPresets: ILoadoutDatabase;
}>("LoadOutPresets")
.populate<{ Ships: IShipInventory }>("Ships", "-ShipInteriorColors -ShipAttachments -SkinFlavourItem");
.populate<{ Ships: IShipInventory }>("Ships", "-ShipInteriorColors");
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);
@ -40,678 +37,11 @@ const inventoryController: RequestHandler = async (request: Request, response: R
if (config.unlockAllMissions) inventoryResponse.Missions = allMissions;
if (config.unlockAllQuests) inventoryResponse.QuestKeys = allQuestKeys;
(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);
if (config.unlockAllShipDecorations) {
inventoryResponse.ShipDecorations = allShipDecorations;
}
response.json(inventoryResponse);
};
export { inventoryController };

View File

@ -0,0 +1,15 @@
import { getPersonalRooms } from "@/src/controllers/api/getShipController";
import { parseString } from "@/src/helpers/general";
import { RequestHandler } from "express";
import { Types } from "mongoose";
// eslint-disable-next-line @typescript-eslint/no-misused-promises
export const setActiveShipController: RequestHandler = async (req, res) => {
const accountId = parseString(req.query.accountId);
const shipId = parseString(req.query.shipId);
const personalRooms = await getPersonalRooms(accountId);
personalRooms.activeShipId = new Types.ObjectId(shipId);
await personalRooms.save();
res.status(200).end();
};

View File

@ -1,18 +1,19 @@
import { setShipCustomizations } from "@/src/services/shipCustomizationsService";
import { ISetShipCustomizationsRequest } from "@/src/types/shipTypes";
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
export const setShipCustomizationsController: RequestHandler = (_req, res) => {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
export const setShipCustomizationsController: RequestHandler = async (req, res) => {
try {
res.send(200);
handleSetShipDecorations();
const setShipCustomizationsRequest = JSON.parse(req.body as string) as ISetShipCustomizationsRequest;
const setShipCustomizationsResponse = await setShipCustomizations(setShipCustomizationsRequest);
res.json(setShipCustomizationsResponse);
} catch (error: unknown) {
if (error instanceof Error) {
logger.error(`error in saveLoadoutController: ${error.message}`);
logger.error(`error in setShipCustomizationsController: ${error.message}`);
res.status(400).json({ error: error.message });
} else {
res.status(400).json({ error: "unknown error" });
}
}
function handleSetShipDecorations() {}
};

View File

@ -1,15 +1,13 @@
import { getPersonalRooms } from "@/src/controllers/api/getShipController";
import { parseString } from "@/src/helpers/general";
import { getShip } from "@/src/services/shipService";
import { IShipDecorationsRequest } from "@/src/types/shipTypes";
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
import { Types } from "mongoose";
import { handleSetShipDecorations } from "@/src/services/shipCustomizationsService";
// 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);
@ -21,56 +19,3 @@ export const shipDecorationsController: RequestHandler = async (req, res) => {
}
}
};
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

@ -46,14 +46,4 @@ databaseAccountSchema.set("toJSON", {
virtuals: true
});
//databaseAccountSchema.set("");
// Create a virtual property `domain` that's computed from `email`.
// databaseAccountSchema.virtual("id").get(function () {
// //console.log(this);
// return this._id;
// });
const Account = model<IDatabaseAccountDocument>("Account", databaseAccountSchema);
export { Account };
export const Account = model<IDatabaseAccountDocument>("Account", databaseAccountSchema);

View File

@ -0,0 +1,60 @@
import { toOid } from "@/src/helpers/inventoryHelpers";
import { IOrbiter, IPersonalRooms, PersonalRoomsModelType } from "@/src/types/personalRoomsTypes";
import { IApartment, IGardening, IPlacedDecosDatabase } from "@/src/types/shipTypes";
import { Schema, model } from "mongoose";
const placedDecosSchema = new Schema<IPlacedDecosDatabase>(
{
Type: String,
Pos: [Number],
Rot: [Number]
},
{ id: false }
);
placedDecosSchema.virtual("id").get(function (this: IPlacedDecosDatabase) {
return toOid(this._id);
});
placedDecosSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
}
});
const roomSchema = new Schema(
{
Name: String,
MaxCapacity: Number,
PlacedDecos: [placedDecosSchema]
},
{ _id: false }
);
const gardeningSchema = new Schema<IGardening>({
Planters: [Schema.Types.Mixed] //TODO: add when implementing gardening
});
const apartmentSchema = new Schema<IApartment>(
{
Rooms: [roomSchema],
FavouriteLoadouts: [Schema.Types.Mixed],
Gardening: gardeningSchema
},
{ _id: false }
);
const orbiterSchema = new Schema<IOrbiter>(
{ Features: [String], Rooms: [roomSchema], ContentUrlSignature: String },
{ _id: false }
);
export const personalRoomsSchema = new Schema<IPersonalRooms>({
personalRoomsOwnerId: Schema.Types.ObjectId,
activeShipId: Schema.Types.ObjectId,
Ship: orbiterSchema,
Apartment: apartmentSchema
});
export const PersonalRooms = model<IPersonalRooms, PersonalRoomsModelType>("PersonalRooms", personalRoomsSchema);

View File

@ -4,35 +4,6 @@ import { toOid } from "@/src/helpers/inventoryHelpers";
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
const placedDecosSchema = new Schema<IPlacedDecosDatabase>(
{
Type: String,
Pos: [Number],
Rot: [Number]
},
{ id: false }
);
placedDecosSchema.virtual("id").get(function (this: IPlacedDecosDatabase) {
return toOid(this._id);
});
placedDecosSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
}
});
const roomSchema = new Schema(
{
Name: String,
MaxCapacity: Number,
PlacedDecos: [placedDecosSchema]
},
{ _id: false }
);
const shipSchema = new Schema<IShipDatabase>(
{
ItemType: String,
@ -58,13 +29,16 @@ shipSchema.set("toJSON", {
delete returnedObject._id;
delete returnedObject.__v;
delete returnedObject.ShipOwnerId;
console.log(shipResponse.ShipExterior);
if (shipResponse.ShipExterior) {
if (shipDatabase.ShipExteriorColors) {
shipResponse.ShipExterior = {
Colors: shipDatabase.ShipExteriorColors,
ShipAttachments: shipDatabase.ShipAttachments,
SkinFlavourItem: shipDatabase.SkinFlavourItem
};
delete shipDatabase.ShipExteriorColors;
delete shipDatabase.ShipAttachments;
delete shipDatabase.SkinFlavourItem;
}
}
});
@ -73,40 +47,4 @@ shipSchema.set("toObject", {
virtuals: true
});
const apartmentSchema = new Schema<IApartment>(
{
Rooms: [roomSchema],
FavouriteLoadouts: [Schema.Types.Mixed]
},
{ _id: false }
);
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

@ -39,6 +39,7 @@ import { startRecipeController } from "@/src/controllers/api/startRecipeControll
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController";
import { shipDecorationsController } from "@/src/controllers/api/shipDecorationsController";
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
import { setActiveShipController } from "@/src/controllers/api/setActiveShipController";
const apiRouter = express.Router();
@ -64,6 +65,7 @@ apiRouter.get("/modularWeaponSale.php", modularWeaponSaleController);
apiRouter.get("/deleteSession.php", deleteSessionController);
apiRouter.get("/logout.php", logoutController);
apiRouter.get("/setBootLocation.php", setBootLocationController);
apiRouter.get("/setActiveShip.php", setActiveShipController);
// post
// eslint-disable-next-line @typescript-eslint/no-misused-promises

View File

@ -0,0 +1,13 @@
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { logger } from "@/src/utils/logger";
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;
};

View File

@ -4,7 +4,7 @@ import { IDatabaseAccount } from "@/src/types/loginTypes";
import { createShip } from "./shipService";
import { Types } from "mongoose";
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
import { PersonalRooms } from "@/src/models/shipModel";
import { PersonalRooms } from "@/src/models/personalRoomsModel";
import new_personal_rooms from "@/static/fixed_responses/personalRooms.json";
const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {

View File

@ -0,0 +1,12 @@
import { PersonalRooms } from "@/src/models/personalRoomsModel";
import { logger } from "@/src/utils/logger";
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

@ -0,0 +1,68 @@
import { getPersonalRooms } from "@/src/services/personalRoomsService";
import { getShip } from "@/src/services/shipService";
import {
ISetShipCustomizationsRequest,
IShipDatabase,
IShipDecorationsRequest,
IShipDecorationsResponse
} from "@/src/types/shipTypes";
import { Types } from "mongoose";
export const setShipCustomizations = async (shipCustomization: ISetShipCustomizationsRequest) => {
const ship = await getShip(new Types.ObjectId(shipCustomization.ShipId));
let shipChanges: Partial<IShipDatabase>;
if (shipCustomization.IsExterior) {
shipChanges = {
ShipExteriorColors: shipCustomization.Customization.Colors,
SkinFlavourItem: shipCustomization.Customization.SkinFlavourItem,
ShipAttachments: shipCustomization.Customization.ShipAttachments,
AirSupportPower: shipCustomization.AirSupportPower!
};
} else {
shipChanges = {
ShipInteriorColors: shipCustomization.Customization.Colors
};
}
ship.set(shipChanges);
await ship.save();
};
export const handleSetShipDecorations = async (
accountId: string,
placedDecoration: IShipDecorationsRequest
): Promise<IShipDecorationsResponse> => {
const personalRooms = await getPersonalRooms(accountId);
const rooms = placedDecoration.IsApartment ? personalRooms.Apartment.Rooms : personalRooms.Ship.Rooms;
const room = 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 };
};

View File

@ -16,7 +16,6 @@ export const createShip = async (accountOwnerId: Types.ObjectId) => {
SkinFlavourItem: "/Lotus/Upgrades/Skins/Liset/LisetSkinFlavourItemDefault"
});
const newShip = await ship.save();
console.log(newShip);
return newShip._id;
} catch (error) {
if (error instanceof Error) {
@ -26,12 +25,12 @@ export const createShip = async (accountOwnerId: Types.ObjectId) => {
}
};
export const getShip = async (shipOwnerId: string, fieldSelection: string = "") => {
const ship = await Ship.findOne({ ShipOwnerId: shipOwnerId }, fieldSelection);
export const getShip = async (shipId: Types.ObjectId, fieldSelection: string = "") => {
const ship = await Ship.findOne({ _id: shipId }, fieldSelection);
if (!ship) {
logger.error(`error finding a ship for account ${shipOwnerId}`);
throw new Error(`error finding a ship for account ${shipOwnerId}`);
logger.error(`error finding a ship for account ${shipId}`);
throw new Error(`error finding a ship for account ${shipId}`);
}
return ship;

View File

@ -458,7 +458,7 @@ export interface ICustomization {
}
export interface IShipExterior {
SkinFlavourItem: string;
SkinFlavourItem?: string;
Colors: IColor;
ShipAttachments?: IShipAttachments;
}

View File

@ -0,0 +1,28 @@
import { IApartment, IRooms } from "@/src/types/shipTypes";
import { Model, Types } from "mongoose";
export interface IOrbiter {
Features: string[];
Rooms: IRooms[];
ContentUrlSignature: string;
}
export interface IPersonalRooms {
personalRoomsOwnerId: Types.ObjectId;
activeShipId: Types.ObjectId;
Ship: IOrbiter;
Apartment: IApartment;
}
export type RoomsType = { Name: string; MaxCapacity: number; PlacedDecos: Types.DocumentArray<IPlacedDecosDatabase> };
export type PersonalRoomsDocumentProps = {
Ship: Omit<IOrbiter, "Rooms"> & {
Rooms: RoomsType[];
};
Apartment: Omit<IApartment, "Rooms"> & {
Rooms: RoomsType[];
};
};
export type PersonalRoomsModelType = Model<IPersonalRooms, {}, PersonalRoomsDocumentProps>;

View File

@ -1,9 +1,6 @@
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 IGetShipResponse {
ShipOwnerId: string;
@ -17,9 +14,9 @@ export interface IShipAttachments {
}
export interface IShipInterior {
Colors: IColor;
ShipAttachments: IShipAttachments;
SkinFlavourItem: string;
Colors?: IColor;
ShipAttachments?: IShipAttachments;
SkinFlavourItem?: string;
}
export interface IShip {
@ -33,11 +30,11 @@ export interface IShip {
export interface IShipDatabase {
ItemType: string;
ShipOwnerId: Schema.Types.ObjectId;
ShipInteriorColors: IColor;
ShipExteriorColors: IColor;
ShipInteriorColors?: IColor;
ShipExteriorColors?: IColor;
AirSupportPower: string;
ShipAttachments: IShipAttachments;
SkinFlavourItem: string;
ShipAttachments?: IShipAttachments;
SkinFlavourItem?: string;
}
export interface IRooms {
@ -56,8 +53,11 @@ export interface IPlanters {
Plants: IPlants[];
}
export interface IGardening {
Planters: IPlanters[];
}
export interface IApartment {
Gardening: { Planters: IPlanters[] };
Gardening: IGardening;
Rooms: IRooms[];
FavouriteLoadouts: string[];
}
@ -72,3 +72,37 @@ export interface IPlacedDecosDatabase {
export interface IPlacedDecosClient extends Omit<IPlacedDecosDatabase, "_id"> {
id: IOid;
}
export interface ISetShipCustomizationsRequest {
ShipId: string;
Customization: Customization;
IsExterior: boolean;
AirSupportPower?: string;
}
export interface Customization {
SkinFlavourItem: string;
Colors: IColor;
ShipAttachments: ShipAttachments;
}
//TODO: check for more attachments
export interface ShipAttachments {
HOOD_ORNAMENT: string;
}
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

@ -0,0 +1,18 @@
[
{
"ItemCount": 1,
"ItemType": "/Lotus/Types/Items/ShipDecos/Vignettes/Warframes/WarframeAFItem"
},
{
"ItemCount": 1,
"ItemType": "/Lotus/Types/Items/ShipDecos/KavatBust"
},
{
"ItemCount": 1,
"ItemType": "/Lotus/Types/Items/ShipDecos/Plushies/PlushyTiger"
},
{
"ItemCount": 1,
"ItemType": "/Lotus/Types/Items/ShipDecos/Venus/PrideCommunityDisplay"
}
]