Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: if (document.URL.match(/mode=commands/)) {var troopsArray = new Array(); var numvil = 0; var main = $("#commands_table")[0]; var names = new Array(); var vilCoords = new Array(); var village = new Array(); var CurVill; var units =['Spears', 'Swords', 'Axes', 'Scouts', 'Light Cal', 'Heavy Cal', 'Rams', 'Cats', 'Paladin', 'Noblemen']; var farmused =['1', '1', '1', '2', '5', '6', '5', '8', '10', '100']; var rows = main.getElementsByTagName('tr'); for (var j = 1;j < rows.length;j++) {var cells = rows[j].getElementsByTagName('td'); if ($(cells[0]).text().match(/Support/) == "Support") {CurVill = $(cells[0]).text().split(/\(/); CurVill = CurVill[CurVill.length - 1]; CurVill = CurVill.match(/\d+\|\d+/); var val = 0; if (vilCoords[CurVill] == null) {village.push(CurVill); vilCoords[CurVill] = new Array(); var p = 0; for (var k = 3;k <= (cells.length - 1);k++) {val = cells[k].firstChild.nodeValue; if ( ! val) {val = cells[k].firstChild.innerHTML.replace( /<[^>]*>/g, '').replace(/\s+/, '').match(/\d+/)[0]; } vilCoords[CurVill][p] = parseInt(val); p = p + 1; } } else {var p = 0; for (var k = 3;k <= (cells.length - 1);k++) {val = cells[k].firstChild.nodeValue; if ( ! val) {val = cells[k].firstChild.innerHTML.replace( /<[^>]*>/g, '').replace(/\s+/, '').match(/\d+/)[0]; } vilCoords[CurVill][p] += parseInt(val); p = p + 1; } } } } var msg = "Total Support Sent<br>" + "---------------------------------<br>"; for (var g = 0;g < village.length;g++) {msg += "Sent -- "; var villageCoords = village[g]; var troops = vilCoords[villageCoords]; var farmspace = 0; for (var h = 0;h <= 11;h++) {if (troops[h] == 0){} else {msg += units[h] +": " + troops[h] + " "; farmspace += parseInt(troops[h] * farmused[h]); } } msg += "to [village]" + village[g] +"[/village] (total farm population is: " + farmspace +")<br><br>"; } function openPopup() {var TheNewWin = window.open('', 'name', 'height=255,width=800, toolbar=no,directories=no,status=no,menubar=no'); TheNewWin.document.write( '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd"><html xmlns="http:\/\/www.w3.org\/1999\/xhtml">'); TheNewWin.document.write( '<head><title>Popup<\/title><\/head><body style="overflow:hidden" bgcolor="#ffffff"> <p>' + msg + '<\/p>'); TheNewWin.document.write(' <hr \/> <p align="right"><a href="#" onclick="self.close(); return false;">Close'); TheNewWin.document.write(' Window<\/a><\/p> <\/body><\/html>'); } openPopup(); } else {self.location = "http://" + window.location.hostname + "/game.php?screen=overview_villages&mode=commands"; } void (0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement