avoid double-starting research
This commit is contained in:
parent
5cad6fe7d9
commit
f37e6dc668
@ -18,15 +18,17 @@ export const guildTechController: RequestHandler = async (req, res) => {
|
|||||||
} else if (data.Action == "Start") {
|
} else if (data.Action == "Start") {
|
||||||
const recipe = ExportDojoRecipes.research[data.RecipeType!];
|
const recipe = ExportDojoRecipes.research[data.RecipeType!];
|
||||||
guild.TechProjects ??= [];
|
guild.TechProjects ??= [];
|
||||||
guild.TechProjects.push({
|
if (!guild.TechProjects.find(x => x.ItemType == data.RecipeType)) {
|
||||||
ItemType: data.RecipeType!,
|
guild.TechProjects.push({
|
||||||
ReqCredits: scaleRequiredCount(recipe.price),
|
ItemType: data.RecipeType!,
|
||||||
ReqItems: recipe.ingredients.map(x => ({
|
ReqCredits: scaleRequiredCount(recipe.price),
|
||||||
ItemType: x.ItemType,
|
ReqItems: recipe.ingredients.map(x => ({
|
||||||
ItemCount: scaleRequiredCount(x.ItemCount)
|
ItemType: x.ItemType,
|
||||||
})),
|
ItemCount: scaleRequiredCount(x.ItemCount)
|
||||||
State: 0
|
})),
|
||||||
});
|
State: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
await guild.save();
|
await guild.save();
|
||||||
res.end();
|
res.end();
|
||||||
} else if (data.Action == "Contribute") {
|
} else if (data.Action == "Contribute") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user