chore: improve ship customization stuff #2402
@ -6,9 +6,8 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { IMongoDate } from "@/src/types/commonTypes";
 | 
			
		||||
import { IMissionReward } from "@/src/types/missionTypes";
 | 
			
		||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { IGardeningClient, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
			
		||||
import { IGardeningClient } from "@/src/types/shipTypes";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { dict_en, ExportResources } from "warframe-public-export-plus";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,10 +3,9 @@ import { config } from "@/src/services/configService";
 | 
			
		||||
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { IGetShipResponse } from "@/src/types/shipTypes";
 | 
			
		||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { IGetShipResponse, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { getLoadout } from "@/src/services/loadoutService";
 | 
			
		||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
 | 
			
		||||
export const getShipController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
@ -26,15 +25,7 @@ export const getShipController: RequestHandler = async (req, res) => {
 | 
			
		||||
        LoadOutInventory: { LoadOutPresets: loadout.toJSON() },
 | 
			
		||||
        Ship: {
 | 
			
		||||
            ...personalRooms.Ship,
 | 
			
		||||
            ShipId: toOid(personalRoomsDb.activeShipId),
 | 
			
		||||
            ShipInterior: {
 | 
			
		||||
                Colors: personalRooms.ShipInteriorColors,
 | 
			
		||||
                ShipAttachments: { HOOD_ORNAMENT: "" },
 | 
			
		||||
                SkinFlavourItem: ""
 | 
			
		||||
            },
 | 
			
		||||
            FavouriteLoadoutId: personalRooms.Ship.FavouriteLoadoutId
 | 
			
		||||
                ? toOid(personalRooms.Ship.FavouriteLoadoutId)
 | 
			
		||||
                : undefined
 | 
			
		||||
            ShipId: toOid(personalRoomsDb.activeShipId)
 | 
			
		||||
        },
 | 
			
		||||
        Apartment: personalRooms.Apartment,
 | 
			
		||||
        TailorShop: personalRooms.TailorShop
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { TBootLocation } from "@/src/types/shipTypes";
 | 
			
		||||
import { TBootLocation } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
 | 
			
		||||
export const setBootLocationController: RequestHandler = async (req, res) => {
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { IPictureFrameInfo, ISetPlacedDecoInfoRequest } from "@/src/types/shipTypes";
 | 
			
		||||
import { IPictureFrameInfo, ISetPlacedDecoInfoRequest } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { handleSetPlacedDecoInfo } from "@/src/services/shipCustomizationsService";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { setShipCustomizations } from "@/src/services/shipCustomizationsService";
 | 
			
		||||
import { ISetShipCustomizationsRequest } from "@/src/types/shipTypes";
 | 
			
		||||
import { ISetShipCustomizationsRequest } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@ import { RequestHandler } from "express";
 | 
			
		||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { IOid } from "@/src/types/commonTypes";
 | 
			
		||||
import { Types } from "mongoose";
 | 
			
		||||
import { IFavouriteLoadoutDatabase, TBootLocation } from "@/src/types/shipTypes";
 | 
			
		||||
import { IFavouriteLoadoutDatabase, TBootLocation } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
 | 
			
		||||
export const setShipFavouriteLoadoutController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { IShipDecorationsRequest } from "@/src/types/shipTypes";
 | 
			
		||||
import { IShipDecorationsRequest } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { handleSetShipDecorations } from "@/src/services/shipCustomizationsService";
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								src/models/commonModel.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/models/commonModel.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
import { Schema } from "mongoose";
 | 
			
		||||
import { IColor } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { IShipCustomization } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
 | 
			
		||||
export const colorSchema = new Schema<IColor>(
 | 
			
		||||
    {
 | 
			
		||||
        t0: Number,
 | 
			
		||||
        t1: Number,
 | 
			
		||||
        t2: Number,
 | 
			
		||||
        t3: Number,
 | 
			
		||||
        en: Number,
 | 
			
		||||
        e1: Number,
 | 
			
		||||
        m0: Number,
 | 
			
		||||
        m1: Number
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
export const shipCustomizationSchema = new Schema<IShipCustomization>(
 | 
			
		||||
    {
 | 
			
		||||
        SkinFlavourItem: String,
 | 
			
		||||
        Colors: colorSchema,
 | 
			
		||||
        ShipAttachments: { HOOD_ORNAMENT: String }
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
@ -42,7 +42,6 @@ import {
 | 
			
		||||
    ICrewShipCustomization,
 | 
			
		||||
    ICrewShipWeapon,
 | 
			
		||||
    ICrewShipWeaponEmplacements,
 | 
			
		||||
    IShipExterior,
 | 
			
		||||
    IHelminthFoodRecord,
 | 
			
		||||
    ICrewShipMembersDatabase,
 | 
			
		||||
    IDialogueHistoryDatabase,
 | 
			
		||||
@ -106,7 +105,6 @@ import {
 | 
			
		||||
import { IOid } from "../../types/commonTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IAbilityOverride,
 | 
			
		||||
    IColor,
 | 
			
		||||
    IItemConfig,
 | 
			
		||||
    IOperatorConfigDatabase,
 | 
			
		||||
    IPolarity,
 | 
			
		||||
@ -117,6 +115,7 @@ import {
 | 
			
		||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { EquipmentSelectionSchema, oidSchema } from "./loadoutModel";
 | 
			
		||||
import { ICountedStoreItem } from "warframe-public-export-plus";
 | 
			
		||||
import { colorSchema, shipCustomizationSchema } from "../commonModel";
 | 
			
		||||
 | 
			
		||||
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
 | 
			
		||||
 | 
			
		||||
@ -166,20 +165,6 @@ const abilityOverrideSchema = new Schema<IAbilityOverride>(
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
export const colorSchema = new Schema<IColor>(
 | 
			
		||||
    {
 | 
			
		||||
        t0: Number,
 | 
			
		||||
        t1: Number,
 | 
			
		||||
        t2: Number,
 | 
			
		||||
        t3: Number,
 | 
			
		||||
        en: Number,
 | 
			
		||||
        e1: Number,
 | 
			
		||||
        m0: Number,
 | 
			
		||||
        m1: Number
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const operatorConfigSchema = new Schema<IOperatorConfigDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        Skins: [String],
 | 
			
		||||
@ -896,18 +881,9 @@ const crewShipWeaponSchema = new Schema<ICrewShipWeapon>(
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const shipExteriorSchema = new Schema<IShipExterior>(
 | 
			
		||||
    {
 | 
			
		||||
        SkinFlavourItem: String,
 | 
			
		||||
        Colors: colorSchema,
 | 
			
		||||
        ShipAttachments: { HOOD_ORNAMENT: String }
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const crewShipCustomizationSchema = new Schema<ICrewShipCustomization>(
 | 
			
		||||
    {
 | 
			
		||||
        CrewshipInterior: shipExteriorSchema
 | 
			
		||||
        CrewshipInterior: shipCustomizationSchema
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,22 @@
 | 
			
		||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { IOrbiter, IPersonalRoomsDatabase, PersonalRoomsModelType } from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IApartmentDatabase,
 | 
			
		||||
    IFavouriteLoadoutDatabase,
 | 
			
		||||
    IGardeningDatabase,
 | 
			
		||||
    IPlacedDecosDatabase,
 | 
			
		||||
    IOrbiterClient,
 | 
			
		||||
    IOrbiterDatabase,
 | 
			
		||||
    IPersonalRoomsDatabase,
 | 
			
		||||
    IPictureFrameInfo,
 | 
			
		||||
    IPlacedDecosDatabase,
 | 
			
		||||
    IPlantClient,
 | 
			
		||||
    IPlantDatabase,
 | 
			
		||||
    IPlanterDatabase,
 | 
			
		||||
    IRoom,
 | 
			
		||||
    ITailorShopDatabase,
 | 
			
		||||
    IApartmentDatabase,
 | 
			
		||||
    IPlanterDatabase,
 | 
			
		||||
    IPlantDatabase,
 | 
			
		||||
    IPlantClient
 | 
			
		||||
} from "@/src/types/shipTypes";
 | 
			
		||||
    PersonalRoomsModelType
 | 
			
		||||
} from "@/src/types/personalRoomsTypes";
 | 
			
		||||
import { Schema, Types, model } from "mongoose";
 | 
			
		||||
import { colorSchema, shipCustomizationSchema } from "./commonModel";
 | 
			
		||||
 | 
			
		||||
export const pictureFrameInfoSchema = new Schema<IPictureFrameInfo>(
 | 
			
		||||
    {
 | 
			
		||||
@ -137,10 +140,11 @@ const apartmentDefault: IApartmentDatabase = {
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const orbiterSchema = new Schema<IOrbiter>(
 | 
			
		||||
const orbiterSchema = new Schema<IOrbiterDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        Features: [String],
 | 
			
		||||
        Rooms: [roomSchema],
 | 
			
		||||
        ShipInterior: shipCustomizationSchema,
 | 
			
		||||
        VignetteFish: { type: [String], default: undefined },
 | 
			
		||||
        FavouriteLoadoutId: Schema.Types.ObjectId,
 | 
			
		||||
        Wallpaper: String,
 | 
			
		||||
@ -150,7 +154,18 @@ const orbiterSchema = new Schema<IOrbiter>(
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
const orbiterDefault: IOrbiter = {
 | 
			
		||||
orbiterSchema.set("toJSON", {
 | 
			
		||||
    virtuals: true,
 | 
			
		||||
    transform(_doc, obj) {
 | 
			
		||||
        const db = obj as IOrbiterDatabase;
 | 
			
		||||
        const client = obj as IOrbiterClient;
 | 
			
		||||
 | 
			
		||||
        if (db.FavouriteLoadoutId) {
 | 
			
		||||
            client.FavouriteLoadoutId = toOid(db.FavouriteLoadoutId);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
const orbiterDefault: IOrbiterDatabase = {
 | 
			
		||||
    Features: ["/Lotus/Types/Items/ShipFeatureItems/EarthNavigationFeatureItem"], //TODO: potentially remove after missionstarting gear
 | 
			
		||||
    Rooms: [
 | 
			
		||||
        { Name: "AlchemyRoom", MaxCapacity: 1600 },
 | 
			
		||||
@ -197,7 +212,6 @@ const tailorShopDefault: ITailorShopDatabase = {
 | 
			
		||||
export const personalRoomsSchema = new Schema<IPersonalRoomsDatabase>({
 | 
			
		||||
    personalRoomsOwnerId: Schema.Types.ObjectId,
 | 
			
		||||
    activeShipId: Schema.Types.ObjectId,
 | 
			
		||||
    ShipInteriorColors: colorSchema,
 | 
			
		||||
    Ship: { type: orbiterSchema, default: orbiterDefault },
 | 
			
		||||
    Apartment: { type: apartmentSchema, default: apartmentDefault },
 | 
			
		||||
    TailorShop: { type: tailorShopSchema, default: tailorShopDefault }
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
import { Document, Schema, Types, model } from "mongoose";
 | 
			
		||||
import { IShipDatabase } from "../types/shipTypes";
 | 
			
		||||
import { toOid } from "@/src/helpers/inventoryHelpers";
 | 
			
		||||
import { colorSchema } from "@/src/models/inventoryModels/inventoryModel";
 | 
			
		||||
import { colorSchema } from "@/src/models/commonModel";
 | 
			
		||||
import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
 | 
			
		||||
const shipSchema = new Schema<IShipDatabase>(
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,6 @@
 | 
			
		||||
import { PersonalRooms } from "@/src/models/personalRoomsModel";
 | 
			
		||||
import { addItem, getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
import { TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
 | 
			
		||||
import { IGardeningDatabase } from "../types/shipTypes";
 | 
			
		||||
import { IGardeningDatabase, TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
 | 
			
		||||
import { getRandomElement } from "./rngService";
 | 
			
		||||
 | 
			
		||||
export const getPersonalRooms = async (
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,14 @@
 | 
			
		||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { getShip } from "@/src/services/shipService";
 | 
			
		||||
import {
 | 
			
		||||
    ISetPlacedDecoInfoRequest,
 | 
			
		||||
    ISetShipCustomizationsRequest,
 | 
			
		||||
    IShipDecorationsRequest,
 | 
			
		||||
    IShipDecorationsResponse,
 | 
			
		||||
    ISetPlacedDecoInfoRequest,
 | 
			
		||||
    TBootLocation
 | 
			
		||||
} from "@/src/types/shipTypes";
 | 
			
		||||
    RoomsType,
 | 
			
		||||
    TBootLocation,
 | 
			
		||||
    TPersonalRoomsDatabaseDocument
 | 
			
		||||
} from "../types/personalRoomsTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { Types } from "mongoose";
 | 
			
		||||
import { addFusionTreasures, addShipDecorations, getInventory } from "./inventoryService";
 | 
			
		||||
@ -15,7 +17,6 @@ import { Guild } from "../models/guildModel";
 | 
			
		||||
import { hasGuildPermission } from "./guildService";
 | 
			
		||||
import { GuildPermission } from "../types/guildTypes";
 | 
			
		||||
import { ExportResources } from "warframe-public-export-plus";
 | 
			
		||||
import { RoomsType, TPersonalRoomsDatabaseDocument } from "../types/personalRoomsTypes";
 | 
			
		||||
 | 
			
		||||
export const setShipCustomizations = async (
 | 
			
		||||
    accountId: string,
 | 
			
		||||
@ -39,7 +40,7 @@ export const setShipCustomizations = async (
 | 
			
		||||
            personalRooms.TailorShop.LevelDecosVisible = shipCustomization.Customization.LevelDecosVisible;
 | 
			
		||||
            personalRooms.TailorShop.CustomJson = shipCustomization.Customization.CustomJson;
 | 
			
		||||
        } else {
 | 
			
		||||
            personalRooms.ShipInteriorColors = shipCustomization.Customization.Colors;
 | 
			
		||||
            personalRooms.Ship.ShipInterior = shipCustomization.Customization;
 | 
			
		||||
        }
 | 
			
		||||
        await personalRooms.save();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
import { Types } from "mongoose";
 | 
			
		||||
import { IOid, IMongoDate, IOidWithLegacySupport } from "@/src/types/commonTypes";
 | 
			
		||||
import { IFusionTreasure, IMiscItem, ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { IPictureFrameInfo } from "./shipTypes";
 | 
			
		||||
import { IPictureFrameInfo } from "./personalRoomsTypes";
 | 
			
		||||
import { IFriendInfo } from "./friendTypes";
 | 
			
		||||
 | 
			
		||||
export interface IGuildClient {
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@ import {
 | 
			
		||||
    IOperatorConfigDatabase
 | 
			
		||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { IFingerprintStat, RivenFingerprint } from "@/src/helpers/rivenHelper";
 | 
			
		||||
import { IOrbiter } from "../personalRoomsTypes";
 | 
			
		||||
import { IOrbiterClient, IShipCustomization } from "../personalRoomsTypes";
 | 
			
		||||
import { ICountedStoreItem } from "warframe-public-export-plus";
 | 
			
		||||
 | 
			
		||||
export type InventoryDatabaseEquipment = {
 | 
			
		||||
@ -381,7 +381,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    BrandedSuits?: IOidWithLegacySupport[];
 | 
			
		||||
    LockedWeaponGroup?: ILockedWeaponGroupClient;
 | 
			
		||||
    HubNpcCustomizations?: IHubNpcCustomization[];
 | 
			
		||||
    Ship?: IOrbiter; // U22 and below, response only
 | 
			
		||||
    Ship?: IOrbiterClient; // U22 and below, response only
 | 
			
		||||
    ClaimedJunctionChallengeRewards?: string[]; // U39
 | 
			
		||||
    SpecialItemRewardAttenuation?: IRewardAttenuation[]; // Baro's Void Surplus
 | 
			
		||||
}
 | 
			
		||||
@ -575,17 +575,7 @@ export interface ICrewShipMemberDatabase {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ICrewShipCustomization {
 | 
			
		||||
    CrewshipInterior: IShipExterior;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipExterior {
 | 
			
		||||
    SkinFlavourItem?: string;
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    ShipAttachments?: IShipAttachments;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipAttachments {
 | 
			
		||||
    HOOD_ORNAMENT: string;
 | 
			
		||||
    CrewshipInterior: IShipCustomization;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IFlavourItem {
 | 
			
		||||
@ -1104,7 +1094,7 @@ export interface ISettings {
 | 
			
		||||
 | 
			
		||||
export interface IShipInventory {
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
    ShipExterior: IShipExterior;
 | 
			
		||||
    ShipExterior: IShipCustomization;
 | 
			
		||||
    AirSupportPower: string;
 | 
			
		||||
    ItemId: IOid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,18 +1,45 @@
 | 
			
		||||
import { IColor } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IRoom,
 | 
			
		||||
    IPlacedDecosDatabase,
 | 
			
		||||
    ITailorShop,
 | 
			
		||||
    ITailorShopDatabase,
 | 
			
		||||
    TBootLocation,
 | 
			
		||||
    IApartmentDatabase,
 | 
			
		||||
    IApartmentClient
 | 
			
		||||
} from "@/src/types/shipTypes";
 | 
			
		||||
import { Document, Model, Types } from "mongoose";
 | 
			
		||||
import { ILoadoutClient } from "./saveLoadoutTypes";
 | 
			
		||||
import { IMongoDate, IOid } from "./commonTypes";
 | 
			
		||||
 | 
			
		||||
export interface IOrbiter {
 | 
			
		||||
export interface IGetShipResponse {
 | 
			
		||||
    ShipOwnerId: string;
 | 
			
		||||
    Ship: IOrbiterClient;
 | 
			
		||||
    Apartment: IApartmentClient;
 | 
			
		||||
    TailorShop: ITailorShop;
 | 
			
		||||
    LoadOutInventory: { LoadOutPresets: ILoadoutClient };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipAttachments {
 | 
			
		||||
    HOOD_ORNAMENT?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipCustomization {
 | 
			
		||||
    SkinFlavourItem?: string;
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    ShipAttachments?: IShipAttachments;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT" | "SHOP";
 | 
			
		||||
 | 
			
		||||
export interface IOrbiterClient {
 | 
			
		||||
    Features: string[];
 | 
			
		||||
    ShipId: IOid;
 | 
			
		||||
    ShipInterior: IShipCustomization;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    VignetteFish?: string[];
 | 
			
		||||
    FavouriteLoadoutId?: IOid;
 | 
			
		||||
    Wallpaper?: string;
 | 
			
		||||
    Vignette?: string;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    ContentUrlSignature?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IOrbiterDatabase {
 | 
			
		||||
    Features: string[];
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    ShipInterior?: IShipCustomization;
 | 
			
		||||
    VignetteFish?: string[];
 | 
			
		||||
    FavouriteLoadoutId?: Types.ObjectId;
 | 
			
		||||
    Wallpaper?: string;
 | 
			
		||||
@ -22,25 +49,169 @@ export interface IOrbiter {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPersonalRoomsClient {
 | 
			
		||||
    ShipInteriorColors: IColor;
 | 
			
		||||
    Ship: IOrbiter;
 | 
			
		||||
    Ship: IOrbiterClient;
 | 
			
		||||
    Apartment: IApartmentClient;
 | 
			
		||||
    TailorShop: ITailorShop;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPersonalRoomsDatabase {
 | 
			
		||||
    ShipInteriorColors: IColor;
 | 
			
		||||
    personalRoomsOwnerId: Types.ObjectId;
 | 
			
		||||
    activeShipId: Types.ObjectId;
 | 
			
		||||
    Ship: IOrbiter;
 | 
			
		||||
 | 
			
		||||
    Ship: IOrbiterDatabase;
 | 
			
		||||
    Apartment: IApartmentDatabase;
 | 
			
		||||
    TailorShop: ITailorShopDatabase;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IRoom {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    MaxCapacity: number;
 | 
			
		||||
    PlacedDecos?: IPlacedDecosDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlantClient {
 | 
			
		||||
    PlantType: string;
 | 
			
		||||
    EndTime: IMongoDate;
 | 
			
		||||
    PlotIndex: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlantDatabase extends Omit<IPlantClient, "EndTime"> {
 | 
			
		||||
    EndTime: Date;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlanterClient {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    Plants: IPlantClient[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlanterDatabase {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    Plants: IPlantDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGardeningClient {
 | 
			
		||||
    Planters: IPlanterClient[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGardeningDatabase {
 | 
			
		||||
    Planters: IPlanterDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IApartmentClient {
 | 
			
		||||
    Gardening: IGardeningClient;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IApartmentDatabase {
 | 
			
		||||
    Gardening: IGardeningDatabase;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlacedDecosDatabase {
 | 
			
		||||
    Type: string;
 | 
			
		||||
    Pos: [number, number, number];
 | 
			
		||||
    Rot: [number, number, number];
 | 
			
		||||
    Scale?: number;
 | 
			
		||||
    Sockets?: number;
 | 
			
		||||
    PictureFrameInfo?: IPictureFrameInfo;
 | 
			
		||||
    _id: Types.ObjectId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlacedDecosClient extends Omit<IPlacedDecosDatabase, "_id"> {
 | 
			
		||||
    id: IOid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ISetShipCustomizationsRequest {
 | 
			
		||||
    ShipId: string;
 | 
			
		||||
    Customization: {
 | 
			
		||||
        SkinFlavourItem?: string;
 | 
			
		||||
        Colors?: IColor;
 | 
			
		||||
        ShipAttachments?: IShipAttachments;
 | 
			
		||||
        LevelDecosVisible?: boolean;
 | 
			
		||||
        CustomJson?: string;
 | 
			
		||||
    };
 | 
			
		||||
    IsExterior: boolean;
 | 
			
		||||
    AirSupportPower?: string;
 | 
			
		||||
    IsShop?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipDecorationsRequest {
 | 
			
		||||
    Type: string;
 | 
			
		||||
    Pos: [number, number, number];
 | 
			
		||||
    Rot: [number, number, number];
 | 
			
		||||
    Room: string;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    IsApartment?: boolean;
 | 
			
		||||
    RemoveId?: string;
 | 
			
		||||
    MoveId?: string;
 | 
			
		||||
    OldRoom?: string;
 | 
			
		||||
    Scale?: number;
 | 
			
		||||
    Sockets?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipDecorationsResponse {
 | 
			
		||||
    DecoId?: string;
 | 
			
		||||
    Room?: string;
 | 
			
		||||
    IsApartment?: boolean;
 | 
			
		||||
    MaxCapacityIncrease?: number;
 | 
			
		||||
    OldRoom?: string;
 | 
			
		||||
    NewRoom?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ISetPlacedDecoInfoRequest {
 | 
			
		||||
    DecoType: string;
 | 
			
		||||
    DecoId: string;
 | 
			
		||||
    Room: string;
 | 
			
		||||
    PictureFrameInfo: IPictureFrameInfo;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    ComponentId?: string;
 | 
			
		||||
    GuildId?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPictureFrameInfo {
 | 
			
		||||
    Image: string;
 | 
			
		||||
    Filter: string;
 | 
			
		||||
    XOffset: number;
 | 
			
		||||
    YOffset: number;
 | 
			
		||||
    Scale: number;
 | 
			
		||||
    InvertX: boolean;
 | 
			
		||||
    InvertY: boolean;
 | 
			
		||||
    ColorCorrection: number;
 | 
			
		||||
    Text: string;
 | 
			
		||||
    TextScale: number;
 | 
			
		||||
    TextColorA: number;
 | 
			
		||||
    TextColorB: number;
 | 
			
		||||
    TextOrientation: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IFavouriteLoadout {
 | 
			
		||||
    Tag: string;
 | 
			
		||||
    LoadoutId: IOid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IFavouriteLoadoutDatabase {
 | 
			
		||||
    Tag: string;
 | 
			
		||||
    LoadoutId: Types.ObjectId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ITailorShopDatabase {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    CustomJson?: string;
 | 
			
		||||
    LevelDecosVisible?: boolean;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type RoomsType = { Name: string; MaxCapacity: number; PlacedDecos: Types.DocumentArray<IPlacedDecosDatabase> };
 | 
			
		||||
 | 
			
		||||
export type PersonalRoomsDocumentProps = {
 | 
			
		||||
    Ship: Omit<IOrbiter, "Rooms"> & {
 | 
			
		||||
    Ship: Omit<IOrbiterDatabase, "Rooms"> & {
 | 
			
		||||
        Rooms: RoomsType[];
 | 
			
		||||
    };
 | 
			
		||||
    Apartment: Omit<IApartmentDatabase, "Rooms"> & {
 | 
			
		||||
 | 
			
		||||
@ -1,40 +1,6 @@
 | 
			
		||||
import { Types } from "mongoose";
 | 
			
		||||
import { IMongoDate, IOid } from "@/src/types/commonTypes";
 | 
			
		||||
import { IColor } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { ILoadoutClient } from "./saveLoadoutTypes";
 | 
			
		||||
 | 
			
		||||
export interface IGetShipResponse {
 | 
			
		||||
    ShipOwnerId: string;
 | 
			
		||||
    Ship: IShip;
 | 
			
		||||
    Apartment: IApartmentClient;
 | 
			
		||||
    TailorShop: ITailorShop;
 | 
			
		||||
    LoadOutInventory: { LoadOutPresets: ILoadoutClient };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipAttachments {
 | 
			
		||||
    HOOD_ORNAMENT: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipInterior {
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    ShipAttachments?: IShipAttachments;
 | 
			
		||||
    SkinFlavourItem?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT" | "SHOP";
 | 
			
		||||
 | 
			
		||||
export interface IShip {
 | 
			
		||||
    Features: string[];
 | 
			
		||||
    ShipId: IOid;
 | 
			
		||||
    ShipInterior: IShipInterior;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    VignetteFish?: string[];
 | 
			
		||||
    FavouriteLoadoutId?: IOid;
 | 
			
		||||
    Wallpaper?: string;
 | 
			
		||||
    Vignette?: string;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    ContentUrlSignature?: string;
 | 
			
		||||
}
 | 
			
		||||
import { IShipAttachments } from "./personalRoomsTypes";
 | 
			
		||||
 | 
			
		||||
export interface IShipDatabase {
 | 
			
		||||
    ItemType: string;
 | 
			
		||||
@ -44,155 +10,3 @@ export interface IShipDatabase {
 | 
			
		||||
    ShipAttachments?: IShipAttachments;
 | 
			
		||||
    SkinFlavourItem?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IRoom {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    MaxCapacity: number;
 | 
			
		||||
    PlacedDecos?: IPlacedDecosDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlantClient {
 | 
			
		||||
    PlantType: string;
 | 
			
		||||
    EndTime: IMongoDate;
 | 
			
		||||
    PlotIndex: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlantDatabase extends Omit<IPlantClient, "EndTime"> {
 | 
			
		||||
    EndTime: Date;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlanterClient {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    Plants: IPlantClient[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlanterDatabase {
 | 
			
		||||
    Name: string;
 | 
			
		||||
    Plants: IPlantDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGardeningClient {
 | 
			
		||||
    Planters: IPlanterClient[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGardeningDatabase {
 | 
			
		||||
    Planters: IPlanterDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IApartmentClient {
 | 
			
		||||
    Gardening: IGardeningClient;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IApartmentDatabase {
 | 
			
		||||
    Gardening: IGardeningDatabase;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlacedDecosDatabase {
 | 
			
		||||
    Type: string;
 | 
			
		||||
    Pos: [number, number, number];
 | 
			
		||||
    Rot: [number, number, number];
 | 
			
		||||
    Scale?: number;
 | 
			
		||||
    Sockets?: number;
 | 
			
		||||
    PictureFrameInfo?: IPictureFrameInfo;
 | 
			
		||||
    _id: Types.ObjectId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlacedDecosClient extends Omit<IPlacedDecosDatabase, "_id"> {
 | 
			
		||||
    id: IOid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ISetShipCustomizationsRequest {
 | 
			
		||||
    ShipId: string;
 | 
			
		||||
    Customization: Customization;
 | 
			
		||||
    IsExterior: boolean;
 | 
			
		||||
    AirSupportPower?: string;
 | 
			
		||||
    IsShop?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface Customization {
 | 
			
		||||
    SkinFlavourItem: string;
 | 
			
		||||
    Colors: IColor;
 | 
			
		||||
    ShipAttachments: ShipAttachments;
 | 
			
		||||
    LevelDecosVisible: boolean;
 | 
			
		||||
    CustomJson: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//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;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    IsApartment?: boolean;
 | 
			
		||||
    RemoveId?: string;
 | 
			
		||||
    MoveId?: string;
 | 
			
		||||
    OldRoom?: string;
 | 
			
		||||
    Scale?: number;
 | 
			
		||||
    Sockets?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipDecorationsResponse {
 | 
			
		||||
    DecoId?: string;
 | 
			
		||||
    Room?: string;
 | 
			
		||||
    IsApartment?: boolean;
 | 
			
		||||
    MaxCapacityIncrease?: number;
 | 
			
		||||
    OldRoom?: string;
 | 
			
		||||
    NewRoom?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ISetPlacedDecoInfoRequest {
 | 
			
		||||
    DecoType: string;
 | 
			
		||||
    DecoId: string;
 | 
			
		||||
    Room: string;
 | 
			
		||||
    PictureFrameInfo: IPictureFrameInfo;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
    ComponentId?: string;
 | 
			
		||||
    GuildId?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPictureFrameInfo {
 | 
			
		||||
    Image: string;
 | 
			
		||||
    Filter: string;
 | 
			
		||||
    XOffset: number;
 | 
			
		||||
    YOffset: number;
 | 
			
		||||
    Scale: number;
 | 
			
		||||
    InvertX: boolean;
 | 
			
		||||
    InvertY: boolean;
 | 
			
		||||
    ColorCorrection: number;
 | 
			
		||||
    Text: string;
 | 
			
		||||
    TextScale: number;
 | 
			
		||||
    TextColorA: number;
 | 
			
		||||
    TextColorB: number;
 | 
			
		||||
    TextOrientation: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IFavouriteLoadout {
 | 
			
		||||
    Tag: string;
 | 
			
		||||
    LoadoutId: IOid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IFavouriteLoadoutDatabase {
 | 
			
		||||
    Tag: string;
 | 
			
		||||
    LoadoutId: Types.ObjectId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ITailorShopDatabase {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    CustomJson: string;
 | 
			
		||||
    LevelDecosVisible: boolean;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user