Ребята помогите пожалуйста разобраться я понимаю чуть мож в этом туповат но все-таки риск того стоит
вот тело:
// ==UserScript==
// @include
http://www.bloodyworld.com/index.php?file=menu
// ==/UserScript==
// (c) Sergey Gorbunov aka maxwell, 2007
var doc = document.wrappedJSObject ? document.wrappedJSObject : document;
var vtop = top;
if (vtop.wrappedJSObject) vtop = vtop.wrappedJSObject;
top.document.getElementsByTagName('frame')[0].scrolling = 'vertical';
//top.document.getElementsByTagName('frameset')[0].rows = "180,*,30";
doc.hit = hit;
doc.GenerateP = GenerateP;
function MRandom(min,max)
{
var rnd = Math.floor(Math.random()*5);
if (rnd > max) { rnd = 9 - rnd; }
if (rnd < min) { rnd = min + rnd; }
return rnd;
}
var t; // timer
//var RATE = MRandom(1,5); // secs for hit
var points = ['righthend','lefthend','head','lags','body'];
var p2 = ['head','lags','body'];
// 0 - 2 удара
// 1 - 1 удар
// 2 - два блока
// 3 - три блока
function GenerateP(mode)
{
var quer="";
var b = [];
switch(mode)
{
case "0":
quer="&fire[]="+points[MRandom(0,4)]+"&fire[]="+points[MRandom(0,4)];
break;
case "1":
quer="&fire="+points[MRandom(0,4)];
break;
case "2":
do
{
b[0] = points[MRandom(0,4)];
b[1] = points[MRandom(0,4)];
}
while (b[0] == b[1])
quer="&shit%5B%5D="+b[0]+"&shit%5B%5D="+b[1];
break;
case "3":
do
{
b[0] = MRandom(0,4);
b[1] = MRandom(0,4);
b[2] = MRandom(0,4);
}
while ((b[0] == b[1]) || (b[2] == b[0]) || (b[2] == b[1]))
b[0] = points[b[0]];
b[1] = points[b[1]];
b[2] = points[b[2]];
quer="&shit%5B%5D="+b[0]+"&shit%5B%5D="+b[1]+"&shit%5B%5D="+b[2];
//quer="&shit%5B%5D=righthend&shit%5B%5D=lefthend&sh it%5B%5D="+p2[MRandom(0,2)];
break;
}
return quer;
}
// 0 - 2 удара
// 1 - 1 удар
// 2 - два блока
// 3 - три блока
function hit()
{
var mod = document.getElementById('maxwell_hit_type').value;
//mod = "1-3"; // debug
switch (mod)
{
case "1-2":
var shield = "2";
var weapon = "1";
break;
case "1-3":
var shield = "3";
var weapon = "1";
break;
case "2-2":
var shield = "2";
var weapon = "0";
break;
}
var main = top.document.getElementsByTagName('frame')[1];
if (main.contentDocument.getElementsByTagName("input" ).length)
{
var cd = main.contentDocument.getElementsByTagName("input")[2].value;
if (main.contentDocument.getElementById('IdHelthP'))
{
var cur_hp = main.contentDocument.getElementById('IdHelthP').in nerHTML;
if (cur_hp < 150) { clearTimeout(t); return false; }
//GM_log('Current hp: '+cur_hp+' \n max hp: '+1);
}
else
{
GM_log('hp_false');
return false;
}
}
else
{
return false;
}
var data = 'file=battle&weapon_arrow=&cd='+cd+'&MagicweaponID =&slotMagic=&weapon_magic=&login_magic='+GenerateP (shield)+'&go.x=25&go.y=9'+GenerateP(weapon);
//GM_log(data);
GM_xmlhttpRequest({
method: 'POST',
url: 'http://www.bloodyworld.com/index.php?file=battle',
data: data,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
},
onload: function(responseDetails) {
main.src = 'http://www.bloodyworld.com/index.php?file=battle';
}
});
}
function startHit()
{
hit();
var seccs = (2+MRandom(1,5)) * 1000;
GM_log(seccs);
t = setTimeout( function(){ return function(){ startHit(); } }(), seccs);
}
function stopHit()
{
clearTimeout(t);
}
var btn = document.createElement('button');
btn.setAttribute('id','maxwell_start_hit');
btn.setAttribute('style','position: absolute; top:30px; right:80px; background: #f1f1f1; width:60px; z-index: 100; border: 1px #000000 solid; color: maroon;');
btn.addEventListener('click', startHit, false);
btn.innerHTML = "start";
document.body.appendChild(btn);
var btn = document.createElement('button');
btn.setAttribute('id','maxwell_stop_hit');
btn.setAttribute('style','position: absolute; top:30px; right:20px; background: #f1f1f1; width:60px; z-index: 100; border: 1px #000000 solid; color: maroon;');
btn.addEventListener('click', stopHit, false);
btn.innerHTML = "stop";
document.body.appendChild(btn);
var btn = document.createElement('div');
btn.setAttribute('id','maxwell_hit_type_div');
btn.setAttribute('style','position: absolute; top:50px; right:20px; z-index: 100;');
btn.innerHTML = "<select id='maxwell_hit_type' style='background: #f1f1f1; border: 1px #000000 solid;'><option value='1-2'>1 удар 2 блока</option><option value='1-3'>1 удар 3 блока</option><option value='2-2'>2 удара 2 блока</option></select>";
document.body.appendChild(btn);
Заранее очень признателен!