Greasy Fork

Greasy Fork is available in English.

斗鱼超级小桀房间工具

快速下注,自动签到,查积分,地图通过率

当前为 2017-07-28 提交的版本,查看 最新版本

// ==UserScript==
// @description 快速下注,自动签到,查积分,地图通过率
// @icon https://apic.douyucdn.cn/upload/avatar/002/86/30/15_avatar_big.jpg
// @name 斗鱼超级小桀房间工具
// @version 0.4
// @match https://www.douyu.com/74751
// @match https://www.douyu.com/cave
// @grant none
// @namespace http://greasyfork.icu/users/142968
// ==/UserScript==

var dragFlag = false;
var x,y;
var URL
var yiqian = true
var jifen_one = -1
var lastText = ""
var acf_did = getCookie('acf_did')
var nickname = getCookie('acf_nickname')
var acf_uid = getCookie('acf_uid')


  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 = "<input type=\'button\' id=\'bnt_qyl1\' style='width:90px;margin-top:10px;margin-left:7px' value=\'#1 全压了\'><input type=\'button\' id=\'bnt_qyl2\' style='width:90px;margin-left:7px' value=\'#2 全压了\'><input type=\'button\' id=\'bnt_yyb1\' style='width:90px;margin-left:7px' value=\'#1 压一半\'><input type=\'button\' id=\'bnt_yyb2\' style='width:90px;margin-left:7px' value=\'#2 压一半\'><input type=\'button\' id=\'bnt_xxlb\' style='width:90px;margin-left:7px' value=\'#谢谢老板\'><input type=\'button\' id=\'bnt_qd\' style='width:90px;margin-left:7px' value=\'#签到\'><input type='checkbox' id='viewjf' style='margin-top:7px;margin-left:10px'><span style='font-size:14px'>显示积分<input type='checkbox' checked='checked' id='autoqd' style='margin-top:7px;margin-left:27px'>自动签到</span><textarea id='jifenxianshi' class='jifenxianshi' style='margin-top:7px;height:50px;width:177px;margin-left:7px;line-height:12pt;overflow:hidden;display:none' readonly='value'></textarea><textarea id='dituxianshi' class='dituxianshi' style='margin-top:7px;height:82px;width:177px;margin-left:7px;line-height:12pt;overflow:hidden;display:none' readonly='value'></textarea>";
  div.style.setProperty('position', 'absolute');
  div.style.setProperty('width', '201px');
  div.style.setProperty('height', '114px');
  div.style.setProperty('background', '#f60');
  div.style.setProperty('left', '940px');
  div.style.setProperty('top', '10px');
  div.style.setProperty('border', '1px solid gray');
  div.style.setProperty('z-index', '999');
  document.body.appendChild(div);
  
  var arr=new Array("bnt_qyl1","bnt_qyl2","bnt_yyb1","bnt_yyb2","bnt_xxlb","bnt_qd","#1 老子全压了","#2 老子全压了","#1 老子压一半","#2 老子压一半","#谢谢老板","#签到"); 

for (var i=0;i<6;i++) 
  {
    addevent(arr[i],arr[i+6])
  }

  document.getElementById('viewjf').addEventListener('click', function (event) { view_jf(); }, false);
  var swfobj = document.getElementById("douyu_room_flash_proxy");


 chajifen(nickname);
 chaditu();

 setInterval(
        function(){
         if(document.getElementById("viewjf").checked) {
           chajifen(nickname);
           chaditu();
         }
         if(document.getElementById("autoqd").checked) {
              qd();
         }
    },6000);
 
function addevent(id,str) {
   document.getElementById(id).addEventListener('click', function (event) { danmu(str); }, false);
}

function chajifen(name) {
    URL = 'https://www.zyz2000.ml:9999/jf?name=' + name 
    fetch(URL).then(function(response) {
        return response.json();
    }).then(function(json) {
       if (jifen_one == -1 ) { jifen_one = json.credit };
       if (json.credit - jifen_one >= 0){tmp = '+' + (json.credit - jifen_one).toString();}else{tmp=json.credit - jifen_one};
       $(".jifenxianshi").val("昵称:" + json.nickName + "\n" + "积分:" + json.credit + " ( " + tmp + " )" + "\n" + "历史积分:"+json.earnedCredit);
    });
}
 
function chaditu() {
    fetch('https://www.zyz2000.ml:9999/dt').then(function(response) {
        return response.json();
    }).then(function(json) {
       $(".dituxianshi").val("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 view_jf() {
   //if(document.getElementById("viewjf").checked) {
   if(document.getElementById("viewjf").checked) {
     div.style.setProperty('height', '275px');
     document.getElementById("jifenxianshi").style.display="block";
     document.getElementById("dituxianshi").style.display="block";
   } else {
     div.style.setProperty('height', '114px');
     document.getElementById("jifenxianshi").style.display="none";
     document.getElementById("dituxianshi").style.display="none";
   }
}

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) {
  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 (!swfobj) {swfobj = document.getElementById("douyu_room_flash_proxy")}
   if (str == lastText){
    for (var i=0;i<Math.round(Math.random()*5)+1;i++){
       str = str + " "
    }
   }
swfobj.js_sendmsg("content@=" + str + "/col@=0/type@=chatmessage/dy@=" + acf_did + "/sender@=" + acf_uid + "/pid@=/ifs@=0/nc@=0/rev@=0/");
lastText = str;
}


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 "";
}