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

fix: reduce platinum cost of rushing recipes based on progress (#1393)

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

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

代码差异

1 个文件 +7 -1
Modified src/controllers/api/claimCompletedRecipeController.ts +7 -1
@@ -116,9 +116,15 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
116 116 ]);
117 117 }
118 118 if (req.query.rush) {
119 const end = Math.trunc(pendingRecipe.CompletionDate.getTime() / 1000);
120 const start = end - recipe.buildTime;
121 const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
122 const progress = secondsElapsed / recipe.buildTime;
123 logger.debug(`rushing recipe at ${Math.trunc(progress * 100)}% completion`);
124 const cost = Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)));
119 125 InventoryChanges = {
120 126 ...InventoryChanges,
121 ...updateCurrency(inventory, recipe.skipBuildTimePrice, true)
127 ...updateCurrency(inventory, cost, true)
122 128 };
123 129 }
124 130 if (recipe.secretIngredientAction != "SIA_UNBRAND") {