handle fusion treasures in personal rooms
All checks were successful
Build / build (pull_request) Successful in 54s
All checks were successful
Build / build (pull_request) Successful in 54s
This commit is contained in:
parent
4b32676bae
commit
91a92ee138
@ -40,6 +40,7 @@ const placedDecosSchema = new Schema<IPlacedDecosDatabase>(
|
||||
Pos: [Number],
|
||||
Rot: [Number],
|
||||
Scale: Number,
|
||||
Sockets: Number,
|
||||
PictureFrameInfo: { type: pictureFrameInfoSchema, default: undefined }
|
||||
},
|
||||
{ id: false }
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
} from "@/src/types/shipTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { Types } from "mongoose";
|
||||
import { addShipDecorations, getInventory } from "./inventoryService";
|
||||
import { addFusionTreasures, addShipDecorations, getInventory } from "./inventoryService";
|
||||
import { config } from "./configService";
|
||||
import { Guild } from "../models/guildModel";
|
||||
import { hasGuildPermission } from "./guildService";
|
||||
@ -102,6 +102,7 @@ export const handleSetShipDecorations = async (
|
||||
Pos: placedDecoration.Pos,
|
||||
Rot: placedDecoration.Rot,
|
||||
Scale: placedDecoration.Scale,
|
||||
Sockets: placedDecoration.Sockets,
|
||||
_id: placedDecoration.MoveId
|
||||
};
|
||||
|
||||
@ -117,13 +118,19 @@ export const handleSetShipDecorations = async (
|
||||
}
|
||||
|
||||
if (placedDecoration.RemoveId) {
|
||||
roomToPlaceIn.PlacedDecos.pull({ _id: placedDecoration.RemoveId });
|
||||
const decoIndex = roomToPlaceIn.PlacedDecos.findIndex(x => x._id.equals(placedDecoration.RemoveId));
|
||||
const deco = roomToPlaceIn.PlacedDecos[decoIndex];
|
||||
roomToPlaceIn.PlacedDecos.splice(decoIndex, 1);
|
||||
await personalRooms.save();
|
||||
|
||||
if (!config.unlockAllShipDecorations) {
|
||||
const inventory = await getInventory(accountId);
|
||||
const itemType = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type)![0];
|
||||
addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]);
|
||||
const itemType = Object.entries(ExportResources).find(arr => arr[1].deco == deco.Type)![0];
|
||||
if (deco.Sockets !== undefined) {
|
||||
addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: deco.Sockets, ItemCount: 1 }]);
|
||||
} else {
|
||||
addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]);
|
||||
}
|
||||
await inventory.save();
|
||||
}
|
||||
|
||||
@ -137,7 +144,13 @@ export const handleSetShipDecorations = async (
|
||||
if (!config.unlockAllShipDecorations) {
|
||||
const inventory = await getInventory(accountId);
|
||||
const itemType = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type)![0];
|
||||
addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: -1 }]);
|
||||
if (placedDecoration.Sockets !== undefined) {
|
||||
addFusionTreasures(inventory, [
|
||||
{ ItemType: itemType, Sockets: placedDecoration.Sockets, ItemCount: -1 }
|
||||
]);
|
||||
} else {
|
||||
addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: -1 }]);
|
||||
}
|
||||
await inventory.save();
|
||||
}
|
||||
}
|
||||
@ -151,6 +164,7 @@ export const handleSetShipDecorations = async (
|
||||
Pos: placedDecoration.Pos,
|
||||
Rot: placedDecoration.Rot,
|
||||
Scale: placedDecoration.Scale,
|
||||
Sockets: placedDecoration.Sockets,
|
||||
_id: decoId
|
||||
});
|
||||
|
||||
|
@ -96,6 +96,7 @@ export interface IPlacedDecosDatabase {
|
||||
Pos: [number, number, number];
|
||||
Rot: [number, number, number];
|
||||
Scale?: number;
|
||||
Sockets?: number;
|
||||
PictureFrameInfo?: IPictureFrameInfo;
|
||||
_id: Types.ObjectId;
|
||||
}
|
||||
@ -136,6 +137,7 @@ export interface IShipDecorationsRequest {
|
||||
MoveId?: string;
|
||||
OldRoom?: string;
|
||||
Scale?: number;
|
||||
Sockets?: number;
|
||||
}
|
||||
|
||||
export interface IShipDecorationsResponse {
|
||||
|
Loading…
x
Reference in New Issue
Block a user