ScoreHACK[Dino]

Get unlimited score

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name        ScoreHACK[Dino]
// @namespace   Violentmonkey Scripts
// @match       *://dino-chrome.com/*
// @match       https://chromedino.com/
// @match       *://chromedino.com/color/
// @match       *://chromedino.com/black/
// @match       *://chromedino.com/batman/
// @match       *://chromedino.com/joker/
// @icon        https://dino-chrome.com/static/images/favicon.ico
// @grant       unsafeWindow
// @grant       GM_addStyle
// @version     1.1
// @author      Drik
// @description Get unlimited score
// @run-at      document-idle
// @license     MIT
// ==/UserScript==

(function() {
    "use strict";

    const WARN_URLS = [
        "https://chromedino.com/color/",
        "https://chromedino.com/black/",
        "https://chromedino.com/batman/",
        "https://chromedino.com/joker/",
    ];

    GM_addStyle(`
    #score_hackk {
      position: fixed;
      left: 12px;
      top: 12px;
      width: 360px;
      z-index: 2147483647;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 13px;
      background: rgba(0,0,0,0.78);
      color: #fff;
      padding: 10px;
      border-radius: 8px;
      box-shadow: 0 6px 18px rgba(0,0,0,0.6);
      backdrop-filter: blur(4px);
    }
    #score_hackk .sh-title {
      font-weight: 700;
      margin-bottom: 8px;
    }
    #score_hackk .sh-row {
      display: flex;
      gap: 8px;
      align-items: center;
    }
    #score_inp {
      flex: 1;
      padding: 6px;
      border-radius: 6px;
      border: 1px solid #444;
      background: #111;
      color: #fff;
    }
    #score_app {
      padding: 6px 10px;
      border-radius: 6px;
      border: 0;
      cursor: pointer;
      background: #2ecc71;
      color: #000;
      font-weight: 600;
    }
    #score_info {
      margin-top: 8px;
      font-size: 12px;
      color: #ddd;
    }
  `);

    function c(t, p) {
        const e = document.createElement(t);
        if (p) Object.assign(e, p);
        return e;
    }

    function cl(v, a, b) {
        return Math.max(a, Math.min(b, v));
    }

    function getRunner() {
        return unsafeWindow.Runner && unsafeWindow.Runner.instance_ ? unsafeWindow.Runner.instance_ : null;
    }

    function isWarnPage() {
        return WARN_URLS.some(function(u) {
            return location.href.startsWith(u);
        });
    }

    function R(cb) {
        const r = getRunner();
        if (r && r.distanceMeter) {
            cb(r);
            return;
        }
        requestAnimationFrame(function() {
            R(cb);
        });
    }

    function ui() {
        if (document.getElementById("score_hackk")) return;

        const w = c("div", {
            id: "score_hackk"
        });
        w.innerHTML = '<div class="sh-title">Score Hack</div>';

        const row = c("div", {
            className: "sh-row"
        });

        const i = c("input", {
            id: "score_inp",
            type: "number",
            placeholder: "Number",
            value: "",
            min: 0,
            step: 1,
        });

        const b = c("button", {
            id: "score_app",
            innerText: "Apply",
        });

        const inf = c("div", {
            id: "score_info"
        });

        row.appendChild(i);
        row.appendChild(b);
        w.appendChild(row);
        w.appendChild(inf);
        document.body.appendChild(w);

        i.addEventListener("input", function() {
            const v = i.value;
            if (v === "") return;

            const n = Number(v);
            if (Number.isNaN(n)) {
                i.value = "";
                inf.innerText = "Only numbers";
                inf.style.color = "#ff8a8a";
                return;
            }

            if (n < 0) i.value = "0";
            inf.innerText = "";
        });

        b.addEventListener("click", function() {
            const raw = i.value;

            if (raw === "") {
                inf.innerText = "Field is empty";
                inf.style.color = "#ff8a8a";
                return;
            }

            const n = parseInt(raw, 10);
            if (Number.isNaN(n)) {
                inf.innerText = "Incorrect entry";
                inf.style.color = "#ff8a8a";
                return;
            }

            if (isWarnPage() && n > 1000000) {
                const ok = confirm(
                    "Are you sure you want to give yourself such a large score? There is a chance you may get banned for it"
                );
                if (!ok) return;
            }

            setScore(n);
        });
    }

    function setScore(s) {
        try {
            const r = getRunner();
            const inf = document.getElementById("score_info");

            if (!r || !r.distanceMeter) {
                if (inf) {
                    inf.innerText = "Game object not found";
                    inf.style.color = "#ff8a8a";
                }
                return;
            }

            if (r.crashed) {
                if (inf) {
                    inf.innerText = "Start the game first";
                    inf.style.color = "#ff8a8a";
                }
                return;
            }

            s = Math.floor(Number(s) || 0);
            if (s < 0) s = 0;

            const d = r.distanceMeter;
            let dg = cl(Math.max(String(s).length, 6), 6, 12);

            d.config.MAX_DISTANCE_UNITS = dg;
            d.maxScoreUnits = dg;
            d.defaultString = "0".repeat(dg);
            d.maxScore = parseInt("9".repeat(dg), 10);

            d.digits = d.defaultString.split("");
            d.highScore = d.highScore || d.defaultString.split("");

            let cf = d.config && d.config.COEFFICIENT ? d.config.COEFFICIENT : 1;
            if (!cf || cf === 0) cf = 1;

            r.distanceRan = s / cf;

            if (typeof d.update === "function") {
                d.update(0, Math.ceil(r.distanceRan));
            }

            if (inf) {
                inf.innerText = "Applied: " + String(s);
                inf.style.color = "#aaffaa";
            }
        } catch (e) {
            const inf2 = document.getElementById("score_info");
            if (inf2) {
                inf2.innerText = "Error: " + String(e);
                inf2.style.color = "#ff8a8a";
            }
        }
    }

    R(function() {
        ui();
    });
})();