Greasy Fork

Greasy Fork is available in English.

超级小桀房间助手

快速下注,自动签到,查积分,地图通过率,查竞猜信息,快速压鱼丸。

目前为 2019-03-22 提交的版本,查看 最新版本

// ==UserScript==
// @description 快速下注,自动签到,查积分,地图通过率,查竞猜信息,快速压鱼丸。
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 超级小桀房间助手
// @version 1.0.4
// @match https://www.douyu.com/74751
// @match https://www.douyu.com/cave
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @namespace http://greasyfork.icu/zh-CN/users/285196-dreamchaser
// @require http://greasyfork.icu/scripts/31852-zjyong/code/zjyong.js?version=208667
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @connect xiaojie666.com
// ==/UserScript==

var dragFlag = false;
var x,y;
var yiqian = true;
var lastText = "";
var acf_did = getCookie('acf_did');
var nickname = getCookie('acf_nickname');
var acf_uid = getCookie('acf_username');
var acf_ltkid = getCookie('acf_ltkid');
var acf_stk = getCookie('acf_stk');
var ver = "1.3";
var show_stat = "1";
var HTMLflag=0,n=10;


var div = document.createElement('div');
div.setAttribute('id', 'newDiv');
div.addEventListener('mousedown', down, false);
document.addEventListener('mousemove', move, false);
document.addEventListener('mouseup', up, false);
div.innerHTML = " <textarea id='jifenxianshi'  style='margin-top:10px;height:65px;width:200px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><textarea id='dituxianshi'  style='margin-top:5px;height:115px;width:200px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><input type=\'button\' id=\'bnt_qyl1\' style='width:100px;margin-top:5px;margin-left:7px' value=\'#1 全压了\'><input type=\'button\' id=\'bnt_qyl2\' style='width:100px;margin-left:7px' value=\'#2 全压了\'><input type=\'button\' id=\'bnt_yyb1\' style='width:100px;margin-top:5px;margin-left:7px' value=\'#1 压一半\'><input type=\'button\' id=\'bnt_yyb2\' style='width:100px;margin-left:7px' value=\'#2 压一半\'><input type=\'button\' id=\'bnt_xxlb\' style='width:100px;margin-top:5px;margin-left:7px' value=\'#抢分\'><input type=\'button\' id=\'bnt_qd\' style='width:100px;margin-left:7px' value=\'#入团\'><input type=\'button\' id=\'bnt_yc\' style='width:100px;margin-top:5px;margin-left:7px' value=\'隐藏\'><span style='width:100px;margin-top:5px;margin-left:3px'><input class='magic-checkbox' type='checkbox' checked='checked' id='autoqd' style='height:17px;width:17px;vertical-align: text-top;margin-left:15px;';>&nbsp自动签到</span><textarea id='betmess'  style='margin-top:10px;height:65px;width:200px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><input type=\'button\' id=\'bnt_leftyw100\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压100鱼丸\'><input type=\'button\' id=\'bnt_rightyw100\' style='width:100px;margin-left:7px;color:blue' value=\'右边压100鱼丸\'><input type=\'button\' id=\'bnt_leftyw1000\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压1000鱼丸\'><input type=\'button\' id=\'bnt_rightyw1000\' style='width:100px;margin-left:7px;color:blue' value=\'右边压1000鱼丸\'>";
div.style.setProperty('position', 'absolute');
div.style.setProperty('width', '220px');
div.style.setProperty('height', '470px');
div.style.setProperty('background', '#eff7ff');
div.style.setProperty('left', '960px');
div.style.setProperty('top', '10px');
div.style.setProperty('border', '1px solid #96c2f1');
div.style.setProperty('z-index', '999');
div.style.setProperty('box-shadow', '0 1px 5px 4px #888888');
document.body.appendChild(div);

if (navigator.userAgent.indexOf("Firefox") == -1) {
    $("#bnt_yyb1").css("margin-top","5px");
    $("#bnt_xxlb").css("margin-top","5px");
    $("#bnt_cf").css("margin-top","5px");
    $("#jifenxianshi").css("margin-top","9px");
}
div.style.left = GM_getValue('left','960px');
div.style.top = GM_getValue('top','10px');

var arr=new Array("bnt_qyl1","bnt_qyl2","bnt_yyb1","bnt_yyb2","bnt_xxlb","bnt_qd","bnt_leftyw100","bnt_rightyw100","bnt_leftyw1000","bnt_rightyw1000","#1 老子全压了","#2 老子全压了","#1 老子压一半","#2 老子压一半","#抢分","#入团","1","1","2","2");

var k = crc64(nickname + ver).toString(16);


chajifen();
betmess();
chaditu();

