返回提交历史
Modified
package-lock.json
+4
-4
Modified
package.json
+1
-1
Modified
src/controllers/api/getGuildDojoController.ts
+2
-2
Modified
src/controllers/api/queueDojoComponentDestructionController.ts
+10
-2
Modified
src/controllers/api/startDojoRecipeController.ts
+8
-0
Modified
src/models/guildModel.ts
+3
-1
Modified
src/types/guildTypes.ts
+3
-1
XFEstudio/XFESpaceNinjaServer
feat: dojo room energy & capacity costs & gains (#633)
7fdb59f6
代码差异
7 个文件
+31
-11
@@ -12,7 +12,7 @@
12
12
"copyfiles": "^2.4.1",
13
13
"express": "^5",
14
14
"mongoose": "^8.9.2",
15
"warframe-public-export-plus": "^0.5.13",
15
"warframe-public-export-plus": "^0.5.14",
16
16
"warframe-riven-info": "^0.1.2",
17
17
"winston": "^3.17.0",
18
18
"winston-daily-rotate-file": "^5.0.0"
@@ -3877,9 +3877,9 @@
3877
3877
}
3878
3878
},
3879
3879
"node_modules/warframe-public-export-plus": {
3880
"version": "0.5.13",
3881
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.13.tgz",
3882
"integrity": "sha512-iyiaEsgZGQMU29jDag+Pq1z2q0/Zj4bCzTMtoZCSFtNUiZOPYwzjBmbYsDN0FO/yUoHu2dboW0lEYsdaofTEDQ=="
3880
"version": "0.5.14",
3881
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.14.tgz",
3882
"integrity": "sha512-G6Jrs1PoETheYQjN2Mm6qVZeiIS5h2U8e+nHC3fPDVhLz3gZkbZShDOTCJ3JNAlP1NFrFYoBqUc6gMmN0Z9Acg=="
3883
3883
},
3884
3884
"node_modules/warframe-riven-info": {
3885
3885
"version": "0.1.2",
@@ -16,7 +16,7 @@
16
16
"copyfiles": "^2.4.1",
17
17
"express": "^5",
18
18
"mongoose": "^8.9.2",
19
"warframe-public-export-plus": "^0.5.13",
19
"warframe-public-export-plus": "^0.5.14",
20
20
"warframe-riven-info": "^0.1.2",
21
21
"winston": "^3.17.0",
22
22
"winston-daily-rotate-file": "^5.0.0"
@@ -33,8 +33,8 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
33
33
FixedContributions: true,
34
34
DojoRevision: 1,
35
35
RevisionTime: Math.round(Date.now() / 1000),
36
Energy: 5,
37
Capacity: 100,
36
Energy: guild.DojoEnergy,
37
Capacity: guild.DojoCapacity,
38
38
DojoRequestStatus: 0,
39
39
DojoComponents: []
40
40
};
@@ -1,13 +1,21 @@
1
1
import { getGuildForRequest } from "@/src/services/guildService";
2
2
import { RequestHandler } from "express";
3
import { ExportDojoRecipes } from "warframe-public-export-plus";
3
4
4
5
export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => {
5
6
const guild = await getGuildForRequest(req);
6
7
const componentId = req.query.componentId as string;
7
guild.DojoComponents!.splice(
8
const component = guild.DojoComponents!.splice(
8
9
guild.DojoComponents!.findIndex(x => x._id.toString() === componentId),
9
10
1
10
);
11
)[0];
12
if (component) {
13
const room = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == component.pf);
14
if (room) {
15
guild.DojoCapacity -= room.capacity;
16
guild.DojoEnergy -= room.energy;
17
}
18
}
11
19
await guild.save();
12
20
res.json({
13
21
DojoRequestStatus: 1
@@ -2,6 +2,7 @@ import { RequestHandler } from "express";
2
2
import { IDojoComponentClient } from "@/src/types/guildTypes";
3
3
import { getGuildForRequest } from "@/src/services/guildService";
4
4
import { Types } from "mongoose";
5
import { ExportDojoRecipes } from "warframe-public-export-plus";
5
6
6
7
interface IStartDojoRecipeRequest {
7
8
PlacedComponent: IDojoComponentClient;
@@ -12,6 +13,13 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
12
13
const guild = await getGuildForRequest(req);
13
14
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build.
14
15
const request = JSON.parse(String(req.body)) as IStartDojoRecipeRequest;
16
17
const room = Object.values(ExportDojoRecipes.rooms).find(x => x.resultType == request.PlacedComponent.pf);
18
if (room) {
19
guild.DojoCapacity += room.capacity;
20
guild.DojoEnergy += room.energy;
21
}
22
15
23
guild.DojoComponents!.push({
16
24
_id: new Types.ObjectId(),
17
25
pf: request.PlacedComponent.pf,
@@ -13,7 +13,9 @@ const dojoComponentSchema = new Schema<IDojoComponentDatabase>({
13
13
const guildSchema = new Schema<IGuildDatabase>(
14
14
{
15
15
Name: { type: String, required: true },
16
DojoComponents: [dojoComponentSchema]
16
DojoComponents: [dojoComponentSchema],
17
DojoCapacity: { type: Number, default: 100 },
18
DojoEnergy: { type: Number, default: 5 }
17
19
},
18
20
{ id: false }
19
21
);
@@ -9,6 +9,8 @@ export interface IGuild {
9
9
export interface IGuildDatabase extends IGuild {
10
10
_id: Types.ObjectId;
11
11
DojoComponents?: IDojoComponentDatabase[];
12
DojoCapacity: number;
13
DojoEnergy: number;
12
14
}
13
15
14
16
export interface ICreateGuildRequest {
@@ -30,7 +32,7 @@ export interface IDojoClient {
30
32
31
33
export interface IDojoComponentClient {
32
34
id: IOid;
33
pf: string;
35
pf: string; // Prefab (.level)
34
36
ppf: string;
35
37
pi?: IOid; // Parent ID. N/A to root.
36
38
op?: string; // "Open Portal"? N/A to root.