fix: reduce platinum cost of rushing recipes based on progress
All checks were successful
Build / build (18) (push) Successful in 1m14s
Build / build (20) (pull_request) Successful in 1m12s
Build / build (22) (pull_request) Successful in 1m18s
Build / build (20) (push) Successful in 38s
Build / build (22) (push) Successful in 1m13s
Build / build (18) (pull_request) Successful in 40s
All checks were successful
Build / build (18) (push) Successful in 1m14s
Build / build (20) (pull_request) Successful in 1m12s
Build / build (22) (pull_request) Successful in 1m18s
Build / build (20) (push) Successful in 38s
Build / build (22) (push) Successful in 1m13s
Build / build (18) (pull_request) Successful in 40s
This commit is contained in:
parent
516f822e43
commit
235fd3885a
@ -111,9 +111,15 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
||||
]);
|
||||
}
|
||||
if (req.query.rush) {
|
||||
const end = Math.trunc(pendingRecipe.CompletionDate.getTime() / 1000);
|
||||
const start = end - recipe.buildTime;
|
||||
const secondsElapsed = Math.trunc(Date.now() / 1000) - start;
|
||||
const progress = secondsElapsed / recipe.buildTime;
|
||||
logger.debug(`rushing recipe at ${Math.trunc(progress * 100)}% completion`);
|
||||
const cost = Math.round(recipe.skipBuildTimePrice * (1 - (progress - 0.5)));
|
||||
InventoryChanges = {
|
||||
...InventoryChanges,
|
||||
...updateCurrency(inventory, recipe.skipBuildTimePrice, true)
|
||||
...updateCurrency(inventory, cost, true)
|
||||
};
|
||||
}
|
||||
InventoryChanges = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user