// ==UserScript==
// @name TWLeoTools
// @namespace TomRobert
// @author Leotas (updated by Tom Robert)
// @description Useful tools for The West!
// @include https://*.the-west.*/game.php*
// @include https://*.the-west.*/index.php?page=logout
// @include https://www.the-west.*
// @include https://beta.the-west.net*
// @version 1.29
// @grant none
// @downloadURL none
// ==/UserScript==
// translation: Tom Robert(German & English), Darius II/Wojcieszy(Polish), pepe100(Spanish), ruud99(Dutch)
if (location.href.indexOf('index.php?page=logout') != - 1) {
location.href = '/';
}
if (location.href.indexOf('https://www.the-west.') != - 1 || location.href.indexOf('https://beta.the-west.net') != - 1) {
window.onload = function () {
var t = Worlds.playerWorlds,
lang = {
net: 'Load all your active worlds with one click',
de: 'Lade all deine aktiven Welten mit einem Klick',
pl: 'Załaduj wszystkie aktywne światów za pomocą jednego kliknięcia',
es: 'Cargar todos los mundos activos con un solo clic',
nl: 'Laad al uw actieve werelden met één klik',
hu: 'Betölti az összes aktív világok egyetlen kattintással',
};
Worlds.show = (function () {
var newstuff = Worlds.show;
return function () {
newstuff.apply(this, arguments);
var count = 0;
$('#selectWorldText').append('');
$('#loginAll').css({
'left': '-3px',
'top': '36px',
'position': 'relative',
'cursor': 'pointer',
}).click(function () {
for (var x in t) {
if (t[x][1] !== null) {
if (count === 0)
Auth.login(t[x]);
else
window.open(location + '#loginWorld' + x, '_blank');
count += 1;
}
}
});
};
}) ();
if (location.hash.indexOf('loginWorld') != - 1) {
$('#loginButton').click();
Auth.login(t[parseFloat(location.hash.replace(/\D/g, ''))]);
}
};
}
if (location.href.indexOf('game.php') != - 1) {
(function (fn) {
var script = document.createElement('script');
script.setAttribute('type', 'application/javascript');
script.textContent = '(' + fn.toString() + ')();';
document.body.appendChild(script);
document.body.removeChild(script);
}) (function () {
TWLTstart = {
version: '1.29',
name: 'TWLeoTools',
author: 'Leotas (updated by Tom Robert)',
minGame: '2.04',
maxGame: Game.version.toString(),
website: 'https://greasyfork.org/scripts/7238',
updateUrl: 'https://raw.githack.com/TomRobert/tw/master/sU.js',
updateAd: 'http://adf.ly/1OMM8P',
};
langs = {
en_US: {
language: 'None (English)',
ApiGui1: 'This script contains many features to simplify your everyday life in The West:
BETA-SERVER: The stats of the set can change at any time!
BETA-SERVER: The stats of the sets can change at any time!
' : '')); var NAM; var type = { }; var SPEC = [ 'speed', 'luck', 'dollar', 'experience', 'regen', 'drop', ]; var lastBon; for (var i = 0; i < sets.length; i++) { for (var k in sets[i].bonus) { for (var l = 0; l < sets[i].bonus[k].length; l++) { var ID = sets[i].bonus[k][l]; if (ID.job) NAM = ID.job; else if (ID.name) NAM = ID.name; else if (ID.bonus) { if (ID.bonus.name) NAM = ID.bonus.name; else NAM = ID.bonus.type; } else NAM = ID.type; if (NAM == id[1]) { if (!type[i]) type[i] = 0; type[i] = (ID.value !== undefined) ? ID.value + type[i] : ID.bonus.value + type[i]; if (SPEC.indexOf(id[1]) == - 1) VAL = Math.round(type[i] * 100) / 100; else { var NUM = type[i] * 100; if (NUM > 0.2) VAL = Math.round(NUM); else VAL = NUM; } var DESC = (ID.desc) ? ID.desc.replace(/[0-9]|\+|\./g, '') : CharacterSkills.keyNames[NAM]; scrollpane.appendContent((sets[i] != lastBon ? '