setInterval(
    function(){
        if( show_stat == "1" ) {
            chajifen();
            betmess();
            chaditu();
        }
        if(document.getElementById("autoqd").checked) {
            qd();
        }
    },5000);



function addevent(id,str) {
    if(id=="bnt_leftyw100"|| id=="bnt_leftyw1000"||id=="bnt_leftyw100a"|| id=="bnt_leftyw1000a" || id=="bnt_leftyw100b"|| id=="bnt_leftyw1000b"){
        document.getElementById(id).addEventListener('click', function (event) { betinput_left(str); }, false);}
    else if(id=="bnt_rightyw100"|| id=="bnt_rightyw1000"||id=="bnt_rightyw100a"|| id=="bnt_rightyw1000a" || id=="bnt_rightyw100b"|| id=="bnt_rightyw1000b"){
        document.getElementById(id).addEventListener('click', function (event) { betinput_right(str); }, false);}
    else{
        document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);}
}

function lsyc() {
    $("#newDiv").hide();
}

function cd_done() {
    $("#bnt_cf").attr("disabled", false);
}

function chajifen() {
    GM_xmlhttpRequest({
        method: "GET",
        url: "http://api.xiaojie666.com/xiaojie/credit/query.do?nickName=" + nickname,
        onload: function(response) {
            var jfjson = JSON.parse(response.responseText);
            $("#jifenxianshi").val("个人信息:" + "\n" + "昵称:" + jfjson.nickName + "\n积分:" + jfjson.credit + "\n历史积分:" + jfjson.earnedCredit);
        }
    });
}

function chaditu() {
    GM_xmlhttpRequest({
        method: "GET",
        url: "http://api.xiaojie666.com/xiaojie/levelrecord/list.do?page=0&rows=1",
        onload: function(response) {
            var json = JSON.parse(response.responseText);
            $("#dituxianshi").val("地图信息:" + "\n" + "ID:" + json.levelRecords[0].levelId  + "\n" + "国家:"+json.levelRecords[0].creator_ntd_origin_zh + "\n" + "尝试次数:"+json.levelRecords[0].attempts + "\n" + "通过率:"+(json.levelRecords[0].clearrate * 100).toFixed(2) + "%"+ "\n" + "地图名:" + json.levelRecords[0].name_zh);
        }
    });
}

function betmess() {
    var betcount=$('.GuessGameBox').length;
    if(betcount==2&&HTMLflag==0||betcount==3&&HTMLflag==0){
        div.style.setProperty('height', '608px');
        div.innerHTML =div.innerHTML + " <textarea id='betmess1'  style='margin-top:10px;height:65px;width:200px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><input type=\'button\' id=\'bnt_leftyw100a\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压100鱼丸\'><input type=\'button\' id=\'bnt_rightyw100a\' style='width:100px;margin-left:7px;color:blue' value=\'右边压100鱼丸\'><input type=\'button\' id=\'bnt_leftyw1000a\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压1000鱼丸\'><input type=\'button\' id=\'bnt_rightyw1000a\' style='width:100px;margin-left:7px;color:blue' value=\'右边压1000鱼丸\'>";
        HTMLflag=1;
        arr=new Array("bnt_qyl1","bnt_qyl2","bnt_yyb1","bnt_yyb2","bnt_xxlb","bnt_qd","bnt_leftyw100","bnt_rightyw100","bnt_leftyw1000","bnt_rightyw1000","bnt_leftyw100a","bnt_rightyw100a","bnt_leftyw1000a","bnt_rightyw1000a","#1 老子全压了","#2 老子全压了","#1 老子压一半","#2 老子压一半","#抢分","#入团","1","1","2","2","3","3","4","4");
        n=n+4;
    }
    else if(betcount==3&&HTMLflag==1){
        div.style.setProperty('height', '746px');
        div.innerHTML =div.innerHTML +  " <textarea id='betmess2'  style='margin-top:10px;height:65px;width:200px;margin-left:7px;line-height:12pt;overflow:hidden' readonly='value'></textarea><input type=\'button\' id=\'bnt_leftyw100b\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压100鱼丸\'><input type=\'button\' id=\'bnt_rightyw100b\' style='width:100px;margin-left:7px;color:blue' value=\'右边压100鱼丸\'><input type=\'button\' id=\'bnt_leftyw1000b\' style='width:100px;margin-top:5px;margin-left:7px;color:red' value=\'左边压1000鱼丸\'><input type=\'button\' id=\'bnt_rightyw1000b\' style='width:100px;margin-left:7px;color:blue' value=\'右边压1000鱼丸\'>";
        HTMLflag=2;
        arr=new Array("bnt_qyl1","bnt_qyl2","bnt_yyb1","bnt_yyb2","bnt_xxlb","bnt_qd","bnt_leftyw100","bnt_rightyw100","bnt_leftyw1000","bnt_rightyw1000","bnt_leftyw100a","bnt_rightyw100a","bnt_leftyw1000a","bnt_rightyw1000a","bnt_leftyw100b","bnt_rightyw100b","bnt_leftyw1000b","bnt_rightyw1000b","#1 老子全压了","#2 老子全压了","#1 老子压一半","#2 老子压一半","#抢分","#入团","1","1","2","2","3","3","4","4","5","5","6","6");
        n=n+4;
    };
    for (var i=0;i<n;i++)
    {
        addevent(arr[i],arr[i+n])
    }
    document.getElementById('bnt_yc').addEventListener('click', function (event) { lsyc(); }, false);

    switch(betcount){
        case 3:
            $("#betmess2").val("竞猜信息:" + "\n" + $('div.boxLeft:eq(2)').text() + "\n" + "左边:" + $('p.GuessContItem-itemTitle:eq(4)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(4)').text() + "\n" +"右边:" + $('p.GuessContItem-itemTitle:eq(5)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(5)').text());
        case 2:
            $("#betmess1").val("竞猜信息:" + "\n" + $('div.boxLeft:eq(1)').text()  + "\n" + "左边:" + $('p.GuessContItem-itemTitle:eq(2)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(2)').text() + "\n" +"右边:" + $('p.GuessContItem-itemTitle:eq(3)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(3)').text());
        case 1:
            $("#betmess").val("竞猜信息:" + "\n" + $('div.boxLeft:eq(0)').text()  + "\n" + "左边:" + $('p.GuessContItem-itemTitle:eq(0)').text() + "   "  + $('p.GuessContItem-itemLoss:eq(0)').text() + "\n" +"右边:" + $('p.GuessContItem-itemTitle:eq(1)').text() +  "   "  + $('p.GuessContItem-itemLoss:eq(1)').text());break;
        case 0:
            $("#betmess").val("竞猜信息:" + "\n" + "暂未获取到竞猜信息或主播暂未发起竞猜!");break;
    }
}

function down(e) {
    e = e || window.event;
    x = e.clientX - div.offsetLeft;
    y = e.clientY - div.offsetTop;
    div.style.cursor="move"
    dragFlag = true;
}

function move(e) {
    if (dragFlag) {
        e = e || window.event;
        div.style.left = e.clientX - x + 'px';
        div.style.top = e.clientY - y + 'px';
    }
}

function up(e) {
    if (dragFlag) {
        GM_setValue('left',div.style.left);
        GM_setValue('top',div.style.top);
    }
    dragFlag = false;
    div.style.cursor="auto"
}

function qd(){
    var date=new Date();
    var m=date.getMinutes();
    if(m==0||m==30){
        if (yiqian) {
            danmu("#签到");
            yiqian = false
        }
    } else {yiqian = true}
}

function danmu(str){
    if($('div.ChatSend-button').text()=='发送'){
        if (str == lastText){
            str = str + " " + Math.ceil(Math.random()*5)
        }
        $(".ChatSend-txt").val(str);
        $('div.ChatSend-button').click();
        lastText = str;
    }
}

function betinput_left(str){
    if(str==1||str==2){
        $('div.GuessContItem.is-left:eq(0)').click();
        if (str==1){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==2){
            $('.chooseOption:eq(2)').click()
        }
    }
    else if(str==3||str==4){
        $('div.GuessContItem.is-left:eq(1)').click();
        if (str==3){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==4){
            $('.chooseOption:eq(2)').click()
        }
    }
    else if(str==5||str==6){
        $('div.GuessContItem.is-left:eq(2)').click();
        if (str==5){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==6){
            $('.chooseOption:eq(2)').click()
        }
    }
    $('div.guessGame--btn.guessGame--btn--sizeM').click();
}

function betinput_right(str){
    if(str==1||str==2){
        $('div.GuessContItem.is-right:eq(0)').click();
        if (str==1){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==2){
            $('.chooseOption:eq(2)').click()
        }
    }
    else if(str==3||str==4){
        $('div.GuessContItem.is-right:eq(1)').click();
        if (str==3){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==4){
            $('.chooseOption:eq(2)').click()
        }
    }
    else if(str==5||str==6){
        $('div.GuessContItem.is-right:eq(2)').click();
        if (str==5){
            $('.chooseOption:eq(1)').click()
        }
        else if(str==6){
            $('.chooseOption:eq(2)').click()
        }
    }
    $('div.guessGame--btn.guessGame--btn--sizeM').click();
}

function getCookie(cname){
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++)
    {
        var c = ca[i].trim();
        if (c.indexOf(name)==0) return c.substring(name.length,c.length);
    }
    return "";
}