MC kulcs/key generator at minecraft.net

Rapidly and automatically generate and redeem 20-character gift codes on Minecraft website

当前为 2024-04-02 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MC kulcs/key generator at minecraft.net
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Rapidly and automatically generate and redeem 20-character gift codes on Minecraft website
// @author       dhex98
// @match        https://www.minecraft.net/*
// @grant        none
// @license      dhex98
// ==/UserScript==

(function() {
    'use strict';

    // Function to generate a random alphanumeric string of length n
    function generateCode(length) {
        var result = '';
        var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
        var charactersLength = characters.length;
        for (var i = 0; i < length; i++) {
            result += characters.charAt(Math.floor(Math.random() * charactersLength));
        }
        return result;
    }

    // Function to check if the redemption message indicates successful redemption
    function isSuccessRedemptionMessage(message) {
        return message.includes("Successfully redeemed code");
    }

    // Function to redeem a code
    function redeemCode(code) {
        var inputField = document.querySelector('input.redeem__input-textbox[data-testid="code"]');
        if (inputField) {
            inputField.value = code;
            inputField.setAttribute('aria-invalid', 'false');
            // Click the Redeem button
            document.querySelector('button[data-testid="button-redeem"]').click();
        }
    }

    // Function to generate and redeem codes rapidly and automatically
    function automateRedemption() {
        // Start the interval for rapid redemption
        var interval = setInterval(function() {
            // Generate a new code
            var newCode = generateCode(5) + '-' + generateCode(5) + '-' + generateCode(5) + '-' + generateCode(5);
            // Redeem the code
            redeemCode(newCode);
        }, 100); // Adjust the interval as needed for rapid redemption
    }

    // Start the redemption process
    automateRedemption();
})();