Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:
- var gd = game_data;
- var perc = 0.01;
- var v = gd.village;
- var u = {
- "spear": 1,
- "sword": 1,
- "axe": 1,
- "archer": 1,
- "spy": 2,
- "light": 4,
- "marcher": 5,
- "heavy": 6,
- "ram": 5,
- "catapult": 8,
- "knight": 10,
- "snob": 100
- }
- var left;
- try {
- if (document.URL.indexOf('try=confirm') != -1 && document.URL.indexOf('target=') == -1);
- else if (document.URL.indexOf('screen=place') == -1 || (document.URL.indexOf('mode') != -1 && document.URL.indexOf('mode=command') == -1)) {
- location = gd.link_base_pure + "place&mode=command";
- } else {
- if ($('.jump_link')[0] !== undefined) {
- location = $('#village_switch_right')[0].href;
- } else {
- var ul = $('.unit_link');
- for (var i = 0; i < ul.length; i++)
- $('#unit_input_' + $(ul[i]).attr('data-unit'))[0].value = "";
- var coords = "580|621 580|626 581|625 581|627 582|618 582|628 583|624 583|625 583|626 584|622 584|623 584|626 584|628 585|621 585|622 585|624 585|625 585|628 586|618 586|625 586|626 587|617 587|625 588|617 588|621 588|623 588|626 588|627 589|621 589|622 589|623 589|627 590|617 590|619 590|620 590|622 590|625 590|628 591|619 591|622 578|631 578|633 580|631 581|633 582|629 583|630 583|633 584|630 586|631 586|633 587|629 587|630 587|631 588|630 588|633 572|611 574|612 576|616 578|620 579|611 579|612 579|613 580|612 580|614 580|615 581|616 582|614 582|615 583|610 584|612 584|613 584|614 585|614 586|613 586|614 586|615 586|616 587|615 587|616 588|613 588|615 588|616 589|611 590|616 591|612 592|613 592|616 592|621 593|613 593|614 593|622 575|599 575|602 575|603 575|605 576|603 576|605 577|600 577|607 578|602 578|608 579|599 579|601 579|605 579|609 581|600 581|608 582|601 582|603 582|606 582|608 583|605 583|608 583|609 584|599 584|600 584|602 584|603 584|607 585|603 586|601 586|602 586|604 586|605 586|606 586|607 567|599 567|609 568|600 568|601 569|599 569|601 569|603 570|603 572|601 572|604 572|605 573|600 573|603 574|601 574|604 574|609 563|599 563|609 565|599 565|610 566|599 566|605 566|608 566|609 566|610 572|592 572|593 577|594 577|597 578|592 578|597 578|598 579|596 579|598 581|595 581|597 582|593 583|598 572|585 572|587 572|590 572|591 573|584 573|585 573|586 573|587 575|584 575|585 576|585 576|590 577|587 577|588 577|589 578|584 578|587 580|590 581|586 582|584 582|585 582|590 583|584 583|587 583|589 584|591 585|587 585|591 585|592 585|595 586|587 586|593 587|586 587|591 587|593 587|597 589|591 589|592 589|593 589|597 575|583 577|580 577|583 578|580 578|581 578|582 579|578 579|579 579|580 579|581 579|582 580|580 580|581 581|579 581|581 581|582 581|583 583|582 584|583 584|585 585|579 585|583 585|584 586|581 586|583 586|585 568|583 568|584 568|593 568|594 569|583 569|594 570|590 570|594 571|583 571|588 571|590 571|594 566|593 566|594 567|593 567|594 567|598 571|596 558|587 558|588 558|589 559|587 559|588 559|591 560|587 560|588 561|591 562|592 562|595 563|588 563|590 563|591 563|592 563|593 563|595 564|591 564|592 564|593 565|587 565|590 566|587 566|589 564|586 562|581 562|582 562|583 563|580 563|581 563|583 564|580 564|585 565|580 565|583 565|584 566|582 566|585 567|585 568|580 571|582 530|672 534|672 537|677 538|671 541|675 541|677 542|674 542|675 542|676 542|678 543|671 543|674 543|678 544|677 544|679 544|680 545|674 545|675 545|677 546|675 546|680 547|675 548|673 552|679 548|672 552|672 553|673 553|675 554|682 555|672 555|676 555|677 555|678 556|679 556|681 556|682 557|673 542|669 542|670 543|669 543|670 544|668 544|669 545|669 545|670 547|670 548|671 549|671 551|667 551|671 539|668 540|668 540|669 543|666 545|665 545|666 548|666 544|662 548|662 549|662 550|663 550|664 550|666 551|660 551|665 552|661 552|663 552|665 553|660 554|664 554|668 554|671 555|662 555|664 555|665 555|666 555|667 555|670 555|671 558|681 559|672 560|673 560|678 560|679 560|680 545|658 547|659 548|655 549|653 551|653 551|656 552|654 552|655 553|656 553|657 554|653 554|655 554|656 554|658 555|656 556|657 556|659 553|650 555|650 555|652 557|653 557|654 558|650 558|654 558|656 559|650 559|657 559|660 559|661 547|641 547|642 548|642 549|640 551|649 552|642 552|647 552|649 553|643 553|648 553|649 554|643 555|641 555|643 555|645 556|640 556|642 557|647 557|648 541|641 542|641 544|641 545|640 547|639 550|637 551|636 551|637 547|632 549|633 552|637 554|639 555|636 555|638 556|637 556|638 556|639 558|635 558|638 558|641 559|635 559|636 559|638 559|640 559|645 560|637 560|641 561|640 561|642 562|634 562|635 562|639 563|635 563|637 563|639 563|640 563|641 563|644 563|645 564|635 564|639 564|641 564|642 564|643 565|634 565|635 565|637 565|645 561|647 562|646 563|646 564|646 566|647 567|641 567|643 567|644 568|638 568|641 568|642 568|644 568|646 569|644 569|645 569|647 570|641 570|642 571|647 567|649 569|648 571|648 572|639 572|640 572|643 572|649 573|642 573|645 573|648 574|639 574|641 574|645 574|648 575|644 575|645 575|647 575|649 576|644 576|646 576|648 577|645 558|648 558|649 559|646 559|647 561|649 561|652 563|651 565|649 567|650 568|651 569|652 570|650 578|641 578|643 578|646 579|639 579|645 579|647 579|649 581|639 581|641 581|648 581|649 575|637 578|631 578|633 580|631 581|633 581|634 583|630 583|633 583|636 584|630 584|635 584|638 584|641 585|634 585|639 585|640 586|631 586|633 576|622 580|626 581|625 581|627 582|628 582|629 583|624 583|625 583|626 584|622 584|623 584|626 584|628 585|622 585|624 585|625 585|628 586|625 586|626".split(" ");
- var selected = [];
- for (var i = 0; i < coords.length; ++i)
- if (isSelected(coords[i]))
- selected.push(coords[i]);
- console.log(selected);
- if (selected.length != 0) {
- left = Math.floor(v.points * perc);
- var index = Math.round(Math.random() * (selected.length - 1));
- $(".target-input-field")[0].value = selected[index];
- /* CONFIG: wybA3r wojsk */
- units("ram", 1) || units("catapult", 1);
- fill("spy:5,axe:40,sword:90,light:15,spear:45,heavy:8,spear:90,heavy:15,spy:45,ram:1,catapult:1");
- if (left > 0)
- UI.ErrorMessage('Za ma3a pula wojsk', 5000);
- } else {
- UI.ErrorMessage('Nie mo?na wybraa wioski', 5000);
- }
- }
- }
- } catch (err) {
- var message = "Wyst1pi3 nieoczekiwany b31d";
- console.log(err.message);
- UI.ErrorMessage(message, 5000);
- }
- function isSelected(coords) {
- var days = ["16-16"];
- var intervals = ["7:00-12:59"];
- var distance = Math.hypot(coords.split("|")[0] - v.x, coords.split("|")[1] - v.y);
- var destination = new Date(distance * 1667000 + gd.time_generated);
- var isInInterval = (intervals, value, predicate) => {
- for (var i = 0; i < intervals.length; i++)
- if (predicate(value, intervals[i]))
- return true;
- return false;
- };
- if (!isInInterval(days, destination, (v, i) => {
- v = v.getDate();
- i = i.split('-');
- return parseInt(i[0]) <= v && v <= parseInt(i[1]);
- })) return false;
- if (isInInterval(intervals, destination, (v, i) => {
- var parseTimer = timer => parseInt(timer[0]) * 60 + parseInt(timer[1]);
- v = parseTimer([v.getHours(), v.getMinutes()]);
- i = i.split("-");
- return 420 <= v && v <= 720;
- })) return true;
- return false;
- }
- function tryUnits(name, value) {
- var mv = $('a#units_entry_all_' + name)[0].innerText.match(/\d+/)[0];
- var sv = $('#unit_input_' + name)[0].value;
- return mv - sv - value >= 0;
- }
- function units(name, value) {
- var mv = $('a#units_entry_all_' + name)[0].innerText.match(/\d+/)[0];
- var sv = $('#unit_input_' + name)[0].value;
- sv = sv == "" ? 0 : parseInt(sv);
- mv -= sv;
- if (value > mv)
- value = mv;
- left -= u[name] * value;
- $('#unit_input_' + name)[0].value = sv + value;
- return value > 0;
- }
- function fill(names) {
- if (left <= 0) return;
- names = names.split(',');
- var name, quantity;
- for (var i = 0; i < names.length; ++i) {
- name = names[i];
- quantity = NaN;
- if (name.indexOf(':') != -1) {
- quantity = parseInt(name.split(':')[1]);
- name = name.split(':')[0];
- }
- units(name, Math.ceil((isNaN(quantity) ? left : (quantity * u[name] >= left ? left : quantity * u[name])) / u[name]));
- if (left <= 0) return;
- }
- }
- document.getElementById('target_attack').click()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement