Untitled

 avatar
unknown
javascript
3 years ago
2.5 kB
5
Indexable
javascript: var ustawienia = [
    //Ukrywanie wiosek bez murków do zbicia (true/false);
    ukrywanie_pozostalych = true,
    //Ukrywanie wiosek po kliknięciu w link do placu (true/false);
    ukrywanie_po_kliknieciu = true,
    //szablony na dane poziomy murków
    szablony = {
        1: {
            "toporki": 0,
            "zwiad": 0,
            "lekka": 3,
            "taran": 2
        },
        2: {
            "toporki": 0,
            "zwiad": 0,
            "lekka": 5,
            "taran": 3
        },
        3: {
            "toporki": 0,
            "zwiad": 0,
            "lekka": 10,
            "taran": 8
        },
        4: {
            "toporki": 0,
            "zwiad": 0,
            "lekka": 20,
            "taran": 15
        },
        5: {
            "toporki": 0,
            "zwiad": 0,
            "lekka": 20,
            "taran": 20
        },
    }
];

// DO NOT EDIT BELOW //
if (game_data.screen == 'am_farm') {
    var lista = $('#plunder_list')[0].rows;
    $.each(lista, function (i) {
        if (i < 2) {
            return
        };
        var murek = Number(lista[i].cells[6].innerHTML) || 0
            if (murek > 0) {
                var dane = {
                    target_village_id: lista[i].cells[11].getElementsByTagName('a')[0].href.split('target=')[1],
                    from: 'simulator',
                    att_axe: szablony[murek]['toporki'],
                    att_spy: szablony[murek]['zwiad'],
                    att_light: szablony[murek]['lekka'],
                    att_ram: szablony[murek]['taran']
                }
                lista[i].cells[11].getElementsByTagName('a')[0].removeAttribute('onclick');
                lista[i].cells[11].getElementsByTagName('a')[0].href += $.param(dane);
                lista[i].cells[11].getElementsByTagName('a')[0].onclick = function (event) {
                    if (!event.ctrlKey && !event.shiftKey) {
                        event.preventDefault();
                        CommandPopup.openRallyPoint(dane)
                    }
                    if (ukrywanie_po_kliknieciu) {
                        javascript: this.closest('tr').style.display = 'none'
                    }
                }
            } else {
                if (ukrywanie_pozostalych) {
                    lista[i].style.display = 'none';
                }
            }
    })
}
Editor is loading...