-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra_attack.js
31 lines (28 loc) · 1014 Bytes
/
extra_attack.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
// ==UserScript==
// @name extra attack
// @namespace https://github.com/extreme4all/tribalwars/blob/master/
// @description Extra attack
// @include https://*tribalwars.*/game.php?*screen=place*
// @require http://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
var parent = document.forms[0];
var para = document.createElement("P");
var sum = 0;
parent.prepend(para);
parent.addEventListener('input', updateValue);
para.innerText = "Total amount units: " + sum
function updateValue(e) {
sum = Number(document.forms[0].spear.value)
+ Number(parent.sword.value)
+ Number(parent.axe.value)
+ Number(parent.archer.value)
+ Number(parent.spy.value)
+ Number(parent.light.value)
+ Number(parent.marcher.value)
+ Number(parent.heavy.value)
+ Number(parent.ram.value)
+ Number(parent.catapult.value)
+ Number(parent.knight.value)
+ Number(parent.snob.value);
para.innerText = "Total amount units: " + sum
}