Fix incorrect NewSurviveTimeSeconds value being sent to client

Thanks to DanW
This commit is contained in:
Dev 2023-11-29 13:32:55 +00:00
parent 673cefcc00
commit 3945de8b1f

View File

@ -565,7 +565,9 @@ export class GameController
*/
public getRaidTime(sessionId: string, request: IGetRaidTimeRequest): IGetRaidTimeResponse
{
const mapBase: ILocationBase = this.databaseServer.getTables().locations[request.Location.toLowerCase()].base;
const db = this.databaseServer.getTables()
const mapBase: ILocationBase = db.locations[request.Location.toLowerCase()].base;
const baseEscapeTimeMinutes = mapBase.EscapeTimeLimit;
// Prep result object to return
@ -620,14 +622,11 @@ export class GameController
this.logger.debug(`Reduced: ${request.Location} raid time by: ${chosenRaidReductionPercent}% to ${newRaidTimeMinutes} minutes`)
// get our new total raid time as seconds
const newRaidTimeSeconds = newRaidTimeMinutes * 60;
const originalSurvivalTimeSeconds = this.databaseServer.getTables().globals.config.exp.match_end.survived_seconds_requirement;
const originalSurvivalTimeSeconds = db.globals.config.exp.match_end.survived_seconds_requirement;
result.OriginalSurvivalTimeSeconds = originalSurvivalTimeSeconds;
// Calculate how long player needs to be in raid to get a `survived` extract status
result.NewSurviveTimeSeconds = Math.max(originalSurvivalTimeSeconds - newRaidTimeSeconds, 0);
result.NewSurviveTimeSeconds = Math.max(originalSurvivalTimeSeconds - ((baseEscapeTimeMinutes - newRaidTimeMinutes) * 60), 0);
const exitAdjustments = this.getExitAdjustments(mapBase, newRaidTimeMinutes);
if (exitAdjustments)