-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates the mod structure to use classes instead of grouped, exported functions. Cleaner.
- Loading branch information
Showing
19 changed files
with
1,107 additions
and
990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase"; | ||
import { CustomRaidTimes } from "../CustomRaidTimes"; | ||
import { LocationProcessor } from "../processors/LocationProcessor"; | ||
|
||
/** | ||
* RaidTimeAdjuster class. | ||
* | ||
* Handles the logic needed to set a new raid time. | ||
*/ | ||
export class RaidTimeAdjuster { | ||
private location: ILocationBase; | ||
private locationName: { config: string; human: string }; | ||
|
||
constructor(location: ILocationBase) { | ||
this.location = location; | ||
this.locationName = LocationProcessor.locationNames[location.Id.toString().toLowerCase()]; | ||
} | ||
|
||
/** | ||
* Adjusts the raid time of the location. | ||
*/ | ||
public adjust(): void { | ||
const originalTime = this.location.EscapeTimeLimit; | ||
|
||
if (CustomRaidTimes.config.raidTimes.overrideAll) { | ||
this.location.EscapeTimeLimit = Number(CustomRaidTimes.config.raidTimes.override); | ||
} else { | ||
const customTime = CustomRaidTimes.config.raidTimes.customTimes[this.locationName.config]; | ||
this.location.EscapeTimeLimit = Number(customTime); | ||
} | ||
|
||
if (CustomRaidTimes.config.general.debug && this.location.EscapeTimeLimit !== originalTime) { | ||
CustomRaidTimes.logger.log( | ||
`CustomRaidTimes: ${this.locationName.human} raid time change from ${originalTime} minutes to ${this.location.EscapeTimeLimit} minutes.`, | ||
"gray" | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.