-
Notifications
You must be signed in to change notification settings - Fork 4
/
twadvanced.min.js
189 lines (189 loc) · 99.5 KB
/
twadvanced.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
(function(){function x(a,b,c,d){"string"===typeof b&&(d=c,c=b,b=!1);c=c||"";if(jQuery.isPlainObject(a))for(var e in a)c+=b?b.call(a[e],e,a[e]):a[e];else for(e=0;e<a.length;e++)c+=b?b.call(a[e],e,a[e]):a[e];return c+(d||"")}function W(a,b){var c,d;b?d=a.split("/"):(c=a.split(" "),d=c[1].split("/"));return(new Date(d[1]+"/"+d[0]+"/"+d[2]+" "+(b||c[0]))).getTime()}function P(a){var b=new Date(a);a=b.getHours();var c=b.getMinutes(),d=b.getSeconds(),e=b.getDate(),f=b.getMonth()+1,b=b.getFullYear();return(10>
a?"0"+a:a)+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)+" "+(10>e?"0"+e:e)+"/"+(10>f?"0"+f:f)+"/"+b}function X(a){var b=!1;if(/^\d+\:\d+\:\d+\s\d+\/\d+\/\d{4}$/.test(a)){a=a.split(" ");var b=a[1].split("/"),c=B.text().split("/"),b=new Date(b[1]+"/"+b[0]+"/"+b[2]+" "+a[0])>new Date(c[1]+"/"+c[0]+"/"+c[2]+" "+C.text())}return b}function h(a,b){return game_data.link_base_pure.replace(/village=\d+/,"village="+(b||game_data.village.id))+a}function Y(a){for(var b,c=0;c<TWMap.size[1];c++)for(var d=0;d<TWMap.size[0];d++){var e=
TWMap.map.coordByPixel(TWMap.map.pos[0]+TWMap.tileSize[0]*d,TWMap.map.pos[1]+TWMap.tileSize[1]*c);if(b=TWMap.villages[e.join("")])b.player=TWMap.players[b.owner],"string"===typeof b.points&&(b.points=Number(b.points.replace(".",""))),a.call(b,e)}}if("undefined"!==typeof TWA)return TWA;var Q=jQuery('<td class="icon-box"><div id="twa-menuOpen">twa</div></td>').appendTo("#menu_row2"),C=jQuery("#serverTime"),B=jQuery("#serverDate"),da=jQuery("#content_value"),l=(document.getElementById("overview")||{value:"production"}).value,
L=jQuery('<div id="twa-tooltip"/>').appendTo("body"),R;TWA={version:"1.6.2",assistentfarm:{id:0,init:function(){return alert("Essa ferramenta estar\u00e1 disponivel na proxima atualiza\u00e7\u00e3o...")},log:function(a,b){jQuery("#twa-assistent-log").after("<tr><td>"+TWA.assistentfarm.id++ +': <img src="'+(b?"/graphic/delete_small.png":"/graphic/command/attack.png")+'"/> '+a+"</td></tr>")},prepare:function(){var a=[],b=0;jQuery.get(location.href,function(c){jQuery("#am_widget_Farm table tr[class]",
c).each(function(){a.push(this)});setInterval(function(){TWA.assistentfarm.attack(a[b]);++b===a.length&&(b=0)},5E3)})},attackHandler:{sendUnits:function(a,b,c){jQuery.ajax({type:"post",url:Accountmanager.send_units_link,data:{target:a,template_id:b},village:c,success:function(a){a=JSON.parse(a);a.success?TWA.assistentfarm.log(a.success.replace("\n"," ")+" "+g.assistentfarm.onvillage+" "+this.village):a.error&&TWA.assistentfarm.log(a.error+" "+g.assistentfarm.onvillage+" "+this.village,!0)}})},reportAttack:function(a,
b,c){jQuery.ajax({type:"post",url:Accountmanager.send_units_link_from_report,data:{report_id:b},village:c,success:function(a){a=JSON.parse(a);a.success?TWA.assistentfarm.log(a.success.replace("\n"," ")+" "+g.assistentfarm.onvillage+" "+this.village):a.error&&TWA.assistentfarm.log(a.error+" "+g.assistentfarm.onvillage+" "+this.village,!0)}})}},attack:function(a){var b=jQuery(".farm_icon_a:not(.farm_icon_disabled)",a),c=jQuery(".farm_icon_b:not(.farm_icon_disabled)",a),b=jQuery(".farm_icon_c:not(.farm_icon_disabled)",
a).length?10:b.length?8:c.length?9:0,c=jQuery("td:eq("+b+") a",a).attr("onclick").toString().match(/(\d+), (\d+)/);TWA.assistentfarm.attackHandler[10===b?"reportAttack":"sendUnits"](c[1],c[2],jQuery("td:eq(3) a",a).html())}}};var Z=/^\d{1,3}\|\d{1,3}$/,ea=/^\d+\:\d+\:\d+\s\d+\/\d+\/\d{4}$/,S=!1,s,T,aa,ba,F,G,M,U;TWA.attackplanner={villages:{},edit:!1,init:function(){t.add("attackplanner",g.attackplanner.attackplanner,('<h3>{addcommand}</h3><table class="twa-table"><tr><th colspan="4">{attacker}</th><th colspan="4">{target}</th><th colspan="4">{time}</th><th colspan="4">{support}</th></tr><tr><td colspan="4"><input tooltip="xxx|yyy" name="from" class="twaInput"/> (<a href="#" id="twaCurrent">{current}</a>)</td><td colspan="4"><input tooltip="xxx|yyy" name="to" class="twaInput"/></td><td colspan="4"><input name="time" tooltip="hh:mm:ss dd/mm/yyyy" class="twaInput" value="'+
TWA.data.attackplanner.lastTime+'"/> (<a href="#" id="twaNow">{now}</a>)</td><td><input name="support" class="center" type="checkbox"/></td></tr></table><table class="twa-table"><tr><th colspan="'+Object.keys(TWA.data.units).length+'">{troops}</th><th>{allunits}</th></tr><tr>'+x(TWA.data.units,function(a){return'<td><img src="http://cdn.tribalwars.net/graphic/unit/unit_'+a+'.png" style="margin-bottom:-4px"/> <input unit="'+a+'" class="units twaInput"/></td>'},!1,'<td><label><input name="allunits" class="center" type="checkbox"/></label></td>')+
'</tr></table><div style="display:none"><h3>{commands}</h3><table class="twa-table"><thead><tr><th>{attacker}</th><th>{target}</th><th>{time}</th><th>{type}</th><th>{troops}</th><th>{options}</th></tr></thead><tbody class="commands"></tbody></table></div><div style="display:none"><h3>{commandssended}</h3><div style="overflow:auto;height:150px"><table class="log twa-table"><thead><tr><th>{attacker}</th><th>{target}</th><th>{time}</th><th>{type}</th></tr><thead></table></div></div>').lang("attackplanner"),
function(){var a=!1,b=!1,c=X(TWA.data.attackplanner.lastTime);s=this.find(".commands");T=this.find(".attackplanner .log");G=this.find("[name=from]");M=this.find("[name=to]");F=this.find("[name=time]");aa=this.find("[name=allunits]");ba=this.find("[name=support]");U=this.find(".units");u.add("attackplanner",{".attackplanner .units":{width:33},".attackplanner input":{width:90,height:20,"text-align":"center"},'.attackplanner [name="time"]':{width:200,border:"1px solid #aaa"},".attackplanner .cmdUnits":{display:"inline-block",
"text-align":"center",margin:"0 3px"},".attackplanner .cmdUnits img":{margin:"0 -3px -3px 1px",width:15},".attackplanner .error":{border:"1px solid red"},".attackplanner tr.editCurrent td":{background:"#F0F09E"}});ba.checkStyle();aa.checkStyle("click",function(){jQuery(".attackplanner .units").attr("disabled",jQuery("input[name=allunits]")[0].checked)});jQuery("#twaNow").click(function(){F.val(C.text()+" "+B.text());return!1});jQuery("#twaCurrent").click(function(){G.val(game_data.village.coord).removeClass("error");
return!1});TWA.attackplanner.update();jQuery.acceptOnly([G,M],"num | enter",function(d){if(13===d.keyCode)return a&&b&&c&&TWA.attackplanner.add();if("from"===this.name){if(!a)return!0;m("addUnitsInput",function(){TWA.attackplanner.villageInfo(this.value,function(a){jQuery.get(h("place",a.id),function(a){jQuery(".unitsInput",a).each(function(a){var b=Number(this.nextElementSibling.innerHTML.match(/\d+/)[0]);U[a].value=0<b?b:""})})})},500,this)}});m("checkInputs",function(){G[(a=Z.test(G[0].value))?
"removeClass":"addClass"]("error");M[(b=Z.test(M[0].value))?"removeClass":"addClass"]("error");F[(c=X(F[0].value))?"removeClass":"addClass"]("error");return!0},200);F.acceptOnly("space num : / enter",function(d){if(13===d.keyCode)return a&&b&&c&&TWA.attackplanner.add();if(38===d.keyCode||40===d.keyCode){if(ea.test(this.value)){var e=this.value.split(" "),f=e[1].split("/"),j=e[0].split(":"),p=[23,59,59,0,12,2050],g=[],h=this.selectionStart,e=19-this.value.length,k=[],n,j=j.concat(f).map(function(a,
b){g[b]=a.length+(b?g[b-1]+1:0);return parseInt(a,10)});g.every(function(a,b){return h<=a?(n=b,!1):!0});38===d.keyCode?(d=p[n],3===n&&(d=(new Date(f[2],f[1],0)).getDate()),++j[n]>d&&(j[n]=d)):(f=2<n?1:0,--j[n]<f&&(j[n]=f));j.every(function(a,b){k.push(2>String(a).length&&10>a?"0"+a:a);k.push(2>b?":":3>b?" ":5>b?"/":"");return!0});this.value=k.join("");this.selectionStart=this.selectionEnd=e+h}return!1}});U.acceptOnly("num enter",function(d){if(13===d.keyCode)return a&&b&&c&&TWA.attackplanner.add()});
c||jQuery(".attackplanner [name=time]").addClass("error")});m("checkAttacks",function(){TWA.attackplanner.checkAttacks();return!0},500)},add:function(){var a=jQuery(".attackplanner input");TWA.data.attackplanner.lastTime=a[2].value=jQuery.trim(a[2].value);if(a[0].value===a[1].value)return alert(g.attackplanner.errorequal);for(var b=!1,c={target:a[1].value,village:a[0].value,time:W(a[2].value),units:{},support:a[3].checked,all:a.filter("[name=allunits]")[0].checked},d=4;d<a.length;d++)Number(a[d].value)&&
(c.units[a[d].getAttribute("unit")]=Number(a[d].value),b=!0);if(!b)return alert(g.attackplanner.errorunits);TWA.attackplanner.edit?(TWA.data.attackplanner.commands[TWA.attackplanner.edit]=c,TWA.attackplanner.edit=!1,s.find("tr.edit").removeClass("editCurrent")):TWA.data.attackplanner.commands.push(c);TWA.attackplanner.update();TWA.storage(!0,null,"data")},update:function(a){if(!TWA.attackplanner.mailLink)return jQuery.get(h("mail"),function(b){TWA.attackplanner.mailLink=this.url+"&mode=new&action=send&h="+
b.match(/"csrf":"(\w+)"/)[1];TWA.attackplanner.update(a)});if(TWA.data.attackplanner.commands.length){S||(S=!0,s.parent().parent().show());var b=TWA.data.attackplanner.commands.sort(function(a,b){return a.time-b.time});s.empty();for(var c=0;c<b.length;c++){var d=jQuery('<tr id="__id"><td class="coord __from"><img src="http://www.preloaders.net/preloaders/252/preview.gif" style="width:25px" class="load"/></td><td class="coord __target"><img src="http://www.preloaders.net/preloaders/252/preview.gif" style="width:25px" class="load"/></td><td>__time</td><td><img src="/graphic/command/__type.png"/></td><td>__units</td><td><a href="#" class="remove"><img src="/graphic/delete.png"/></a> <a href="#" class="editCommand"><img src="/graphic/edit.png"/></a></td></tr>'.replace("__id",
c).replace("__from",b[c].village).replace("__target",b[c].target).replace("__time",P(b[c].time)).replace("__type",b[c].support?"support":"attack").replace("__units",b[c].all?g.attackplanner.allunits:x(b[c].units,function(a){return'<span class="cmdUnits"><img src="http://cdn.tribalwars.net/graphic/unit/unit_'+a+'.png"/><br/><span class="'+a+'">'+this+"</span></span>"}))).appendTo(s);d.find(".remove").click(function(){var a=this.parentNode.parentNode;TWA.data.attackplanner.commands.remove(Number(a.id));
TWA.attackplanner.update();TWA.attackplanner.edit&&TWA.attackplanner.edit==a.id&&(TWA.attackplanner.edit=!1);TWA.storage(!0,null,"data");return!1});d.find(".editCommand").click(function(){var a=jQuery(".attackplanner input"),b=this.parentNode.parentNode,c=b.getElementsByTagName("td");b.className="editCurrent";a[0].focus();a[0].value=c[0].className.split(" ")[1];a[1].value=c[1].className.split(" ")[1];a[2].value=c[2].innerHTML;a[3].checked=TWA.data.attackplanner.commands[b.id].support;a.filter(".units").val("");
TWA.data.attackplanner.commands[b.id].all?a.filter("[name=allunits]:not(:checked)").next().trigger("click"):jQuery("span",c[4]).each(function(){a.filter("[unit="+this.className+"]").val(this.innerHTML)});TWA.attackplanner.edit=b.id;return!1})}s.find(".coord").each(function(){var a=this.className.split(" ")[1];if(TWA.attackplanner.villages[a]){if(TWA.attackplanner.villages[a].error)return this.innerHTML=g.attackplanner.errorcoords.springf(a),!0;this.innerHTML='<a href="'+h("info_village&id="+TWA.attackplanner.villages[a].id)+
'">'+TWA.attackplanner.villages[a].name+"</a>"}else TWA.attackplanner.villageInfo(a,function(a,b){var c=s.find('.coord[class*="'+b+'"]');if(a.error)return c.html(g.attackplanner.errorcoords.springf(b)),!0;c.html('<a href="'+h("info_village&id="+a.id)+'">'+a.name+"</a>")})})}else S=!1,s.parent().parent().hide(),s.empty();a&&a()},villageInfo:function(a,b){if(TWA.attackplanner.villages[a])return b?b(TWA.attackplanner.villages[a]):TWA.attackplanner.villages[a];if("undefined"===typeof TWA.attackplanner.villages[a])TWA.attackplanner.villages[a]=
!1;else return!1;jQuery.post(TWA.attackplanner.mailLink,{extended:0,preview:1,to:game_data.player.name,subject:"0",text:"[coord]"+a+"[/coord]"},function(c){c=jQuery('td[style="background-color: white; border: solid 1px black;"] a:first',c);TWA.attackplanner.villages[a]=c.length?{error:!1,name:c.text(),id:c.attr("href").match(/id=(\d+)/)[1]}:{error:!0};b(TWA.attackplanner.villages[a],a)})},checkAttacks:function(){if(!TWA.data.attackplanner.commands[0])return!1;for(var a=W(B.text(),C.text()),b=TWA.data.attackplanner.commands.length,
c=[];TWA.data.attackplanner.commands[0];)if(a>TWA.data.attackplanner.commands[0].time-1E3)c.push(TWA.data.attackplanner.commands.shift());else break;if(b!==TWA.data.attackplanner.commands.length){TWA.attackplanner.update();var d=P((new Date).getTime());(function f(){setTimeout(function(){TWA.attackplanner.attack(c.shift(),d);c.shift();c.length&&f()},250)})();TWA.storage(!0,null,"data")}},attack:function(a,b){TWA.attackplanner.villageInfo(a.village,function(){var c=function(c){c=c||a.units;var e=a.target.split("|"),
e=jQuery.extend({x:e[0],y:e[1]},c),f=TWA.attackplanner.villages[a.village],g=TWA.attackplanner.villages[a.target];e[a.support?"support":"attack"]=!0;jQuery.post(h("place&try=confirm",f.id),e,function(e){var A=jQuery("#error",e);if(A.text())return T.append('<tr><td colspan="5">'+b+" - "+A.text()+"</td></tr>");e=jQuery("form",e);jQuery.post(e[0].action,e.serialize(),function(){T.append('<tr><td><a href="'+h("info_village&id="+f.id)+'">'+f.name+'</a></td><td><a href="'+h("info_village&id="+g.id)+'">'+
g.name+"</a></td><td><strong>"+b+'</strong></td><td><img src="/graphic/command/'+(a.support?"support":"attack")+'.png"/></td><td>'+x(c,function(a){return'<img src="http://cdn.tribalwars.net/graphic/unit/unit_'+a+'.png" style="margin:0px -3px -3px;width:15px"/> '+this+" "})+"</td></tr>")})})};a.all?TWA.attackplanner.villageUnits(a.village,function(){c(this)}):c()})},villageUnits:function(a,b){TWA.attackplanner.villageInfo(a,function(a){jQuery.get(h("place",a.id),function(d){var e={};jQuery("#menu_map_link",
d)[0].href.match(/village=(\d+)/)[1]==a.id&&(jQuery(".unitsInput",d).each(function(){var a=this.id.split("_")[2];e[a]=Number(this.nextElementSibling.innerHTML.match(/\d+/)[0])}),b.call(e))})})}};var D={attack:!0},H=[],I=!1,J=!0;TWA.autofarm={init:function(){t.add("autofarm",g.autofarm.autofarm,('<h2>{autofarm}</h2><table><tr><th>{units}</th></tr><tr><td class="units"></td></tr><tr><th>{coords}</th></tr><tr><td><textarea name="coords" class="twaInput">'+TWA.settings._autofarm.coords.join(" ")+'</textarea></td></tr><tr><th>{options}</th></tr><tr><td><label><input type="checkbox" name="protect"/><span>{protect}</span></label><label><input type="checkbox" name="random"/><span>{random}</span></label><button class="twaButton">{start}</button></td></tr></table>').lang("autofarm"),
function(){u.add("autofarm",{".autofarm .units input":{width:40,height:20,"text-align":"center","margin-bottom":-4},".autofarm img":{margin:"0 3px -4px 10px"},'.autofarm [name="coords"]':{width:584,height:90,"font-size":12},".autofarm table":{width:"100%"},".autofarm table th":{background:"-special-linear-gradient(right, #EEE 30%, #DDD 100%) !important","border-radius":"5px 0px 0px 5px",padding:10,"font-size":13},".autofarm table td":{background:"none",padding:10},".autofarm label":{display:"block",
height:25,"line-height":20},".autofarm label span":{"margin-left":5},".autofarm .log":{"overflow-y":"scroll",height:150},".autofarm .log td":{padding:2,"border-bottom":"1px solid #DADADA"}});jQuery(".autofarm .units").append(x(TWA.data.units,function(a){return'<img src="http://cdn.tribalwars.net/graphic/unit/unit_'+a+'.png"/> <input name="'+a+'" class="twaInput"/>'})).find("input").acceptOnly("num",function(){m("autofarmSave",function(){TWA.settings._autofarm.units[this.name]=D[this.name]=Number(this.value);
TWA.storage(!0)},500,this)}).each(function(){Number(TWA.settings._autofarm.units[this.name])&&(this.value=TWA.settings._autofarm.units[this.name])});jQuery(".autofarm [name=coords]").acceptOnly("num space |",function(){m("autofarmSave",function(){for(var a=this.value.split(/\s+/),c=[],d=0;d<a.length;d++)/-?\d{1,3}\|-?\d{1,3}/.test(a[d])&&c.push(a[d]);TWA.settings._autofarm.coords=c;TWA.autofarm.next(!0);TWA.storage(!0)},500,this)});jQuery(".autofarm input[type=checkbox]").each(function(){this.checked=
TWA.settings._autofarm[this.name]}).checkStyle().change(function(){TWA.settings._autofarm[this.name]=this.checked;TWA.storage(!0)});jQuery(".autofarm button").click(function(){J?(this.innerHTML=g.autofarm.stop,J=!1,TWA.autofarm.attack()):(this.innerHTML=g.autofarm.continueAtt,J=!0,m.remove("autofarmAttack"))});for(var a in timers)timers[a].reload=!1;for(name in TWA.data.units)D[name]=TWA.settings._autofarm.units[name];TWA.settings._autofarm.index>=TWA.settings._autofarm.coords.length&&(TWA.settings._autofarm.index=
0);TWA.settings._autofarm.coords.length&&(H=TWA.settings._autofarm.coords[TWA.settings._autofarm.index].split("|"))})},log:function(a,b){TWA.autofarm.$log||(TWA.autofarm.$log=jQuery('<div class="log"><table></table></div>').appendTo("div.autofarm"));TWA.autofarm.$log.prepend("<tr><td><strong>"+(C.text()+" "+B.text())+':</strong> <img src="/graphic/'+(b?"delete_small":"command/attack")+'.png"/> '+a+"</td></tr>");return TWA.autofarm},attack:function(a,b){if(!J){b||(D.x=H[0],D.y=H[1]);if(a)for(var c in a)D[c]=
a[c];jQuery.ajax({url:h("place&try=confirm"),type:"post",data:D,success:function(a){if(jQuery('img[src="/game.php?captcha"]',a).length)return!1;var b=jQuery("#error",a),c=TWA.autofarm.troops(a);if(b.text())(a=TWA.autofarm.commands(a))&&!c?(!I&&TWA.autofarm.log(g.autofarm.waitingreturn,!0),m("autofarmAttack",function(){TWA.autofarm.attack(!1,!0)},a),I=!0):!a&&!c?(!I&&TWA.autofarm.log(g.autofarm.notroops,!0),m("autofarmAttack",function(){TWA.autofarm.attack(!1,!0)},1E4),I=!0):c&&TWA.autofarm.attack(c,
!0);else{if(TWA.settings._autofarm.protect&&jQuery("form a[href*=player]",a).length)return TWA.autofarm.next();c=jQuery("form",a);jQuery.post(c[0].action,c.serialize(),function(){TWA.autofarm.log(g.autofarm.success.springf(H.join("|"))).next();I=!1})}},error:function(){TWA.autofarm.attack(a,!0)}});return TWA.autofarm}},commands:function(a){var b=jQuery("table.vis:last tr:not(:first)",a);a=b.find("[src*=cancel], [src*=back], [src*=return]");b=b.find("[src*=attack]");a=a.length?a:b.length?b:!1;if(!a)return!1;
if(a=a.eq(0).parent().parent().find(".timer").text())return a=a.split(":"),36E5*a[0]+6E4*a[1]+1E3*a[2]},troops:function(a){var b={},c,d;jQuery(".unitsInput",a).each(function(){c=this.id.split("_")[2];d=Number(this.nextElementSibling.innerHTML.match(/\d+/)[0]);TWA.settings._autofarm.units[c]&&d>=TWA.settings._autofarm.units[c]&&(b[c]=d)});return!$.isEmptyObject(b)?b:!1},next:function(a){a||TWA.settings._autofarm.index++;TWA.settings._autofarm.index>=TWA.settings._autofarm.coords.length&&(TWA.settings._autofarm.index=
0);TWA.storage(!0);TWA.settings._autofarm.coords.length&&(H=TWA.settings._autofarm.coords[TWA.settings._autofarm.index].split("|"));a||(TWA.settings._autofarm.random?m("autofarmAttack",function(){TWA.autofarm.attack()},1E4*Math.random()):TWA.autofarm.attack());return TWA.autofarm},pageLoad:function(){var a="overview main mail&mode=mass_out recruit barracks place ranking&mode=player&from=1&lit=1 ally forum stone premium reports mail settings map".split(" ");m("pageLoad",function(){if(J)return TWA.autofarm.pageLoad();
jQuery.get(h(a[Math.floor(Math.random()*a.length)]),function(){TWA.autofarm.pageLoad()})},2E4*Math.random())}};TWA.building={init:function(){jQuery("#twa-overviewtools").show().append('<tr id="twa-building"><th><label><input type="radio" checked name="twa-building" id="twa-building-build"/> {buildtitle} <img src="graphic/questionmark.png" width="13" title="{buildhelp}"/></label> <a href="#" id="twa-cancel-builds">\u00bb {cancelbuilds}</a></th></tr><tr><td class="twa-buildings"></td></tr><tr><th><label><input type="radio" name="twa-building" id="twa-building-destroy"/> {destroytitle} <img src="graphic/questionmark.png" width="13" title="{destroyhelp}"/></label> <a href="#" id="twa-cancel-destroy">\u00bb {canceldestroy}</a></th></tr><tr><td class="twa-buildings"></td></tr><tr><th>{help}</th></tr>'.lang("building"));
jQuery("#twa-building-build, #twa-building-destroy").click(function(){1===BuildingOverview._display_type&&"twa-building-destroy"===this.id||0===BuildingOverview._display_type&&"twa-building-build"===this.id||BuildingOverview.show_all_upgrade_buildings("twa-building-destroy"===this.id)});jQuery("#twa-cancel-builds, #twa-cancel-destroy").unbind("click").click(function(){confirm(g.building.confirmcancel.springf("twa-cancel-destroy"===this.id?g.building.demolitions:g.building.buildings))&&TWA.building.cancel("twa-cancel-destroy"===
this.id);return!1});!1===BuildingOverview._display_type?BuildingOverview.show_all_upgrade_buildings():BuildingOverview._display_type&&jQuery("#twa-building-destroy").attr("checked",!0);for(var a=0;2>a;a++){var b=jQuery(".twa-buildings").eq(a),c;for(c in TWA.data.builds)c=TWA.data.builds[c],b.append('<img src="graphic/buildings/'+c+'.png"/> <input type="text" style="width:25px" name="'+c+'" value="'+TWA.settings[a?"_buildingdestroy":"_buildingbuild"][c]+'"/> ')}jQuery(".twa-buildings").each(function(a){jQuery("input",
this).keyup(function(){var b=this;clearTimeout(void 0);setTimeout(function(){TWA.settings[a?"_buildingdestroy":"_buildingbuild"][b.name]=b.value;TWA.storage(!0)},2E3)}).keypress(function(a){return 47<a.charCode&&58>a.charCode&&3>this.value.length})});jQuery("#buildings_table tr:first th:has(img[src*=buildings]) a").click(function(){return TWA.building._do(jQuery("img",this)[0].src.match(/\/([a-z]+)\.png/)[1],BuildingOverview._display_type)})},_do:function(a,b){var c=jQuery("#upgrade_building_link").val(),
d=b?5:TWA.settings._buildingmaxorders,e=Number(jQuery(".twa-buildings").eq(b).find("input[name="+a+"]").val());jQuery("#buildings_table tr:not(:first)").each(function(){var f=this.className.match(/\d+/)[0];if(BuildingOverview._upgrade_villages[f].buildings[a])for(var g=jQuery("td:last li:has(.build-status-light[style*="+(b?"red":"green")+']) img[src*="'+a+'.png"]',this),g=Number(jQuery(".b_"+a+" a",this).text())+g.length,p=jQuery("#building_order_"+f+" img").length/2;p<d;p++)(b?g-- >e:g++<e)&&jQuery.ajax({url:c.replace(/village=\d+/,
"village="+f),data:{id:a,destroy:b,force:1},async:!1,dataType:"json",success:function(a){if(a.success){if(!jQuery("#building_order_"+f).length){var b=jQuery('<ul class="building_order" id="building_order_'+f+'"></ul>');BuildingOverview.create_sortable(b);jQuery("#v_"+f+" td:last").append(b)}jQuery("#building_order_"+f).html(a.building_orders)}}})});return!1},cancel:function(a){jQuery("li:has(.build-status-light[style*="+(a?"red":"green")+"]) .build-cancel-icon img").click()}};TWA.changegroups={init:function(){jQuery("#twa-overviewtools").show().append('<tr id="twa-changegroups"><td>{changegroups} <select id="twa-group" name="selected_group"></select> <input type="submit" value="{add}" name="add_to_group"/> <input type="submit" value="{remove}" name="remove_from_group"/> <input type="submit" value="{move}" name="change_group"/> <img src="http://www.preloaders.net/preloaders/252/preview.gif" style="width:25px;display:none" id="twa-loader"/></td></tr>'.lang("changegroups"));
jQuery("#twa-changegroups input").click(function(){TWA.changegroups.change(this)});var a=document.getElementById("twa-group"),b=TWA.changegroups.getgroups(),c;for(c in b)a.innerHTML+='<option value="'+c+'" name="village_ids[]">'+b[c]+"</option>"},change:function(a){jQuery("#twa-loader").show();var b=jQuery('[name="village_ids[]"], [name=selected_group]').serializeArray();b.push({name:a.name,value:a.value});jQuery.post(h("overview_villages&mode=groups&action=bulk_edit_villages&h="+game_data.csrf),
b,function(){jQuery("#twa-loader").hide()})},getgroups:function(){var a={};jQuery("#group_table tr:not(:first, :last) td[id^=show_group] a").each(function(){a[this.href.match(/edit_group=(\d+)/)[1]]=this.innerHTML});return a}};TWA.config=function(){var a=x({other:"autofarm lastattack reportfilter villagefilter reportrename commandrename renamevillages mapgenerator reportcalc troopcounter assistentfarm building research changegroups attackplanner selectvillages overview".split(" "),coords:["mapcoords",
"profilecoords","mapidentify","mapmanual"],graphicstats:["rankinggraphic","allygraphic","profilestats"]},function(a,b){return x(b,function(){return'<label tooltip="'+g.config.tooltip[this]+'"><input type="checkbox" name="'+this+'"/> <span>'+g.config[this]+"</span></label>"},"<div><h1>"+g.config[a]+"</h1>","</div>")},'<div id="twa-tooltip"></div><div class="content">');u.add("config",{".config .content div:first-child":{"margin-left":0},".config .content div":{display:"block","float":"left","margin-left":"1%",
width:"49.5%"},".config .content .bottom":{width:"100%","text-align":"center"},".config textarea":{border:"1px solid #999",width:280,height:80,"font-size":12},".config select":{border:"1px solid #999",width:70,margin:"0 2px","font-size":12},".config input":{border:"1px solid #999",margin:3},".config h1":{background:"#e4e4e4","border-bottom":"1px solid #c4c4c4","border-top":"1px solid #fff",color:"#333","font-size":13,"font-weight":"bold","line-height":20,margin:"6px 0 10px",padding:"3px 7px"},".config label":{margin:"3px 0",
display:"block",height:20,"line-height":21},".config label span":{"margin-left":5}});t.add("config","</div>"+g.config.config,a+"<div><h1>Languages</h1><label>Language: "+x(N,function(a){return"<option value="+a+">"+this.lang+"</option>"},'<select style="width:120px" name="lang">')+'</select></label></div><div class="bottom"><button class="twaButton">{save}</button></div>'.lang("config"),function(){this.find("input[type=checkbox]").checkStyle();jQuery(".config [tooltip]").tooltip();jQuery(".config button").click(function(){jQuery(".config input").each(function(){TWA.settings[this.name]=
"checkbox"===this.type?jQuery(this).is(":checked"):this.value});TWA.settings.lang=jQuery("[name=lang]").val();TWA.storage(!0);alert(g.config.savealert)})});for(var b in TWA.settings)"_"!==b[0]&&(document.getElementsByName(b)[0]["boolean"===typeof TWA.settings[b]?"checked":"value"]=TWA.settings[b])};TWA.lastAttack=function(){if(!document.getElementById("show_popup").checked||!document.getElementById("map_popup_attack").checked)return!1;jQuery(".twa-lastattack").remove();return Y(function(){jQuery.ajax({url:"game.php?village="+
this.id+"&screen=overview&json=1&source=873",dataType:"json",id:this.id,success:function(a){if(a[0].attack){a=a[0].attack.time.split(/\s[A-z]/)[0].split(".");a=(new Date([a[1],a[0],"20"+a[2]].join(" "))).getTime();var b=B.text().split("/"),b=(new Date([b[1],b[0],b[2],C.text()].join(" "))).getTime(),c=(new Date(b-a)).getTime();a=Math.floor(c/31536E6);var b=Math.floor(c/864E5),d=Math.floor(c/36E5),c=Math.floor(c/6E4);1==a?a=a+" "+g.lastattack.year:1<a?a=a+" "+g.lastattack.years:1<b?a=b+g.lastattack.days+
" "+d%24+"h":0<d?(c%=60,a=(10>d?"0"+d:d)+":"+(10>c?"0"+c:c)+"h"):(c=10>c?"0"+c:c,a="00:"+c+"m");TWA.mapElement({vid:this.id,html:a,Class:"twa-lastattack",pos:[25,2]},{width:45,height:10,fontSize:8,borderRadius:5,color:"#fff",textAlign:"center",background:"#111",border:"1px solid #000",opacity:0.7})}}})})};var E=0,O=[],K={},y,z,ca=function(a,b){if(13===a.keyCode){jQuery(".lastConquests tbody:first").empty();y.show();z.hide();E=0;var c=(new Date).getTime()/1E3-3600*(24<this.value?24:this.value);return jQuery.get("/interface.php?func=get_conquer&since="+
c,function(a){a=a.split("\n");for(var c=a.length-1;0<=c;c--)O.push(a[c]);TWA.lastConquests.post(20*E,20,b)})}};TWA.lastConquests={init:function(){u.add("lastConquests",{".lastConquests table":{width:"100%"},".lastConquests th":{"text-align":"center",background:"-special-linear-gradient(bottom, #BBB 30%, #CCC 100%) !important",padding:7},".lastConquests td":{"text-align":"center",padding:"7px 0",height:15,"border-bottom":"1px solid rgba(0,0,0,.05)"},".lastConquests .time":{"text-align":"center",padding:"3px 10px",
width:13}});t.add("lastConquests",g.lastConquests.lastConquests,'<p>{loadLast} <input type="text" class="time twaInput" value="1"/> {hours}. (max 24h)</p><table><thead><tr><th>{village}</th><th style="width:150px">{date}</th><th>{newOwn}</th><th>{oldOwn}</th></tr></thead><tbody></tbody></table><table><tr><td><a href="#" id="twaPageUp" style="display:none">{pageUp}</a></td><td><a href="#" id="twaPageDown">{pageDown}</a></td></tr></table>'.lang("lastConquests"),function(){this.find("tbody:first").empty();
z=jQuery("#twaPageUp");y=jQuery("#twaPageDown");ca.call(this.find(".time").acceptOnly("num enter",ca)[0],{keyCode:13},!0);z.click(function(){z.attr("colspan",1);y.show();0===--E&&(z.hide(),y.attr("colspan",2));TWA.lastConquests.post(20*E,20);return!1});y.click(function(){y.attr("colspan",1);z.show();++E===Math.floor(O.length/20)&&(y.hide(),z.attr("colspan",2));TWA.lastConquests.post(20*E,20);return!1})})},load:function(a,b){if(0==b)return jQuery("."+a+b).parent().text(g.lastConquests.abandoned);K[a+
b]?"string"===typeof K[a+b]&&jQuery("."+a+b).text(K[a+b]):(K[a+b]=!0,jQuery.get(h("info_"+a+"&id="+b),function(c){jQuery("."+a+b).text(K[a+b]=jQuery("h2",c).text())}))},post:function(a,b,c){for(var d=jQuery(".lastConquests tbody:first").empty(),e=a;e<a+b&&O[e];e++){var f=O[e].split(",");jQuery('<tr><td><a class="village'+f[0]+'" href="'+h("info_village&id="+f[0])+'"></a></td><td class="time">'+P(1E3*f[1])+'</td><td><a class="player'+f[2]+'" href="'+h("info_player&id="+f[2])+'"></a></td><td><a class="player'+
f[3]+'" href="'+h("info_player&id="+f[3])+'"></a></td></tr>').appendTo(d);TWA.lastConquests.load("village",f[0]);TWA.lastConquests.load("player",f[2]);TWA.lastConquests.load("player",f[3])}c&&20>e&&y.hide()}};TWA.mapCoords={init:function(){var a=jQuery('<br/><table class="vis" width="100%" id="twa-getcoords"><tr><th>{getcoords} <a href="#" class="refresh">\u00bb {update}</a></th></tr><tr><td style="text-align:center"><textarea style="width:100%;background:none;border:none;resize:none;font-size:11px"></textarea></td></tr><tr><td class="options"><label><input type="checkbox" name="_mapplayers"> {mapplayers}</label> {min}: <input name="_mapplayersmin" style="width:35px"> {max}: <input name="_mapplayersmax" style="width:35px"><br/><label><input name="_mapabandoneds" type="checkbox"> {mapabandoneds}</label> {min}: <input name="_mapabandonedsmin" style="width:35px"> {max}: <input name="_mapabandonedsmax" style="width:35px"></td></tr></table>'.lang("mapcoords")).insertAfter("#map_whole");
a.find(".options input").each(function(){this["checkbox"===this.type?"checked":"value"]=TWA.settings[this.name]}).change(function(){var a=this;m("savemapCoords",function(){var c=a["checkbox"===a.type?"checked":"value"];TWA.settings[a.name]="checkbox"===a.type?c:Number(c);TWA.storage(!0)},1E3)});a.find(".refresh").click(function(){return TWA.mapCoords.get()});TWA.mapCoords.get()},get:function(){var a=[],b;jQuery(".twa-identify").remove();Y(function(c){if(b="0"===this.owner?TWA.settings._mapabandoneds&&
this.points>Number(TWA.settings._mapabandonedsmin)&&this.points<Number(TWA.settings._mapabandonedsmax):TWA.settings._mapplayers&&this.points>Number(TWA.settings._mapplayersmin)&&this.points<Number(TWA.settings._mapplayersmax))a.push(c.join("|")),TWA.settings.mapidentify&&TWA.mapElement({id:"twa-mapcoords"+this.id,vid:this.id,Class:"twa-identify",pos:[TWA.settings.lastattack&&game_data.player.premium?15:25,38]},{width:7,height:7,borderRadius:10,background:"green",border:"1px solid #000",opacity:0.7})});
jQuery("#twa-getcoords textarea").html(a.join(" "));return!1}};TWA.mapElement=function(a,b){var c=jQuery("#map_village_"+a.vid),d=a.pos||[0,0],d=jQuery("<div/>").css(jQuery.extend(b,{top:Number(c.css("top").replace("px",""))+d[0],left:Number(c.css("left").replace("px",""))+d[1],zIndex:10,position:"absolute","border-radius":b.borderRadius})).addClass(a.Class);a.id&&d.attr("id",a.id);a.html&&d.html(a.html);c.parent().prepend(d)};TWA.mapGenerator=function(){var a=/ally/.test(game_data.mode)?"t":"p",
b="00ff00 999999 823c0a b40000 f40000 0000f4 880088 f0c800 00a0f4 ff8800 ffff00 e0d3b8 04b45f 04b4ae 81f7f3 be81f7 fa58f4 ff0088 ffffff f7be81".split(" "),c=120,d=500,e=500;if(/con/.test(game_data.mode))var f=jQuery("#con_player_ranking_table, #con_ally_ranking_table"),c=320,g=jQuery("h3").html().match(/\d+/)[0],g=1===g.length?"0"+g:g,d=g[1]+"50",e=g[0]+"50";else/kill/.test(game_data.mode)?f=jQuery("#kill_player_ranking_table, #kill_ally_ranking_table").next():"awards"===game_data.mode?f=jQuery("#award_ranking_table"):
("t"===a&&jQuery("#ally_ranking_table tr:first th:eq(1)").width(150),f=jQuery("#player_ranking_table, #ally_ranking_table"));f.find("tr:not(:first)").each(function(a){jQuery("td:eq(1)",this).prepend('<input class="map-item" type="checkbox" style="margin:0px;margin-right:20px" color="'+b[a]+'" id="'+this.getElementsByTagName("a")[0].href.match(/id\=(\d+)/)[1]+'"/>')}).eq(-1).after('<tr><td colspan="8"><input type="button" id="twa-mapgenerator" value="{generate}"/> <label><input type="checkbox" id="checkall"/> <strong>{selectall}</strong></label></td></tr>'.lang("mapgenerator"));
document.getElementById("twa-mapgenerator").onclick=function(){var b="http://"+game_data.market+".twstats.com/"+game_data.world+"/index.php?page=map&";jQuery(".map-item").each(function(c){this.checked&&(b+=a+"i"+ ++c+"="+this.id+"&"+a+"c"+c+"="+this.getAttribute("color")+"&")});b+="zoom="+c+"¢rex="+d+"¢rey="+e+"&nocache=1&fill=000000&grid=1&kn=1&bm=1";window.open(b)};jQuery("#checkall").click(function(){jQuery(".map-item").attr("checked",this.checked)})};TWA.mapManual=function(){jQuery("#map_whole").after('<br/><table class="vis" width="100%" id="twa-mapmanual"><tr><th>'+
g.mapmanual.getcoords+'</th></tr><tr><td style="text-align:center"><textarea style="width:100%;background:none;border:none;resize:none;font-size:11px"></textarea></td></tr></table>');var a=jQuery("#twa-mapmanual textarea"),b=[],c;TWMap.map._handleClick=function(d){d=this.coordByEvent(d);if(c=TWMap.villages[d.join("")])d=d.join("|"),0>b.indexOf(d)?(b.push(d),a.val(b.join(" ")),TWA.mapElement({id:"twa-manual-"+c.id,vid:c.id,Class:"twa-mapmanual",pos:[TWA.settings.lastattack&&game_data.player.premium?
15:25,TWA.settings.mapidentify?28:38]},{width:7,height:7,borderRadius:10,background:"red",border:"1px solid #000",opacity:0.7})):(b.remove(b.indexOf(d)),a.val(b.join(" ")),jQuery("#twa-manual-"+c.id).remove());return!1}};TWA.overview={init:function(){R.show().append('<tr><td>{changemode} <select id="twa-modes"></select> ({needreload})</td></tr>'.lang("overview"));jQuery("#twa-modes").change(function(){TWA.settings._overviewmode=this.value;TWA.storage(!0);TWA.settings.renamevillages&&(TWA.renamevillages.mode=
game_data.player.premium?TWA.renamevillages.modes[l]:TWA.renamevillages.modes.nopremium[TWA.settings.overview?TWA.settings._overviewmode:"nooverview"])}).append(x(TWA.overview.modes,function(a){return'<option value="'+a+'"'+(TWA.settings._overviewmode===a?' selected="selected"':"")+">"+g.overview[a]+"</option>"}));950>jQuery(".maincell").width()&&da.prepend("<p><b>"+g.overview.warning+"</b></p>");jQuery(".overview_table").before(TWA.overview.modes[TWA.settings._overviewmode]()).remove()},modes:{production:function(){for(var a=
jQuery('<table id="production_table" class="vis overview_table" width="100%"><thead><tr><th width="400px">{village}</th><th style="width:50px;text-align:center">{wood}</th><th style="width:50px;text-align:center">{stone}</th><th style="width:50px;text-align:center">{stone}</th><th style="width:46px;text-align:center"><span class="icon header ressources"></span></th><th style="width:53px;text-align:center"><img src="http://cdn2.tribalwars.net/graphic/overview/trader.png"/></th><th>{buildings}</th><th>{research}</th><th>{recruit}</th></tr></thead></table>'.lang("overview")),
b=jQuery(".overview_table tr[class]").get(),c,d,e,f,j,p,A,q=0;q<b.length;q++){A=b[q].getElementsByTagName("td")[0].getElementsByTagName("a")[0].href.match(/village=(\d+)/)[1];e=b[q].getElementsByTagName("td")[0].cloneNode(!0);p=e.getElementsByTagName("span")[0];f=b[q].getElementsByTagName("td")[3].innerHTML;d=b[q].getElementsByTagName("td")[2].innerHTML.replace(/<\/?span( class="[^\d]+")?>|\.|\s$/g,"").split(" ");c="";j=b[q].getElementsByTagName("td")[4].innerHTML;for(var k=0;3>k;k++)c+='<td style="text-align:center;padding:0 2px;font-size:12px">'+
d[k]+'<div style="width:100%;height:2px;border:1px solid #aaa"><div style="width:'+100*(d[k]/f)+'%;background:#ccc;height:2px"></div></div></td>';p.style.display="block";p.style["float"]="left";a[0].innerHTML+='<tr class="twa-overview-'+A+'"><td style="line-height:10px;white-space:nowrap">'+e.innerHTML+'<span style="text-align:right;font-size:9px;display:block;float:right;margin-left:30px">'+b[q].getElementsByTagName("td")[1].innerHTML+" "+g.overview.points+" ("+j+")</span></td>"+c+'<td style="text-align:center">'+
f+'</td><td class="market" style="text-align:center"></td><td class="builds" style="text-align:center"></td><td class="research" style="text-align:center"></td><td class="recruit" style="text-align:center"></td></tr>';jQuery.get(h("market",A),function(b){b=jQuery("th:first",b);a[0].getElementsByTagName("td")[6].innerHTML=b.length?'<a href="'+h("market")+'">'+b[0].innerHTML.match(/\d+\/\d+/)[0]+"</a>":"0/0"});jQuery.get(h("main",A),function(b){for(var c="",d=jQuery("#buildqueue tr:gt(0)",b).get(),
e=0;e<d.length;e++)c+='<img style="margin-right:2px" src="'+jQuery("#buildings tr:not(:first) td:has(a:contains("+jQuery.trim(jQuery("td:first",d[e]).text().split(" (")[0])+")) img",b)[0].src+'" tooltip="'+d[e].getElementsByTagName("td")[2].innerHTML+'"/>';a[0].getElementsByTagName("td")[7].innerHTML=c});jQuery.get(h("train",A),function(b){for(var c="",d=jQuery(".trainqueue_wrap tr[class]",b).get(),e,f=0;f<d.length;f++)e=d[f].getElementsByTagName("td")[0].innerHTML.match(/(\d+)\s(.*)/),e[2]=1===e[2].split(" ").length?
e[2].slice(0,7):e[2],c+='<img src="'+jQuery("#train_form table tr[class] td:contains("+e[2]+") img",b)[0].src+'" tooltip="'+e[1]+'"/>';a[0].getElementsByTagName("td")[8].innerHTML=c;jQuery("img[tooltip]",a[0].getElementsByTagName("td")[8]).tooltip()});jQuery.get(h("smith",A),function(b){for(var c="",d=jQuery("#current_research tr[class]",b).get(),e=0;e<d.length;e++)c+='<img src="'+jQuery("#tech_list img[alt="+d[e].getElementsByTagName("td")[0].innerHTML+"]",b)[0].src+'" tooltip="'+d[e].getElementsByTagName("td")[2].innerHTML+
'"/>';a[0].getElementsByTagName("td")[9].innerHTML=c;jQuery("img[tooltip]",a[0].getElementsByTagName("td")[9]).tooltip()})}jQuery(".overview_table").replaceWith(a[0])},combined:function(){function a(a,b,c){var d=document.createElement("img"),e=[];a=jQuery(a+" tr[class]",b).get();if(b=a.length){for(var f=0;f<b;f++)f===b-1?e.push(a[f].getElementsByTagName("td")[1].innerHTML+" - "+a[f].getElementsByTagName("td")[2].innerHTML):e.push(a[f].getElementsByTagName("td")[1].innerHTML);d.title=e.join(", ");
d.src="http://cdn2.tribalwars.net/graphic/overview/prod_running.png"}else d.src="http://cdn2.tribalwars.net/graphic/overview/prod_avail.png";c.appendChild(d)}u.add("overview",{".overview_table th":{"text-align":"center"}});for(var b=x(TWA.data.units,function(a){return'<th><img src="http://cdn2.tribalwars.net/graphic/unit/unit_'+a+'.png"/></th>'},'<tr><th width="400px" style="text-align:left">'+g.overview.village+'</th><th><img src="http://cdn2.tribalwars.net/graphic/overview/main.png"/></th><th><img src="http://cdn2.tribalwars.net/graphic/overview/barracks.png"/></th><th><img src="http://cdn2.tribalwars.net/graphic/overview/stable.png"/></th><th><img src="http://cdn2.tribalwars.net/graphic/overview/garage.png"/></th><th><img src="http://cdn2.tribalwars.net/graphic/overview/smith.png"/></th><th><img src="http://cdn2.tribalwars.net/graphic/overview/farm.png"/></th>'),
b=jQuery('<table id="combined_table" class="vis overview_table" width="100%"><thead>'+b+'<th><img src="http://cdn2.tribalwars.net/graphic/overview/trader.png"/></th></tr></thead></table>'),c=jQuery(".overview_table tr[class]").get(),d,e,f,j=0;j<c.length;j++)d=c[j].getElementsByTagName("td")[0].cloneNode(!0),f=d.getElementsByTagName("a")[0].href.match(/village=(\d+)/)[1],b[0].innerHTML+='<tr class="'+c[j].className+" twa-overview-"+f+'">'+x(TWA.data.units,function(a){return'<td class="unit-item '+
a+'"></td>'},'<td style="line-height:10px;white-space:nowrap">'+d.innerHTML+'<span style="text-align:right;font-size:9px;display:block;float:right;margin-left:30px">'+c[j].getElementsByTagName("td")[1].innerHTML+" "+g.overview.points+'</span></td><td class="main"></td><td class="barracks"></td><td class="stable"></td><td class="garage"></td><td class="smith"></td><td><a href="'+h("farm",f)+'">'+c[j].getElementsByTagName("td")[4].innerHTML+"</a></td>")+'<td class="market"></td></tr>',e=b[0].getElementsByTagName("tr")[c.length].getElementsByTagName("td"),
jQuery.get(h("main"),function(b){a("#buildqueue",b,e[2])}),jQuery.get(h("train"),function(b){for(var c=jQuery("#train_form tr[class]",b).get(),d={},f=8,g,j=0;j<c.length;j++)g=c[j].getElementsByTagName("td")[0].getElementsByTagName("img")[0].src.match(/unit_(\w+)\./)[1],d[g]=Number(c[j].getElementsByTagName("td")[6].innerHTML.split("/")[0]);for(var h in TWA.data.units)c=e[f++],d[h]?c.innerHTML=d[h]:(c.innerHTML="0",c.className+=" hidden");a("#trainqueue_wrap_barracks",b,e[3]);a("#trainqueue_wrap_stable",
b,e[4]);a("#trainqueue_wrap_garage",b,e[5])}),jQuery.get(h("smith"),function(b){a("#current_research",b,e[6])}),jQuery.get(h("market"),function(a){a=jQuery("th:first",a)[0];if(!a)return e[e.length-1].innerHTML="-";e[e.length-1].innerHTML='<a href="'+h("market")+'">'+a.innerHTML.match(/(\d+\/\d+)/)[1]+"</a>"});return b[0]}}};TWA.profileCoords=function(){for(var a=document.getElementById("villages_list").getElementsByTagName("tr"),b=[],c,d,e=1;e<a.length-1;e++)d=Number(a[e].getElementsByTagName("td")[2].innerHTML.replace('<span class="grey">.</span>',
"")),d>TWA.settings._profilecoordsmin&&d<TWA.settings._profilecoordsmax&&b.push(a[e].getElementsByTagName("td")[1].innerHTML);jQuery('<table class="vis" id="twa-profilecoords" width="100%"><tr><th>{everycoords}</th></tr><tr><td><textarea style="width:100%;background:none;border:none;resize:none;font-size:11px">'+b.join(" ")+'</textarea></td></tr><tr><td><label><input style="width:40px" name="_profilecoordsmin"/> {min}</label><br/><label><input style="width:40px" name="_profilecoordsmax"/> {max}</label></td></tr></table><br/>'.lang("profilecoords")).insertBefore("#villages_list").find("input").each(function(){this.value=
TWA.settings[this.name]}).change(function(){var a=this;clearTimeout(c);c=setTimeout(function(){TWA.settings[a.name]=Number(a.value);TWA.storage(!0)},1E3)})};TWA.profileGraphic=function(){var a=location.search.match(/id=(\d+)/)[1],b="info_player"===game_data.screen?"player":"tribe",c="http://"+game_data.world+".tribalwarsmap.com/"+game_data.market+"/",a='<table class="vis" width="100%" id="twa-graphic"><tr><th><a href="'+c+"history/"+b+"/"+a+'">'+g.profilegraphic.stats+' <img src="http://www.hhs.gov/web/images/exit_disclaimer.png"/></a></th></tr><tr><td style="text-align:center"><p><img src="'+
(c+"graph/p_"+b+"/"+a)+'"/></p><img src="'+(c+"graph/oda_"+b+"/"+a)+'"/><p><img src="'+(c+"graph/odd_"+b+"/"+a)+'"/></p></td></tr></table>';"player"===b?jQuery(".vis:not([id^=twa]):eq(2)").after("<br/>"+a):jQuery("#content_value > table tr:first").append('<td valign="top">'+a+"</td>")};TWA.ready=function(a){function b(c,d,e){var f=arguments;if(jQuery("#hide_completed:checked",c[0]).length)return jQuery.post(jQuery("#hide_completed",c[0]).attr("onclick").toString().split("'")[1],{hide_completed:!1},
function(){b.apply(window,f)});jQuery("#buildings a:has(img[src*=buildings])",c[0]).each(function(){TWA.data.builds[jQuery(this).text().trim()]=this.href.match(/\=(\w+)$/)[1]});jQuery("config > *",d[0]).each(function(a,b){4>a?TWA.data.world[b.nodeName]=jQuery(b).text():jQuery("*",b).each(function(){TWA.data.world[this.nodeName]=Number(jQuery(this).text())})});jQuery("config > *",e[0]).each(function(){"militia"!==this.nodeName&&(console.log(),TWA.data.units[this.nodeName]={speed:Math.round(24E3*Number(jQuery("speed",
this).text())),carry:Number(jQuery("carry",this).text()),pop:Number(jQuery("pop",this).text())})});TWA.storage(!0,null,"data");a()}TWA.data.builds?a():(TWA.data.builds={},TWA.data.world={},TWA.data.units={},jQuery.when(jQuery.get(h("main")),jQuery.get("interface.php?func=get_config"),jQuery.get("interface.php?func=get_unit_info")).done(b))};TWA.rename={init:function(a,b,c){var d=jQuery(a);".overview_table"!==a&&(d=d.parent());d.before('<table class="vis" width="100%"><tr><th>{rename} '+b+': <input type="text" id="twa-'+
c+'" style="padding:1px 2px;border:1px solid red;border-radius:2px;border-radius:2px;height:15px"/> <input type="button" value="{rename}"/><label><input type="checkbox" id="twa-onlyselected"/> {only} '+b+' {selected}</label> <img src="http://www.preloaders.net/preloaders/252/preview.gif" style="width:25px;display:none" id="twa-loader"/></th></tr></table>'.lang("rename"))},reports:function(){TWA.rename.init("#report_list",g.rename.report,"reportrename");TWA.rename._do({entry:"#twa-reportrename",input:"#report_list tr:not(:first, :last):visible input:not([type=checkbox])",
inputChecked:"#report_list tr:not(:first, :last):visible:has(input:checked) input:not([type=checkbox])"})},commands:function(){TWA.rename.init(".overview_table",g.rename.commands,"commandrename","o");jQuery(".overview_table input[type=checkbox]").removeAttr("disabled");TWA.rename._do({entry:"#twa-commandrename",input:".overview_table tr:not(:first, :last):visible input[id^=editInput]",inputChecked:".overview_table tr:not(:first, :last):visible:has(input:checked) input[id^=editInput]"})},_do:function(a){function b(b){if(!this.val()||
this.val().length<(a.min||1)||this.val().length>(a.max||255))return this.css("border","1px solid red");this.css("border","1px solid silver");b&&jQuery(jQuery("#twa-onlyselected:checked").length?a.inputChecked:a.input).val(this.val()).next().click()}jQuery(a.entry).keyup(function(a){b.call(jQuery(this),13===a.keyCode);return!1}).keypress(function(a){return 13!==a.keyCode});jQuery(a.entry).next().click(function(){b.call(jQuery(this).prev(),!0)})}};TWA.renamevillages={init:function(){u.add("renamevillages",
{"#twa-renamevillages":{padding:"1px 2px",border:"1px solid red","border-radius":2,"border-radius":2,height:15}});R.show().append('<tr><td>{renamevillages}: <input type="text" id="twa-renamevillages"/> <a href="http://code.google.com/p/tribalwars-scripts/wiki/Renomeador_de_Aldeias" target="_blank">({mask})</a> <label><input type="checkbox" id="twa-onlyselected"/> {onlySelected}.</label></td></tr>'.lang("renamevillages"));jQuery("#twa-renamevillages").keyup(function(a){if(!this.value||3>this.value.length)this.style.border=
"1px solid red";this.style.border="1px solid silver";if(13===a.keyCode)return TWA.renamevillages.newname=this.value,TWA.renamevillages.prepare(document.getElementById("twa-onlyselected").checked),!1});jQuery.get(h("main"),function(a){TWA.renamevillages.hkey=jQuery("form",a)[0].action.match(/h=(\w+)/)[1]});game_data.player.premium?TWA.renamevillages.mode=TWA.renamevillages.modes[l]:(TWA.renamevillages.individual(),TWA.renamevillages.mode=TWA.renamevillages.modes.nopremium[TWA.settings.overview?TWA.settings._overviewmode:
"nooverview"])},replace:function(a,b){return a.replace(/\{([^}]+)\}/g,function(a,d){d=d.match(/([^(]+)(?:\s?\(([^)]+)\))?/);var e=d[1].toLowerCase(),f=[];d[2]&&(f=jQuery.trim(d[2]).split(/\s*,\s*/));return TWA.renamevillages.modes.all[e]?TWA.renamevillages.modes.all[e].apply(this,f):TWA.renamevillages.mode[e]?TWA.renamevillages.mode[e].apply(jQuery(b),f):a})},prepare:function(a){a=jQuery(".overview_table tr[class]"+(a?":has(.addcheckbox:checked)":"")).get();for(var b,c,d=0;d<a.length;d++)c=a[d].getElementsByTagName("span")[0].id.split("_")[1],
b=TWA.renamevillages.replace(TWA.renamevillages.newname,a[d]),TWA.renamevillages.rename(c,b)},rename:function(a,b){jQuery.post(h("main&action=change_name&h="+TWA.renamevillages.hkey,a),{name:b},function(){var a=this.url.match(/village=(\d+)/)[1],a=document.getElementById("label_text_"+a);a.innerHTML=b+a.innerHTML.match(/\s\(\d+\|\d+\)\s\w+$/)[0]})},individual:function(){for(var a=jQuery(".overview_table tr[class]").get(),b,c,d=0;d<a.length;d++)c=a[d].getElementsByTagName("span")[0],b=c.id.split("_")[1],
a[d].getElementsByTagName("input")[1].onclick=function(){if(game_data.player.premium){var c=document.getElementById("edit_input_"+b);c.value=TWA.renamevillages.replace(c.value,a[d]);c.nextElementSibling.click()}else TWA.renamevillages.rename(b,TWA.renamevillages.replace(document.getElementById("edit_input_"+b).value,a[d])),document.getElementById("edit_"+b).style.display="none",document.getElementById("label_"+b).style.display=""},jQuery("<a>").addClass("rename-icon").click(function(){document.getElementById("edit_"+
b).style.display="";document.getElementById("label_"+b).style.display="none"}).appendTo(c)},modes:{nopremium:{nooverview:{points:function(){return this.find("td:eq(2)").text()},wood:function(){return this.find("td:eq(3)").text().split(" ")[0]},stone:function(){return this.find("td:eq(3)").text().split(" ")[1]},iron:function(){return this.find("td:eq(3)").text().split(" ")[2]},storage:function(){return this.find("td:eq(4)").text()},farmused:function(){return this.find("td:eq(5)").text().split("/")[0]},
farmtotal:function(){return this.find("td:eq(5)").text().split("/")[1]},current:function(){return jQuery.trim(this.find("td:first").text()).match(/(.*) \(\d+\|\d+\)\s\w{3}.?$/)[1]},x:function(){return jQuery.trim(this.find("td:eq(1)").text()).match(/.* \((\d+)\|\d+\)\s\w{3}.?$/)[1]},y:function(){return jQuery.trim(this.find("td:eq(1)").text()).match(/.* \(\d+\|(\d+)\)\s\w{3}.?$/)[1]}},production:{points:function(){return this.find("td:eq(1) span:last").text().split(" ")[0]},wood:function(){return this.find("td:eq(2)").text()},
stone:function(){return this.find("td:eq(3)").text()},iron:function(){return this.find("td:eq(4)").text()},storage:function(){return this.find("td:eq(5)").text()},farmused:function(){return this.find("td:eq(1) span:last").html().match(/\((\d+)/)[1]},farmtotal:function(){return this.find("td:eq(1) span:last").html().match(/\/(\d+)\)/)[1]},current:function(){return $.trim(this.find("td:eq(1) a:first").text()).match(/(.*) \(\d+\|\d+\)\s\w{3}.?$/)[1]},x:function(){return $.trim(this.find("td:eq(1) a:first").text()).match(/.* \((\d+)\|\d+\)\s\w{3}.?$/)[1]},
y:function(){return $.trim(this.find("td:eq(1) a:first").text()).match(/.* \(\d+\|(\d+)\)\s\w{3}.?$/)[1]}},combined:{points:function(){return this.find("td:eq(1) span:last").text().split(" ")[0]},farmused:function(){return this.find("td:eq(7) a").text().split("/")[0]},farmtotal:function(){return this.find("td:eq(7) a").text().split("/")[1]},current:function(){return jQuery.trim(this.find("td:eq(1) a:first").text()).match(/(.*) \(\d+\|\d+\)\s\w{3}.?$/)[1]},x:function(){return jQuery.trim(this.find("td:eq(1) a:first").text()).match(/.* \((\d+)\|\d+\)\s\w{3}.?$/)[1]},
y:function(){return jQuery.trim(this.find("td:eq(1) a:first").text()).match(/.* \(\d+\|(\d+)\)\s\w{3}.?$/)[1]},unit:function(a){if(!TWA.data.units[a])return UI.ErrorMessage("Renomeador de Aldeias - Argumento inv\u00e1lido: {unit("+a+")} Correto: {unit(UNIDADE)}"),"{unit(ERROR)}";var b=TWA.renamevillages.modes.nopremium.combined.unit.cache;b||(b={},jQuery(".overview_table tr:first th").each(function(a){var d=jQuery("img[src*=unit_]",this);d.length&&(b[d[0].src.match(/unit_(\w+)\./)[1]]=a)}),TWA.renamevillages.modes.nopremium.combined.unit.cache=
b);return this[0].getElementsByTagName("td")[b[a]].innerHTML}}},all:{random:function(a,b){a=Number(a||0);b=Number(b||1E4);return isNaN(a)||isNaN(b)?(UI.ErrorMessage("{renamevillages} - {argumentError}: {random("+a+", "+b+")} {correct}: {random( NUM, NUM )}"),"{random(ERROR)}"):Math.floor(Math.random()*(b-a+1)+a)}}}};TWA.reportCalc=function(){var a={spy:!0,catapult:!0,ram:!0,snob:!0},b={},c=TWA.settings._reportcalc,d;if(document.getElementById("twaReportCalc"))d=jQuery("#twa-attack");else{u.add("reportCalc",
{"#twaReportCalc":{width:475,background:"#eee","border-radius":4,border:"1px solid rgba(0,0,0,0.2)","margin-bottom":15},"#twaReportCalc td":{"text-align":"center"},"#twa-spy, #twa-ram":{width:30,"text-align":"center"},".twaUnits":{margin:"-1px -2px -2px"},"#twa-attack":{display:"none"},"#twa-results td":{border:"1px solid #ddd","border-radius":5,background:"#fff",height:20}});var e="",f="",j=0;x(TWA.data.units,function(b){a[b]||(j++,e+='<td><img src="http://cdn.tribalwars.net/graphic/unit/unit_'+
b+'.png"/> <input type="checkbox" class="twaUnits" unit="'+b+'" '+(0<=c.actives.indexOf(b)?'checked="true"':"")+"/></td>",f+='<td name="'+b+'"></td>')});jQuery(('<div id="twaReportCalc"><table class="twa-table"><tr><th colspan="__colspan">{unitscalc}</th></tr><tr><td style="text-align:left" colspan="__colspan"><label><input type="checkbox" id="twa-currentVillage"> {currentvillage}</label></td></tr><tr><td style="text-align:left" colspan="__colspan"><label><input class="twaInput" id="twa-spy" value="'+
this.settings._reportcalc.spy+'"/> {sendSpy}.</label></td></tr><tr><td style="text-align:left" colspan="__colspan"><label><input class="twaInput" id="twa-ram" value="'+this.settings._reportcalc.ram+'"/> {sendRam}.</label></td></tr><tr>__inputs</tr><tr id="twa-results">__unitsAttack</tr></table><div style="margin:5px"><a href="#" id="twa-attack">\u00bb {attack}</a></div></div>').replace("__inputs",e).replace("__unitsAttack",f).replace(/__colspan/g,j).lang("reportcalc")).insertBefore("table[width=470]");
d=jQuery("#twa-attack");jQuery(".twaUnits, #twa-spy, #twa-ram, #twa-currentVillage").change(function(){"twa-spy"===this.id?c.spy=isNaN(this.value)?0:Number(this.value):"twa-ram"===this.id?c.ram=isNaN(this.value)?0:Number(this.value):"twa-currentVillage"===this.id?c.currentVillage=this.checked:(c.actives=[],jQuery(".twaUnits:checked").each(function(){c.actives.push(this.getAttribute("unit"))}));TWA.settings._reportcalc=c;TWA.storage(!0);d.hide();TWA.reportCalc()});d.click(function(){jQuery.post(h("place&try=confirm",
v),jQuery.extend({x:y[0],y:y[1],attack:!0},b),function(a){var b=jQuery("#error",a);if(b.text())return alert(g.reportcalc.error+" "+b.text());a=jQuery("form",a);jQuery.post(a[0].action,a.serialize(),function(){alert(g.reportcalc.success)})});return!1})}jQuery("#twa-results td").html("");for(var p=0,l=jQuery("#attack_spy tr:first td").text().trim().replace(/\./g,"").split(" "),q=jQuery("#attack_spy tr:eq(1) td:last").text().replace(/\t/g,"").split("\n"),k={},q=q.splice(1,q.length-2),n=0;n<q.length;n++){var m=
q[n].split(/\s\(/),r=m[1].match(/\d+/);k[TWA.data.builds[m[0]]]=Number(r)}for(var q=0===k.hide?0:Math.round(150*Math.pow(40/3,(k.hide-1)/9)),s=0===k.storage?1E3:Math.round(1E3*Math.pow(400,(k.storage-1)/29)),n=jQuery("#attack_info_att tr:eq(1) a").text().match(/\s\((\d+)\|(\d+)\)\s\w+$/),m=jQuery("#attack_info_def tr:eq(1) a").text().match(/\s\((\d+)\|(\d+)\)\s\w+$/),m=Math.sqrt(Math.pow(Number(n[1])-Number(m[1]),2)+Math.pow(Number(n[2])-Number(m[2]),2)),w=[k.wood||0,k.stone||0,k.iron||0],t=0,n=0;n<
c.actives.length;n++)TWA.data.units[c.actives[n]]&&(k=Math.round(TWA.data.units[c.actives[n]].speed*(m/TWA.data.world.unit_speed)/TWA.data.world.speed),k>t&&(t=k));l.map(function(a,b){var c=(0===w[b]?5*TWA.data.world.speed:Math.round(30*Math.pow(80,(w[b]-1)/29))*TWA.data.world.speed)/3600;a=Number(a)+t*c;a>s&&(a=s);p+=a});var p=p-q,l=jQuery("#attack_info_att a:first").attr("href").match(/id=(\d+)/)[1],k=jQuery("#attack_info_att tr:eq(1) a").attr("href").match(/id=(\d+)/)[1],y=jQuery("#attack_info_def a[href*=info_village]").text().match(/.*\((\d+)\|(\d+)\)\sK\d{1,2}/).slice(1,
3),v=game_data.village.id,z=!1;l===game_data.player.id&&(v=jQuery("#twa-currentVillage:checked").length?game_data.village.id:k);jQuery.get(this.url("place",v),function(a){var e={},f;for(f in TWA.data.units)e[f]=Number(jQuery("[name="+f+"]",a).next().text().match(/\d+/)[0]);for(a=0;a<TWA.settings._reportcalc.actives.length;a++){f=TWA.settings._reportcalc.actives[a];var g=TWA.data.units[f].carry,j=e[f]*g;if(j)if(z=!0,j>=p){b[f]=Math.ceil(p/g);break}else b[f]=e[f],p-=j}if(z){for(f in b)document.getElementsByName(f)[0].innerHTML=
b[f];c.ram&&e.ram>=c.ram&&(b.ram=c.ram);c.spy&&e.spy>=c.spy&&(b.spy=c.spy);d.show()}else d.hide()})};TWA.reportFilter=function(){u.add("reportfinder",{"#twa-reportfinder":{padding:"1px 2px",border:"1px solid silver","border-radius":2,height:15}});jQuery('<table class="vis" width="100%"><tr><th>{search} <input type="text" id="twa-reportfinder"/></th></tr></table>'.lang("reportfilter")).insertBefore("#report_list").find("#twa-reportfinder").keyup(function(){var a=this.value.toLowerCase();jQuery("#report_list tr:not(:first, :last)").each(function(){this.style.display=
0>jQuery(this).text().toLowerCase().indexOf(a)?"none":"block"})});selectAll=function(a,b){jQuery("#report_list tr:not(:first, :last):visible input[type=checkbox]").attr("checked",b)}};TWA.research={init:function(){jQuery('<table class="vis" width="100%"><tr><th>{help} <a href="#" class="cancel">\u00bb {cancel}</a></th></tr></table>'.lang("research")).insertBefore(".overview_table").find(".cancel").click(function(){confirm(g.research.confirmcancel)&&TWA.research.cancel();return!1});jQuery("#techs_table tr:first a:has(img)").click(function(){return TWA.research._do(this.href.match(/order=(\w+)/)[1])})},
_do:function(a){for(var b=document.getElementById("techs_table").getElementsByTagName("tr"),c=1;c<b.length;c++){var d=b[c].id.split("_")[1];document.getElementById(d+"_"+a)&&jQuery.ajax({type:"post",url:TechOverview.urls.ajax_research_link.replace(/village=\d+/,"village="+d),data:{tech_id:a},dataType:"json",vid:d,success:function(b){b.success&&(document.getElementById("village_tech_order_"+this.vid).innerHTML=b.tech_order,TechOverview.change_dot(jQuery("#"+this.vid+"_"+a),this.vid,a,"brown"),game_data.village.id==
this.vid&&(jQuery("#wood").html(b.resources[0]),jQuery("#stone").html(b.resources[1]),jQuery("#iron").html(b.resources[2]),startTimer()))}})}return!1},cancel:function(){jQuery("#techs_table div.tech-cancel-icon img").each(function(){var a=this.onclick.toString().match(/cancel_research_order\((\d+), (\d+), '(\w+)'\)/);jQuery.ajax({url:TechOverview.urls.ajax_cancel_tech_order_link.replace(/village=\d+/,"village="+a[1]),dataType:"json",type:"post",data:{tech_order_id:a[2]},name:a[3],vid:a[1],success:function(a){a.success&&
(document.getElementById("village_tech_order_"+this.vid).innerHTML=a.tech_order,TechOverview.restore_dot(this.vid,this.name))}})})}};TWA.selectVillages={init:function(){var a=TWA.selectVillages.modes;ready=!1;for(var b in a)l===a[b][0]&&(ready=!0);ready&&jQuery("#twa-overviewtools").show().append("<tr><td>"+g.selectvillages.selectvillages+' <span id="twa-selectvillages"></span></td></tr>');jQuery('#combined_table tr:first th:has(img[src*="unit/unit"]) img').each(function(){TWA.selectVillages.tools.unitsorder.push(this.src.match(/unit_(\w+)/)[1])});
for(b in a)if(l===a[b][0])a[b][1]()},modes:{unitsattack:["combined",function(){var a=jQuery("#combined_table tr:gt(0)");jQuery('<label><input type="checkbox"/> '+g.selectvillages.unitsattack+"</label>").change(function(){for(var b,c,d=0;d<a.length;d++)c=TWA.selectVillages.tools.getunits(a[d]),b=TWA.selectVillages.tools.getpop("att",c),c=TWA.selectVillages.tools.getpop("def",c),b>c&&jQuery(".addcheckbox",a[d]).attr("checked",this.checked)}).appendTo("#twa-selectvillages")}],unitsdefence:["combined",
function(){var a=jQuery("#combined_table tr:gt(0)");jQuery('<label><input type="checkbox"/> '+g.selectvillages.unitsdefence+"</label>").change(function(){for(var b,c,d=0;d<a.length;d++)c=TWA.selectVillages.tools.getunits(a[d]),b=TWA.selectVillages.tools.getpop("att",c),c=TWA.selectVillages.tools.getpop("def",c),b<c&&jQuery(".addcheckbox",a[d]).attr("checked",this.checked)}).appendTo("#twa-selectvillages")}],unitsnob:["combined",function(){var a=jQuery("#combined_table tr:not(:first)");jQuery('<label><input type="checkbox" id="twa-selectvillages-unitsnob"> '+
g.selectvillages.unitsnob+"</label>").change(function(){for(var b,c=0;c<a.length;c++)b=TWA.selectVillages.tools.getunits(a[c]),0<b.snob&&jQuery(".addcheckbox",a[c]).attr("checked",this.checked)}).appendTo("#twa-selectvillages")}]},tools:{getunits:function(a){a=jQuery(".unit-item",a);var b={};a=a.add(a.next().last());for(var c=0;c<TWA.selectVillages.tools.unitsorder.length;c++)b[TWA.selectVillages.tools.unitsorder[c]]=Number(a.eq(c).text());return b},getpop:function(a,b){var c=0,d,e=0;switch(a){case "att":for(;e<
TWA.selectVillages.tools.unitsatt.length;e++)d=TWA.selectVillages.tools.unitsatt[e],TWA.data.units[d]&&(c+=b[d]*TWA.data.units[d].pop);break;case "def":for(;e<TWA.selectVillages.tools.unitsdef.length;e++)d=TWA.selectVillages.tools.unitsdef[e],TWA.data.units[d]&&(c+=b[d]*TWA.data.units[d].pop);break;case "all":for(e in b)TWA.data.units[b[e]]&&(c+=b[e]*TWA.data.units[b[e]].pop)}return c},unitsatt:"axe light marcher ram catapult knight".split(" "),unitsdef:["spear","sword","archer","heavy"],unitsorder:[]}};
TWA.storage=function(a,b,c){var d=c?v[c]:v.settings;c=c?"data":"settings";if(!0===a)localStorage[d]=JSON.stringify(TWA[c]);else if("string"===typeof a)return b?(TWA[c][a]=b,localStorage[d]=JSON.stringify(TWA[c]),b):TWA[c][a];return!0};TWA.tooltipGraphic=function(){jQuery('<input type="hidden"/>').appendTo("body");jQuery("#content_value a[href*=info_player], #content_value a[href*=info_ally]").each(function(){if(/id=\d+/.test(this.href)){var a="http://"+game_data.world+".tribalwarsmap.com/"+game_data.market+
"/graph/p_"+(/info_player/.test(this.href)?"player":"tribe")+"/"+this.href.match(/id=(\d+)/)[1];(new Image).src=a;this.setAttribute("tooltip",'<img src="'+a+'">');jQuery.tooltip(this)}})};TWA.troopCounter=function(){for(var a={},b=jQuery('<table id="twa-troopcounter" class="vis" style="width:100%;margin:0 auto"><thead>'+jQuery("#units_table thead").html()+"</thead><tbody>"+jQuery("#units_table tbody:first").html()+"</tbody></table>").insertAfter("#units_table"),c=document.getElementById("units_table").getElementsByTagName("tr")[0].getElementsByTagName("img"),
d=document.getElementById("units_table").getElementsByTagName("tbody"),e=b.getElementsByTagName("tbody")[0].getElementsByTagName("tr"),f=0;f<c.length;f++)a[c[f].src.match(/_(\w+)\.png/)[1]]=[[f+2,0],[f+1,0],[f+1,0],[f+1,0]];for(f=0;f<d.length;f++)for(var c=d[f].getElementsByTagName("tr"),g=0;g<c.length;g++)for(var h in a)a[h][g][1]+=Number(c[g].getElementsByTagName("td")[a[h][g][0]].innerHTML);jQuery("td:first",b).empty().width(jQuery("#units_table td:first").width());jQuery("th:first",b).html("Contagem de Tropas:");
jQuery("th:last, td:has(a)",b).remove();for(f=0;f<e.length;f++)for(h in a)b=e[f].getElementsByTagName("td")[a[h][f][0]],b.className="unit-item"+(0==a[h][f][1]?" hidden":""),b.innerHTML=a[h][f][1]};TWA.villageFilter=function(){var a=".overview_table tr:not(:first)",b;if("units"===l)a=".overview_table tbody";else if("commands"===l||"incomings"===l)a=".overview_table tr.nowrap";var c=jQuery(a).get();u.add("villagefilter",{"#twa-villagefilter":{padding:"1px 2px",border:"1px solid silver","border-radius":2,
height:15}});jQuery("#twa-overviewtools").show().append("<tr><td>"+g.villagefilter.search+' <input type="text" id="twa-villagefilter"/></td></tr>');jQuery("#twa-villagefilter").keyup(function(){var a=this.value.toLowerCase();clearTimeout(b);b=setTimeout(function(){for(var b=0;b<c.length;b++)c[b].style.display=0>c[b].getElementsByTagName("span")[1].innerHTML.toLowerCase().indexOf(a)?"none":""},200)});selectAll=function(a,b){jQuery(".overview_table tr.nowrap:visible input[type=checkbox]").attr("checked",
b)}};Array.prototype.remove=function(a,b){var c=this.slice((b||a)+1||this.length);this.length=0>a?this.length+a:a;return this.push.apply(this,c)};Number.prototype.format=function(){var a=Math.floor(this/6E4)%60,b=this/1E3%60,c=Math.floor(this/36E5)+":";10>a&&(c+="0");c+=a+":";10>b&&(c+="0");return c+b};String.prototype.springf=function(){var a=arguments;return this.replace(/{(\d+)}/g,function(b,c){return"undefined"!=typeof a[c]?a[c]:b})};String.prototype.lang=function(a){var b=arguments;return String(this).replace(/\{([^}]+)\}/g,
function(c,d){if(g[a]){if(!g[a][d]){for(var e=2;e<b.length;e++)if(g[b[e]][d])return g[b[e]][d];return"LangError"}}else return g.lang;return g[a][d]})};jQuery.fn.onlyNumbers=function(a){return this.keydown(function(b){var c=b.charCode||b.keyCode||0;return b.ctrlKey?!0:8==c||9==c||46==c||32==c||"coords"===a&&b.shiftKey&&226==c||37<=c&&40>=c||48<=c&&57>=c||96<=c&&105>=c})};jQuery.fn.tooltip=jQuery.tooltip=function(a){(this.jquery?this:jQuery(a)).hover(function(a){L.html(this.getAttribute("tooltip"));
L.css({top:a.pageY+25,left:a.pageX+15}).show()},function(){L.hide()}).mousemove(function(){L.css({top:event.pageY+25,left:event.pageX+15})})};jQuery.fn.checkStyle=function(a,b){return this.hide().each(function(){var c=jQuery(this),d=jQuery('<a class="checkStyle"></a>').click(function(){d=jQuery(this);var a=d.hasClass("checked");d[d.hasClass("checked")?"removeClass":"addClass"]("checked");c.attr("checked",!a);return!1}).bind(a,b).addClass(this.className).insertAfter(this);c.is(":checked")&&d.addClass("checked");
"label"===this.parentElement.nodeName.toLowerCase()&&jQuery(this).click(function(){d.trigger("click")})})};var fa={num:function(a){return 47<a.keyCode&&58>a.keyCode},space:function(a){return 32===a.keyCode},enter:function(a){return 13===a.keyCode},tab:function(a){return 9===a.keyCode},"|":function(a){return 226===a.keyCode&&a.shiftKey},":":function(a){return 191===a.keyCode&&a.shiftKey},"/":function(a){return(193===a.keyCode||81===a.keyCode)&&a.altKey&&!a.shiftKey}};jQuery.fn.acceptOnly=jQuery.acceptOnly=
function(a,b,c){this.jquery&&(c=b,b=a,a=!1);var d=function(a){var d;a:if(d=b,d=d.split(" "),40==a.keyCode||46==a.keyCode||8==a.keyCode||9==a.keyCode||27==a.keyCode||13==a.keyCode||65==a.keyCode&&!0===a.ctrlKey||35<=a.keyCode&&39>=a.keyCode||(67===a.keyCode||86===a.keyCode||88===a.keyCode)&&a.ctrlKey)d=!0;else{for(var e=0;e<d.length;e++)if(fa[d[e]](a)){d=d[e];break a}d=!1}return d?c.call(this,a,d):a.preventDefault()};if(a)for(var e=0;e<a.length;e++)a[e].keydown(d);else return this.keydown(d);return a};
var u,w=function(){this._styles={};return this},ga=/^-special-/,ha=jQuery.browser.mozilla?"-moz-":jQuery.browser.webkit?"-webkit-":jQuery.browser.opera?"-o-":"";w.prototype={add:function(a,b){this._styles[a]?(this._styles[a].css=jQuery.extend(this._styles[a].css,this.compatibility(b)),this._styles[a].elem.html(this.stringfy(this._styles[a].css))):(this._styles[a]={},this._styles[a].css=this.compatibility(b),this._styles[a].elem=jQuery("<style>").html(this.stringfy(this._styles[a].css)).appendTo("head"));
return this},stringfy:function(a){var b=[],c;for(c in a){var d=[],e;for(e in a[c]){var f=a[c][e];"number"===typeof f&&(f+="px");d.push(e+":"+f)}b.push(c+"{"+d.join(";")+"}")}return b.join("")},compatibility:function(a){var b={},c;for(c in a){var d={},e;for(e in a[c])ga.test(a[c][e])&&(a[c][e]=a[c][e].replace("-special-",ha)),d[e]=a[c][e];b[c]=d}return b}};u=new w;var t,w=function(a,b){var c=this;this.opened=!1;this._menus={};this._active="comments";this.menu=jQuery('<div class="twa-menu"><div class="head"><ul></ul></div><div class="body"></div></div>').appendTo("body");
a.click(function(){if(b&&!1===b.call(c))return!1;c[c.menu.is(":visible")?"hide":"show"]()});return this};w.prototype={add:function(a,b,c,d){var e=this;this._menus[a]=[jQuery("<li/>").append(jQuery('<a href="#" class="'+a+'">'+b+"</a>").click(function(){return e.select(a)})).appendTo(jQuery(".head ul",this.menu)),jQuery('<div style="display:none" class="'+a+'"/>').append(c).appendTo(jQuery(".body",this.menu)),d];this._active===a&&this.select(a,!0);return this},select:function(a,b){if(b||this._active!==
a)this._active&&this._menus[this._active]&&this._menus[this._active][1].hide(),jQuery(".head a",this.menu).removeClass("active"),jQuery(".head ."+a,this.menu).addClass("active"),this._active=a,this._menus[a][1].show(),this._menus[a][2]&&(this.opened?(this._menus[a][2].call(this._menus[a][1]),this._menus[a][2]=!1):this.open=function(){this._menus[a][2].call(this._menus[a][1]);this._menus[a][2]=!1});return!1},show:function(){return this.menu.show(300)},hide:function(){return this.menu.hide(300)}};t=
w;t=new t(Q,function(){if(!this.opened){this.opened=!0;this.open&&this.open();var a=this.menu,b=jQuery(window);this.menu=a.css("left",Math.max(0,(b.width()-a.outerWidth())/2+b.scrollLeft()))}return!0});var m,r=function(){r.sets=r.sets||{};r.add.apply(this,arguments)};r.remove=function(a){clearTimeout(r.sets[a]);delete r.sets[a]};r.add=function(a,b,c,d){function e(){return setTimeout(function(){!0===b.call(d,f++)&&(r.sets[a]=e())},c)}var f=0;r.sets[a]&&r.remove(a);r.sets[a]=e()};m=r;u.add("twa",{"#twa-menuOpen, #twa-commentsOpen":{margin:"0px 6px 0px 2px",
"border-radius":4,padding:"0px 3px 2px 3px","font-family":"courier new",border:"1px solid rgba(0,0,0,0.25)",background:"-special-linear-gradient(bottom, #e7e7e7 100%, #c5c5c5 0%)",cursor:"pointer"},".fb-comments, .fb-comments > span, .fb-comments iframe[style]":{width:"100% !important"},"#twa-tooltip":{position:"absolute",display:"none","z-index":"999999",background:"rgba(0,0,0,.8)",width:300,color:"#ccc",padding:4,"border-radius":2,"box-shadow":"1px 1px 3px #333"},".twaInput":{background:"#F3F3F3",
"border-radius":6,"box-shadow":"0 1px 4px rgba(0,0,0,0.2) inset","font-family":"courier new",border:"1px solid #bbb",color:"#555"},".twaInput:disabled":{background:"#ddd",color:"#aaa"},".twaButton":{"border-radius":3,margin:10,padding:"7px 20px",background:"-special-linear-gradient(bottom, #CCC 0%, white 100%)",border:"1px solid #AAA","font-weight":"bold"},".checkStyle":{display:"block","float":"left",background:"url(http://i.imgur.com/MhppaVe.png) top left no-repeat","background-position":"-4px -5px",
width:21,height:20},".checkStyle.checked":{"background-position":"-4px -65px"},".checkStyle.center":{margin:"0 auto","float":"none!important"},".twa-table":{width:"100%"},".twa-table th":{"text-align":"center",background:"-special-linear-gradient(bottom, #BBB 30%, #CCC 100%) !important",padding:"7px !important"},".twa-table td":{"text-align":"center",padding:"7px 0"},".twa-menu":{display:"none","z-index":"12000",position:"absolute",top:130,"font-family":"Helvetica","font-size":12,width:1020,background:"#eee",
color:"#333",border:"solid 1px rgba(0,0,0,0.2)","border-radius":4,"box-shadow":"3px 3px 5px rgba(0,0,0,0.2)",margin:"0 auto 30px"},".twa-menu a":{"font-weight":"700"},".twa-menu .head":{"text-align":"center",height:25,"border-bottom":"1px solid #ddd"},".twa-menu .head ul":{"line-height":15,padding:0},".twa-menu .head li":{"list-style":"none",display:"inline","border-right":"1px solid #bbb",padding:"0 13px"},".twa-menu .head li:last-child":{border:"none"},".twa-menu .head li a":{color:"#666","text-decoration":"none",
padding:8,"font-size":13,"border-radius":10},".twa-menu .head li a.active":{"box-shadow":"0 0 5px #AAA inset"},".twa-menu .body":{padding:10}});var v={settings:"TWASettings"+game_data.player.id,data:"TWAData"+game_data.player.id},Q="br"===game_data.market?"pt":game_data.market;TWA.settings=localStorage[v.settings]?JSON.parse(localStorage[v.settings]):!1;TWA.data=localStorage[v.data]?JSON.parse(localStorage[v.data]):!1;!TWA.settings||!TWA.data?w=!0:TWA.data.version!==TWA.version?(TWA.data.version=
TWA.version,TWA.oldSettings=TWA.settings,TWA.oldData=TWA.data,u.add("update",{"#newVersion span":{display:"block","margin-bottom":6,"font-size":11}}),UI.SuccessMessage('<div id="newVersion"><b>Relaxeaza Tribal Wars Advanced - Version '+TWA.version+'. </b><p>Altera\u00e7\u00f5es/Changes<br/> <span><b>Adicionado:</b> Sistema de coment\u00e1rios do facebook.</span><span><b>Reparado:</b> Alguns problemas do "Ultimas Conquistas" e "Planeador de Ataques".</span><span>Mais informa\u00e7\u00f5es <a href="https://github.com/relaxeaza/twadvanced/wiki/Tribal-Wars-Advanced">aqui</a></span></p></div>',
6E4),w=!0):w=void 0;w&&(localStorage[v.settings]=JSON.stringify(TWA.settings=jQuery.extend({mapcoords:!0,profilecoords:!0,_profilecoordsmin:0,_profilecoordsmax:12500,_mapplayers:!0,_mapplayersmin:0,_mapplayersmax:1E3,_mapabandoneds:!0,_mapabandonedsmin:0,_mapabandonedsmax:12500,mapidentify:!0,mapmanual:!0,lastattack:!0,rankinggraphic:!0,allygraphic:!0,profilestats:!0,reportfilter:!0,villagefilter:!0,reportrename:!0,commandrename:!0,troopcounter:!0,mapgenerator:!0,reportcalc:!0,_reportcalc:{actives:["knight",
"light","marcher","spear"],spy:5,ram:5,currentVillage:!1},assistentfarm:!0,autofarm:!0,_autofarm:{protect:!0,index:0,units:{},coords:[],random:!0},building:!0,_buildingbuild:{main:20,barracks:25,stable:20,garage:10,snob:1,smith:20,place:1,statue:1,market:10,wood:30,stone:30,iron:30,farm:30,storage:30,hide:0,wall:20},_buildingdestroy:{main:20,barracks:25,stable:20,garage:10,snob:1,smith:20,place:1,statue:1,market:10,wood:30,stone:30,iron:30,farm:30,storage:30,hide:0,wall:20},_buildingmaxorders:5,research:!0,
changegroups:!0,attackplanner:!0,selectvillages:!0,overview:!0,_overviewmode:"production",renamevillages:!0,lang:Q},TWA.oldSettings||{})),localStorage[v.data]=JSON.stringify(TWA.data=jQuery.extend({version:TWA.version,attackplanner:{commands:[],lastTime:C.text()+" "+B.text()}},TWA.oldData||{})));var N={en:{lang:"English",config:{config:"Settings",tooltip:{autofarm:"Allows farm several villages automatically.",mapcoords:"Allow to obtain map coords.",profilecoords:"Allow to obtain village coords from player profile.",
mapidentify:"Add a mark in the villages that were obtained coordinates.",mapmanual:"Allows you to obtain coordinates of villages from the map just clicking them.",rankinggraphic:"Shows a pontuation graph on ranking page on hover over the name of player/tribe.",allygraphic:"Shows a pontuation graph on members tribe on hover over the name of any player.",profilestats:"Shows an area with multiple charts of a player/tribe in the same profile.",lastattack:"Shows how much time has passed since the last attack on the map.",
reportfilter:"Shows a search field by title on report page.",villagefilter:"Shows a field of search on overview page to search villages by name.",reportrename:"Shows a field of search on report page to rename reports.",commandrename:"Shows a field to rename commands on overview.",villagerename:"Shows a field to rename villages on overview.",mapgenerator:"Generate TW Stats maps from ranking page allowing select players or tribes that will be included on the map.",reportcalc:"Makes calculating the amount of resources they currently have in starting a village of a spy report and shows the amount of troops needed to farm.",
troopcounter:"Makes the calculation of the amount of troops that has all the villages visible in views> troops. The amount is shown on the bottom.",assistentfarm:"Make automatic attacks from the Assistent Farm page.",building:"Mass constructions and demolitions in overview of buildings.",research:"Mass research on overview page (just simple blacksmith, for now).",changegroups:"Allows change in mass groups from any page of views.",attackplanner:"Attacks with scheduled time automatically. Note: You must leave a tab with the script running in the game for the attacks being made??!",
selectvillages:"Function to select specific villages in overview, as villages with troops attack, defense, and with noble etc ...",overview:"Add premium options on overview page for users without premium account.",renamevillages:"Allow rename mass village on overview."},title:"Relaxeaza TWAdvanced v{0}",coords:"Coords",autofarm:"Auto Farmer.",mapcoords:"Get map coords.",profilecoords:"Get profile player coords.",mapidentify:"Identify on get coords",mapmanual:"Obtain coordinates manually",graphicstats:"Graphics and Statistics",
rankinggraphic:"Ponctuation graphic on ranking.",allygraphic:"Ponctuation graphic on members tribe.",profilestats:"Shows stats of a player on player/trible profile.",lastattack:"Show time of last attack on map.",reportfilter:"Search field on reports.",villagefilter:"Search villages on overview.",reportrename:"Rename field to rename reports.",commandrename:"Rename field to rename commands on overview.",villagerename:"Field to rename villages on overview.",mapgenerator:"Generate map from ranking page.",
reportcalc:"Calculate amount of resources in a village.",troopcounter:"Calculate amount of troops.",assistentfarm:"Auto-Farm Assistent",building:"Mass builder/demolition.",research:"Massive search Units",changegroups:"Change groups on overview.",attackplanner:"Attack Planner",selectvillages:"Village picker.",overview:"Advanced overview.",savealert:"Settings have been saved!",save:"Save",other:"Other options",renamevillages:"Village renamer."},mapcoords:{getcoords:"Coords obtained",update:"Update",
mapplayers:"Obtain player coords.",min:"Min",max:"Max",mapabandoneds:"Obtain abandoneds coords."},mapmanual:{getcoords:"Coords obtained manually"},profilecoords:{everycoords:"All coords",min:"Min points.",max:"Max points."},profilegraphic:{stats:"Stats"},lastattack:{year:"year",years:"years",days:"d"},mapgenerator:{generate:"Generate map",selectall:"Select all"},reportfilter:{search:"Report search:"},villagefilter:{search:"Village search:"},reportcalc:{neededunits:"Necessary units",currentvillage:"Use troops of current village",
unitscalc:"Units calculated:",attack:"Attack with these troops ",error:"An error occurred on send attack:",success:"Attack successfully sent!",sendSpy:"Send spys",sendRam:"Send rams"},selectvillages:{selectvillages:"Select villages:",unitsattack:"with offense troops",unitsdefence:"with deffense troops",unitsnob:"with nobles"},rename:{rename:"Rename",only:"Only",selected:"selected",report:"reports",villages:"villages",commands:"commands"},assistentfarm:{auto:"Auto",log:"Assistent Farm Log",onvillage:"on village"},
autofarm:{farm:"Farmer",autofarm:"Auto-Farmer",coords:"Coordinates:",protect:"Protection - Don't send attack if village has an owner.",random:"Random Time - Attacks are sent at a time between 0-10 seconds. (To complicate the detection of Auto Farm)",start:"Start attacks",stop:"Stop attacks",continueAtt:"Continue attacks",units:"Units",options:"Options",log:"Attacks log",waitingreturn:"There is no troops on the village right now. Waiting for troops come back!",notroops:"There is no troops on the village.",
success:"Attacks sent in village {0}."},building:{buildtitle:"Mass Builder - Buildings",buildhelp:"The buildings will be built to level indicated below!",cancelbuilds:"Cancel all builders",destroytitle:"Mass Demolition - Buildings",destroyhelp:"The buildings will be demolished to the level indicated below!",canceldestroy:"Cancel all demolitions",help:"Click on the icon below the buildings to start construction on the building mass clicked.",demolitions:"demolitions",buildings:"builders",confirmcancel:"Are you sure cancel all {0}?"},
research:{help:"Click the icon of the units below to start searching mass unit clicked.",cancel:"Cancel all researches?",confirmcancel:"Ara you sure cancel all researches?"},changegroups:{changegroups:"Change groups of selected villages:",add:"Add",remove:"Remove",move:"Move"},attackplanner:{planner:"Planner",attackplanner:"Attack Planner",addcommand:"Add comand",attacker:"Attacker village",target:"Village target",time:"Send time",support:"Support",attack:"Attack",troops:"Troops",commands:"Commands",
type:"Type",options:"Options",commandssended:"Commands sent",errorequal:"The coordinates of the village attacker can not be the same fate of the village!",errorunits:"You aren't entered any unit!",errorcoords:"Coords {0} doesn't exist.",success:"{0} send on village {1} to village {2} with the troops: {3}",current:"Current",now:"Now",allunits:"Send all units"},overview:{warning:"* The advanced visualization is best viewed with the window width above 1000px. (Settings -> Settings)",combined:"Combined",
production:"Production",changemode:"Change overview mode",needreload:"You need to refresh page",village:"Village",wood:"Wood",stone:"Stone",iron:"Iron",buildings:"Buildings",research:"Researchs",recruit:"Recruitment",points:"points"},lastConquests:{lastConquests:"Last Ennoblements",loadLast:"Load ennoblement in the last",hours:"hours",village:"Village",date:"Date",newOwn:"New Owner",oldOwn:"Old Owner",pageUp:"<<< page up",pageDown:"page down >>>",abandoned:"Abandoned village"},renamevillages:{renamevillages:"Rename villages",
mask:"Masks",onlySelected:"Only selected villages",argumentError:"Invalid argument",correct:"Correct"},comments:"Comments"},pt:{lang:"Portugu\u00eas",config:{config:"Configura\u00e7\u00f5es",tooltip:{autofarm:"Permite farmar v\u00e1rias aldeias automaticamente.",mapcoords:"Permite obter coordenadas do mapa.",profilecoords:"Permite obter coordenadas de aldeias apartir do perfil de um jogador.",mapidentify:"Adiciona uma marca\u00e7\u00e3o nas aldeias que foram obtidas coordenadas.",mapmanual:"Permite obter coordenadas de aldeias no mapa clicando nelas.",
rankinggraphic:"Mostra um gr\u00e1fico de pontua\u00e7\u00e3o na classifica\u00e7\u00e3o ao passar o mouse sobre o nome de algum jogador ou tribo.",allygraphic:"Mostra um gr\u00e1fico de pontua\u00e7\u00e3o na p\u00e1gina de membros de uma tribo ao passar o mouse sobre o nome de algum jogador.",profilestats:"Mostra uma \u00e1rea com v\u00e1rios gr\u00e1ficos de um jogador ou uma tribo no perfil do mesmo.",lastattack:"Mostra quanto tempo se passou desde o \u00faltimo ataque no mapa.",reportfilter:"Mostra um campo de pesquisa por t\u00edtulo na p\u00e1gina de relat\u00f3rios.",
villagefilter:"Mostra um campo de pesquisa na visualiza\u00e7\u00e3o para pesquisar aldeias por nome.",reportrename:"Mostra um campo na p\u00e1gina de relat\u00f3rios para renomear todos ou apenas os selecionados.",commandrename:"Mostra um campo na visualiza\u00e7\u00e3o para renomear todas os comandos de apenas uma vez.",villagerename:"Mostra um campo na visualiza\u00e7\u00e3o das aldeias para renomear todas as aldeias de apenas uma vez.",mapgenerator:"Gera mapas do TW Stats direto da classifica\u00e7\u00e3o permitindo selecionar os jogadores ou tribos que estaram incluidos no mapa.",
reportcalc:"Faz o calculo da quantidade de recursos que tem atualmente em uma aldeia apartir de um relat\u00f3rio de espionagem e mostra a quantidade de tropas necess\u00e1rias para farmar.",troopcounter:"Faz o calculo da quantidade de tropas que tempo todas as aldeias visiveis em visualiza\u00e7\u00f5es > tropas. A quantidade \u00e9 mostrada no final da p\u00e1gina.",assistentfarm:"Faz ataques autom\u00e1ticos apartir da p\u00e1gina do Assistente de Farm.",building:"Faz constru\u00e7\u00f5es e demoli\u00e7\u00f5es em massa na visualiza\u00e7\u00e3o dos edif\u00edcios.",
research:"Faz pesquisas em massa apartir da p\u00e1gina de visualiza\u00e7\u00e3o de pesquisas (apenas ferreiro simples, por enquanto).",changegroups:"Permite alterar grupos em massa apartir de qualquer p\u00e1gina das visualiza\u00e7\u00f5es.",attackplanner:"Faz ataques programados com hor\u00e1rio automaticamente. Obs.: \u00e9 preciso deixar uma aba com o script rodando no jogo para os ataques serem efetuados!",selectvillages:"Fun\u00e7\u00e3o para selecionar aldeias especificas na visualiza\u00e7\u00e3o, como aldeias com tropas de ataque, defesa, com nobres e etc...",
overview:"Adiciona op\u00e7\u00f5es premium na p\u00e1gina de visualiza\u00e7\u00e3o para usu\u00e1rios sem conta premium.",renamevillages:"Permite renomear aldeias em massa e individuais na visualiza\u00e7\u00e3o de aldeias."},title:"Relaxeaza TWAdvanced v{0}",coords:"Coordenadas",autofarm:"Farmador autom\u00e1tico.",mapcoords:"Obter coordenadas do mapa.",profilecoords:"Obter coordenadas por perfil.",mapidentify:"Identificar ao obter coordenadas",mapmanual:"Obter coordenadas manualmente",graphicstats:"Gr\u00e1ficos & Estat\u00edsticas",
rankinggraphic:"Gr\u00e1fico de pontua\u00e7\u00e3o na classifica\u00e7\u00e3o.",allygraphic:"Gr\u00e1fico de pontua\u00e7\u00e3o em membros da tribo.",profilestats:"Mostrar estat\u00edsticas de um jogador/tribo no perfil.",lastattack:"Mostrar tempo do \u00faltimo ataque no mapa.",reportfilter:"Campo de pesquisa nos relat\u00f3rios.",villagefilter:"Pesquisa de aldeias na visualiza\u00e7\u00e3o.",reportrename:"Campo para renomear relat\u00f3rios.",commandrename:"Campo para renomear comandos na visualiza\u00e7\u00e3o.",
villagerename:"Campo para renomear aldeias na visualiza\u00e7\u00e3o.",mapgenerator:"Gerar mapa apartir da classific\u00e3o.",reportcalc:"Calcula recursos exatas em uma aldeia.",troopcounter:"Calcula a quantidade de tropas.",assistentfarm:"Assistente de Farm autom\u00e1tico.",building:"Constru\u00e7\u00e3o/demoli\u00e7\u00e3o em massa.",research:"Pesquisa em massa.",changegroups:"Alterar grupos na visualiza\u00e7\u00e3o.",attackplanner:"Planeador de Ataques.",selectvillages:"Selecionador de aldeias.",
overview:"Visualiza\u00e7\u00e3o avan\u00e7ada.",savealert:"As configura\u00e7\u00f5es foram salvas!",save:"Salvar",other:"Outras op\u00e7\u00f5es",renamevillages:"Renomeador de aldeias"},mapcoords:{getcoords:"Coordenadas obtidas",update:"Atualizar",mapplayers:"Obter coordenadas de jogadores.",min:"M\u00ednimo",max:"M\u00e1ximo",mapabandoneds:"Obter coordenadas de abandonadas."},mapmanual:{getcoords:"Coordenadas obtidas manualmente"},profilecoords:{everycoords:"Todas coordenadas",min:"Pontua\u00e7\u00e3o m\u00ednima.",
max:"Pontua\u00e7\u00e3o m\u00e1xima."},profilegraphic:{stats:"Estat\u00edsticas"},lastattack:{year:"ano",years:"anos",days:"d"},mapgenerator:{generate:"Gerar mapa",selectall:"Selecionar todos"},reportfilter:{search:"Pesquisar relat\u00f3rios:"},villagefilter:{search:"Pesquisar aldeias:"},reportcalc:{neededunits:"Unidades necess\u00e1rias:",currentvillage:"Usar tropas da aldeia atual",unitscalc:"Unidades calculadas:",attack:"Atacar com essas tropas",error:"Ocorreu o seguinte erro ao enviar o ataque:",
success:"Ataque enviado com sucesso!",sendSpy:"Enviar exploradores",sendRam:"Enviar arietes"},selectvillages:{selectvillages:"Selecionar aldeias:",unitsattack:"com tropas de ataque",unitsdefence:"com tropas de defesa",unitsnob:"com nobres"},rename:{rename:"Renomear",only:"Apenas",selected:"selecionados",report:"relat\u00f3rios",villages:"aldeias",commands:"comandos"},assistentfarm:{auto:"Autom\u00e1tico",log:"Farm Assistent Log",onvillage:"na aldeia"},autofarm:{farm:"Farmador",autofarm:"Farmador Autom\u00e1tico",
coords:"Coordenadas:",protect:"Prote\u00e7\u00e3o - N\u00e3o enviar ataques caso a aldeia tenha dono.",random:"Tempo Aleat\u00f3rio - Os ataques s\u00e3o enviados em um tempo entre 0-10 segundos. (Para dificultar a detec\u00e7\u00e3o do Auto Farm)",start:"Iniciar ataques",stop:"Parar ataques",continueAtt:"Continuar ataques",log:"Log de ataques:",waitingreturn:"N\u00e3o h\u00e1 tropas na aldeia no momento. Aguardando tropas retornarem!",notroops:"N\u00e3o existem tropas na aldeia.",success:"Ataque enviado na aldeia {0}.",
units:"Unidades",options:"Op\u00e7\u00f5es"},building:{buildtitle:"Constru\u00e7\u00e3o em Massa - Edif\u00edcios",buildhelp:"Os edif\u00edcios ser\u00e3o construidos at\u00e9 o n\u00edvel indicado abaixo!",cancelbuilds:"Cancelar todas as contru\u00e7\u00f5es",destroytitle:"Demoli\u00e7\u00e3o em Massa - Edif\u00edcios",destroyhelp:"Os edif\u00edcios ser\u00e3o demolidos at\u00e9 o n\u00edvel indicado abaixo!",canceldestroy:"Cancelar todas as demoli\u00e7\u00f5es",help:"Clique no icone dos edif\u00edcios abaixo para iniciar a constru\u00e7\u00e3o em massa do edif\u00edcio clicado.",
demolitions:"demoli\u00e7\u00f5es",buildings:"constru\u00e7\u00f5es",confirmcancel:"Tem certeza que deseja cancelar todas as {0}?"},research:{help:"Clique no icone das unidades abaixo para iniciar a pesquisa em massa da unidade clicada.",cancel:"Cancelar todas as pesquisas",confirmcancel:"Tem certeza que deseja cancelar todas as pesquisas?"},changegroups:{changegroups:"Alterar grupos das aldeias selecionadas:",add:"Adicionar",remove:"Remover",move:"Mover"},attackplanner:{planner:"Planeador",attackplanner:"Planeador de ataque",
addcommand:"Adicionar comando",attacker:"Aldeia atacante",target:"Aldeia alvo",time:"Hor\u00e1rio de envio",support:"Apoio",attack:"Ataque",troops:"Tropas",commands:"Comandos",type:"Tipo",options:"Op\u00e7\u00f5es",commandssended:"Comandos enviados",errorequal:"As coordenadas da aldeia atacante n\u00e3o pode ser a mesma da aldeia de destino!",errorunits:"Voc\u00ea n\u00e3o inseriu nenhuma unidade!",errorcoords:"A coordenada {0} n\u00e3o existe.",success:"<td>{1}</td><td>{2}</td> com as seguintes tropas: {3}",
current:"Atual",now:"Agora",allunits:"Enviar todas tropas"},overview:{warning:"* A visualiza\u00e7\u00e3o avan\u00e7ada \u00e9 melhor visualizada com a largura da janela acima de 1000px. (Configura\u00e7\u00f5es -> Configura\u00e7\u00f5es)",combined:"Combinado",production:"Produ\u00e7\u00e3o",changemode:"Alterar modo de visualiza\u00e7\u00e3o",needreload:"Necessita atualizar p\u00e1gina",village:"Aldeia",wood:"Madeira",stone:"Argila",iron:"Ferro",buildings:"Contru\u00e7\u00f5es",research:"Pesquisas",
recruit:"Recrutamento",points:"pontos"},lastConquests:{lastConquests:"\u00daltimas Conquistas",loadLast:"Carregar conquistas nas \u00faltimas",hours:"horas",village:"Aldeia",date:"Data",newOwn:"Novo dono",oldOwn:"Antigo dono",pageUp:"<<< para cima",pageDown:"para baixo >>>",abandoned:"Aldeia abandonada"},renamevillages:{renamevillages:"Renomear aldeias",mask:"M\u00e1scaras",onlySelected:"Apenas aldeias selecionadas",argumentError:"Argumento inv\u00e1lido",correct:"Correto"},comments:"Coment\u00e1rios"},
sk:{lang:"Slovak",config:{config:"Nastavenie",tooltip:{autofarm:"Umo\u017e\u0148uje nieko\u013eko ded\u00edn po\u013enohospod\u00e1r automaticky",mapcoords:"Umo\u017e\u00f2uje zobrazi\u009d s\u00faradn\u00edce na mape.",profilecoords:"Umo\u017e\u00f2uje zobrazi\u009d s\u00faradnice v\u0161etk\u00fdch ded\u00edn hr\u00e1\u00e8a.",mapidentify:"Prid\u00e1 udalos\u009d v dedin\u00e1ch, kde boli z\u00edskan\u00e9 s\u00faradnice.",mapmanual:"Umo\u017e\u00f2uje z\u00edska\u009d s\u00faradnice ded\u00edn v mape kliknut\u00edm na ne.",
rankinggraphic:"Ukazuje graf rastu v tabu\u00beke ka\u017ed\u00e9ho hr\u00e1\u00e8a alebo kme\u00f2a.",allygraphic:"Zobrazuje \u0161tatistiky vybran\u00e9ho kme\u00f2a.",profilestats:"Zobrazuje \u0161tatistiky vybran\u00e9ho hr\u00e1\u00e8a.",lastattack:"Ukazuje, ko\u00beko \u00e8asu uplynulo od posledn\u00e9ho \u00fatoku na mape.",reportfilter:"Filter ozn\u00e1men\u00ed.",villagefilter:"Filter ded\u00edn.",reportrename:"Premenov\u00e1va v\u0161etky alebo len vybran\u00e9 ozn\u00e1menia.",commandrename:"Premenov\u00e1va vybran\u00e9 \u00fatoky.",
villagerename:"Premenov\u00e1va vybran\u00e9 dediny.",mapgenerator:"TW Stats vygeneruje mapu vybran\u00e9ho hr\u00e1\u00e8a alebo kme\u00f2a.",reportcalc:"Automaticky vypo\u00e8\u00edta ko\u00beko vojakov treba posla\u009d na kompletn\u00e9 vyfarmenie barbarky (potrebn\u00fd \u0161peh v predch\u00e1dzaj\u00facom \u00fatoku). ",troopcounter:"Spo\u00e8\u00edtav\u00e1 vojsk\u00e1. Zobrazenie> Jednotky. Suma sa zobraz\u00ed v dolnej \u00e8asti.",assistentfarm:"Automaticky odosiela \u00fatoky v n\u00e1h\u00beade.",
building:"Stavia a b\u00fara budovy v n\u00e1h\u00beade.",research:"Automaticky vysk\u00fama v\u0161etky v\u00fdskumy (zatia\u00be len pre jednoduch\u00fd v\u00fdskum).",changegroups:"Umo\u017enuje zmeni\u009d skupinu pre skupinu jednotliv\u00fdch ded\u00edn.",attackplanner:"Napad\u00e1 dediny automaticky. Pozn\u00e1mka: Mus\u00edte opusti\u009d kartu a skript necha\u009d spusten\u00fd!",selectvillages:"Funkcia pre v\u00fdber konkr\u00e9tnej dediny v zobrazen\u00ed, ako napr. \u00fato\u00e8n\u00e1 dedina, obrann\u00e1, \u0161\u00e5achtic ...",
overview:"Pridat pr\u00e9miov\u00e9 mo\u017enosti na str\u00e1nke n\u00e1hladu pre u\u017e\u00edvatelov bez premium \u00factu.",renamevillages:"Premenovanie ded\u00edn v individu\u00e1lnej a hromadnej prezeranie ded\u00edn."},title:"Relaxeaza TWAdvanced v{0}",coords:"S\u00faradnice",autofarm:"Automatick\u00e9 Farma.",mapcoords:"Z\u00edska s\u00faradnice na mape.",profilecoords:"Z\u00edska s\u00faradnice z profilu hr\u00e1\u00e8a.",mapidentify:"Identifikova\u009d k z\u00edskaniu s\u00faradn\u00edc",
mapmanual:"Zada\u009d s\u00faradnice ru\u00e8ne.",graphicstats:"Grafy a \u0161tatistiky.",rankinggraphic:"Bodov\u00fd graf",allygraphic:"Bodov\u00fd graf kme\u00f2a.",profilestats:"Zobrazi\u009d \u0161tatistiky pre hr\u00e1\u00e8a / kme\u00f2.",lastattack:"Zobrazi\u009d \u00e8as posledn\u00e9ho \u00fatoku na mape.",reportfilter:"Filter ozn\u00e1menii.",villagefilter:"Filter dediny v n\u00e1h\u00beade.",reportrename:"Premenov\u00e1va ozn\u00e1menie.",commandrename:"Premenov\u00e1va \u00fatoky.",villagerename:"Premenov\u00e1va dediny.",
mapgenerator:"Generator mapy pod\u00bea predvolen\u00fdch bodov",reportcalc:"Po\u00e8\u00edta presne suroviny v dedine.",troopcounter:"Vypo\u00e8\u00edtava mno\u017estvo vojakov.",assistentfarm:"Autofarmiaci pomocn\u00edk.",building:"Stavanie / b\u00faranie budov.",research:"V\u00fdskum.",changegroups:"Zmena skup\u00edn v n\u00e1h\u00beade.",attackplanner:"Pl\u00e1nova\u00e8 \u00fatokov.",selectvillages:"V\u00fdber ded\u00edn.",overview:"Advanced vizualiz\u00e1cie.",savealert:"Nastavenia boli ulo\u017een\u00e9!",
save:"Ulo\u017eit",other:"Dal\u0161ie mo\u017enosti",renamevillages:"Renamer dediny"},mapcoords:{getcoords:"S\u00faradnice z\u00edskan\u00e9.",update:"Aktualizova\u009d.",mapplayers:"Z\u00edsk\u00e1va s\u00faradn\u00edce hr\u00e1\u00e8ov.",min:"Minim\u00e1lna.",max:"Maxim\u00e1lna.",mapabandoneds:"S\u00faradnice barbariek z\u00edskan\u00e9."},mapmanual:{getcoords:"Suradnice, zadan\u00e9 ru\u00e8ne"},profilecoords:{everycoords:"V\u0161etky s\u00faradnice.",min:"Minim\u00e1lne hranica bodov.",max:"Maxim\u00e1lna hranica bodov."},
profilegraphic:{stats:"\u0160tatistika."},lastattack:{year:"rok",years:"rokov",days:"d"},mapgenerator:{generate:"Generova\u009d mapu",selectall:"Vybra\u009d v\u0161etko"},reportfilter:{search:"H\u00beada\u009d ozn\u00e1menia:"},villagefilter:{search:"H\u00beada\u009d dediny:"},reportcalc:{neededunits:"Po\u017eadovan\u00e9 vojsko:",currentvillage:"Pou\u017eitie vojska z aktu\u00e1lnej dediny.",unitscalc:"Vojsko vypo\u00e8\u00edta:",attack:"\u00dato\u00e8i\u009d s t\u00fdmito vojakmi",error:"Chyba!",
success:"\u00datok \u00faspe\u0161ne odoslan\u00fd!",sendSpy:"Odosla\u0165 prieskumn\u00edci",sendRam:"Odosla\u0165 barany"},selectvillages:{selectvillages:"Vybra\u009d dediny:",unitsattack:"Vojsk\u00e1 \u00fato\u00e8ia",unitsdefence:"S obrann\u00fdmi jednotkami",unitsnob:"So \u0161\u00beachtami"},rename:{rename:"Premenova\u009d",only:"Iba",selected:"Vybran\u00fd",report:"Ozn\u00e1menie",villages:"Dediny",commands:"Povely"},assistentfarm:{auto:"Automatick\u00fd",log:"Logy",onvillage:"Dedina"},autofarm:{farm:"Farmenie",
autofarm:"Automatick\u00e9 farmenie",coords:"S\u00faradnice:",protect:"Ochrana - Nebud\u00fa posielan\u00e9 \u00fatoky ak m\u00e1 dedina majite\u00bea.",random:"Random Time - \u00datoky s\u00fa odosielan\u00e9 v \u010dase medzi 0-10 sek\u00fand. (To komplikuje detekciu Auto Farm)",start:"\u0160tart \u00fatoky",stop:"Zastavenie \u00fatokov",continueAtt:"Pokra\u010dova\u0165 \u00fatoky",units:"Jednotky",options:"Mo\u017enosti",log:"Logy:",waitingreturn:"Nie s\u00fa \u017eiadne jednotky v dedine.\u00c8ak\u00e1 sa na vracaj\u00facich sa vojakov!",
notroops:"V dedine nie s\u00fa \u017eiadne jednotky.",success:"\u00datoky na dedinu odoslan\u00e9 {0}."},building:{buildtitle:"Hromadn\u00e9 stavenie - Budovy",buildhelp:"Budovy bud\u00fa postaven\u00e9 na \u00farove\u00f2 uveden\u00fa ni\u017e\u0161ie!",cancelbuilds:"Zru\u0161i\u009d v\u0161etky pr\u00edkazy na stavbu",destroytitle:"Hromadn\u00e9 b\u00faranie - Budovy",destroyhelp:"Budovy bud\u00fa zb\u00faran\u00e9 na \u00farove\u00f2 uveden\u00fa ni\u017e\u0161ie!",canceldestroy:"Zru\u0161i\u009d v\u0161etky demol\u00e1cie",
help:"Kliknite na ikonu budovy, pre za\u00e8atie automatick\u00e9ho stavania.",demolitions:"B\u00faranie",buildings:"Budovy",confirmcancel:"Ste si ist\u00ed, \u017ee chcete zru\u0161i\u009d v\u0161etky {0}?"},research:{help:"Kliknite na ikonu v\u00fdskum pre za\u00e8atie hromadn\u00e9ho sk\u00famania",cancel:"Zru\u0161i\u009d v\u0161etky sk\u00famania",confirmcancel:"Ste si ist\u00ed, \u017ee chcete zru\u0161i\u009d v\u0161etky sk\u00famania?"},changegroups:{changegroups:"Zmena skupiny vybran\u00fdch ded\u00edn:",
add:"Prida\u009d",remove:"Odstr\u00e1ni\u009d",move:"Pohyb"},attackplanner:{planner:"Pl\u00e1nova\u00e8",attackplanner:"Pl\u00e1nova\u00e8 \u00datokov",addcommand:"Prida\u009d pr\u00edkaz",attacker:"\u00dato\u00e8iaca dedina",target:"Cie\u00be",time:"Doba dopadu",support:"Podpora",attack:"\u00datok",troops:"Jednotky",commands:"Pr\u00edkazy",type:"Typ",options:"Mo\u017enosti",commandssended:"Odoslan\u00e9 \u00fatoky",errorequal:"S\u00faradnice dediny \u00fato\u00e8nika nemo\u017eu by\u009d rovnak\u00e9 ako s\u00faradnice dediny cie\u00bea!",
errorunits:"Nezadali ste \u017eiadnu jednotku!",errorcoords:"Cie\u00be {0} neexistuje!",success:"{0} Poslan\u00e9 z dedine {1} do dediny {2} s nasledujuc\u00edmi vojakmi {3}",current:"Pr\u00fad",now:"Teraz",allunits:"Posla\u0165 v\u0161etky jednotky"},overview:{warning:"* Pokro\u00e8il\u00e1 vizualiz\u00e1cia je optimalizovan\u00e1 pre \u0161\u00edrku okna nad 1000px. (Nastavenia -> Nastavenia)",combined:"Kombinovan\u00fd",production:"Produkcia",changemode:"Zmena re\u017eimu zobrazenia",needreload:"Potrebujete aktualizova\u009d str\u00e1nku",
village:"Obec",wood:"Drevo",stone:"\u00cdl",iron:"\u017eehli\u010dka",buildings:"Stavby",research:"Vyh\u013ead\u00e1vanie",recruit:"N\u00e1bor",points:"body"},lastConquests:{lastConquests:"Najnov\u0161ie \u00daspechy",loadLast:"Vlo\u017ete \u00faspechy v posledn\u00fdch",hours:"hodiny",village:"Obec",date:"D\u00e1tum",newOwn:"Nov\u00fd vlastn\u00edk",oldOwn:"B\u00fdval\u00fd majite\u013e",pageUp:"<<< hore",pageDown:"dole >>>",abandoned:"Opusten\u00e9 dediny"},renamevillages:{renamevillages:"Premenovanie ded\u00edn",
mask:"Masky",onlySelected:"Len vybran\u00e9 obce",argumentError:"Neplatn\u00fd argument",correct:"Opravi\u0165"},comments:"Koment\u00e1re"}},g=!N[TWA.settings.lang]?N.pt:N[TWA.settings.lang];TWA.ready(function(){switch(game_data.screen){case "map":(TWA.settings._mapplayers||TWA.settings._mapabandoneds)&&TWA.mapCoords.init();TWA.settings.mapmanual&&TWA.mapManual();TWA.settings.lastattack&&game_data.player.premium&&TWA.lastAttack();break;case "info_player":TWA.settings.profilecoords&&TWA.profileCoords();
TWA.settings.profilestats&&TWA.profileGraphic();break;case "info_ally":TWA.settings.profilestats&&TWA.profileGraphic();break;case "info_member":TWA.settings.allygraphic&&"info_member"===game_data.screen&&TWA.tooltipGraphic();break;case "ranking":TWA.settings.mapgenerator&&"awards"!==game_data.mode&&"wars"!==game_data.mode&&"secrets"!==game_data.mode&&TWA.mapGenerator();TWA.settings.rankinggraphic&&TWA.tooltipGraphic();break;case "overview_villages":R=jQuery('<table class="vis" id="twa-overviewtools" style="display:none" width="100%"><tr><th>Tribal Wars Advanced</th></tr></table>').insertBefore(".overview_table");
var a,b;if(!(0<=["trader","groups","commands","incomings"].indexOf(l))){if("units"==l){a=document.getElementById("units_table");b=a.getElementsByTagName("tbody");a=a.getElementsByTagName("th")[0];var c;a.innerHTML='<input type="checkbox" style="margin:0px" id="twa-selectAll"/> '+a.innerHTML;for(a=0;a<b.length;a++)c=b[a].getElementsByTagName("tr")[0],c.getElementsByTagName("td")[0].innerHTML='<input type="checkbox" name="village_ids[]" class="addcheckbox" style="margin:0px" value="'+jQuery('a[href*="village="]:first',
b[a])[0].href.match(/village=(\d+)/)[1]+'"/>'+c.getElementsByTagName("td")[0].innerHTML}else{b=jQuery(".overview_table")[0].getElementsByTagName("tr");for(a=0;a<b.length;a++)b[a].innerHTML=(!a?'<th><input type="checkbox" id="twa-selectAll"/></th>':'<td><input type="checkbox" name="village_ids[]" class="addcheckbox" value="'+jQuery('a[href*="village="]:first',b[a])[0].href.match(/village=(\d+)/)[1]+'"/></td>')+b[a].innerHTML}jQuery("#twa-selectAll").click(function(){jQuery(".addcheckbox:visible").attr("checked",
this.checked)})}TWA.settings.overview&&!game_data.player.premium&&TWA.overview.init();TWA.settings.renamevillages&&TWA.renamevillages.init();TWA.settings.commandrename&&"commands"===l&&TWA.rename.commands();TWA.settings.villagefilter&&"trader"!==l&&TWA.villageFilter();TWA.settings.troopcounter&&"units"===l&&TWA.troopCounter();TWA.settings.changegroups&&game_data.player.premium&&"groups"!==l&&"trader"!==l&&TWA.changegroups.init();TWA.settings.building&&"buildings"===l&&TWA.building.init();TWA.settings.research&&
"tech"===l&&TWA.research.init();TWA.settings.selectvillages&&game_data.player.premium&&TWA.selectVillages.init();break;case "report":TWA.settings.reportcalc&&/view\=\d+/.test(location.href)&&TWA.reportCalc();TWA.settings.reportfilter&&TWA.reportFilter();TWA.settings.reportrename&&game_data.player.premium&&TWA.rename.reports();break;case "am_farm":TWA.settings.assistentfarm&&game_data.player.farm_manager&&!document.getElementsByClassName("error").length&&TWA.assistentfarm.init()}TWA.settings.attackplanner&&
TWA.attackplanner.init();TWA.settings.autofarm&&TWA.autofarm.init();TWA.config();TWA.lastConquests.init()});var V=document;t.add("comments",g.comments,'<div class="fb-comments" data-href="http://relaxeaza.qlix.com.br" data-num-posts="10"></div>',function(){jQuery("body").prepend('<div id="fb-root"></div>');var a,b=V.getElementsByTagName("script")[0];V.getElementById("facebook-jssdk")||(a=V.createElement("script"),a.id="facebook-jssdk",a.src="//connect.facebook.net/pt_BR/all.js#xfbml=1",b.parentNode.insertBefore(a,
b))})})();