HWM_AutoReportMGTasks

Автосдача задания ГН

当前为 2017-11-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         HWM_AutoReportMGTasks
// @namespace    Небылица
// @version      1.11
// @description  Автосдача задания ГН
// @author       Небылица
// @include      /^https{0,1}:\/\/((www|qrator)\.heroeswm\.ru|178\.248\.235\.15)\/(map|mercenary_guild)\.php/
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';

    // скрипт требует для своей работы скрипт SetsMaster от Demin, который должен находиться выше по порядку исполнения
    if (document.getElementById("pers_gn").innerHTML.split(":").length === 3){
        if ((document.querySelector("a[href=\"map.php?cx=51&cy=50\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=50&cy=48\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=52&cy=48\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=52&cy=53\"]") !== null)){
            var xhr = new XMLHttpRequest();
            var response;

            xhr.open('GET', "mercenary_guild.php", true);
            xhr.send();
            xhr.onreadystatechange = function() {
                if (this.readyState == 4 && this.status == 200) {
                    response = xhr.responseText;
                    if (response.indexOf("<b>Статус</b>") !== -1){
                        try{GM_setValue("reward", response.match(/<Br><br>(.+?)<table\sborder=0\scellspacing=0\scellpadding=0>/)[1]);}
                        catch(err){console.log(err);}
                        window.open("mercenary_guild.php", "_self");
                    }
                }
            };
        }
    }

    if (location.pathname.indexOf("mercenary_guild.php") !== -1 && GM_getValue("reward") !== "-1"){
        var td = document.querySelector("td[rowspan=\"2\"]");
        td.innerHTML = td.innerHTML.split("<table border")[0] + GM_getValue("reward") + "<table border"+ td.innerHTML.split("<table border")[1];
        GM_setValue("reward", "-1");
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址