您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
BR大逃杀全键盘操作脚本
当前为
// ==UserScript== // @name BRDTS_KeyboardScript // @namespace http://tampermonkey.net/ // @version 0.74 // @description BR大逃杀全键盘操作脚本 // @author StingX // @match http://123.57.37.3/game.php // @match http://www.dtsgame.com/game.php // @match http://br.265g.com/game.php // @require http://code.jquery.com/jquery-1.11.0.min.js // @grant none // ==/UserScript== //发请求 function postCommand(mode,command){ if(arguments.length){ $('#submit').attr("disabled",true); var oXmlHttp = zXmlHttp.createRequest(); var sBody = 'mode='+mode+'&command='+command+'&=%E6%8F%90%E4%BA%A4'; oXmlHttp.open("post", "command.php", false); oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { showGamedata(oXmlHttp.responseText); $('#submit').attr("disabled",false); } else { showNotice(oXmlHttp.statusText); } } }; oXmlHttp.send(sBody); } else{ //提交按钮变灰 $('#submit').attr("disabled",true); //初始化请求类 var oXmlHttp = zXmlHttp.createRequest(); //复制表单内容 var sBody = getRequestBody(document.forms['cmd']); //设置请求类型为post,页面为command.php oXmlHttp.open("post", "command.php", false); //设置请求头 oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //设置响应 oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { showGamedata(oXmlHttp.responseText); $('#submit').attr("disabled",false); } else { showNotice(oXmlHttp.statusText); } } }; //发请求 oXmlHttp.send(sBody); } } //显示界面 function showGamedata(sGamedata){ gamedata = sGamedata.parseJSON(); if(gamedata['url']) { window.location.href = gamedata['url']; } else if(!gamedata['main']) { window.location.href = 'index.php'; } if(gamedata['team']) { $('#team').val(gamedata['team']); gamedata['team'] = ''; } for(var id in gamedata) { if((id == 'toJSONString')||(!gamedata[id])) {continue;} $('#'+id).html(gamedata[id]); } autoSelectMerge(); console.log('自动选择合并'); } //展开select function open(elem) { if (document.createEvent) { var e = document.createEvent("MouseEvents"); e.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); elem[0].dispatchEvent(e); } else if (element.fireEvent) { elem[0].fireEvent("onmousedown"); } } //键盘-操作映射组 var scroll = { '!' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose0'); }, '@' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose1'); }, '#' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose2'); }, '$' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose3'); }, '%' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose4'); }, '^' : function() { $("select[name='sp_cmd']").val('sp_pose'); sl('special'); postCommand(); postCommand('special','pose5'); }, 'Q' : function() { $("select[name='sp_cmd']").val('sp_tac'); sl('special'); postCommand(); postCommand('special','tac0'); }, 'W' : function() { $("select[name='sp_cmd']").val('sp_tac'); sl('special'); postCommand(); postCommand('special','tac2'); }, 'E' : function() { $("select[name='sp_cmd']").val('sp_tac'); sl('special'); postCommand(); postCommand('special','tac3'); }, 'R' : function() { $("select[name='sp_cmd']").val('sp_tac'); sl('special'); postCommand(); postCommand('special','tac4'); }, '`' : function() { $("select[name='moveto']").val(0); sl('move'); postCommand(); }, '1' : function() { $("select[name='moveto']").val(1); sl('move'); postCommand(); }, '2' : function() { $("select[name='moveto']").val(2); sl('move'); postCommand(); }, '3' : function() { $("select[name='moveto']").val(3); sl('move'); postCommand(); }, '4' : function() { $("select[name='moveto']").val(4); sl('move'); postCommand(); }, '5' : function() { $("select[name='moveto']").val(5); sl('move'); postCommand(); }, '6' : function() { $("select[name='moveto']").val(6); sl('move'); postCommand(); }, '7' : function() { $("select[name='moveto']").val(7); sl('move'); postCommand(); }, '8' : function() { $("select[name='moveto']").val(8); sl('move'); postCommand(); }, '9' : function() { $("select[name='moveto']").val(9); sl('move'); postCommand(); }, '0' : function() { $("select[name='moveto']").val(10); sl('move'); postCommand(); }, '-' : function() { $("select[name='moveto']").val(11); sl('move'); postCommand(); }, 'q' : function() { $("select[name='moveto']").val(12); sl('move'); postCommand(); }, 'w' : function() { $("select[name='moveto']").val(13); sl('move'); postCommand(); }, 'e' : function() { $("select[name='moveto']").val(14); sl('move'); postCommand(); }, 'r' : function() { $("select[name='moveto']").val(15); sl('move'); postCommand(); }, 't' : function() { $("select[name='moveto']").val(16); sl('move'); postCommand(); }, 'y' : function() { $("select[name='moveto']").val(17); sl('move'); postCommand(); }, 'u' : function() { $("select[name='moveto']").val(18); sl('move'); postCommand(); }, 'i' : function() { $("select[name='moveto']").val(19); sl('move'); postCommand(); }, 'o' : function() { $("select[name='moveto']").val(20); sl('move'); postCommand(); }, 'p' : function() { $("select[name='moveto']").val(21); sl('move'); postCommand(); }, ' ':function() { postCommand(); }, 'a':function() { if(document.location.hostname.includes('265g')) sl('search'); else sl('search_'); postCommand(); }, //left '37':function() { var radios = $("input[type='radio']"); var checkedIndex; radios.each(function(i,e){ if(e.checked){ checkedIndex = i; return false; } }); radios.get(checkedIndex+1).click(); }, //up '38':function() { var radios = $("input[type='radio']"); var checkedIndex; radios.each(function(i,e){ if(e.checked){ checkedIndex = i; return false; } }); if(checkedIndex>0) radios.get(checkedIndex-1).checked = true; else radios.get(radios.length-1).checked = true; }, //right '39':function() { var radios = $("input[type='radio']"); var checkedIndex; radios.each(function(i,e){ if(e.checked){ checkedIndex = i; return false; } }); open(radios.eq(checkedIndex).next().children().first()); }, //down '40':function() { var radios = $("input[type='radio']"); var checkedIndex; radios.each(function(i,e){ if(e.checked){ checkedIndex = i; return false; } }); if(checkedIndex<radios.length-1) radios.get(checkedIndex+1).checked = true; else radios.get(0).checked = true; }, }; //主程序入口 var run =function () { create_right(); //更改聊天栏信息刷新间隔为1秒 chat('ref',1000); //绑定按键事件 window.addEventListener('keydown', function(e) { if (document.activeElement.type=='text'||document.activeElement.type=='password'||e.metaKey || e.ctrlKey || e.target.isContentEditable || document.designMode ==="on") { console.log('block key2'); return; } if (e.keyCode<37||e.keyCode>40) return; if (scroll[e.keyCode]) { //触发映射 setTimeout(scroll[e.keyCode],10); //无效化按键原来的效果 e.preventDefault(); e.stopPropagation(); } }, false); //组合键映射 window.addEventListener('keypress', function(e) { if (document.activeElement.type=='text'||document.activeElement.type=='password'||e.metaKey || e.ctrlKey || e.target.isContentEditable || document.designMode ==="on") { console.log('block key1'); return; } var key = String.fromCharCode(e.charCode); if (scroll[key]) { setTimeout(scroll[key],10); e.preventDefault(); e.stopPropagation(); } }, false); } function autoSelectMerge(){ if ($('#itmn').length) { $('#itmn').next().next().next().next().click(); console.log('auto merge.'); } else console.log('no merge.'); } //插在屏幕右端 function create_right(){ if($("td[rowspan='2']").length>0){ $("td[rowspan='2']").parent().append("\ <td rowspan=\"2\"> <table border=\"1\" width=\"250\" height=\"550\" cellspacing=\"0\" cellpadding=\"0\"> \ <tbody> <tr><td valign=\"top\" class=\"b3\" style=\"text-align: left\"> <div id=\"log\"> <span class=\"yellow b\" style=\"letter-spacing: 2px;\">\ 基础快捷键:<br/>\ 选择--方向键↑→↓,Esc<br/>\ 提交,确定--空格<br/>\ 探索--a<br/>\ <br/>\ 移动:<br/>\ 北海岸--1 北村住宅区--2<br/>\ 北村公所--3 邮电局--4<br/>\ 消防署--5 观音堂--6<br/>\ 清水池--7 西村神社--8<br/>\ 墓地--9 山丘地带--0<br/>\ 隧道--- 西村住宅区--q<br/>\ 寺庙--w 废校--e<br/>\ 南村神社--r 森林地带--t<br/>\ 源二郎池--y 南村住宅区--u<br/>\ 诊所--i 灯塔--o<br/>\ 南海岸--p 分校--`<br/>\ <br/>\ 基础姿态:<br/>\ 通常--shift+1<br/>\ 攻击姿态--shift+2<br/>\ 防守姿态--shift+3 <br/>\ 探索姿态--shift+4<br/>\ 隐藏姿态--shift+5 <br/>\ 治疗姿态--shift+6 <br/>\ <br/>\ 应战策略:<br/>\ 通常--shift+q<br/>\ 重视防御 --shift+w<br/>\ 重视反击 --shift+e<br/>\ 重视躲避 --shift+r<br/>\ </span><br> </div> </td> </tr> </tbody></table> </td>"); } } run();