XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

feat: dojo visitors (#2374)

Closes #2373 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2374 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

a9b3b16d
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

7 个文件 +53 -13
Modified package-lock.json +4 -4
@@ -23,7 +23,7 @@
23 23 "ncp": "^2.0.0",
24 24 "typescript": "^5.5",
25 25 "undici": "^7.10.0",
26 "warframe-public-export-plus": "^0.5.74",
26 "warframe-public-export-plus": "^0.5.76",
27 27 "warframe-riven-info": "^0.1.2",
28 28 "winston": "^3.17.0",
29 29 "winston-daily-rotate-file": "^5.0.0",
@@ -3386,9 +3386,9 @@
3386 3386 }
3387 3387 },
3388 3388 "node_modules/warframe-public-export-plus": {
3389 "version": "0.5.74",
3390 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.74.tgz",
3391 "integrity": "sha512-pA7dxA0lKn9w/2Sc97oxnn+CEzL1SrT9XriNLTDF4Xp+2SBEpGcfbqbdR9ljPQJopIbrc9Zy02R+uBQVomcwyA=="
3389 "version": "0.5.76",
3390 "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.76.tgz",
3391 "integrity": "sha512-0gX3NTWaxFyzUmqBSUHhPY8pMRX92iXQFqoBuMQlMG1+6uC6JMKtwP5t8cuXR3pvV2vkaCi/cDWjP1JUChkZ9g=="
3392 3392 },
3393 3393 "node_modules/warframe-riven-info": {
3394 3394 "version": "0.1.2",
Modified package.json +1 -1
@@ -37,7 +37,7 @@
37 37 "ncp": "^2.0.0",
38 38 "typescript": "^5.5",
39 39 "undici": "^7.10.0",
40 "warframe-public-export-plus": "^0.5.74",
40 "warframe-public-export-plus": "^0.5.76",
41 41 "warframe-riven-info": "^0.1.2",
42 42 "winston": "^3.17.0",
43 43 "winston-daily-rotate-file": "^5.0.0",
Modified src/controllers/api/guildTechController.ts +7 -2
@@ -5,6 +5,7 @@ import {
5 5 getGuildVault,
6 6 hasAccessToDojo,
7 7 hasGuildPermission,
8 processCompletedGuildTechProject,
8 9 processFundedGuildTechProject,
9 10 processGuildTechProjectContributionsUpdate,
10 11 removePigmentsFromGuildMembers,
@@ -51,8 +52,12 @@ export const guildTechController: RequestHandler = async (req, res) => {
51 52 };
52 53 if (project.CompletionDate) {
53 54 techProject.CompletionDate = toMongoDate(project.CompletionDate);
54 if (Date.now() >= project.CompletionDate.getTime()) {
55 needSave ||= setGuildTechLogState(guild, project.ItemType, 4, project.CompletionDate);
55 if (
56 Date.now() >= project.CompletionDate.getTime() &&
57 setGuildTechLogState(guild, project.ItemType, 4, project.CompletionDate)
58 ) {
59 processCompletedGuildTechProject(guild, project.ItemType);
60 needSave = true;
56 61 }
57 62 }
58 63 techProjects.push(techProject);
Modified src/controllers/api/placeDecoInComponentController.ts +13 -3
@@ -57,8 +57,12 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
57 57 component.DecoCapacity -= meta.capacityCost;
58 58 }
59 59 } else {
60 const [itemType, meta] = Object.entries(ExportResources).find(arr => arr[1].deco == deco.Type)!;
61 if (!itemType || meta.dojoCapacityCost === undefined) {
60 const entry = Object.entries(ExportResources).find(arr => arr[1].deco == deco.Type);
61 if (!entry) {
62 throw new Error(`unknown deco type: ${deco.Type}`);
63 }
64 const [itemType, meta] = entry;
65 if (meta.dojoCapacityCost === undefined) {
62 66 throw new Error(`unknown deco type: ${deco.Type}`);
63 67 }
64 68 component.DecoCapacity -= meta.dojoCapacityCost;
@@ -75,7 +79,13 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
75 79 if (meta) {
76 80 processDojoBuildMaterialsGathered(guild, meta);
77 81 }
78 } else if (guild.AutoContributeFromVault && guild.VaultRegularCredits && guild.VaultMiscItems) {
82 } else if (
83 deco.Type.startsWith("/Lotus/Objects/Tenno/Dojo/NpcPlaceables/") ||
84 (guild.AutoContributeFromVault && guild.VaultRegularCredits && guild.VaultMiscItems)
85 ) {
86 if (!guild.VaultRegularCredits || !guild.VaultMiscItems) {
87 throw new Error(`dojo visitor placed without anything in vault?!`);
88 }
79 89 if (guild.VaultRegularCredits >= scaleRequiredCount(guild.Tier, meta.price)) {
80 90 let enoughMiscItems = true;
81 91 for (const ingredient of meta.ingredients) {
Modified src/services/guildService.ts +13 -0
@@ -550,6 +550,19 @@ export const processFundedGuildTechProject = (
550 550 guild.XP += recipe.guildXpValue;
551 551 }
552 552 setGuildTechLogState(guild, techProject.ItemType, config.noDojoResearchTime ? 4 : 3, techProject.CompletionDate);
553 if (config.noDojoResearchTime) {
554 processCompletedGuildTechProject(guild, techProject.ItemType);
555 }
556 };
557
558 export const processCompletedGuildTechProject = (guild: TGuildDatabaseDocument, type: string): void => {
559 if (type.startsWith("/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/")) {
560 guild.VaultDecoRecipes ??= [];
561 guild.VaultDecoRecipes.push({
562 ItemType: type,
563 ItemCount: 1
564 });
565 }
553 566 };
554 567
555 568 export const setGuildTechLogState = (
Modified src/services/shipCustomizationsService.ts +6 -2
@@ -64,8 +64,12 @@ export const handleSetShipDecorations = async (
64 64 throw new Error(`unknown room: ${placedDecoration.Room}`);
65 65 }
66 66
67 const [itemType, meta] = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type)!;
68 if (!itemType || meta.capacityCost === undefined) {
67 const entry = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type);
68 if (!entry) {
69 throw new Error(`unknown deco type: ${placedDecoration.Type}`);
70 }
71 const [itemType, meta] = entry;
72 if (meta.capacityCost === undefined) {
69 73 throw new Error(`unknown deco type: ${placedDecoration.Type}`);
70 74 }
71 75
Modified static/fixed_responses/allDecoRecipes.json +9 -1
@@ -92,5 +92,13 @@
92 92 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/ThumperTrophySilverRecipe",
93 93 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/CorpusPlaceables/GasTurbineConeRecipe",
94 94 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NaturalPlaceables/CoralChunkARecipe",
95 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/TennoPlaceables/TnoBeaconEmitterRecipe"
95 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/TennoPlaceables/TnoBeaconEmitterRecipe",
96 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronFemaleSitting",
97 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronFemaleStanding",
98 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronMaleStanding",
99 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronMaleStandingTwo",
100 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisForeman",
101 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisHazard",
102 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisStrikerOne",
103 "/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisStrikerThree"
96 104 ]