feat: entratiLabConquestMode.php #1291

Merged
Sainan merged 4 commits from conquest into main 2025-03-23 05:06:32 -07:00
Showing only changes of commit 18062b5d91 - Show all commits

View File

@ -13,10 +13,13 @@ export const entratiLabConquestModeController: RequestHandler = async (req, res)
const body = getJSONfromString<IEntratiLabConquestModeRequest>(String(req.body));
if (body.BuyMode) {
if (!inventory.EntratiVaultCountResetDate || Date.now() >= inventory.EntratiVaultCountResetDate.getTime()) {
const thisWeek = Math.trunc(Date.now() / 604800000) * 604800000;
const nextWeek = thisWeek + 604800000;
const EPOCH = 1734307200 * 1000; // Mondays, amirite?
const day = Math.trunc((Date.now() - EPOCH) / 86400000);
const week = Math.trunc(day / 7);
const weekStart = EPOCH + week * 604800000;
const weekEnd = weekStart + 604800000;
inventory.EntratiVaultCountLastPeriod = 0;
inventory.EntratiVaultCountResetDate = new Date(nextWeek);
inventory.EntratiVaultCountResetDate = new Date(weekEnd);
if (inventory.EntratiLabConquestUnlocked) {
inventory.EntratiLabConquestUnlocked = 0;
}