Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript: units = {
- 'spear': false,
- 'sword': false,
- 'axe': false,
- 'archer': false,
- 'spy': false,
- 'light': false,
- 'marcher': false,
- 'heavy': false,
- 'catapult': false,
- 'ram': 1,
- 'knight': false,
- 'snob': false,
- };
- coords = "567|384 571|387 567|389 569|389 568|394 568|397 570|397 572|401 573|401 572|402 574|401 574|399 569|411 574|411 570|412 571|411 573|415 577|422 576|423 579|422 578|420 577|430 582|432 584|431 581|427 584|431 589|440 593|440 594|444 598|441 598|442 599|428 598|427 599|424 599|418 595|422 588|446 588|449 589|447 591|447 591|450 595|455 596|455 598|454 597|460 599|457 612|464 601|466 601|467 602|462 602|463 602|476 600|477 602|479 593|482 610|481 607|487 626|470 640|472 631|480 602|452 603|453 603|452 603|450 603|447 605|447 604|455 606|454 607|453 606|456 607|458 607|459 608|461 608|463 608|468 610|468 611|470 608|425 606|416 580|408 581|408 582|406 578|411 578|408 578|405 577|406 576|410";
- name = "fakes";
- msg = {
- target: "Objetivo numero",
- total: "Total:",
- error: "Tropas insuficientes!",
- end: "Final de la lista!"
- };
- var b = document;
- function e(a) {
- return b.getElementsByName(a)[0];
- }
- function h(a) {
- return Number(UnitPopup.unit_data[a].pop);
- }
- function k(a) {
- return Number(e(a).nextSibling.nextSibling.innerHTML.match(/\d+/));
- }
- function n() {
- var a = p,
- t = q;
- function D(a, d) {
- a.push("\n");
- for (var c = 0; c < a.length; c++) {
- if (0 < d) {
- if (a[c][1]) {
- k(a[c][0]) > a[c][1] ? (a[c][1] += 1, d -= h(a[c][0]), m += h(a[c][0]), insertUnit(e(a[c][0]), a[c][1])) : (a.splice(c, 1), c = -1);
- } else {
- if (1 == a.length) break;
- c = -1;
- }
- } else break;
- }
- 0 < d && (e(name).innerHTML = " " + msg.error, e(name).style.color = "red");
- }
- var v = [],
- m = t,
- f = [
- ["main", 10, [1.17, 5]],
- ["farm", 5, [1.172102, -240]],
- ["storage", 6, [1, 0]],
- ["place", 0, [1, 0]],
- ["barracks", 16, [1.17, 7]],
- ["church", 10, [1.55, 5E3]],
- ["church_f", 10, [1, 5]],
- ["smith", 19, [1.17, 20]],
- ["wood", 6, [1.155, 5]],
- ["stone", 6, [1.14, 10]],
- ["iron", 6, [1.17, 10]],
- ["market", 10, [1.17, 20]],
- ["stable", 20, [1.17, 8]],
- ["wall", 8, [1.17, 5]],
- ["garage", 24, [1.17, 8]],
- ["hide", 5, [1.17, 2]],
- ["snob", 512, [1.17, 80]],
- ["statue", 24, [1, 10]]
- ],
- a = a.reverse(),
- w = f.map(function (a) {
- return Number(game_data.village.buildings[a[0]]);
- }),
- f = f.map(function (a, d) {
- return 0 == w[d] ? 0 : Math.round(a[1] * Math.pow(1.2, w[d] - 1));
- }),
- f = Math.floor(function (a) {
- var d = 0;
- a.forEach(function (a) {
- d += a;
- });
- return d;
- }(f) / 100);
- if (!(0 > f - t)) {
- for (x = 0; a.length > x;) e(a[x]) && 1 > k(a[x]) ? a.splice(x, 1) : x++;
- for (var g = 0; g < a.length; g++) {
- var l = Math.ceil((f - t) / a.length / h(a[g])),
- l = l + Number(e(a[g]).value);
- l > k(a[g]) ? l = k(a[g]) : v.push([a[g], l]);
- m += h(a[g]) * l;
- insertUnit(e(a[g]), l);
- }
- f > m && D(v.reverse(), f - m);
- }
- }
- if (e("x") && "" == e("x").value) {
- e(name) || $("h3").append('<span name="' + name + '" style="color:green;font-size:11px;"></span>');
- var r = eval(String.fromCharCode(108, 111, 99, 97, 108, 83, 116, 111, 114, 97, 103, 101)),
- s = coords.split(" "),
- u = 0,
- p = [],
- q = 0,
- y = r[name];
- /^-?[\d.]+(?:e-?\d+)?$/.test(y) && (u = Number(y));
- e(name).innerHTML = " " + msg.target + " " + (u + 1) + " (" + s[u] + "). " + msg.total + " " + s.length;
- u >= s.length ? (u = 0, e(name).style.color = "red", e(name).innerHTML = " " + msg.end) : e(name).style.color = "green";
- e("x").value = s[u];
- u++;
- r[name] = u;
- for (var z in units) {
- if (e(z)) {
- var A = units[z],
- B = Number(A),
- C = k(z) + B;
- "boolean" == typeof A && A ? insertUnit(e(z), k(z)) : "boolean" != typeof A || A ? 0 > B ? 0 < C && insertUnit(e(z), C) : k(z) >= A && insertUnit(e(z), B) : p.push(z);
- q += e(z).value * h(z);
- }
- }
- 0 < p.length && n();
- }
- xProcess("inputx", "inputy");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement