forked from OpenWF/SpaceNinjaServer
Compare commits
3 Commits
main
...
mission-Em
Author | SHA1 | Date | |
---|---|---|---|
514e306394 | |||
26ad8fceff | |||
1341b71177 |
@ -33,7 +33,6 @@
|
|||||||
"noDailyStandingLimits": true,
|
"noDailyStandingLimits": true,
|
||||||
"instantResourceExtractorDrones": false,
|
"instantResourceExtractorDrones": false,
|
||||||
"noDojoRoomBuildStage": true,
|
"noDojoRoomBuildStage": true,
|
||||||
"fastDojoRoomDestruction": true,
|
|
||||||
"noDojoResearchCosts": true,
|
"noDojoResearchCosts": true,
|
||||||
"noDojoResearchTime": true,
|
"noDojoResearchTime": true,
|
||||||
"spoofMasteryRank": -1
|
"spoofMasteryRank": -1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getDojoClient, getGuildForRequestEx, removeDojoDeco, removeDojoRoom } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequestEx } from "@/src/services/guildService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
@ -8,19 +8,12 @@ export const abortDojoComponentController: RequestHandler = async (req, res) =>
|
|||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const guild = await getGuildForRequestEx(req, inventory);
|
const guild = await getGuildForRequestEx(req, inventory);
|
||||||
const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest;
|
const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest;
|
||||||
|
// TODO: Move already-contributed credits & items to the clan vault
|
||||||
if (request.DecoId) {
|
guild.DojoComponents.pull({ _id: request.ComponentId });
|
||||||
removeDojoDeco(guild, request.ComponentId, request.DecoId);
|
|
||||||
} else {
|
|
||||||
removeDojoRoom(guild, request.ComponentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(await getDojoClient(guild, 0, request.ComponentId));
|
res.json(getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IAbortDojoComponentRequest {
|
export interface IAbortDojoComponentRequest {
|
||||||
DecoType?: string;
|
|
||||||
ComponentId: string;
|
ComponentId: string;
|
||||||
DecoId?: string;
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const abortDojoComponentDestructionController: RequestHandler = async (req, res) => {
|
|
||||||
const guild = await getGuildForRequest(req);
|
|
||||||
const componentId = req.query.componentId as string;
|
|
||||||
|
|
||||||
guild.DojoComponents.id(componentId)!.DestructionTime = undefined;
|
|
||||||
|
|
||||||
await guild.save();
|
|
||||||
res.json(await getDojoClient(guild, 0, componentId));
|
|
||||||
};
|
|
@ -58,7 +58,7 @@ export const changeDojoRootController: RequestHandler = async (req, res) => {
|
|||||||
|
|
||||||
await guild.save();
|
await guild.save();
|
||||||
|
|
||||||
res.json(await getDojoClient(guild, 0));
|
res.json(getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
interface INode {
|
interface INode {
|
||||||
|
@ -1,26 +1,10 @@
|
|||||||
import { TGuildDatabaseDocument } from "@/src/models/guildModel";
|
|
||||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
|
||||||
import { getDojoClient, getGuildForRequestEx, scaleRequiredCount } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequestEx, scaleRequiredCount } from "@/src/services/guildService";
|
||||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IDojoContributable } from "@/src/types/guildTypes";
|
|
||||||
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportDojoRecipes, IDojoRecipe } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
|
|
||||||
interface IContributeToDojoComponentRequest {
|
|
||||||
ComponentId: string;
|
|
||||||
DecoId?: string;
|
|
||||||
DecoType?: string;
|
|
||||||
IngredientContributions: {
|
|
||||||
ItemType: string;
|
|
||||||
ItemCount: number;
|
|
||||||
}[];
|
|
||||||
RegularCredits: number;
|
|
||||||
VaultIngredientContributions: [];
|
|
||||||
VaultCredits: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const contributeToDojoComponentController: RequestHandler = async (req, res) => {
|
export const contributeToDojoComponentController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -29,54 +13,21 @@ export const contributeToDojoComponentController: RequestHandler = async (req, r
|
|||||||
// Any clan member should have permission to contribute although notably permission is denied if they have not crafted the dojo key and were simply invited in.
|
// Any clan member should have permission to contribute although notably permission is denied if they have not crafted the dojo key and were simply invited in.
|
||||||
const request = JSON.parse(String(req.body)) as IContributeToDojoComponentRequest;
|
const request = JSON.parse(String(req.body)) as IContributeToDojoComponentRequest;
|
||||||
const component = guild.DojoComponents.id(request.ComponentId)!;
|
const component = guild.DojoComponents.id(request.ComponentId)!;
|
||||||
|
const componentMeta = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf)!;
|
||||||
|
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
|
||||||
if (!component.CompletionTime) {
|
|
||||||
// Room is in "Collecting Materials" state
|
|
||||||
if (request.DecoId) {
|
|
||||||
throw new Error("attempt to contribute to a deco in an unfinished room?!");
|
|
||||||
}
|
|
||||||
const meta = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf)!;
|
|
||||||
await processContribution(guild, request, inventory, inventoryChanges, meta, component);
|
|
||||||
} else {
|
|
||||||
// Room is past "Collecting Materials"
|
|
||||||
if (request.DecoId) {
|
|
||||||
const deco = component.Decos!.find(x => x._id.equals(request.DecoId))!;
|
|
||||||
const meta = Object.values(ExportDojoRecipes.decos).find(x => x.resultType == deco.Type)!;
|
|
||||||
await processContribution(guild, request, inventory, inventoryChanges, meta, deco);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await guild.save();
|
|
||||||
await inventory.save();
|
|
||||||
res.json({
|
|
||||||
...(await getDojoClient(guild, 0, component._id)),
|
|
||||||
InventoryChanges: inventoryChanges
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const processContribution = async (
|
|
||||||
guild: TGuildDatabaseDocument,
|
|
||||||
request: IContributeToDojoComponentRequest,
|
|
||||||
inventory: TInventoryDatabaseDocument,
|
|
||||||
inventoryChanges: IInventoryChanges,
|
|
||||||
meta: IDojoRecipe,
|
|
||||||
component: IDojoContributable
|
|
||||||
): Promise<void> => {
|
|
||||||
component.RegularCredits ??= 0;
|
component.RegularCredits ??= 0;
|
||||||
if (component.RegularCredits + request.RegularCredits > scaleRequiredCount(meta.price)) {
|
if (component.RegularCredits + request.RegularCredits > scaleRequiredCount(componentMeta.price)) {
|
||||||
request.RegularCredits = scaleRequiredCount(meta.price) - component.RegularCredits;
|
request.RegularCredits = scaleRequiredCount(componentMeta.price) - component.RegularCredits;
|
||||||
}
|
}
|
||||||
component.RegularCredits += request.RegularCredits;
|
component.RegularCredits += request.RegularCredits;
|
||||||
inventoryChanges.RegularCredits = -request.RegularCredits;
|
const inventoryChanges: IInventoryChanges = updateCurrency(inventory, request.RegularCredits, false);
|
||||||
updateCurrency(inventory, request.RegularCredits, false);
|
|
||||||
|
|
||||||
component.MiscItems ??= [];
|
component.MiscItems ??= [];
|
||||||
const miscItemChanges: IMiscItem[] = [];
|
const miscItemChanges: IMiscItem[] = [];
|
||||||
for (const ingredientContribution of request.IngredientContributions) {
|
for (const ingredientContribution of request.IngredientContributions) {
|
||||||
const componentMiscItem = component.MiscItems.find(x => x.ItemType == ingredientContribution.ItemType);
|
const componentMiscItem = component.MiscItems.find(x => x.ItemType == ingredientContribution.ItemType);
|
||||||
if (componentMiscItem) {
|
if (componentMiscItem) {
|
||||||
const ingredientMeta = meta.ingredients.find(x => x.ItemType == ingredientContribution.ItemType)!;
|
const ingredientMeta = componentMeta.ingredients.find(x => x.ItemType == ingredientContribution.ItemType)!;
|
||||||
if (
|
if (
|
||||||
componentMiscItem.ItemCount + ingredientContribution.ItemCount >
|
componentMiscItem.ItemCount + ingredientContribution.ItemCount >
|
||||||
scaleRequiredCount(ingredientMeta.ItemCount)
|
scaleRequiredCount(ingredientMeta.ItemCount)
|
||||||
@ -96,9 +47,9 @@ const processContribution = async (
|
|||||||
addMiscItems(inventory, miscItemChanges);
|
addMiscItems(inventory, miscItemChanges);
|
||||||
inventoryChanges.MiscItems = miscItemChanges;
|
inventoryChanges.MiscItems = miscItemChanges;
|
||||||
|
|
||||||
if (component.RegularCredits >= scaleRequiredCount(meta.price)) {
|
if (component.RegularCredits >= scaleRequiredCount(componentMeta.price)) {
|
||||||
let fullyFunded = true;
|
let fullyFunded = true;
|
||||||
for (const ingredient of meta.ingredients) {
|
for (const ingredient of componentMeta.ingredients) {
|
||||||
const componentMiscItem = component.MiscItems.find(x => x.ItemType == ingredient.ItemType);
|
const componentMiscItem = component.MiscItems.find(x => x.ItemType == ingredient.ItemType);
|
||||||
if (!componentMiscItem || componentMiscItem.ItemCount < scaleRequiredCount(ingredient.ItemCount)) {
|
if (!componentMiscItem || componentMiscItem.ItemCount < scaleRequiredCount(ingredient.ItemCount)) {
|
||||||
fullyFunded = false;
|
fullyFunded = false;
|
||||||
@ -106,13 +57,27 @@ const processContribution = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fullyFunded) {
|
if (fullyFunded) {
|
||||||
if (request.IngredientContributions.length) {
|
|
||||||
// We've already updated subpaths of MiscItems, we need to allow MongoDB to save this before we remove MiscItems.
|
|
||||||
await guild.save();
|
|
||||||
}
|
|
||||||
component.RegularCredits = undefined;
|
component.RegularCredits = undefined;
|
||||||
component.MiscItems = undefined;
|
component.MiscItems = undefined;
|
||||||
component.CompletionTime = new Date(Date.now() + meta.time * 1000);
|
component.CompletionTime = new Date(Date.now() + componentMeta.time * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await guild.save();
|
||||||
|
await inventory.save();
|
||||||
|
res.json({
|
||||||
|
...getDojoClient(guild, 0, component._id),
|
||||||
|
InventoryChanges: inventoryChanges
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface IContributeToDojoComponentRequest {
|
||||||
|
ComponentId: string;
|
||||||
|
IngredientContributions: {
|
||||||
|
ItemType: string;
|
||||||
|
ItemCount: number;
|
||||||
|
}[];
|
||||||
|
RegularCredits: number;
|
||||||
|
VaultIngredientContributions: [];
|
||||||
|
VaultCredits: number;
|
||||||
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
import { getDojoClient, getGuildForRequest, removeDojoDeco } from "@/src/services/guildService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
|
|
||||||
export const destroyDojoDecoController: RequestHandler = async (req, res) => {
|
|
||||||
const guild = await getGuildForRequest(req);
|
|
||||||
const request = JSON.parse(String(req.body)) as IDestroyDojoDecoRequest;
|
|
||||||
|
|
||||||
removeDojoDeco(guild, request.ComponentId, request.DecoId);
|
|
||||||
|
|
||||||
await guild.save();
|
|
||||||
res.json(await getDojoClient(guild, 0, request.ComponentId));
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IDestroyDojoDecoRequest {
|
|
||||||
DecoType: string;
|
|
||||||
ComponentId: string;
|
|
||||||
DecoId: string;
|
|
||||||
}
|
|
@ -1,18 +1,8 @@
|
|||||||
import { getDojoClient, getGuildForRequestEx, scaleRequiredCount } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequestEx, scaleRequiredCount } from "@/src/services/guildService";
|
||||||
import { getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { IDojoContributable } from "@/src/types/guildTypes";
|
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { ExportDojoRecipes, IDojoRecipe } from "warframe-public-export-plus";
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
|
|
||||||
interface IDojoComponentRushRequest {
|
|
||||||
DecoType?: string;
|
|
||||||
DecoId?: string;
|
|
||||||
ComponentId: string;
|
|
||||||
Amount: number;
|
|
||||||
VaultAmount: number;
|
|
||||||
AllianceVaultAmount: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dojoComponentRushController: RequestHandler = async (req, res) => {
|
export const dojoComponentRushController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -20,31 +10,27 @@ export const dojoComponentRushController: RequestHandler = async (req, res) => {
|
|||||||
const guild = await getGuildForRequestEx(req, inventory);
|
const guild = await getGuildForRequestEx(req, inventory);
|
||||||
const request = JSON.parse(String(req.body)) as IDojoComponentRushRequest;
|
const request = JSON.parse(String(req.body)) as IDojoComponentRushRequest;
|
||||||
const component = guild.DojoComponents.id(request.ComponentId)!;
|
const component = guild.DojoComponents.id(request.ComponentId)!;
|
||||||
|
const componentMeta = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf)!;
|
||||||
|
|
||||||
if (request.DecoId) {
|
const fullPlatinumCost = scaleRequiredCount(componentMeta.skipTimePrice);
|
||||||
const deco = component.Decos!.find(x => x._id.equals(request.DecoId))!;
|
const fullDurationSeconds = componentMeta.time;
|
||||||
const meta = Object.values(ExportDojoRecipes.decos).find(x => x.resultType == deco.Type)!;
|
const secondsPerPlatinum = fullDurationSeconds / fullPlatinumCost;
|
||||||
processContribution(deco, meta, request.Amount);
|
component.CompletionTime = new Date(
|
||||||
} else {
|
component.CompletionTime!.getTime() - secondsPerPlatinum * request.Amount * 1000
|
||||||
const meta = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf)!;
|
);
|
||||||
processContribution(component, meta, request.Amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
const inventoryChanges = updateCurrency(inventory, request.Amount, true);
|
const inventoryChanges = updateCurrency(inventory, request.Amount, true);
|
||||||
|
|
||||||
await guild.save();
|
await guild.save();
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.json({
|
res.json({
|
||||||
...(await getDojoClient(guild, 0, component._id)),
|
...getDojoClient(guild, 0, component._id),
|
||||||
InventoryChanges: inventoryChanges
|
InventoryChanges: inventoryChanges
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const processContribution = (component: IDojoContributable, meta: IDojoRecipe, platinumDonated: number): void => {
|
interface IDojoComponentRushRequest {
|
||||||
const fullPlatinumCost = scaleRequiredCount(meta.skipTimePrice);
|
ComponentId: string;
|
||||||
const fullDurationSeconds = meta.time;
|
Amount: number;
|
||||||
const secondsPerPlatinum = fullDurationSeconds / fullPlatinumCost;
|
VaultAmount: number;
|
||||||
component.CompletionTime = new Date(
|
AllianceVaultAmount: number;
|
||||||
component.CompletionTime!.getTime() - secondsPerPlatinum * platinumDonated * 1000
|
}
|
||||||
);
|
|
||||||
};
|
|
||||||
|
@ -18,11 +18,10 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
|
|||||||
_id: new Types.ObjectId(),
|
_id: new Types.ObjectId(),
|
||||||
pf: "/Lotus/Levels/ClanDojo/DojoHall.level",
|
pf: "/Lotus/Levels/ClanDojo/DojoHall.level",
|
||||||
ppf: "",
|
ppf: "",
|
||||||
CompletionTime: new Date(Date.now()),
|
CompletionTime: new Date(Date.now())
|
||||||
DecoCapacity: 600
|
|
||||||
});
|
});
|
||||||
await guild.save();
|
await guild.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(await getDojoClient(guild, 0));
|
res.json(getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
|
|||||||
logger.debug("mission report:", missionReport);
|
logger.debug("mission report:", missionReport);
|
||||||
|
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const inventoryUpdates = addMissionInventoryUpdates(inventory, missionReport);
|
const inventoryUpdates = await addMissionInventoryUpdates(inventory, missionReport);
|
||||||
|
|
||||||
if (missionReport.MissionStatus !== "GS_SUCCESS") {
|
if (missionReport.MissionStatus !== "GS_SUCCESS") {
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
|
|
||||||
import { RequestHandler } from "express";
|
|
||||||
import { Types } from "mongoose";
|
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
|
||||||
|
|
||||||
export const placeDecoInComponentController: RequestHandler = async (req, res) => {
|
|
||||||
const guild = await getGuildForRequest(req);
|
|
||||||
const request = JSON.parse(String(req.body)) as IPlaceDecoInComponentRequest;
|
|
||||||
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to place decorations.
|
|
||||||
const component = guild.DojoComponents.id(request.ComponentId)!;
|
|
||||||
|
|
||||||
if (component.DecoCapacity === undefined) {
|
|
||||||
component.DecoCapacity = Object.values(ExportDojoRecipes.rooms).find(
|
|
||||||
x => x.resultType == component.pf
|
|
||||||
)!.decoCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
component.Decos ??= [];
|
|
||||||
component.Decos.push({
|
|
||||||
_id: new Types.ObjectId(),
|
|
||||||
Type: request.Type,
|
|
||||||
Pos: request.Pos,
|
|
||||||
Rot: request.Rot,
|
|
||||||
Name: request.Name
|
|
||||||
});
|
|
||||||
|
|
||||||
const meta = Object.values(ExportDojoRecipes.decos).find(x => x.resultType == request.Type);
|
|
||||||
if (meta && meta.capacityCost) {
|
|
||||||
component.DecoCapacity -= meta.capacityCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
await guild.save();
|
|
||||||
res.json(await getDojoClient(guild, 0, component._id));
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IPlaceDecoInComponentRequest {
|
|
||||||
ComponentId: string;
|
|
||||||
Revision: number;
|
|
||||||
Type: string;
|
|
||||||
Pos: number[];
|
|
||||||
Rot: number[];
|
|
||||||
Name?: string;
|
|
||||||
}
|
|
@ -1,15 +1,19 @@
|
|||||||
import { config } from "@/src/services/configService";
|
|
||||||
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
|
import { getDojoClient, getGuildForRequest } from "@/src/services/guildService";
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
||||||
|
|
||||||
export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => {
|
export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => {
|
||||||
const guild = await getGuildForRequest(req);
|
const guild = await getGuildForRequest(req);
|
||||||
const componentId = req.query.componentId as string;
|
const componentId = req.query.componentId as string;
|
||||||
|
const component = guild.DojoComponents.splice(
|
||||||
guild.DojoComponents.id(componentId)!.DestructionTime = new Date(
|
guild.DojoComponents.findIndex(x => x._id.toString() === componentId),
|
||||||
Date.now() + (config.fastDojoRoomDestruction ? 5_000 : 2 * 3600_000)
|
1
|
||||||
);
|
)[0];
|
||||||
|
const room = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf);
|
||||||
|
if (room) {
|
||||||
|
guild.DojoCapacity -= room.capacity;
|
||||||
|
guild.DojoEnergy -= room.energy;
|
||||||
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(await getDojoClient(guild, 0, componentId));
|
res.json(getDojoClient(guild, 1));
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ export const setDojoComponentMessageController: RequestHandler = async (req, res
|
|||||||
component.Message = payload.Message;
|
component.Message = payload.Message;
|
||||||
}
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(await getDojoClient(guild, 0, component._id));
|
res.json(getDojoClient(guild, 0, component._id));
|
||||||
};
|
};
|
||||||
|
|
||||||
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };
|
type SetDojoComponentMessageRequest = { Name: string } | { Message: string };
|
||||||
|
@ -29,13 +29,12 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
|
|||||||
ppf: request.PlacedComponent.ppf,
|
ppf: request.PlacedComponent.ppf,
|
||||||
pi: new Types.ObjectId(request.PlacedComponent.pi!.$oid),
|
pi: new Types.ObjectId(request.PlacedComponent.pi!.$oid),
|
||||||
op: request.PlacedComponent.op,
|
op: request.PlacedComponent.op,
|
||||||
pp: request.PlacedComponent.pp,
|
pp: request.PlacedComponent.pp
|
||||||
DecoCapacity: room?.decoCapacity
|
|
||||||
}) - 1
|
}) - 1
|
||||||
];
|
];
|
||||||
if (config.noDojoRoomBuildStage) {
|
if (config.noDojoRoomBuildStage) {
|
||||||
component.CompletionTime = new Date(Date.now());
|
component.CompletionTime = new Date(Date.now());
|
||||||
}
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.json(await getDojoClient(guild, 0));
|
res.json(getDojoClient(guild, 0));
|
||||||
};
|
};
|
||||||
|
@ -2,23 +2,12 @@ import {
|
|||||||
IGuildDatabase,
|
IGuildDatabase,
|
||||||
IDojoComponentDatabase,
|
IDojoComponentDatabase,
|
||||||
ITechProjectDatabase,
|
ITechProjectDatabase,
|
||||||
ITechProjectClient,
|
ITechProjectClient
|
||||||
IDojoDecoDatabase
|
|
||||||
} from "@/src/types/guildTypes";
|
} from "@/src/types/guildTypes";
|
||||||
import { Document, Model, model, Schema, Types } from "mongoose";
|
import { Document, Model, model, Schema, Types } from "mongoose";
|
||||||
import { typeCountSchema } from "./inventoryModels/inventoryModel";
|
import { typeCountSchema } from "./inventoryModels/inventoryModel";
|
||||||
import { toMongoDate } from "../helpers/inventoryHelpers";
|
import { toMongoDate } from "../helpers/inventoryHelpers";
|
||||||
|
|
||||||
const dojoDecoSchema = new Schema<IDojoDecoDatabase>({
|
|
||||||
Type: String,
|
|
||||||
Pos: [Number],
|
|
||||||
Rot: [Number],
|
|
||||||
Name: String,
|
|
||||||
RegularCredits: Number,
|
|
||||||
MiscItems: { type: [typeCountSchema], default: undefined },
|
|
||||||
CompletionTime: Date
|
|
||||||
});
|
|
||||||
|
|
||||||
const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
|
const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
|
||||||
pf: { type: String, required: true },
|
pf: { type: String, required: true },
|
||||||
ppf: String,
|
ppf: String,
|
||||||
@ -29,10 +18,7 @@ const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
|
|||||||
Message: String,
|
Message: String,
|
||||||
RegularCredits: Number,
|
RegularCredits: Number,
|
||||||
MiscItems: { type: [typeCountSchema], default: undefined },
|
MiscItems: { type: [typeCountSchema], default: undefined },
|
||||||
CompletionTime: Date,
|
CompletionTime: Date
|
||||||
DestructionTime: Date,
|
|
||||||
Decos: [dojoDecoSchema],
|
|
||||||
DecoCapacity: Number
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const techProjectSchema = new Schema<ITechProjectDatabase>(
|
const techProjectSchema = new Schema<ITechProjectDatabase>(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import { abandonLibraryDailyTaskController } from "@/src/controllers/api/abandonLibraryDailyTaskController";
|
import { abandonLibraryDailyTaskController } from "@/src/controllers/api/abandonLibraryDailyTaskController";
|
||||||
import { abortDojoComponentController } from "@/src/controllers/api/abortDojoComponentController";
|
import { abortDojoComponentController } from "@/src/controllers/api/abortDojoComponentController";
|
||||||
import { abortDojoComponentDestructionController } from "@/src/controllers/api/abortDojoComponentDestructionController";
|
|
||||||
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
|
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
|
||||||
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
||||||
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
|
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
|
||||||
@ -17,7 +16,6 @@ import { contributeToDojoComponentController } from "@/src/controllers/api/contr
|
|||||||
import { createGuildController } from "@/src/controllers/api/createGuildController";
|
import { createGuildController } from "@/src/controllers/api/createGuildController";
|
||||||
import { creditsController } from "@/src/controllers/api/creditsController";
|
import { creditsController } from "@/src/controllers/api/creditsController";
|
||||||
import { deleteSessionController } from "@/src/controllers/api/deleteSessionController";
|
import { deleteSessionController } from "@/src/controllers/api/deleteSessionController";
|
||||||
import { destroyDojoDecoController } from "@/src/controllers/api/destroyDojoDecoController";
|
|
||||||
import { dojoComponentRushController } from "@/src/controllers/api/dojoComponentRushController";
|
import { dojoComponentRushController } from "@/src/controllers/api/dojoComponentRushController";
|
||||||
import { dojoController } from "@/src/controllers/api/dojoController";
|
import { dojoController } from "@/src/controllers/api/dojoController";
|
||||||
import { dronesController } from "@/src/controllers/api/dronesController";
|
import { dronesController } from "@/src/controllers/api/dronesController";
|
||||||
@ -61,7 +59,6 @@ import { missionInventoryUpdateController } from "@/src/controllers/api/missionI
|
|||||||
import { modularWeaponCraftingController } from "@/src/controllers/api/modularWeaponCraftingController";
|
import { modularWeaponCraftingController } from "@/src/controllers/api/modularWeaponCraftingController";
|
||||||
import { modularWeaponSaleController } from "@/src/controllers/api/modularWeaponSaleController";
|
import { modularWeaponSaleController } from "@/src/controllers/api/modularWeaponSaleController";
|
||||||
import { nameWeaponController } from "@/src/controllers/api/nameWeaponController";
|
import { nameWeaponController } from "@/src/controllers/api/nameWeaponController";
|
||||||
import { placeDecoInComponentController } from "@/src/controllers/api/placeDecoInComponentController";
|
|
||||||
import { playerSkillsController } from "@/src/controllers/api/playerSkillsController";
|
import { playerSkillsController } from "@/src/controllers/api/playerSkillsController";
|
||||||
import { projectionManagerController } from "@/src/controllers/api/projectionManagerController";
|
import { projectionManagerController } from "@/src/controllers/api/projectionManagerController";
|
||||||
import { purchaseController } from "@/src/controllers/api/purchaseController";
|
import { purchaseController } from "@/src/controllers/api/purchaseController";
|
||||||
@ -106,7 +103,6 @@ const apiRouter = express.Router();
|
|||||||
|
|
||||||
// get
|
// get
|
||||||
apiRouter.get("/abandonLibraryDailyTask.php", abandonLibraryDailyTaskController);
|
apiRouter.get("/abandonLibraryDailyTask.php", abandonLibraryDailyTaskController);
|
||||||
apiRouter.get("/abortDojoComponentDestruction.php", abortDojoComponentDestructionController);
|
|
||||||
apiRouter.get("/checkDailyMissionBonus.php", checkDailyMissionBonusController);
|
apiRouter.get("/checkDailyMissionBonus.php", checkDailyMissionBonusController);
|
||||||
apiRouter.get("/claimLibraryDailyTaskReward.php", claimLibraryDailyTaskRewardController);
|
apiRouter.get("/claimLibraryDailyTaskReward.php", claimLibraryDailyTaskRewardController);
|
||||||
apiRouter.get("/credits.php", creditsController);
|
apiRouter.get("/credits.php", creditsController);
|
||||||
@ -154,7 +150,6 @@ apiRouter.post("/clearDialogueHistory.php", clearDialogueHistoryController);
|
|||||||
apiRouter.post("/completeRandomModChallenge.php", completeRandomModChallengeController);
|
apiRouter.post("/completeRandomModChallenge.php", completeRandomModChallengeController);
|
||||||
apiRouter.post("/contributeToDojoComponent.php", contributeToDojoComponentController);
|
apiRouter.post("/contributeToDojoComponent.php", contributeToDojoComponentController);
|
||||||
apiRouter.post("/createGuild.php", createGuildController);
|
apiRouter.post("/createGuild.php", createGuildController);
|
||||||
apiRouter.post("/destroyDojoDeco.php", destroyDojoDecoController);
|
|
||||||
apiRouter.post("/dojoComponentRush.php", dojoComponentRushController);
|
apiRouter.post("/dojoComponentRush.php", dojoComponentRushController);
|
||||||
apiRouter.post("/drones.php", dronesController);
|
apiRouter.post("/drones.php", dronesController);
|
||||||
apiRouter.post("/endlessXp.php", endlessXpController);
|
apiRouter.post("/endlessXp.php", endlessXpController);
|
||||||
@ -180,7 +175,6 @@ apiRouter.post("/login.php", loginController);
|
|||||||
apiRouter.post("/missionInventoryUpdate.php", missionInventoryUpdateController);
|
apiRouter.post("/missionInventoryUpdate.php", missionInventoryUpdateController);
|
||||||
apiRouter.post("/modularWeaponCrafting.php", modularWeaponCraftingController);
|
apiRouter.post("/modularWeaponCrafting.php", modularWeaponCraftingController);
|
||||||
apiRouter.post("/nameWeapon.php", nameWeaponController);
|
apiRouter.post("/nameWeapon.php", nameWeaponController);
|
||||||
apiRouter.post("/placeDecoInComponent.php", placeDecoInComponentController);
|
|
||||||
apiRouter.post("/playerSkills.php", playerSkillsController);
|
apiRouter.post("/playerSkills.php", playerSkillsController);
|
||||||
apiRouter.post("/projectionManager.php", projectionManagerController);
|
apiRouter.post("/projectionManager.php", projectionManagerController);
|
||||||
apiRouter.post("/purchase.php", purchaseController);
|
apiRouter.post("/purchase.php", purchaseController);
|
||||||
|
@ -59,7 +59,6 @@ interface IConfig {
|
|||||||
noDailyStandingLimits?: boolean;
|
noDailyStandingLimits?: boolean;
|
||||||
instantResourceExtractorDrones?: boolean;
|
instantResourceExtractorDrones?: boolean;
|
||||||
noDojoRoomBuildStage?: boolean;
|
noDojoRoomBuildStage?: boolean;
|
||||||
fastDojoRoomDestruction?: boolean;
|
|
||||||
noDojoResearchCosts?: boolean;
|
noDojoResearchCosts?: boolean;
|
||||||
noDojoResearchTime?: boolean;
|
noDojoResearchTime?: boolean;
|
||||||
spoofMasteryRank?: number;
|
spoofMasteryRank?: number;
|
||||||
|
@ -6,8 +6,6 @@ import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/invento
|
|||||||
import { IDojoClient, IDojoComponentClient } from "@/src/types/guildTypes";
|
import { IDojoClient, IDojoComponentClient } from "@/src/types/guildTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
|
|
||||||
import { logger } from "../utils/logger";
|
|
||||||
|
|
||||||
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
export const getGuildForRequest = async (req: Request): Promise<TGuildDatabaseDocument> => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
@ -30,11 +28,11 @@ export const getGuildForRequestEx = async (
|
|||||||
return guild;
|
return guild;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDojoClient = async (
|
export const getDojoClient = (
|
||||||
guild: TGuildDatabaseDocument,
|
guild: TGuildDatabaseDocument,
|
||||||
status: number,
|
status: number,
|
||||||
componentId: Types.ObjectId | string | undefined = undefined
|
componentId: Types.ObjectId | undefined = undefined
|
||||||
): Promise<IDojoClient> => {
|
): IDojoClient => {
|
||||||
const dojo: IDojoClient = {
|
const dojo: IDojoClient = {
|
||||||
_id: { $oid: guild._id.toString() },
|
_id: { $oid: guild._id.toString() },
|
||||||
Name: guild.Name,
|
Name: guild.Name,
|
||||||
@ -47,16 +45,15 @@ export const getDojoClient = async (
|
|||||||
DojoRequestStatus: status,
|
DojoRequestStatus: status,
|
||||||
DojoComponents: []
|
DojoComponents: []
|
||||||
};
|
};
|
||||||
const roomsToRemove: Types.ObjectId[] = [];
|
|
||||||
guild.DojoComponents.forEach(dojoComponent => {
|
guild.DojoComponents.forEach(dojoComponent => {
|
||||||
if (!componentId || dojoComponent._id.equals(componentId)) {
|
if (!componentId || componentId == dojoComponent._id) {
|
||||||
const clientComponent: IDojoComponentClient = {
|
const clientComponent: IDojoComponentClient = {
|
||||||
id: toOid(dojoComponent._id),
|
id: toOid(dojoComponent._id),
|
||||||
pf: dojoComponent.pf,
|
pf: dojoComponent.pf,
|
||||||
ppf: dojoComponent.ppf,
|
ppf: dojoComponent.ppf,
|
||||||
Name: dojoComponent.Name,
|
Name: dojoComponent.Name,
|
||||||
Message: dojoComponent.Message,
|
Message: dojoComponent.Message,
|
||||||
DecoCapacity: dojoComponent.DecoCapacity ?? 600
|
DecoCapacity: 600
|
||||||
};
|
};
|
||||||
if (dojoComponent.pi) {
|
if (dojoComponent.pi) {
|
||||||
clientComponent.pi = toOid(dojoComponent.pi);
|
clientComponent.pi = toOid(dojoComponent.pi);
|
||||||
@ -65,41 +62,13 @@ export const getDojoClient = async (
|
|||||||
}
|
}
|
||||||
if (dojoComponent.CompletionTime) {
|
if (dojoComponent.CompletionTime) {
|
||||||
clientComponent.CompletionTime = toMongoDate(dojoComponent.CompletionTime);
|
clientComponent.CompletionTime = toMongoDate(dojoComponent.CompletionTime);
|
||||||
if (dojoComponent.DestructionTime) {
|
|
||||||
if (Date.now() >= dojoComponent.DestructionTime.getTime()) {
|
|
||||||
roomsToRemove.push(dojoComponent._id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clientComponent.DestructionTime = toMongoDate(dojoComponent.DestructionTime);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
clientComponent.RegularCredits = dojoComponent.RegularCredits;
|
clientComponent.RegularCredits = dojoComponent.RegularCredits;
|
||||||
clientComponent.MiscItems = dojoComponent.MiscItems;
|
clientComponent.MiscItems = dojoComponent.MiscItems;
|
||||||
}
|
}
|
||||||
if (dojoComponent.Decos) {
|
|
||||||
clientComponent.Decos = [];
|
|
||||||
for (const deco of dojoComponent.Decos) {
|
|
||||||
clientComponent.Decos.push({
|
|
||||||
id: toOid(deco._id),
|
|
||||||
Type: deco.Type,
|
|
||||||
Pos: deco.Pos,
|
|
||||||
Rot: deco.Rot,
|
|
||||||
CompletionTime: deco.CompletionTime ? toMongoDate(deco.CompletionTime) : undefined,
|
|
||||||
RegularCredits: deco.RegularCredits,
|
|
||||||
MiscItems: deco.MiscItems
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dojo.DojoComponents.push(clientComponent);
|
dojo.DojoComponents.push(clientComponent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (roomsToRemove.length) {
|
|
||||||
logger.debug(`removing now-destroyed rooms`, roomsToRemove);
|
|
||||||
for (const id of roomsToRemove) {
|
|
||||||
removeDojoRoom(guild, id);
|
|
||||||
}
|
|
||||||
await guild.save();
|
|
||||||
}
|
|
||||||
return dojo;
|
return dojo;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -107,33 +76,3 @@ export const scaleRequiredCount = (count: number): number => {
|
|||||||
// The recipes in the export are for Moon clans. For now we'll just assume we only have Ghost clans.
|
// The recipes in the export are for Moon clans. For now we'll just assume we only have Ghost clans.
|
||||||
return Math.max(1, Math.trunc(count / 100));
|
return Math.max(1, Math.trunc(count / 100));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeDojoRoom = (guild: TGuildDatabaseDocument, componentId: Types.ObjectId | string): void => {
|
|
||||||
const component = guild.DojoComponents.splice(
|
|
||||||
guild.DojoComponents.findIndex(x => x._id.equals(componentId)),
|
|
||||||
1
|
|
||||||
)[0];
|
|
||||||
const meta = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf);
|
|
||||||
if (meta) {
|
|
||||||
guild.DojoCapacity -= meta.capacity;
|
|
||||||
guild.DojoEnergy -= meta.energy;
|
|
||||||
}
|
|
||||||
// TODO: Add resources spent to the clan vault
|
|
||||||
};
|
|
||||||
|
|
||||||
export const removeDojoDeco = (
|
|
||||||
guild: TGuildDatabaseDocument,
|
|
||||||
componentId: Types.ObjectId | string,
|
|
||||||
decoId: Types.ObjectId | string
|
|
||||||
): void => {
|
|
||||||
const component = guild.DojoComponents.id(componentId)!;
|
|
||||||
const deco = component.Decos!.splice(
|
|
||||||
component.Decos!.findIndex(x => x._id.equals(decoId)),
|
|
||||||
1
|
|
||||||
)[0];
|
|
||||||
const meta = Object.values(ExportDojoRecipes.decos).find(x => x.resultType == deco.Type);
|
|
||||||
if (meta && meta.capacityCost) {
|
|
||||||
component.DecoCapacity! += meta.capacityCost;
|
|
||||||
}
|
|
||||||
// TODO: Add resources spent to the clan vault
|
|
||||||
};
|
|
||||||
|
@ -428,10 +428,8 @@ export const addItem = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (typeName in ExportEmailItems) {
|
if (typeName in ExportEmailItems) {
|
||||||
const emailItem = ExportEmailItems[typeName];
|
|
||||||
await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(emailItem.message)]);
|
|
||||||
return {
|
return {
|
||||||
InventoryChanges: {}
|
InventoryChanges: await addEmailItem(inventory, typeName)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,6 +941,28 @@ const addDrone = (
|
|||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addEmailItem = async (
|
||||||
|
inventory: TInventoryDatabaseDocument,
|
||||||
|
typeName: string,
|
||||||
|
inventoryChanges: IInventoryChanges = {}
|
||||||
|
): Promise<IInventoryChanges> => {
|
||||||
|
const meta = ExportEmailItems[typeName];
|
||||||
|
const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
|
||||||
|
if (!emailItem || !meta.sendOnlyOnce) {
|
||||||
|
await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(meta.message)]);
|
||||||
|
|
||||||
|
if (emailItem) {
|
||||||
|
emailItem.ItemCount += 1;
|
||||||
|
} else {
|
||||||
|
inventory.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
inventoryChanges.EmailItems ??= [];
|
||||||
|
inventoryChanges.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
|
||||||
|
}
|
||||||
|
return inventoryChanges;
|
||||||
|
};
|
||||||
|
|
||||||
//TODO: wrong id is not erroring
|
//TODO: wrong id is not erroring
|
||||||
export const addGearExpByCategory = (
|
export const addGearExpByCategory = (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
addConsumables,
|
addConsumables,
|
||||||
addCrewShipAmmo,
|
addCrewShipAmmo,
|
||||||
addCrewShipRawSalvage,
|
addCrewShipRawSalvage,
|
||||||
|
addEmailItem,
|
||||||
addFocusXpIncreases,
|
addFocusXpIncreases,
|
||||||
addFusionTreasures,
|
addFusionTreasures,
|
||||||
addGearExpByCategory,
|
addGearExpByCategory,
|
||||||
@ -61,10 +62,10 @@ const getRandomRewardByChance = (pool: IReward[]): IRngResult | undefined => {
|
|||||||
//type TignoredInventoryUpdateKeys = (typeof ignoredInventoryUpdateKeys)[number];
|
//type TignoredInventoryUpdateKeys = (typeof ignoredInventoryUpdateKeys)[number];
|
||||||
//const knownUnhandledKeys: readonly string[] = ["test"] as const; // for unimplemented but important keys
|
//const knownUnhandledKeys: readonly string[] = ["test"] as const; // for unimplemented but important keys
|
||||||
|
|
||||||
export const addMissionInventoryUpdates = (
|
export const addMissionInventoryUpdates = async (
|
||||||
inventory: HydratedDocument<IInventoryDatabase, InventoryDocumentProps>,
|
inventory: HydratedDocument<IInventoryDatabase, InventoryDocumentProps>,
|
||||||
inventoryUpdates: IMissionInventoryUpdateRequest
|
inventoryUpdates: IMissionInventoryUpdateRequest
|
||||||
): Partial<IInventoryDatabase> | undefined => {
|
): Promise<Partial<IInventoryDatabase> | undefined> => {
|
||||||
//TODO: type this properly
|
//TODO: type this properly
|
||||||
const inventoryChanges: Partial<IInventoryDatabase> = {};
|
const inventoryChanges: Partial<IInventoryDatabase> = {};
|
||||||
if (inventoryUpdates.MissionFailed === true) {
|
if (inventoryUpdates.MissionFailed === true) {
|
||||||
@ -156,6 +157,12 @@ export const addMissionInventoryUpdates = (
|
|||||||
inventoryChanges.FusionPoints = fusionPoints;
|
inventoryChanges.FusionPoints = fusionPoints;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "EmailItems": {
|
||||||
|
for (const tc of value) {
|
||||||
|
await addEmailItem(inventory, tc.ItemType);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "FocusXpIncreases": {
|
case "FocusXpIncreases": {
|
||||||
addFocusXpIncreases(inventory, value);
|
addFocusXpIncreases(inventory, value);
|
||||||
break;
|
break;
|
||||||
@ -206,32 +213,32 @@ export const addMissionInventoryUpdates = (
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "CollectibleScans":
|
case "CollectibleScans":
|
||||||
value.forEach(scan => {
|
for (const scan of value) {
|
||||||
const entry = inventory.CollectibleSeries?.find(x => x.CollectibleType == scan.CollectibleType);
|
const entry = inventory.CollectibleSeries?.find(x => x.CollectibleType == scan.CollectibleType);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
entry.Count = scan.Count;
|
entry.Count = scan.Count;
|
||||||
entry.Tracking = scan.Tracking;
|
entry.Tracking = scan.Tracking;
|
||||||
if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") {
|
if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") {
|
||||||
const progress = entry.Count / entry.ReqScans;
|
const progress = entry.Count / entry.ReqScans;
|
||||||
entry.IncentiveStates.forEach(gate => {
|
for (const gate of entry.IncentiveStates) {
|
||||||
gate.complete = progress >= gate.threshold;
|
gate.complete = progress >= gate.threshold;
|
||||||
if (gate.complete && !gate.sent) {
|
if (gate.complete && !gate.sent) {
|
||||||
gate.sent = true;
|
gate.sent = true;
|
||||||
if (gate.threshold == 0.5) {
|
if (gate.threshold == 0.5) {
|
||||||
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage50]);
|
await createMessage(inventory.accountOwnerId.toString(), [kuriaMessage50]);
|
||||||
} else {
|
} else {
|
||||||
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage75]);
|
await createMessage(inventory.accountOwnerId.toString(), [kuriaMessage75]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
if (progress >= 1.0) {
|
if (progress >= 1.0) {
|
||||||
void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage100]);
|
await createMessage(inventory.accountOwnerId.toString(), [kuriaMessage100]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.warn(`${scan.CollectibleType} was not found in inventory, ignoring scans`);
|
logger.warn(`${scan.CollectibleType} was not found in inventory, ignoring scans`);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
break;
|
break;
|
||||||
case "Upgrades":
|
case "Upgrades":
|
||||||
value.forEach(clientUpgrade => {
|
value.forEach(clientUpgrade => {
|
||||||
|
@ -41,33 +41,18 @@ export interface IDojoComponentClient {
|
|||||||
CompletionTime?: IMongoDate;
|
CompletionTime?: IMongoDate;
|
||||||
RushPlatinum?: number;
|
RushPlatinum?: number;
|
||||||
DestructionTime?: IMongoDate;
|
DestructionTime?: IMongoDate;
|
||||||
Decos?: IDojoDecoClient[];
|
|
||||||
DecoCapacity?: number;
|
DecoCapacity?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDojoComponentDatabase
|
export interface IDojoComponentDatabase
|
||||||
extends Omit<IDojoComponentClient, "id" | "pi" | "CompletionTime" | "RushPlatinum" | "DestructionTime" | "Decos"> {
|
extends Omit<
|
||||||
|
IDojoComponentClient,
|
||||||
|
"id" | "pi" | "CompletionTime" | "RushPlatinum" | "DestructionTime" | "DecoCapacity"
|
||||||
|
> {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
pi?: Types.ObjectId;
|
pi?: Types.ObjectId;
|
||||||
CompletionTime?: Date;
|
CompletionTime?: Date;
|
||||||
DestructionTime?: Date;
|
//DestructionTime?: Date;
|
||||||
Decos?: IDojoDecoDatabase[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IDojoDecoClient {
|
|
||||||
id: IOid;
|
|
||||||
Type: string;
|
|
||||||
Pos: number[];
|
|
||||||
Rot: number[];
|
|
||||||
Name?: string; // for teleporters
|
|
||||||
RegularCredits?: number;
|
|
||||||
MiscItems?: IMiscItem[];
|
|
||||||
CompletionTime?: IMongoDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IDojoDecoDatabase extends Omit<IDojoDecoClient, "id" | "CompletionTime"> {
|
|
||||||
_id: Types.ObjectId;
|
|
||||||
CompletionTime?: Date;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITechProjectClient {
|
export interface ITechProjectClient {
|
||||||
@ -81,9 +66,3 @@ export interface ITechProjectClient {
|
|||||||
export interface ITechProjectDatabase extends Omit<ITechProjectClient, "CompletionDate"> {
|
export interface ITechProjectDatabase extends Omit<ITechProjectClient, "CompletionDate"> {
|
||||||
CompletionDate?: Date;
|
CompletionDate?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDojoContributable {
|
|
||||||
RegularCredits?: number;
|
|
||||||
MiscItems?: IMiscItem[];
|
|
||||||
CompletionTime?: Date;
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
import { IEquipmentClient } from "./inventoryTypes/commonInventoryTypes";
|
import { IEquipmentClient } from "./inventoryTypes/commonInventoryTypes";
|
||||||
import { IDroneClient, IInfestedFoundryClient, IMiscItem, TEquipmentKey } from "./inventoryTypes/inventoryTypes";
|
import {
|
||||||
|
IDroneClient,
|
||||||
|
IInfestedFoundryClient,
|
||||||
|
IMiscItem,
|
||||||
|
ITypeCount,
|
||||||
|
TEquipmentKey
|
||||||
|
} from "./inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
export interface IPurchaseRequest {
|
export interface IPurchaseRequest {
|
||||||
PurchaseParams: IPurchaseParams;
|
PurchaseParams: IPurchaseParams;
|
||||||
@ -33,6 +39,7 @@ export type IInventoryChanges = {
|
|||||||
InfestedFoundry?: IInfestedFoundryClient;
|
InfestedFoundry?: IInfestedFoundryClient;
|
||||||
Drones?: IDroneClient[];
|
Drones?: IDroneClient[];
|
||||||
MiscItems?: IMiscItem[];
|
MiscItems?: IMiscItem[];
|
||||||
|
EmailItems?: ITypeCount[];
|
||||||
} & Record<
|
} & Record<
|
||||||
Exclude<
|
Exclude<
|
||||||
string,
|
string,
|
||||||
@ -44,6 +51,7 @@ export type IInventoryChanges = {
|
|||||||
| "InfestedFoundry"
|
| "InfestedFoundry"
|
||||||
| "Drones"
|
| "Drones"
|
||||||
| "MiscItems"
|
| "MiscItems"
|
||||||
|
| "EmailItems"
|
||||||
>,
|
>,
|
||||||
number | object[]
|
number | object[]
|
||||||
>;
|
>;
|
||||||
|
@ -46,6 +46,7 @@ export type IMissionInventoryUpdateRequest = {
|
|||||||
CrewShipRawSalvage?: ITypeCount[];
|
CrewShipRawSalvage?: ITypeCount[];
|
||||||
CrewShipAmmo?: ITypeCount[];
|
CrewShipAmmo?: ITypeCount[];
|
||||||
BonusMiscItems?: ITypeCount[];
|
BonusMiscItems?: ITypeCount[];
|
||||||
|
EmailItems?: ITypeCount[];
|
||||||
|
|
||||||
SyndicateId?: string;
|
SyndicateId?: string;
|
||||||
SortieId?: string;
|
SortieId?: string;
|
||||||
|
@ -525,10 +525,6 @@
|
|||||||
<input class="form-check-input" type="checkbox" id="noDojoRoomBuildStage" />
|
<input class="form-check-input" type="checkbox" id="noDojoRoomBuildStage" />
|
||||||
<label class="form-check-label" for="noDojoRoomBuildStage" data-loc="cheats_noDojoRoomBuildStage"></label>
|
<label class="form-check-label" for="noDojoRoomBuildStage" data-loc="cheats_noDojoRoomBuildStage"></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" id="fastDojoRoomDestruction" />
|
|
||||||
<label class="form-check-label" for="fastDojoRoomDestruction" data-loc="cheats_fastDojoRoomDestruction"></label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" id="noDojoResearchCosts" />
|
<input class="form-check-input" type="checkbox" id="noDojoResearchCosts" />
|
||||||
<label class="form-check-label" for="noDojoResearchCosts" data-loc="cheats_noDojoResearchCosts"></label>
|
<label class="form-check-label" for="noDojoResearchCosts" data-loc="cheats_noDojoResearchCosts"></label>
|
||||||
|
@ -111,7 +111,6 @@ dict = {
|
|||||||
cheats_noDailyStandingLimits: `No Daily Standing Limits`,
|
cheats_noDailyStandingLimits: `No Daily Standing Limits`,
|
||||||
cheats_instantResourceExtractorDrones: `Instant Resource Extractor Drones`,
|
cheats_instantResourceExtractorDrones: `Instant Resource Extractor Drones`,
|
||||||
cheats_noDojoRoomBuildStage: `No Dojo Room Build Stage`,
|
cheats_noDojoRoomBuildStage: `No Dojo Room Build Stage`,
|
||||||
cheats_fastDojoRoomDestruction: `Fast Dojo Room Destruction`,
|
|
||||||
cheats_noDojoResearchCosts: `No Dojo Research Costs`,
|
cheats_noDojoResearchCosts: `No Dojo Research Costs`,
|
||||||
cheats_noDojoResearchTime: `No Dojo Research Time`,
|
cheats_noDojoResearchTime: `No Dojo Research Time`,
|
||||||
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// French translation by Vitruvio
|
|
||||||
dict = {
|
dict = {
|
||||||
general_inventoryUpdateNote: `Note : Les changements effectués ici seront appliqués lors de la syncrhonisation. Visiter la navigation appliquera les changements apportés à l'inventaire.`,
|
general_inventoryUpdateNote: `Note : Les changements effectués ici seront appliqués lors de la syncrhonisation. Visiter la navigation appliquera les changements apportés à l'inventaire.`,
|
||||||
general_addButton: `Ajouter`,
|
general_addButton: `Ajouter`,
|
||||||
@ -95,6 +94,8 @@ dict = {
|
|||||||
cheats_skipAllDialogue: `Passer les dialogues`,
|
cheats_skipAllDialogue: `Passer les dialogues`,
|
||||||
cheats_unlockAllScans: `Débloquer tous les scans`,
|
cheats_unlockAllScans: `Débloquer tous les scans`,
|
||||||
cheats_unlockAllMissions: `Débloquer toutes les missions`,
|
cheats_unlockAllMissions: `Débloquer toutes les missions`,
|
||||||
|
cheats_unlockAllQuests: `Débloquer toutes les quêtes`,
|
||||||
|
cheats_completeAllQuests: `Compléter toutes les quêtes`,
|
||||||
cheats_infiniteCredits: `Crédits infinis`,
|
cheats_infiniteCredits: `Crédits infinis`,
|
||||||
cheats_infinitePlatinum: `Platinum infini`,
|
cheats_infinitePlatinum: `Platinum infini`,
|
||||||
cheats_infiniteEndo: `Endo infini`,
|
cheats_infiniteEndo: `Endo infini`,
|
||||||
@ -112,7 +113,6 @@ dict = {
|
|||||||
cheats_noDailyStandingLimits: `Pas de limite de réputation journalière`,
|
cheats_noDailyStandingLimits: `Pas de limite de réputation journalière`,
|
||||||
cheats_instantResourceExtractorDrones: `Ressources de drone d'extraction instantannées`,
|
cheats_instantResourceExtractorDrones: `Ressources de drone d'extraction instantannées`,
|
||||||
cheats_noDojoRoomBuildStage: `No Dojo Room Build Stage`,
|
cheats_noDojoRoomBuildStage: `No Dojo Room Build Stage`,
|
||||||
cheats_fastDojoRoomDestruction: `[UNTRANSLATED] Fast Dojo Room Destruction`,
|
|
||||||
cheats_noDojoResearchCosts: `Aucun coût de recherche (Dojo)`,
|
cheats_noDojoResearchCosts: `Aucun coût de recherche (Dojo)`,
|
||||||
cheats_noDojoResearchTime: `Aucun temps de recherche (Dojo)`,
|
cheats_noDojoResearchTime: `Aucun temps de recherche (Dojo)`,
|
||||||
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
|
||||||
|
@ -112,7 +112,6 @@ dict = {
|
|||||||
cheats_noDailyStandingLimits: `Без ежедневных ограничений репутации`,
|
cheats_noDailyStandingLimits: `Без ежедневных ограничений репутации`,
|
||||||
cheats_instantResourceExtractorDrones: `[UNTRANSLATED] Instant Resource Extractor Drones`,
|
cheats_instantResourceExtractorDrones: `[UNTRANSLATED] Instant Resource Extractor Drones`,
|
||||||
cheats_noDojoRoomBuildStage: `[UNTRANSLATED] No Dojo Room Build Stage`,
|
cheats_noDojoRoomBuildStage: `[UNTRANSLATED] No Dojo Room Build Stage`,
|
||||||
cheats_fastDojoRoomDestruction: `[UNTRANSLATED] Fast Dojo Room Destruction`,
|
|
||||||
cheats_noDojoResearchCosts: `[UNTRANSLATED] No Dojo Research Costs`,
|
cheats_noDojoResearchCosts: `[UNTRANSLATED] No Dojo Research Costs`,
|
||||||
cheats_noDojoResearchTime: `[UNTRANSLATED] No Dojo Research Time`,
|
cheats_noDojoResearchTime: `[UNTRANSLATED] No Dojo Research Time`,
|
||||||
cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
|
cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user