Greasy Fork

Greasy Fork is available in English.

FF14道具仓库批量领取

最终幻想14道具仓库批量领取

当前为 2018-12-29 提交的版本,查看 最新版本

// ==UserScript==
// @name         FF14道具仓库批量领取
// @description  最终幻想14道具仓库批量领取
// @namespace    http://greasyfork.icu/users/129402
// @match        http://act.ff.sdo.com/20170918Shop/index.html
// @grant        none
// @version      1.0.0
// @license      GNU General Public License v3.0 or later
// @compatible   chrome
// @compatible   firefox
// @compatible   opera
// @compatible   safari
// @run-at       document-start
// ==/UserScript==
(function() {
    var flag = false,
        data = [];
    setInterval(() => {
        if (flag) {
            flag = false;
            var item = data.shift();
            $.post('http://act.ff.sdo.com/20170918Shop/Server/Warehouse.ashx', { method: 'getItem', id: item.id, type: +item.type }, (_) => {
                var d = JSON.parse(_);
                if (d.Success) {
                    console.info(item.name, item.id, "领取成功~");
                    item.self.find('.prize').text("领取成功~");
                } else data.push(item);
                if (data.length > 0) flag = true;
                else setTimeout(() => alert("全部领取完成~"), 1);
            });
        }
    }, 1000);
    var button = $("<a/>");
    button.addClass("back-btn").css({
        cursor: "pointer",
        "margin-right": "15px",
        background: "rgb(82, 150, 235)",
        "border-radius": "5px"
    });
    button.text("批量领取道具");
    $(".rtbox").append(button);
    button.on("click", function() {
        var target = $('.lqspan[dataid][datatype][dataname]');
        if (target.length) {
            target.each(function() {
                data.push({
                    id: $(this).attr("dataid"),
                    type: $(this).attr("datatype"),
                    name: $(this).attr("dataname"),
                    self: $(this).closest("li"),
                });
            });
            alert("开始批量领取,请注意由于系统限制,领取速度可能稍慢~");
            flag = true;
        } else alert("无物品可领取");
    });
})();