Farm Merge Valley Script

farm merge valley script

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Farm Merge Valley Script
// @namespace    http://tampermonkey.net/
// @author       Thobias
// @description  farm merge valley script
// @match        *://*.discordsays.com/*
// @match        https://farm-merge-valley.game-files.crazygames.com/farm-merge-valley/*
// @icon         https://i.ytimg.com/vi/hO49uPxHeAQ/maxresdefault.jpg
// @license      GPL
// @grant        none
// @version      1.0
// ==/UserScript==

XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.send = function(data) {
    this.addEventListener('readystatechange', function() {
        const url = this.responseURL
        if (url.includes("lucky_merge_config")) { // always lucky merge
            Object.defineProperty(this, "responseText", {writable: true})
            this.responseText = '{"CHANCE":100}';
        } else if(url.includes("crate_regeneration_config")) { // infinite crates
            Object.defineProperty(this, "responseText", {writable: true})
            this.responseText = '{"MAX_AMOUNT":100,"AMOUNT_PER_INTERVAL":100,"SPAWN_INTERVAL":1}'
        } else if(url.includes("energy_regeneration_config.json")) { // infinite energy
            this.responseText = '{"MAX_AMOUNT":100,"AMOUNT_PER_INTERVAL":100,"SPAWN_INTERVAL":1}'
        } else if (url.includes("marketplace_items_config")) { // Free shop
            Object.defineProperty(this, "responseText", {writable: true})
            const shop = JSON.parse(this.response)
            for (const item in shop['items']) {
                let itemrec = shop["items"][item]
                if (itemrec["payment"]["type"] == "iap") {
                    itemrec["payment"] = {"type": "inventory", "key": "gems", "amount": 0}
                } else {
                    itemrec["payment"]["amount"] = 0
                };
              if (itemrec["id"] == "energy_80") { // Replace 2nd energy offer with coins
                itemrec["reward"]["data"]["key"] = "coins"
                itemrec["reward"]["data"]["amount"] = "1200"
              }
              if (itemrec["id"] == "energy_300") { // Replace 2nd energy offer with coins
                itemrec["reward"]["data"]["key"] = "exp"
                itemrec["reward"]["data"]["amount"] = "1200"
              }
            }
            this.responseText = JSON.stringify(shop)
        } else if(this.responseURL.includes("blueprints/greenhouse")) {
            Object.defineProperty(this, "responseText", {writable: true})
            const components = JSON.parse(this.response)
            components["components"]["shovelable"] = {};
            this.responseText = JSON.stringify(components)
        } else if(this.responseURL.includes("blueprints/base_")) {
            Object.defineProperty(this, "responseText", {writable: true})
            const components = JSON.parse(this.response)
            components["components"]["shovelable"] = {};
            this.responseText = JSON.stringify(components)
        };
    });
    this.realSend(data)
};