feat: entratiLabConquestMode.php #1291
@ -13,10 +13,13 @@ export const entratiLabConquestModeController: RequestHandler = async (req, res)
 | 
				
			|||||||
    const body = getJSONfromString<IEntratiLabConquestModeRequest>(String(req.body));
 | 
					    const body = getJSONfromString<IEntratiLabConquestModeRequest>(String(req.body));
 | 
				
			||||||
    if (body.BuyMode) {
 | 
					    if (body.BuyMode) {
 | 
				
			||||||
        if (!inventory.EntratiVaultCountResetDate || Date.now() >= inventory.EntratiVaultCountResetDate.getTime()) {
 | 
					        if (!inventory.EntratiVaultCountResetDate || Date.now() >= inventory.EntratiVaultCountResetDate.getTime()) {
 | 
				
			||||||
            const thisWeek = Math.trunc(Date.now() / 604800000) * 604800000;
 | 
					            const EPOCH = 1734307200 * 1000; // Mondays, amirite?
 | 
				
			||||||
            const nextWeek = thisWeek + 604800000;
 | 
					            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.EntratiVaultCountLastPeriod = 0;
 | 
				
			||||||
            inventory.EntratiVaultCountResetDate = new Date(nextWeek);
 | 
					            inventory.EntratiVaultCountResetDate = new Date(weekEnd);
 | 
				
			||||||
            if (inventory.EntratiLabConquestUnlocked) {
 | 
					            if (inventory.EntratiLabConquestUnlocked) {
 | 
				
			||||||
                inventory.EntratiLabConquestUnlocked = 0;
 | 
					                inventory.EntratiLabConquestUnlocked = 0;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user