feat: noDojoResearchCosts & noDojoResearchTime #1053
@ -31,5 +31,7 @@
 | 
				
			|||||||
  "unlockExilusEverywhere": true,
 | 
					  "unlockExilusEverywhere": true,
 | 
				
			||||||
  "unlockArcanesEverywhere": true,
 | 
					  "unlockArcanesEverywhere": true,
 | 
				
			||||||
  "noDailyStandingLimits": true,
 | 
					  "noDailyStandingLimits": true,
 | 
				
			||||||
 | 
					  "noDojoResearchCosts": true,
 | 
				
			||||||
 | 
					  "noDojoResearchTime": true,
 | 
				
			||||||
  "spoofMasteryRank": -1
 | 
					  "spoofMasteryRank": -1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,12 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getGuildForRequestEx } from "@/src/services/guildService";
 | 
					import { getGuildForRequestEx } from "@/src/services/guildService";
 | 
				
			||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
 | 
					import { ExportDojoRecipes, IDojoResearch } from "warframe-public-export-plus";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
 | 
					import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
 | 
				
			||||||
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 { config } from "@/src/services/configService";
 | 
				
			||||||
 | 
					import { ITechProjectDatabase } from "@/src/types/guildTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const guildTechController: RequestHandler = async (req, res) => {
 | 
					export const guildTechController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
@ -20,15 +22,21 @@ export const guildTechController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        const recipe = ExportDojoRecipes.research[data.RecipeType!];
 | 
					        const recipe = ExportDojoRecipes.research[data.RecipeType!];
 | 
				
			||||||
        guild.TechProjects ??= [];
 | 
					        guild.TechProjects ??= [];
 | 
				
			||||||
        if (!guild.TechProjects.find(x => x.ItemType == data.RecipeType)) {
 | 
					        if (!guild.TechProjects.find(x => x.ItemType == data.RecipeType)) {
 | 
				
			||||||
 | 
					            const techProject =
 | 
				
			||||||
 | 
					                guild.TechProjects[
 | 
				
			||||||
                    guild.TechProjects.push({
 | 
					                    guild.TechProjects.push({
 | 
				
			||||||
                        ItemType: data.RecipeType!,
 | 
					                        ItemType: data.RecipeType!,
 | 
				
			||||||
                ReqCredits: scaleRequiredCount(recipe.price),
 | 
					                        ReqCredits: config.noDojoResearchCosts ? 0 : scaleRequiredCount(recipe.price),
 | 
				
			||||||
                        ReqItems: recipe.ingredients.map(x => ({
 | 
					                        ReqItems: recipe.ingredients.map(x => ({
 | 
				
			||||||
                            ItemType: x.ItemType,
 | 
					                            ItemType: x.ItemType,
 | 
				
			||||||
                    ItemCount: scaleRequiredCount(x.ItemCount)
 | 
					                            ItemCount: config.noDojoResearchCosts ? 0 : scaleRequiredCount(x.ItemCount)
 | 
				
			||||||
                        })),
 | 
					                        })),
 | 
				
			||||||
                        State: 0
 | 
					                        State: 0
 | 
				
			||||||
            });
 | 
					                    }) - 1
 | 
				
			||||||
 | 
					                ];
 | 
				
			||||||
 | 
					            if (config.noDojoResearchCosts) {
 | 
				
			||||||
 | 
					                processFundedProject(techProject, recipe);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        await guild.save();
 | 
					        await guild.save();
 | 
				
			||||||
        res.end();
 | 
					        res.end();
 | 
				
			||||||
@ -59,9 +67,8 @@ export const guildTechController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (techProject.ReqCredits == 0 && !techProject.ReqItems.find(x => x.ItemCount > 0)) {
 | 
					        if (techProject.ReqCredits == 0 && !techProject.ReqItems.find(x => x.ItemCount > 0)) {
 | 
				
			||||||
            // This research is now fully funded.
 | 
					            // This research is now fully funded.
 | 
				
			||||||
            techProject.State = 1;
 | 
					 | 
				
			||||||
            const recipe = ExportDojoRecipes.research[data.RecipeType!];
 | 
					            const recipe = ExportDojoRecipes.research[data.RecipeType!];
 | 
				
			||||||
            techProject.CompletionDate = new Date(new Date().getTime() + recipe.time * 1000);
 | 
					            processFundedProject(techProject, recipe);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        await guild.save();
 | 
					        await guild.save();
 | 
				
			||||||
@ -98,6 +105,11 @@ export const guildTechController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const processFundedProject = (techProject: ITechProjectDatabase, recipe: IDojoResearch): void => {
 | 
				
			||||||
 | 
					    techProject.State = 1;
 | 
				
			||||||
 | 
					    techProject.CompletionDate = new Date(new Date().getTime() + (config.noDojoResearchTime ? 0 : recipe.time) * 1000);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type TGuildTechRequest = {
 | 
					type TGuildTechRequest = {
 | 
				
			||||||
    Action: string;
 | 
					    Action: string;
 | 
				
			||||||
} & Partial<IGuildTechStartFields> &
 | 
					} & Partial<IGuildTechStartFields> &
 | 
				
			||||||
 | 
				
			|||||||
@ -57,6 +57,8 @@ interface IConfig {
 | 
				
			|||||||
    unlockExilusEverywhere?: boolean;
 | 
					    unlockExilusEverywhere?: boolean;
 | 
				
			||||||
    unlockArcanesEverywhere?: boolean;
 | 
					    unlockArcanesEverywhere?: boolean;
 | 
				
			||||||
    noDailyStandingLimits?: boolean;
 | 
					    noDailyStandingLimits?: boolean;
 | 
				
			||||||
 | 
					    noDojoResearchCosts?: boolean;
 | 
				
			||||||
 | 
					    noDojoResearchTime?: boolean;
 | 
				
			||||||
    spoofMasteryRank?: number;
 | 
					    spoofMasteryRank?: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -517,6 +517,14 @@
 | 
				
			|||||||
                                        <input class="form-check-input" type="checkbox" id="noDailyStandingLimits" />
 | 
					                                        <input class="form-check-input" type="checkbox" id="noDailyStandingLimits" />
 | 
				
			||||||
                                        <label class="form-check-label" for="noDailyStandingLimits" data-loc="cheats_noDailyStandingLimits"></label>
 | 
					                                        <label class="form-check-label" for="noDailyStandingLimits" data-loc="cheats_noDailyStandingLimits"></label>
 | 
				
			||||||
                                    </div>
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                    <div class="form-check">
 | 
				
			||||||
 | 
					                                        <input class="form-check-input" type="checkbox" id="noDojoResearchCosts" />
 | 
				
			||||||
 | 
					                                        <label class="form-check-label" for="noDojoResearchCosts" data-loc="cheats_noDojoResearchCosts"></label>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
 | 
					                                    <div class="form-check">
 | 
				
			||||||
 | 
					                                        <input class="form-check-input" type="checkbox" id="noDojoResearchTime" />
 | 
				
			||||||
 | 
					                                        <label class="form-check-label" for="noDojoResearchTime" data-loc="cheats_noDojoResearchTime"></label>
 | 
				
			||||||
 | 
					                                    </div>
 | 
				
			||||||
                                    <div class="form-group mt-2">
 | 
					                                    <div class="form-group mt-2">
 | 
				
			||||||
                                        <label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
 | 
					                                        <label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
 | 
				
			||||||
                                        <input class="form-control" id="spoofMasteryRank" type="number" min="-1" max="65535" />
 | 
					                                        <input class="form-control" id="spoofMasteryRank" type="number" min="-1" max="65535" />
 | 
				
			||||||
 | 
				
			|||||||
@ -111,6 +111,8 @@ dict = {
 | 
				
			|||||||
    cheats_unlockExilusEverywhere: `Exilus Adapters Everywhere`,
 | 
					    cheats_unlockExilusEverywhere: `Exilus Adapters Everywhere`,
 | 
				
			||||||
    cheats_unlockArcanesEverywhere: `Arcane Adapters Everywhere`,
 | 
					    cheats_unlockArcanesEverywhere: `Arcane Adapters Everywhere`,
 | 
				
			||||||
    cheats_noDailyStandingLimits: `No Daily Standing Limits`,
 | 
					    cheats_noDailyStandingLimits: `No Daily Standing Limits`,
 | 
				
			||||||
 | 
					    cheats_noDojoResearchCosts: `No Dojo Research Costs`,
 | 
				
			||||||
 | 
					    cheats_noDojoResearchTime: `No Dojo Research Time`,
 | 
				
			||||||
    cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
 | 
					    cheats_spoofMasteryRank: `Spoofed Mastery Rank (-1 to disable)`,
 | 
				
			||||||
    cheats_saveSettings: `Save Settings`,
 | 
					    cheats_saveSettings: `Save Settings`,
 | 
				
			||||||
    cheats_account: `Account`,
 | 
					    cheats_account: `Account`,
 | 
				
			||||||
 | 
				
			|||||||
@ -112,6 +112,8 @@ dict = {
 | 
				
			|||||||
    cheats_unlockExilusEverywhere: `Адаптеры Эксилус везде`,
 | 
					    cheats_unlockExilusEverywhere: `Адаптеры Эксилус везде`,
 | 
				
			||||||
    cheats_unlockArcanesEverywhere: `Адаптеры для мистификаторов везде`,
 | 
					    cheats_unlockArcanesEverywhere: `Адаптеры для мистификаторов везде`,
 | 
				
			||||||
    cheats_noDailyStandingLimits: `Без ежедневных ограничений репутации`,
 | 
					    cheats_noDailyStandingLimits: `Без ежедневных ограничений репутации`,
 | 
				
			||||||
 | 
					    cheats_noDojoResearchCosts: `[UNTRANSLATED] No Dojo Research Costs`,
 | 
				
			||||||
 | 
					    cheats_noDojoResearchTime: `[UNTRANSLATED] No Dojo Research Time`,
 | 
				
			||||||
    cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
 | 
					    cheats_spoofMasteryRank: `Подделанный ранг мастерства (-1 для отключения)`,
 | 
				
			||||||
    cheats_saveSettings: `Сохранить настройки`,
 | 
					    cheats_saveSettings: `Сохранить настройки`,
 | 
				
			||||||
    cheats_account: `Аккаунт`,
 | 
					    cheats_account: `Аккаунт`,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user