NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Бот тест
// @namespace https://www.bestmafia.com/
// @version 1.0
// @description bot
// @author Fizel54
// @match http://www.mafia-rules.net/*
// @match https://www.mafia-rules.net/*
// @grant none
// @license MIT
// @updateURL https://openuserjs.org/meta/Fizel54/Бот_тест.meta.js
// ==/UserScript==
function() {
'use strict';
var is8Fl=0;
var is12Fl=0;
var is16Fl=0;
var is20Fl=0;
var isChaosFl=0;
var isBronzaFl=0;
var isSerebroFl=0;
var isZolotoFl=0;
var isPlatinaFl=0;
var isBrilliantFl=0;
var isMyLeagueFl=0;
var intervalIdCheckGaming;
var intervalIdCheckRooms;
var intervalIdAntiBullet;
var intervalIdTakeTicket;
var intervalIdMove;
var AntiBulletActive=0;
var TakeTicketActive=0;
var isHolydays=0;
var sayGr=0;
var inRoomNickFl;
var getAukFl;
var getAukMoneyFl;
var getAukStarted=0;
var getAukMoneyStarted=0;
var isNightHorror=0;
var isIntuition=0;
var botMode=0;
var tmpr="";
var gr=[];
var moveFl=0;
var taskOnTalkative=0;
var gameOnTask=1;
function isHolydaysCheck(){
var now = new Date();
if (now.getDay()==0 || now.getDay()==6) return 1;
else return 0
}
function role(){
return document.getElementsByClassName("ico my")[0].title
}
function costOfRoom(){
var n=parseInt(document.getElementById("inputMoney").value);
if (n>10) return n;
else return 20;
}
function StopCheat(){
is8Fl=0;
is12Fl=0;
is16Fl=0;
is20Fl=0;
isChaosFl=0;
isBronzaFl=0;
isSerebroFl=0;
isZolotoFl=0;
isPlatinaFl=0;
isBrilliantFl=0;
isMyLeagueFl=0;
tmpr="";
isIntuition=0;
AntiBulletActive=0;
TakeTicketActive=0;
isHolydays=0;
sayGr=0;
isNightHorror=0;
clearIntervals();
clearInterval(intervalIdCheckGaming);
document.getElementById("8").checked=false;
document.getElementById("12").checked=false;
document.getElementById("16").checked=false;
document.getElementById("20").checked=false;
document.getElementById("brnz").checked=false;
document.getElementById("srbr").checked=false;
document.getElementById("zlt").checked=false;
document.getElementById("pltn").checked=false;
document.getElementById("brl").checked=false;
document.getElementById("me").checked=false;
console.debug("Stopped");
}
function clearIntervals(){
clearInterval(intervalIdCheckRooms);
clearInterval(intervalIdAntiBullet);
clearInterval(intervalIdTakeTicket);
clearInterval(intervalIdMove);
}
function openClan(){
_WND_proc('clans')
}
function openDuel(){
_WND_proc('duels')
}
function openPrf(){
_PRF();
}
function PauseCheat(){
clearInterval(intervalIdCheckGaming);
clearIntervals();
console.debug("Paused");
}
function exitFromRoom(){
console.debug('exit')
if($('#wnd_invite')[0] && $('#wnd_invite')[0].children.length==3)
_WND_proc('', 'close', 'invite')
if($('#wnd_newbie')[0] && $('#wnd_newbie')[0].children.length==3)
_WND_proc('', 'close', 'newbie')
if($('#pp_money_bonus') && $('#pp_money_bonus').children().length==3)
$('.newButton').click();
if(Gaming() && !isNightHorror){
if($(".newButton")[0] && $(".newButton")[0].textContent=="Выйти"){
isNightHorror=0;
isIntuition=0;
if(gameOnTask){
console.debug('игра на заданку, обнуляю')
StopCheat();
StartGaming();
}
console.debug("Чёт игра закончилась, выхожу");
gr=[];
clearIntervals();
_GM_action('', 'exit');
return;
}
if($(".finalGamePopup")[0] && $(".finalGamePopup")[0].textContent.search("Рассказать")>=0){
_DLG('exit', 0, event);
isNightHorror=0;
if(gameOnTask){
console.debug('игра на заданку, обнуляю')
StopCheat();
StartGaming();
}
isIntuition=0;
gr=[];
clearIntervals();
return;
}
}
$('.popupClose').click()
}
function countOfMaf(){
var roles=document.getElementsByClassName("role");
var mafs;
var boss=0;
var dvul=0;
for(var i=0; i<roles.length; i++){
if(roles[i].title=="Мафиози"){
mafs=roles[i].children[2].textContent;
}
if(roles[i].title=="Босс мафии") boss=1;
if(roles[i].title=="Двуликий") dvul=1;
}
return parseInt(mafs)+boss+dvul;
}
function countOfGr(){
return $('.whoIsLife .vs')[0].children[0].textContent;
}
function countOfEvil(){
return $('.whoIsLife .vs')[0].children[2].textContent;
}
function closeMenu(){
if(document.getElementById("Menu"))
document.getElementById("Menu").parentNode.removeChild(document.getElementById("Menu"));
document.getElementById("btnShow").hidden=false;
clearInterval(intervalIdCheckGaming);
clearIntervals();
}
function inRoom(){
if($("#roomsListContainer")[0].className=="switch") return 1;
return 0;
}
function Gaming(){
if( $("h1.day-night-chg")[0]==null) return 0;
else return 1;
}
function showMenu(){
if(document.getElementById("Menu"))
document.getElementById("Menu").hidden=false;
else createMenu();
document.getElementById("btnShow").hidden=true;
}
function hideMenu(){
if(document.getElementById("Menu"))
document.getElementById("Menu").hidden=true;
document.getElementById("btnShow").hidden=false;
}
function myNick(){
return $('.my_nickname').text()
}
function returnSizeOfRoom(s){
var i=s.search('/');
return s.substr(i+1, 2);
}
function returnMyLeague(s) {
if (~s.search("ронз"))
return "Бронза";
if (~s.search("ереб") )
return "Серебро";
if (~s.search("оло") )
return "Золото";
if (~s.search("лати") )
return "Платина+";
if (~s.search("рилл"))
return "Бриллиант";
if (~s.search("емп"))
return "Лига Чемпионов";
}
function sayImGr(){
/*
if($("h1.day-night-chg").length==1 && role()=="Гражданин"){
var chance=rndm(11);
if(chance>6){
_CHT_action('', 'smile', "гр", event);
setTimeout(function(){
_CHT_action('ich', 'send', 'close', event);
},1000)
}
}*/
}
function takeTicket(){
//_GM_action('', 'duel_lwin', 'get');
if($("#dlw_btn")[0]) $("#dlw_btn")[0].click();
}
function checkInGame(){
if(inRoom() || Gaming()){
hideMenu();
clearInterval(intervalIdCheckRooms);
}
if(!Gaming()){
if(getAukFl && !getAukStarted){
takeAuk();
console.debug("takeAuk start");
}
if(getAukMoneyFl && !getAukMoneyStarted){
takeAukMoney();
console.debug("takeAukMoney start");
}
}
if(Gaming() && botMode){
AntiBullet()
if(isHolydays && !TakeTicketActive){ intervalIdTakeTicket=setInterval(takeTicket, 500); TakeTicketActive=1;}
sayImGr();
exitFromRoom();
sliv();
clearInterval(intervalIdMove);
if(isNight() && role()!="Гражданин" && role()!="Медработник"){
if(role()=="Мафиози"){
intervalIdMove=setInterval(NightMoveMaf, 1000);
} else if(role()=="Подручный"){
intervalIdMove=setInterval(NightMovePodr, 1000);
} else if(role()=="Комиссар"){
intervalIdMove=setInterval(NightMoveCom, 1000);
} else if(role()=="Зомби"){
intervalIdMove=setInterval(NightMoveZombie, 1000);
} else if(role()=="Вор" || role()=="Стерва"){
intervalIdMove=setInterval(NightMoveVor, 1000);
} else if(role()=="Доктор"){
intervalIdMove=setInterval(NightMoveDoc, 1000);
} else if(role()=="Маньяк"){
intervalIdMove=setInterval(NightMoveMan, 5000);
} else {
intervalIdMove=setInterval(NightMoveRndm, 1000);
}
}
}
if(!inRoom() && !Gaming()){
showMenu();
if(isHolydays && TakeTicketActive){ clearInterval(intervalIdTakeTicket); TakeTicketActive=0}
clearInterval(intervalIdCheckRooms);
if(inRoomNickFl)
intervalIdCheckRooms=setInterval(joinToRoomNick, 2000);
else
intervalIdCheckRooms=setInterval(joinToRoom, 2000);
}
return;
}
function takeAukMoney(){
var intervalBuy=setInterval(function(){
getAukMoneyStarted=1;
var lim=+document.getElementById("takeAutMoneyInp").value;
if($("#gsl_timer").text() && +$("#gsl_bet").text() < lim )
$("#gsl_btn").click();
else if(+$("#gsl_bet").text() >= lim || !$("#gsl_timer").text()){
clearInterval(intervalBuy);
console.debug("takeAukMoney stopped");
getAukMoneyStarted=0;
}
}, 20)
}
function takeAuk(){
if($('#getAuk').attr('checked') !='checked')
return;
var intervalBuy=setInterval(function(){
if(Gaming()){
console.debug('clearInterval')
getAukStarted=0;
clearInterval(intervalBuy);
return;
}
getAukStarted=1;
var fl=0;
var nick=document.getElementById("takeAutInp").value;
if(nick=="*")
fl=1;
if( (fl || $('.roleName').text()==nick ) && $("#gsl_timer").text()=="0" && +$("#gsl_bet").text() < 200){
console.debug("READY");
clearInterval(intervalBuy);
getAukStarted=0;
console.debug("buy auk try")
console.debug("takeAuk stopped");
setTimeout(function(){
for(var i=0; i<6; i++){
setTimeout(function(){
$("#gsl_btn").click();
}, 30)
}
}, 800)
}
}, 50)
}
function rndm(max_random){
return Math.floor(Math.random()*max_random);
}
var smiles = [":{", ":]", ":|", ":(", ":D", "8-)", "x)", "эм", "(c)", "B)", ".", "...", ".", ".", "..", ".", ".", ".", ".", "."];
function AntiBullet(){
if(Gaming() && $('.my').find('.noSpeak')[0].title=="Подозрительно молчит" && $('.my').find('.noSpeak')[0].className.indexOf("not") < 0){
console.debug("AntiBullet");
_CHT_action('', 'smile', smiles[rndm(smiles.length)], event);
setTimeout(function(){
_CHT_action('ich', 'send', 'close', event);
},1000)
}
}
setInterval(function(){
if(Gaming() && gameOnTask && taskOnTalkative){
console.debug("AntiBullet");
_CHT_action('', 'smile', smiles[rndm(smiles.length)], event);
setTimeout(function(){
_CHT_action('ich', 'send', 'close', event);
},1000)
}
}, 67000+(rndm(20)*1000))
function joinToRoomNick(){
var nick=document.getElementById("nickInp").value;
console.debug("Врываюсь в комнату с ником " + nick);
var rooms=$('#gml_list')[0].children;
for(var i=0; i<rooms.length; i++){
if(rooms[i].children[0] && rooms[i].children[0].textContent==nick){
rooms[i].children[4].children[0].click()
if(inRoom()){
hideMenu();
}
}
}
}
function joinToRoom(){
console.debug("Врываюсь в комнату");
gr=[];
isNightHorror=0;
isIntuition=0;
var len=$('#gml_list')[0].children.length;
var myLeague=$('#leagueBlock').find('h2').text();
myLeague=returnMyLeague(myLeague);
for(var i=0;i<len;i++){
if($('#gml_list')[0].children[i].id.search("league")<0){
var name=$('#gml_list')[0].children[i].children[0].textContent;
var league=$('#gml_list').children().eq(i).find('.rating').text();
var size=$('#gml_list')[0].children[i].children[2].textContent;
size=returnSizeOfRoom(size);
var chaos=$('#gml_list')[0].children[i].children[3].title;
isChaos=0;
var money=$('#gml_list')[0].children[i].children[3].textContent
if((is8Fl && size=="8") || (is12Fl && size=="12") || (is16Fl && size=="16") || (is20Fl && size=="20")){
if( (isBronzaFl && league=="Бронза") || (isSerebroFl && league=="Серебро") || (isZolotoFl && league=="Золото") || (isPlatinaFl && league=="Платина+") || (isBrilliantFl && league=="Бриллиант") || (isMyLeagueFl && league==myLeague)){
if(parseInt(money)==costOfRoom()){
try{
$('#gml_list')[0].children[i].children[4].children[0].click();
if(inRoom()){
hideMenu();
break;
}
} catch(e){
console.debug("i cant join");
}
}
}
}
}
}
}
function seconds(){
if(Gaming()){
var str=document.getElementById("gmv_timer").children[0].textContent;
str=str.replace(/ ——/g,"");
str=str.replace(/—— /g,"");
return +str;
}
}
function isNight(){
if(Gaming()){
var days=document.getElementsByClassName("day-night-chg")
if(days[days.length-1].textContent.search("НОЧЬ")>=0) return 1;
else return 0;
}
}
function NightMoveDoc(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Ночной ход дока");
for(var i=0; i<playersS.mas.length; i++){
if(playersS.isPeace(i) && !playersS.mas[i].isDead ){
console.debug("док, иду к мирному "+playersS.mas[i].nick)
playersS.clickOn(i);
}
}
playersS.clickOn(rndm(playersS.mas.length-1));
}
}
function NightMoveCom(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Ночной ход кома");
var n=rndm(playersS.mas.length-1);
if(!playersS.mas[n].role){
console.debug("ком, иду к неизвестному "+playersS.mas[n].nick)
playersS.clickOn(n);
}
}
}
function NightMoveVor(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Ночной ход вора")
for(var i=0; i<playersS.mas.length; i++){
if(playersS.isEvil(i) && !playersS.mas[i].isDead){
console.debug("вор, иду к злому "+playersS.mas[i].nick)
playersS.clickOn(i);
break;
}
}
playersS.clickOn(rndm(playersS.mas.length-1));
}
}
function NightMoveMan(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Ночной ход мана")
for(var i=0; i<playersS.mas.length; i++){
if( (playersS.isEvil(i) || playersS.isZombie(i)) && !playersS.mas[i].isDead){
console.debug("ман, иду к злому "+playersS.mas[i].nick)
playersS.clickOn(i);
break;
}
}
playersS.clickOn(rndm(playersS.mas.length-1));
}
}
function NightMoveRndm(){
if(isNight() && seconds()<=(10+rndm(10)) ){
if(!isIntuition){
console.debug("Хожу от балды");
playersS.clickOn(rndm(playersS.mas.length-1));
} else {
var nick="";
var text=document.getElementsByClassName("text");
for(var i=0; i<text.length; i++){
var s=text[i].textContent;
if(s.search("Интуиция подсказывает вам: ")==0){
s=s.substr(27, s.length-1)
var ind=s.search(" - ");
nick=s.substr(0, ind);
}
}
console.debug("Хожу по интуиции к " + nick);
var players=document.getElementById("upl_list").children;
for(var i=0; i<players.length; i++){
var pl=players[i].getElementsByClassName("nick")[0].textContent;
if(pl==nick && players[i].children[2].children[0].title!="Реанимация"){
players[i].children[2].children[0].click();
return;
}
}
console.debug("что-то пошло не так :(")
for(var i=0; i<players.length; i++){
var n=rndm(players.length-1);
if(n && players[n].children[2].children[0].title!="Реанимация"){
players[n].children[2].children[0].click()
}
}
}
}
}
/*
function NightMoveMan(){
console.debug("Хожу за маньяка");
if(isNight()){
var players=document.getElementById("upl_list").children;
for(var i=0; i<players.length; i++){
if(playersS.isMaf(i) || playersS.isZombie(i)){
if(players[i].children[2].children[0].title!="Реанимация")
players[i].children[2].children[0].click()
}
if(Gaming() && isNight() && role()=='Маньяк' && ($(players[i]).find('.ico')[0].title=="Зомби" || $(players[i]).find('.ico')[0].title=="Мафия") && players[n].children[2].children[0].title!="Реанимация" ){
players[n].children[2].children[0].click()
}
}
for(var i=0; i<players.length; i++){
var n=rndm(players.length-1);
if(isNight() && n && players[n].children[2].children[0].title!="Реанимация" ){
players[n].children[2].children[0].click()
}
}
}
}*/
function findTarget(){
var NightActs=$(".night-r-act");
if(NightActs.length>0){
for(var i=NightActs.length-1; i>=0; i--){
var s=NightActs[NightActs.length-1].textContent;
var n=s.search("Думаю нужно убить ");
if(n>=0){
return s.substr(n+18, s.length);
}
}
}
return 0;
}
function findTargetZombie(){
var NightActs=$(".night-r-act");
if(NightActs.length>0){
for(var i=NightActs.length-1; i>=0; i--){
var s=NightActs[NightActs.length-1].textContent;
var subs='Иду есть мозги у ';
var n=s.search(subs);
if(n>=0){
return s.substr(n+subs.length, s.length);
}
}
}
return 0;
}
function findAntiTargetZombie(){
var NightActs=$(".night-act");
if(NightActs.length>0){
for(var i=NightActs.length-1; i>=0; i--){
var s=NightActs[i].textContent;
var subs='Иду превращать в Зомби ';
var n=s.search(subs);
if(n>=0){
return s.substr(n+subs.length, s.length);
}
}
}
return 0;
}
function findAntiTarget(){
var NightActs=$(".night-r-act");
if(NightActs.length>0){
for(var i=NightActs.length-1; i>=0; i--){
var s=NightActs[i].textContent;
var n=s.search("Думаю нужно заморозить ");
if(n>=0){
return s.substr(n+23, s.length);
}
}
}
return 0;
}
function NightMovePodr(){
if(isNight() && seconds()<=(10+rndm(10)) ){
var players=document.getElementById("upl_list").children;
var nick=findTarget();
var antiNick=findAntiTarget();
console.debug("Цель подручного: " +nick);
console.debug("Цель тони: " +antiNick);
if(nick){
for(var i=0; i<players.length; i++){
console.debug("finded");
if(players[i].getElementsByClassName("nick")[0].textContent==nick && players[i].children[2].children[0].title!="Реанимация")
players[i].children[2].children[0].click()
}
}
if(seconds()<=1){
console.debug("not finded. going random");
for(var i=0; i<players.length; i++){
n=rndm(players.length);
if(n>0 && players[n].getElementsByClassName("nick")[0].textContent!=antiNick && players[n].children[2].children[0].title!="Реанимация")
players[n].children[2].children[0].click()
}
if(players[0].children[2].children[0].title!="Реанимация")
players[0].children[2].children[0].click()
}
}
}
function NightMoveMaf(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Наши там кого-нибудь бьют?");
var players=document.getElementById("upl_list").children;
var nick=findTarget();
var antiNick=findAntiTarget();
console.debug("Цель мафии: " +nick);
console.debug("Цель босса: " +antiNick);
if(nick){
for(var i=0; i<players.length; i++){
console.debug("finded");
if(players[i].getElementsByClassName("nick")[0].textContent==nick && players[i].children[2].children[0].title!="Реанимация")
players[i].children[2].children[0].click()
}
}
if(seconds()<=(2+rndm(3)) ){
console.debug("Чёт не бьют, сча сам порешаю");
for(var i=0; i<players.length; i++){
n=rndm(players.length);
if(n>0 && players[n].getElementsByClassName("nick")[0].textContent!=antiNick && players[n].children[2].children[0].title!="Реанимация")
players[n].children[2].children[0].click()
}
if(players[0].children[2].children[0].title!="Реанимация")
players[0].children[2].children[0].click()
}
}
}
function NightMoveZombie(){
if(isNight() && seconds()<=(10+rndm(10)) ){
console.debug("Наши там кого-нибудь бьют?");
var players=document.getElementById("upl_list").children;
var nick=findTargetZombie();
var antiNick=findAntiTargetZombie();
console.debug("Цель зомби: " +nick);
console.debug("Цель профа: " +antiNick);
if(nick){
for(var i=0; i<players.length; i++){
console.debug("finded");
if(players[i].getElementsByClassName("nick")[0].textContent==nick && players[i].children[2].children[0].title!="Реанимация")
players[i].children[2].children[0].click();
}
}
if(seconds()<=(2+rndm(3)) ){
console.debug("Чёт не бьют, сча сам порешаю");
for(var i=0; i<players.length; i++){
n=rndm(players.length);
if(n>0 && players[n].getElementsByClassName("nick")[0].textContent!=antiNick && players[n].children[2].children[0].title!="Реанимация")
players[n].children[2].children[0].click()
}
if(players[0].children[2].children[0].title!="Реанимация")
players[0].children[2].children[0].click()
}
}
}
function role(){
return document.getElementsByClassName("ico my")[0].title
}
function findPartial( a, s ){
for( var i = 0; i < a.length; ++i )
if( a[i].indexOf( s ) >= 0 )
return i;
return -1;
}
function isMaf(role){
if(role=="Мафиози" || role=="Босс мафии" || role=="Двуликий")
return 1;
return 0;
}
function isZombie(role){
if(role=="Чокнутый Профессор" || role=="Зомби")
return 1;
return 0;
}
function Player(nick, role, target, isDead) {
this.nick=nick;
this.role=role;
this.target=target;
this.isDead=isDead;
};
function compare(a, b) {
return b.count - a.count;
}
function Players() {
this.mas=[];
this.countOfVotes=0;
this.clickOn=function(i){
var players=document.getElementById("upl_list").children;
if(players[i].children[2].children[0].title!="Реанимация")
players[i].children[2].children[0].click()
};
this.mafsIsEqGr=function(){
if ( this.countOfMafs() +2 >= this.countOfPeace()) {
return 1;
}
return 0;
};
this.mafsIsEqGrJail=function(){
var jail=document.getElementsByClassName("jail");
if(jail.length){
try{
var s=jail[jail.length-1].children[3].textContent;
var opr=+s[s.length-1];
var prig=+s[19];
if( (this.countOfAll() - (opr+prig) < 3) && (prig-opr) < 2)
return 1;
} catch(e){
;
}
}
return 0;
};
this.countOfEvil=function(){
return +$('.whoIsLife .vs')[0].children[2].textContent;
};
this.countOfAll=function(){
return (+this.countOfEvil()) + (+this.countOfPeace());
}
this.countOfPeace=function(){
return +$('.whoIsLife .vs')[0].children[0].textContent;
};
this.countOfMafs=function(){
var mafs=0;
var boss=0;
var dvul=0;
if(document.getElementById("whl_role_2"))
mafs=+document.getElementById("whl_role_2").getElementsByClassName("count")[0].textContent;
if(document.getElementById("whl_role_9"))
boss=1;
if(document.getElementById("whl_role_25"))
dvul=1;
return mafs+boss+dvul;
};
this.getId=function(nick){
for(var i=0; i<this.mas.length; i++){
if(this.mas[i].nick==nick)
return i;
}
return -1;
}
this.add = function(player) {
this.mas.push(player)
};
this.print = function() {
for(var i=0; i<this.mas.length; i++){
console.debug(this.mas[i]);
}
};
this.getNick=function(i){
return this.mas[i].nick;
}
this.clear=function(){
this.mas.splice(0, this.mas.length);
};
this.target=function(){
var tmp=[];
var masobj=[];
for(var i=0; i<this.mas.length; i++){
if(this.mas[i].target){
this.countOfVotes++;
var finded=findPartial(tmp, this.mas[i].target);
if( finded<0){
tmp.push(this.mas[i].target);
var o={};
o.id=tmp.length-1;
o.nick=this.mas[i].target;
o.count=1;
masobj.push(o);
}
else{
masobj[finded].count++;
}
}
}
if(masobj.length){
masobj.sort(compare);
console.debug('кого сливают:' +tmp);
// if(+this.countOfVotes >= parseInt(+this.countOfAll()/3) )
return this.getId(masobj[0].nick);
}
return -1;
}
this.isMaf=function(i){
if(this.mas[i].role && (this.mas[i].role=="Мафиози" || this.mas[i].role=="Босс мафии" || this.mas[i].role=="Двуликий"))
return 1;
return 0;
};
this.isPeace=function(i){
if(this.mas[i].role &&(this.mas[i].role=="Гражданин" || this.mas[i].role=="Свидетель" || this.mas[i].role=="Доктор" || this.mas[i].role=="Комиссар" || this.mas[i].role=="Сержант" || this.mas[i].role=="Стерва" || this.mas[i].role=="Вор" || this.mas[i].role=="Медработник"))
return 1;
return 0;
};
this.isZombie=function(i){
if(this.mas[i].role && (this.mas[i].role=="Чокнутый Профессор" || this.mas[i].role=="Зомби"))
return 1;
return 0;
}
this.isEvil=function(i){
if(this.mas[i].role && (this.mas[i].role=="Мафиози" || this.mas[i].role=="Подручный" || this.mas[i].role=="Зомби" || this.mas[i].role=="Чокнутый Профессор" || this.mas[i].role=="Зомби" || this.mas[i].role=="Маньяк" || this.mas[i].role=="Двуликий" || this.mas[i].role=="Босс мафии"))
return 1;
return 0;
};
this.mafsTarget=function(){
for(var i=0; i<this.mas.length; i++){
if(this.isMaf(i) && this.mas[i].target)
return this.getId(this.mas[i].target);
}
};
this.peaceTarget=function(){
for(var i=0; i<this.mas.length; i++){
if(this.isPeace(i) && this.mas[i].target)
return this.getId(this.mas[i].target);
}
};
this.zombieTarget=function(){
for(var i=0; i<this.mas.length; i++){
if(this.isZombie(i) && this.mas[i].target)
return this.getId(this.mas[i].target);
}
};
this.printEvil=function(){
var tmp=[];
for(var i=0; i<this.mas.length; i++){
if(this.isEvil(i))
tmp.push(this.mas[i].nick);
}
console.debug("список злых: " + tmp);
return;
}
this.printPeace=function(){
var tmp=[];
for(var i=0; i<this.mas.length; i++){
if(this.isPeace(i))
tmp.push(this.mas[i].nick);
}
console.debug("список мирных: " + tmp);
return;
}
this.printAllRole=function(){
for(var i=0; i<this.mas.length; i++){
console.debug(this.mas[i].nick + " - " + this.mas[i].role);
}
return;
}
this.checkEvil=function(){
for(var i=0; i<this.mas.length; i++){
if( (this.isEvil(i) || this.isZombie(i)) && !this.mas[i].isDead) {
console.debug("Найден злодей " + this.mas[i].nick)
return i;
}
}
return -1;
}
};
//Пытки паяльником дали результат: ЕгО ЛюБиМаЯ ЖеНа - Мафиози
//Карты таро раскрыли вам роль: Под Елью_с_винтовкой - Гражданин
function fillRole(){
var mas=$('p');
for(var i=0; i<mas.length; i++){
var s=mas[i].textContent;
var n=s.search('таро раскрыли вам роль: ');
var payala=0;
if(n<0){
n=s.search('паяльником дали результат: ');
payala=3;
}
if(n<0){
n=s.search('Детектор лжи дал результат: ');
payala=4;
}
if(n>=0){
console.debug("Найдено сообщение в чате " +s);
s=s.substr(n+24+payala, s.length);
n=s.search(' - Гражданин')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if(j!=-1)
playersS.mas[j].role="Гражданин";
}
n=s.search(' - Мафиози')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if (j!=-1)
playersS.mas[j].role="Мафиози";
}
n=s.search(' - Двуликий')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if (j!=-1)
playersS.mas[j].role="Двуликий";
}
n=s.search(' - Босс мафии')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if (j!=-1)
playersS.mas[j].role="Босс мафии";
}
n=s.search(' - Маньяк')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if (j!=-1 )
playersS.mas[j].role="Маньяк";
}
n=s.search(' - Чокнутый Профессор')
if(n>0){
var j=playersS.getId(s.substr(0, n));
if (j!=-1 )
playersS.mas[j].role="Голем";
}
}
}
var provi=$(".proverka");
for(var i=0; i<provi.length; i++){
var s=provi[i].textContent;
var len=19;
if(s.search("комиссар")>=0){
len=19;
}
//Комиссар сообщает:
//Свидетель сообщает:
if(s.search("видетель")>=0){
len=20;
}
var n=s.search(' играет за мафию');
if(n>0){
var j=playersS.getId(s.substr(len, n-len));
if(j!=-1 && !playersS.mas[j].role)
playersS.mas[j].role="Мафиози";
}
var n=s.search(' играет за граждан');
if(n>0){
var j=playersS.getId(s.substr(len, n-len));
if(j!=-1 && !playersS.mas[j].role)
playersS.mas[j].role="Гражданин";
}
var n=s.search(' играет за маньяка');
if(n>0){
var j=playersS.getId(s.substr(len, n-len));
if(j!=-1 && !playersS.mas[j].role)
playersS.mas[j].role="Маньяк";
}
var n=s.search(' играет за Зомби');
if(n>0){
var j=playersS.getId(s.substr(len, n-len));
if(j!=-1 && !playersS.mas[j].role)
playersS.mas[j].role="Зомби";
}
}
}
function vote(){
sliv();
}
var playersS;
function sliv(){
var myhint=document.getElementsByClassName("name my")[0].getElementsByClassName("hint")[0].textContent;
playersS=new Players();
var playersSList=document.getElementById("upl_list").children;
var myrole=role();
for(var i=0; i<playersSList.length; i++){
var isDead=0;
var nick=playersSList[i].getElementsByClassName("nick")[0].textContent
var target=playersSList[i].getElementsByClassName("hint")[0].textContent
target=target.substr(8);
var title=playersSList[i].children[0].title;
if(playersSList[i].children[0].children[0].className=="dead")
isDead=1;
var player= new Player(nick, title, target, isDead);
playersS.add(player);
var chatr=$('.chat p');
var mynameplace=chatr[0].textContent.search(',');
var myname=chatr[0].textContent.substr(0, mynameplace);
if(!isNight() && target==myname){
try{
if(playersSList[i].children[2].children[0].title=='Голосовать')
playersSList[i].children[2].children[0].click();
if( $('.popupGameVote h2')[0].textContent[0]=="Г"){
$('.popupGameVote')[0].children[2].children[0].click();
}
break;
} catch(e){}
}
}
fillRole();
playersS.printEvil();
playersS.printPeace();
var imMaf=isMaf(myrole);
var imZombie=isZombie(myrole);
if(!myhint && !isNight()){
var fl=playersS.target();
if(fl<0)
fl=playersS.checkEvil();
var f=0;
if(fl>=0){
if(!f && imMaf && !playersS.isMaf(fl)){
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[fl].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
console.debug("Маф. Сажу не мафа за всеми")
f=1;
}
if(!f && imZombie && !playersS.isZombie(fl)){
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[fl].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
console.debug("Зомби. Сажу не зомби")
f=1;
}
if(!f && !imMaf && !imZombie && playersS.isEvil(fl)){
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[fl].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
console.debug("Мир. Сажу злодея");
f=1
}
if(!f && imMaf && playersS.mafsIsEqGr() && playersS.mafsTarget()>=0){
console.debug("Маф. Голосую за мафами")
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[playersS.mafsTarget()].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
f=1;
}
}
if(!f && !imMaf && !imZombie && playersS.peaceTarget()>=0){
console.debug("Мир. Голосую за мирными")
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[playersS.peaceTarget()].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
f=1;
}
if(!f && !imMaf && !imZombie && playersS.peaceTarget()>=0){
console.debug("Мир. Голосую за мирными")
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[playersS.peaceTarget()].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
f=1;
}
if(!f && imZombie && playersS.zombieTarget()>=0){
console.debug("Зомби. Голосую за зомби")
if(playersSList[fl].getElementsByClassName("vote")[0])
playersSList[playersS.zombieTarget()].getElementsByClassName("vote")[0].click();
if($(".popupGameVote button.yes")[0] && $('.popupGameVote h2')[0].textContent[0]=="Г")
$(".popupGameVote button.yes")[0].click();
f=1;
}
} else {
console.debug("Я " + myhint);
}
if(!isNight() && $('.popupGameVote h2')[0] && $('.popupGameVote h2')[0].textContent[0]=='С' ){
var f=0;
var popupTarget=$('.popupGameVote em, .popupGameVote em a')[0].textContent;
if(myrole=="Потрошитель"){
console.debug("Потрошитель. Приговариваю кого-то")
$('.popupGameVote')[0].children[2].children[0].click();
f=1;
}
if(myrole=="Маньяк" && !f){
console.debug("Маньяк. Приговариваю кого-то")
$('.popupGameVote')[0].children[2].children[0].click();
f=1;
}
if(!f && imMaf && playersS.isMaf(playersS.getId(popupTarget)) && playersS.mafsIsEqGrJail() ){
console.debug("Маф. Оправдываю своего")
$('.popupGameVote')[0].children[2].children[1].click();
f=1;
}
if(!f && !imMaf && playersS.isEvil(playersS.getId(popupTarget))){
console.debug("Мир. Приговариваю злодея")
$('.popupGameVote')[0].children[2].children[0].click();
f=1
}
if(!f && !imZombie && playersS.isZombie(playersS.getId(popupTarget))){
console.debug("Приговариваю Зомби")
$('.popupGameVote')[0].children[2].children[0].click();
f=1
}
if(!f && imMaf && !playersS.isMaf(playersS.getId(popupTarget))){
console.debug("Маф. Приговариваю кого-то")
$('.popupGameVote')[0].children[2].children[0].click();
f=1
}
if(!f && !imMaf && (findPartial(gr, popupTarget)>=0 || playersS.isPeace(playersS.getId(popupTarget)))){
console.debug("Мир. Оправдываю мирных")
$('.popupGameVote')[0].children[2].children[1].click();
f=1
}
/*
if(!f){
console.debug("Тупо приговариваю");
$('.popupGameVote')[0].children[2].children[0].click();
}*/
}
}
function reverse(s){
return s.split("").reverse().join("");
}
function ImNotToni(){
if(role()!="Подручный" && role()!="Франческа" && role()!="Марко" && role()!="Жирный Тони") return 1;
else return 0;
}
function findme(s){
var qq;
qq=s.search("играет за мафию");
if(qq>0) return qq;
qq=s.search("играет за маньяка");
if(qq>0) return qq;
qq=s.search("- Босс мафии");
if(qq>0) return qq;
qq=s.search("- Двуликий");
if(qq>0) return qq;
qq=s.search("- Мафиози");
if(qq>0) return qq;
qq=s.search("- Зомби");
if(qq>0) return qq;
qq=s.search("играет за зомби");
if(qq>0) return qq;
qq=s.search("играет за Потрошителя");
if(qq>0) return qq;
qq=s.search("играет за семью Жирного Тони");
if(qq>0 && ImNotToni() ) return qq;
return -1;
}
function findmegr(s){
var qq=s.search("играет за граждан");
if(qq>0) return qq;
}
function playOnTask(callback){
if(gameOnTask){
document.getElementById("8").checked=false;
document.getElementById("12").checked=false;
document.getElementById("16").checked=false;
document.getElementById("20").checked=false;
taskOnTalkative=0;
document.getElementById("brnz").checked=true;
document.getElementById("srbr").checked=true;
document.getElementById("zlt").checked=true;
document.getElementById("me").checked=true;
var task;
getTask(function(tsk){
task=tsk;
if(task.indexOf("при помощи экстры") >=0){
console.debug("На заданке активка, покупаю")
document.getElementById("8").checked=true;
_WND_proc('extras', 'buy', {id: 102}, event)
;
} else if(task.indexOf("на 20 игроков") >=0){
console.debug("На заданке игры на 20, врываюсь")
document.getElementById("20").checked=true;
;
} else if(task.indexOf("на 16 игроков") >=0){
console.debug("На заданке игры на 16, врываюсь")
document.getElementById("16").checked=true;
;
} else if(task.indexOf("на 12 игроков") >=0){
console.debug("На заданке игры на 12, врываюсь")
document.getElementById("12").checked=true;
;
} else if(task.indexOf("на 8 игроков") >=0){
console.debug("На заданке игры на 8, врываюсь")
document.getElementById("8").checked=true;
} else if(task.indexOf("молчит") >=0){
console.debug("На заданке игры с болтуном, пытаюсь сменить")
document.getElementById("8").checked=true;
;
} else if(task.indexOf("без смертей") >=0){
console.debug("На заданке игры супермена, врываюсь")
skipTask(function(data){
if(data.err && data.err==1){
document.getElementById("8").checked=true;
is8Fl=true;
callback();
return
}
StartGaming();
});
} else if(task.indexOf("играя за один клан") >=0){
console.debug("На заданке игра на опыт")
document.getElementById("8").checked=true;
} else{
console.debug("Заданки закончились??")
document.getElementById('task').checked=false;
StopCheat();
}
callback();
});
} else
callback();
}
function StartGaming(){
$('#task').attr('checked')=='checked'? gameOnTask=1: gameOnTask=0;
playOnTask(function(){
isHolydays=isHolydaysCheck();
is8Fl=document.getElementById("8").checked;
is12Fl=document.getElementById("12").checked;
is16Fl=document.getElementById("16").checked;
is20Fl=document.getElementById("20").checked;
isBronzaFl=document.getElementById("brnz").checked;
isSerebroFl=document.getElementById("srbr").checked;
isZolotoFl=document.getElementById("zlt").checked;
isPlatinaFl=document.getElementById("pltn").checked;
isBrilliantFl=document.getElementById("brl").checked;
isMyLeagueFl=document.getElementById("me").checked;
if(is8Fl || is12Fl || is16Fl || is20Fl)
botMode=1;
inRoomNickFl=document.getElementById("inRoom").checked;
getAukFl=document.getElementById("getAuk").checked;
getAukMoneyFl=document.getElementById("getAukMoney").checked;
console.debug("Started");
checkInGame();
clearInterval(intervalIdCheckGaming);
intervalIdCheckGaming=setInterval(checkInGame, 10000+rndm(10000));
});
}
function skipTask(callback){
$.ajax({
async: true,
cache: false,
type: "POST",
url: window.location.pathname+"DO/" + Math.random(),
data: {method: "cl_askip"},
dataType: "json",
success: function(data) {
console.debug(data);
callback(data);
}
});
}
function getTask(callback){
var sss;
$.ajax({
async: true,
cache: false,
type: "POST",
url: window.location.pathname+"DO/" + Math.random(),
data: {method: "cl_root", id: my_clan},
dataType: "json",
success: function(data) {
var _t = __ach[data.clach[0]]['text'];
callback(_t.replace(/%s/g, data.clach[3]))
}
});
}
function createMenu(){
/*основной див*/
var el = document.createElement("div");
el.id = "Menu";
el.style.width = "272px";
el.style.height = "352px";
el.style.background = "white";
el.style.opacity = "0.95";
el.style["border-radius"] = "10px";
el.style.position = "absolute";
el.style.right = "10px";
el.style.top = "110px";
el.style["z-index"] = "10000";
el.style["line-height"]="20px";
el.style.color = "black";
el.style["font-size"] = "10px";
el.style["text-align"] = "center";
el.style.overflow = "hidden";
el.style["white-space"] = "nowrap";
document.body.appendChild(el);
var btnshow = document.createElement('input')
btnshow.setAttribute("onclick", "showMenu()")
btnshow.type = 'button'
btnshow.style.width="86px";
btnshow.style.height = "40px";
btnshow.value="ShowMenu";
btnshow.style.position = "absolute";
btnshow.style.top = "0px";
btnshow.style.right = "0px";
btnshow.style.background = "#3F3D35";
btnshow.style.opacity="1.0";
btnshow.style.color="white";
btnshow.style["z-index"] = "10000";
btnshow.id="btnShow";
btnshow.hidden=true;
document.body.appendChild(btnshow);
var btn = document.createElement('input')
btn.setAttribute("onclick", "StartGaming();")
btn.type = 'button'
btn.style.width="86px";
btn.style.height = "40px";
btn.value="Start";
btn.style.position = "absolute";
btn.style.top = "180px";
btn.style.right = "151px";
btn.style.background = "#3F3D35";
btn.style.opacity="1.0";
btn.style.color="white";
var btnStop = document.createElement('input')
btnStop.setAttribute("onclick", "StopCheat();")
btnStop.type = 'button'
btnStop.style.width="59px";
btnStop.style.height = "40px";
btnStop.value="Stop";
btnStop.style.position = "absolute";
btnStop.style.top = "180px";
btnStop.style.right = "33px";
btnStop.style.background = "#3F3D35";
btnStop.style.opacity="1.0";
btnStop.style.color="white";
var btnPause= document.createElement('input')
btnPause.setAttribute("onclick", "PauseCheat();")
btnPause.type = 'button'
btnPause.style.width="59px";
btnPause.style.height = "40px";
btnPause.value="Pause";
btnPause.style.position = "absolute";
btnPause.style.top = "180px";
btnPause.style.right = "92px";
btnPause.style.background = "#3F3D35";
btnPause.style.opacity="1.0";
btnPause.style.color="white";
el.appendChild(btn);
el.appendChild(btnPause);
el.appendChild(btnStop);
var SizeOfRoom12 = document.createElement('input');
SizeOfRoom12.type = "checkbox";
SizeOfRoom12.id = "12";
SizeOfRoom12.style["margin-left"]="30px";
var SizeOfRoom8 = document.createElement('input');
SizeOfRoom8.type = "checkbox";
SizeOfRoom8.id = "8";
SizeOfRoom8.style["margin-left"]="30px";
SizeOfRoom8.checked=true;
var SizeOfRoom16 = document.createElement('input');
SizeOfRoom16.type = "checkbox";
SizeOfRoom16.id = "16";
SizeOfRoom16.style["margin-left"]="30px";
var SizeOfRoom20 = document.createElement('input');
SizeOfRoom20.type = "checkbox";
SizeOfRoom20.id = "20";
SizeOfRoom20.style["margin-left"]="30px";
var divRoom=document.createElement("div");
//divRoom.textContent="Размер комнат";
divRoom.style.width = "272px";
divRoom.style.height = "50px";
divRoom.style.position = "absolute";
divRoom.style.right = "0px";
divRoom.style.top = "0px";
var newlabel8 = document.createElement("Label");
newlabel8.setAttribute("for", "8");
newlabel8.innerHTML = "8";
var newlabel12 = document.createElement("Label");
newlabel12.setAttribute("for", "12");
newlabel12.innerHTML = "12";
var newlabel16 = document.createElement("Label");
newlabel16.setAttribute("for", "16");
newlabel16.innerHTML = "16";
var newlabel20 = document.createElement("Label");
newlabel20.setAttribute("for", "20");
newlabel20.innerHTML = "20";
var a1 = document.createElement("a");
a1.textContent="Выбор размера комнаты";
var br1 = document.createElement("br");
divRoom.appendChild(a1);
divRoom.appendChild(br1);
divRoom.appendChild(SizeOfRoom8)
divRoom.appendChild(newlabel8)
divRoom.appendChild(SizeOfRoom12)
divRoom.appendChild(newlabel12)
divRoom.appendChild(SizeOfRoom16)
divRoom.appendChild(newlabel16)
divRoom.appendChild(SizeOfRoom20)
divRoom.appendChild(newlabel20)
/*VIBOR LIGI*/
var divLeague=document.createElement("div");
//divLeague.textContent="Размер комнат";
divLeague.style.width = "272px";
divLeague.style.height = "50px";
divLeague.style.position = "absolute";
divLeague.style.right = "0px";
divLeague.style.top = "50px";
var brnz = document.createElement('input');
brnz.type = "checkbox";
brnz.id = "brnz";
brnz.style["margin-left"]="5px";
//brnz.style.display="block";
var srbr = document.createElement('input');
srbr.type = "checkbox";
srbr.id = "srbr";
srbr.style["margin-left"]="5px";
//srbr.style.display="block";
var zlt = document.createElement('input');
zlt.type = "checkbox";
zlt.id = "zlt";
zlt.style["margin-left"]="5px";
var pltn = document.createElement('input');
pltn.type = "checkbox";
pltn.id = "pltn";
pltn.style["margin-left"]="5px";
var brl = document.createElement('input');
brl.type = "checkbox";
brl.id = "brl";
brl.style["margin-left"]="5px";
var me = document.createElement('input');
me.type = "checkbox";
me.checked=true;
me.id = "me";
me.style["margin-left"]="5px";
var task = document.createElement('input');
task.type = "checkbox";
task.checked=true;
task.id = "task";
task.style["margin-left"]="5px";
var creat = document.createElement('input');
creat.type = "checkbox";
creat.id = "creat";
creat.style["margin-left"]="5px";
var newlabelbr = document.createElement("Label");
newlabelbr.setAttribute("for", "brnz");
newlabelbr.innerHTML = "Бронза";
var newlabelsr = document.createElement("Label");
newlabelsr.setAttribute("for", "srbr");
newlabelsr.innerHTML = "Серебро";
var newlabelzl = document.createElement("Label");
newlabelzl.setAttribute("for", "zlt");
newlabelzl.innerHTML = "Золото";
var newlabelpl = document.createElement("Label");
newlabelpl.setAttribute("for", "pltn");
newlabelpl.innerHTML = "Платина+";
var newlabelbrl = document.createElement("Label");
newlabelbrl.setAttribute("for", "brl");
newlabelbrl.innerHTML = "Бриллиант";
var newlabelme = document.createElement("Label");
newlabelme.setAttribute("for", "me");
newlabelme.innerHTML = "Моя лига";
var newlabelChaos = document.createElement("Label");
newlabelChaos.setAttribute("for", "task");
newlabelChaos.innerHTML = "Заданки";
var newlabelCreate = document.createElement("Label");
newlabelCreate.setAttribute("for", "creat");
newlabelCreate.innerHTML = "Создавать комнату";
var a = document.createElement("a");
a.textContent="Выбор лиги";
var br = document.createElement("br");
var br2 = document.createElement("br");
divLeague.appendChild(a);
divLeague.appendChild(br);
divLeague.appendChild(brnz)
divLeague.appendChild(newlabelbr)
divLeague.appendChild(srbr)
divLeague.appendChild(newlabelsr)
divLeague.appendChild(zlt)
divLeague.appendChild(newlabelzl)
divLeague.appendChild(pltn)
divLeague.appendChild(newlabelpl)
divLeague.appendChild(br2)
divLeague.appendChild(brl)
divLeague.appendChild(newlabelbrl)
divLeague.appendChild(me)
divLeague.appendChild(newlabelme)
divLeague.appendChild(document.createElement("br"))
divLeague.appendChild(document.createElement("br"))
divLeague.appendChild(task)
divLeague.appendChild(newlabelChaos)
divLeague.appendChild(creat)
divLeague.appendChild(newlabelCreate)
var inputMoney = document.createElement('input')
inputMoney.type = 'text'
inputMoney.style.width="72px";
inputMoney.style.height = "18px";
inputMoney.value="Стоимость";
inputMoney.style.position = "absolute";
inputMoney.style.top = "114px";
inputMoney.style.right = "94px";
inputMoney.style.background = "#D8C7C7";
inputMoney.style.opacity="1.0";
inputMoney.style.color="black";
inputMoney.style.border="solid 1px";
inputMoney.style["font-size"]="10px";
inputMoney.id="inputMoney";
el.appendChild(inputMoney);
el.appendChild(divRoom)
el.appendChild(divLeague)
var btnClose = document.createElement('input')
btnClose.setAttribute("onclick", "closeMenu();")
btnClose.type = 'button'
btnClose.style.width="22px";
btnClose.style.height = "22px";
btnClose.value="X";
btnClose.style.position = "absolute";
btnClose.style.top = "0px";
btnClose.style.right = "7px";
btnClose.style.background = "#3F3D35";
btnClose.style.opacity="1.0";
btnClose.style.color="white";
btnClose.style.border="solid 1px";
el.appendChild(btnClose);
var btnHide = document.createElement('input')
btnHide.setAttribute("onclick", "hideMenu();")
btnHide.type = 'button'
btnHide.style.width="22px";
btnHide.style.height = "22px";
btnHide.value="-";
btnHide.style.position = "absolute";
btnHide.style.top = "0px";
btnHide.style.right = "27px";
btnHide.style.background = "#3F3D35";
btnHide.style.opacity="1.0";
btnHide.style.color="white";
btnHide.style.border="solid 1px";
el.appendChild(btnHide);
var btnClan= document.createElement('input')
btnClan.setAttribute("onclick", "openClan();")
btnClan.type = 'button'
btnClan.style.width="40px";
btnClan.style.height = "20px";
btnClan.value="Clan";
btnClan.style.position = "absolute";
btnClan.style.top = "155px";
btnClan.style.right = "159px";
btnClan.style.background = "#3F3D35";
btnClan.style.opacity="1.0";
btnClan.style.color="white";
el.appendChild(btnClan);
var btnDuel= document.createElement('input')
btnDuel.setAttribute("onclick", "openDuel();")
btnDuel.type = 'button'
btnDuel.style.width="40px";
btnDuel.style.height = "20px";
btnDuel.value="Duel";
btnDuel.style.position = "absolute";
btnDuel.style.top = "155px";
btnDuel.style.right = "108px";
btnDuel.style.background = "#3F3D35";
btnDuel.style.opacity="1.0";
btnDuel.style.color="white";
el.appendChild(btnDuel);
var btnPrf= document.createElement('input')
btnPrf.setAttribute("onclick", "openPrf();")
btnPrf.type = 'button'
btnPrf.style.width="40px";
btnPrf.style.height = "20px";
btnPrf.value="Prof";
btnPrf.style.position = "absolute";
btnPrf.style.top = "155px";
btnPrf.style.right = "58px";
btnPrf.style.background = "#3F3D35";
btnPrf.style.opacity="1.0";
btnPrf.style.color="white";
el.appendChild(btnPrf);
var nickInp = document.createElement('input')
nickInp.type = 'text'
nickInp.style.width="72px";
nickInp.style.height = "18px";
nickInp.value="Ник";
nickInp.style.position = "absolute";
nickInp.style.top = "240px";
nickInp.style.right = "142px";
nickInp.style.background = "#D8C7C7";
nickInp.style.opacity="1.0";
nickInp.style.color="black";
nickInp.style.border="solid 1px";
nickInp.style["font-size"]="10px";
nickInp.id="nickInp";
el.appendChild(nickInp);
var takeAutInp = document.createElement('input')
takeAutInp.type = 'text'
takeAutInp.style.width="72px";
takeAutInp.style.height = "18px";
takeAutInp.value="Чокнутый Профессор";
takeAutInp.style.position = "absolute";
takeAutInp.style.top = "279px";
takeAutInp.style.right = "142px";
takeAutInp.style.background = "#D8C7C7";
takeAutInp.style.opacity="1.0";
takeAutInp.style.color="black";
takeAutInp.style.border="solid 1px";
takeAutInp.style["font-size"]="10px";
takeAutInp.id="takeAutInp";
el.appendChild(takeAutInp);
var takeAutMoneyInp = document.createElement('input')
takeAutMoneyInp.type = 'text'
takeAutMoneyInp.style.width="72px";
takeAutMoneyInp.style.height = "18px";
takeAutMoneyInp.value="Стоимость";
takeAutMoneyInp.style.position = "absolute";
takeAutMoneyInp.style.top = "316px";
takeAutMoneyInp.style.right = "142px";
takeAutMoneyInp.style.background = "#D8C7C7";
takeAutMoneyInp.style.opacity="1.0";
takeAutMoneyInp.style.color="black";
takeAutMoneyInp.style.border="solid 1px";
takeAutMoneyInp.style["font-size"]="10px";
takeAutMoneyInp.id="takeAutMoneyInp";
el.appendChild(takeAutMoneyInp);
var getAuk = document.createElement('input');
getAuk.type = "checkbox";
getAuk.id = "getAuk";
getAuk.style.position="absolute";
getAuk.style.top="279px";
getAuk.style.right="110px";
getAuk.checked=false;
var inRoom = document.createElement('input');
inRoom.type = "checkbox";
inRoom.id = "inRoom";
inRoom.style.position="absolute";
inRoom.style.top="240px";
inRoom.style.right="110px";
var getAukMoney = document.createElement('input');
getAukMoney.type = "checkbox";
getAukMoney.id = "getAukMoney";
getAukMoney.style.position="absolute";
getAukMoney.style.top="318px";
getAukMoney.style.right="110px";
var newlabelgetAuk= document.createElement("Label");
newlabelgetAuk.setAttribute("for", "getAuk");
newlabelgetAuk.innerHTML = "Брать аук с ролью ( * - любой аук):";
newlabelgetAuk.style.position="absolute";
newlabelgetAuk.style.top="261px";
newlabelgetAuk.style.right="50px";
var newlabelgetAukMoney = document.createElement("Label");
newlabelgetAukMoney.setAttribute("for", "getAukMoney");
newlabelgetAukMoney.innerHTML = "Набить аук на:";
newlabelgetAukMoney.style.position="absolute";
newlabelgetAukMoney.style.top="298px";
newlabelgetAukMoney.style.right="147px";
var newlabelinRoom = document.createElement("Label");
newlabelinRoom.setAttribute("for", "inRoom");
newlabelinRoom.innerHTML = "Заходить в комнату с ником:";
newlabelinRoom.style.position="absolute";
newlabelinRoom.style.top="222px";
newlabelinRoom.style.right="83px";
el.appendChild(getAuk);
el.appendChild(newlabelgetAukMoney);
el.appendChild(inRoom);
el.appendChild(newlabelinRoom);
el.appendChild(getAukMoney);
el.appendChild(newlabelgetAuk);
setInterval(function(){
$('.containerEraser').css('display','none');
}, 200)
}
createMenu();
/*СОЗДАНИЕ КОМНАТ + ВЫХОД*/
function Gaming(){
if( $("h1.day-night-chg")[0]==null) return 0;
else return 1;
}
function CreateRoom(){
try{
_GM_action('', 'create');
$("#crt_players").find("option:contains('8')").attr("selected", "selected");
$("#crt_league").find("option:contains('Моя лига')").attr("selected", "selected");
$('#crt_prior').click();
_GM_action('gmc_btn_create', 'create', 1, event);
} catch(e){}
}
setInterval(function(){
if(!Gaming() && $('#creat').attr('checked')=='checked' ){
CreateRoom();
} else
;
//$($('.footerButtons').find('button')[0]).click();
}, 5000+rndm(4000));
end
}