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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

feat: noDojoResearchCosts & noDojoResearchTime (#1053)

Closes #1052 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1053 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>

4205364b
Sainan <sainan@calamity.inc>
提交于

代码差异

6 个文件 +40 -12
Modified config.json.example +2 -0
@@ -31,5 +31,7 @@
31 31 "unlockExilusEverywhere": true,
32 32 "unlockArcanesEverywhere": true,
33 33 "noDailyStandingLimits": true,
34 "noDojoResearchCosts": true,
35 "noDojoResearchTime": true,
34 36 "spoofMasteryRank": -1
35 37 }
Modified src/controllers/api/guildTechController.ts +24 -12
@@ -1,10 +1,12 @@
1 1 import { RequestHandler } from "express";
2 2 import { getGuildForRequestEx } from "@/src/services/guildService";
3 import { ExportDojoRecipes } from "warframe-public-export-plus";
3 import { ExportDojoRecipes, IDojoResearch } from "warframe-public-export-plus";
4 4 import { getAccountIdForRequest } from "@/src/services/loginService";
5 5 import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
6 6 import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
7 7 import { IInventoryChanges } from "@/src/types/purchaseTypes";
8 import { config } from "@/src/services/configService";
9 import { ITechProjectDatabase } from "@/src/types/guildTypes";
8 10
9 11 export const guildTechController: RequestHandler = async (req, res) => {
10 12 const accountId = await getAccountIdForRequest(req);
@@ -20,15 +22,21 @@ export const guildTechController: RequestHandler = async (req, res) => {
20 22 const recipe = ExportDojoRecipes.research[data.RecipeType!];
21 23 guild.TechProjects ??= [];
22 24 if (!guild.TechProjects.find(x => x.ItemType == data.RecipeType)) {
23 guild.TechProjects.push({
24 ItemType: data.RecipeType!,
25 ReqCredits: scaleRequiredCount(recipe.price),
26 ReqItems: recipe.ingredients.map(x => ({
27 ItemType: x.ItemType,
28 ItemCount: scaleRequiredCount(x.ItemCount)
29 })),
30 State: 0
31 });
25 const techProject =
26 guild.TechProjects[
27 guild.TechProjects.push({
28 ItemType: data.RecipeType!,
29 ReqCredits: config.noDojoResearchCosts ? 0 : scaleRequiredCount(recipe.price),
30 ReqItems: recipe.ingredients.map(x => ({
31 ItemType: x.ItemType,
32 ItemCount: config.noDojoResearchCosts ? 0 : scaleRequiredCount(x.ItemCount)
33 })),
34 State: 0
35 }) - 1
36 ];
37 if (config.noDojoResearchCosts) {
38 processFundedProject(techProject, recipe);
39 }
32 40 }
33 41 await guild.save();
34 42 res.end();
@@ -59,9 +67,8 @@ export const guildTechController: RequestHandler = async (req, res) => {
59 67
60 68 if (techProject.ReqCredits == 0 && !techProject.ReqItems.find(x => x.ItemCount > 0)) {
61 69 // This research is now fully funded.
62 techProject.State = 1;
63 70 const recipe = ExportDojoRecipes.research[data.RecipeType!];
64 techProject.CompletionDate = new Date(new Date().getTime() + recipe.time * 1000);
71 processFundedProject(techProject, recipe);
65 72 }
66 73
67 74 await guild.save();
@@ -98,6 +105,11 @@ export const guildTechController: RequestHandler = async (req, res) => {
98 105 }
99 106 };
100 107
108 const processFundedProject = (techProject: ITechProjectDatabase, recipe: IDojoResearch): void => {
109 techProject.State = 1;
110 techProject.CompletionDate = new Date(new Date().getTime() + (config.noDojoResearchTime ? 0 : recipe.time) * 1000);
111 };
112
101 113 type TGuildTechRequest = {
102 114 Action: string;
103 115 } & Partial<IGuildTechStartFields> &
Modified src/services/configService.ts +2 -0
@@ -57,6 +57,8 @@ interface IConfig {
57 57 unlockExilusEverywhere?: boolean;
58 58 unlockArcanesEverywhere?: boolean;
59 59 noDailyStandingLimits?: boolean;
60 noDojoResearchCosts?: boolean;
61 noDojoResearchTime?: boolean;
60 62 spoofMasteryRank?: number;
61 63 }
62 64
Modified static/webui/index.html +8 -0
@@ -517,6 +517,14 @@
517 517 <input class="form-check-input" type="checkbox" id="noDailyStandingLimits" />
518 518 <label class="form-check-label" for="noDailyStandingLimits" data-loc="cheats_noDailyStandingLimits"></label>
519 519 </div>
520 <div class="form-check">
521 <input class="form-check-input" type="checkbox" id="noDojoResearchCosts" />
522 <label class="form-check-label" for="noDojoResearchCosts" data-loc="cheats_noDojoResearchCosts"></label>
523 </div>
524 <div class="form-check">
525 <input class="form-check-input" type="checkbox" id="noDojoResearchTime" />
526 <label class="form-check-label" for="noDojoResearchTime" data-loc="cheats_noDojoResearchTime"></label>
527 </div>
520 528 <div class="form-group mt-2">
521 529 <label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
522 530 <input class="form-control" id="spoofMasteryRank" type="number" min="-1" max="65535" />
Modified static/webui/translations/en.js +2 -0
@@ -111,6 +111,8 @@ dict = {
111 111 cheats_unlockExilusEverywhere: `Exilus Adapters Everywhere`,
112 112 cheats_unlockArcanesEverywhere: `Arcane Adapters Everywhere`,
113 113 cheats_noDailyStandingLimits: `No Daily Standing Limits`,
114 cheats_noDojoResearchCosts: `No Dojo Research Costs`,
115 cheats_noDojoResearchTime: `No Dojo Research Time`,
114 116 cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
115 117 cheats_saveSettings: `Save Settings`,
116 118 cheats_account: `Account`,
Modified static/webui/translations/ru.js +2 -0
@@ -112,6 +112,8 @@ dict = {
112 112 cheats_unlockExilusEverywhere: `Адаптеры Эксилус везде`,
113 113 cheats_unlockArcanesEverywhere: `Адаптеры для мистификаторов везде`,
114 114 cheats_noDailyStandingLimits: `Без ежедневных ограничений репутации`,
115 cheats_noDojoResearchCosts: `[UNTRANSLATED] No Dojo Research Costs`,
116 cheats_noDojoResearchTime: `[UNTRANSLATED] No Dojo Research Time`,
115 117 cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
116 118 cheats_saveSettings: `Сохранить настройки`,
117 119 cheats_account: `Аккаунт`,