magic firefly event time thing

every 10 secs it tells you in console wowsers

目前为 2024-12-07 提交的版本。查看 最新版本

// ==UserScript==
// @name         magic firefly event time thing
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  every 10 secs it tells you in console wowsers
// @author       Kosuken
// @match        https://florr.io/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function nextMfs() {
        const intv = 4732;
        const startT = 1733449900;

        // when
        const Tnow = Math.floor(Date.now() / 1000);
        const nextT = startT + (Math.floor((Tnow - startT) / intv) + 1) * intv;

        // left
        const secsLeft = nextT - Tnow;
        const hours = Math.floor(secsLeft / 3600);
        const minutes = Math.floor((secsLeft % 3600) / 60);
        const seconds = secsLeft % 60;

        console.log("Next ff event:", new Date(nextT * 1000));
        console.log(`Time left: ${hours} hours, ${minutes} minutes, and ${seconds} seconds`);
    }

    // Run the function every 10 seconds
    setInterval(nextMfs, 10000);
})();