Last active
November 23, 2015 12:58
-
-
Save thevtm/35b4ad15bc144e9ed483 to your computer and use it in GitHub Desktop.
Tribal Wars Farming facilitator.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name TW Farm+ | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Vinícius Tabille Manjabosco | |
// @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js | |
// @match https://*.tribalwars.com.br/game.php?*screen=am_farm | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
"use strict"; | |
parseResource = function (res_text) { | |
"use strict"; | |
return _(res_text) | |
.trim() | |
.split(" ") | |
.filter(function (x) { return x !== ""; }) | |
.map(_.parseInt); | |
} | |
plunder_list = $('#plunder_list tr').slice(1); | |
plunder_list_res = $('#plunder_list tr td:nth-child(6)'); | |
$('#plunder_list tr td:nth-child(6)').each(function () { | |
"use strict"; | |
var res_jq = $(this); | |
var res = parseResource(res_jq.text()); | |
var res_sum = _.sum(res); | |
res_jq.append(' <span class="icon header ressources"></span> ' + res_sum); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment