mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 18:23:54 +01:00
24 lines
616 B
TypeScript
24 lines
616 B
TypeScript
import { Factions } from "./Faction/Factions";
|
|
import { IPlayer } from "./PersonObjects/IPlayer";
|
|
|
|
export let LastExportBonus = 0;
|
|
|
|
const bonusTimer = 24 * 60 * 60 * 1000; // 24h
|
|
export function canGetBonus(): boolean {
|
|
const now = new Date().getTime();
|
|
if (now - LastExportBonus > bonusTimer) return true;
|
|
return false;
|
|
}
|
|
|
|
export function onExport(p: IPlayer): void {
|
|
if (!canGetBonus()) return;
|
|
for (const facName of p.factions) {
|
|
Factions[facName].favor++;
|
|
}
|
|
LastExportBonus = new Date().getTime();
|
|
}
|
|
|
|
export function setLastExportBonus(unixTime: number): void {
|
|
LastExportBonus = unixTime;
|
|
}
|