// ==UserScript==
// @name TW Gold Jobs Finder (More Languages)
// @namespace TomRobert
// @author Macabre2077 (updated by Tom Robert)
// @author tw81 (Italian translation)
// @author Jakovlev (Hungarian translation)
// @author realfan2002 (Romanian translation)
// @author Vebuus (Polish translation)
// @author Ilja Iljic (Czech translation)
// @author pepe100 (Spanish translation)
// @author Tom Robert (German translation)
// @description Shows a list of all silver and gold jobs!
// @include http*://*.the-west.*/game.php*
// @version 1.01
// @grant none
// @downloadURL none
// ==/UserScript==
(function (fn) {
var script = document.createElement('script');
script.setAttribute('type', 'application/javascript');
script.textContent = '(' + fn + ')();';
document.body.appendChild(script); // run the script
document.body.removeChild(script); // clean up
}) (function () {
GoldJobs = {
version: '1.01',
name: 'TW Gold Jobs Finder',
author: 'Macabre2077 (updated by Tom Robert)',
minGame: '2.05',
maxGame: Game.version.toString(),
website: 'https://greasyfork.org/scripts/7226',
updateUrl: 'http://pastebin.com/raw.php?i=1NHRGWVx',
toLoad: 0,
loaded: 0,
xMax: 181,
yMax: 79,
blockMaxLength: 300,
dataLoaded: false,
silverJobBbColor: '#708090',
goldJobBbColor: '#f4c430',
preferences: {
jobName: '',
showSilver: true,
showGold: true,
sortByName: 0,
sortByDistance: 1
},
hiddenImageOpacity: 0.35,
shownImageOpacity: 1,
bestJobTime: 0
};
langs = {
en_US: {
language: 'None (English)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Contact',
jobIcon: 'Icon',
jobName: 'Job name',
distanceTime: 'Travel time',
showJob: 'Show',
title: 'Gold And Silver Jobs',
loading: 'Loading...',
exportButtonTitle: 'Share',
generatedBy: 'Generated by TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Generated by TW Gold Jobs Finder[/url][/i]',
plainText: 'Plain Text',
bbCode: 'BB code',
enqueue: 'Enqueue',
openWindowTitle: 'Open window',
refreshTitle: 'Refresh',
feedbackTitle: 'Send feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English, German or French please..',
update: 'Update',
updateAvailable: 'A new version of the script is available',
cancel: 'Cancel',
},
ru_RU: {
language: 'Russian (ру́сский)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'контакт',
jobIcon: 'Иконка',
jobName: 'Название работы',
distanceTime: 'Время',
showJob: 'Показать',
title: 'Золотые и серебряные работы',
loading: 'Загрузка...',
exportButtonTitle: 'Поделиться',
generatedBy: 'Получено с помощью TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Получено с помощью TW Gold Jobs Finder[/url][/i]',
plainText: 'Без BB-кода',
bbCode: 'С BB-кодом',
enqueue: 'Начать',
openWindowTitle: 'Открыть',
refreshTitle: 'Обновить данные',
feedbackTitle: 'Обратная связь',
feedbackWindowTitle: 'Golden Jobs, обратная связь',
feedbackDescription: 'Если нашли баги, или есть идеи, как улучшить скрипт, отправить мне сообщение',
update: 'обновление',
updateAvailable: 'Доступно обновление скрипта',
cancel: 'отменить',
},
it_IT: {
language: 'Italian (italiano)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Contatto',
jobIcon: 'Icona',
jobName: 'Nome lavoro',
distanceTime: 'Tempo di viaggio',
showJob: 'Mostra',
title: 'Lavoro Oro e Argento',
loading: 'Caricamento in corso ... Ci vorrà un po \'',
exportButtonTitle: 'Cita',
generatedBy: 'Generato da TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Generato da TW Gold Jobs Finder[/url][/i]',
plainText: 'Testo normale',
bbCode: 'BB code',
enqueue: 'Inizia',
openWindowTitle: 'Aperto',
refreshTitle: 'Aggiornare dati',
feedbackTitle: 'Invia feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
feedbackDescription: 'Se avete riscontrato qualche bug o avete idee su come migliorare questo script, vi prego di descriverle .. in inglese, tedesco o francese per favore.',
update: 'Atualizar',
updateAvailable: 'Script aggiornamento disponibile',
cancel: 'Cancelar',
},
hu_HU: {
language: 'Hungarian (Magyar)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Érintkezés',
jobIcon: 'Ikon',
jobName: 'Munka neve',
distanceTime: 'Menetidő',
showJob: 'Mutatás',
title: 'Arany és ezüst munkák',
loading: 'Kis türelmet, töltés alatt...',
exportButtonTitle: 'Megosztás',
generatedBy: 'TW Gold Jobs Finder által létrehozva',
generatedByBb: '[i][url=' + GoldJobs.website + ']TW Gold Jobs Finder által létrehozva[/url][/i]',
plainText: 'Szövegként',
bbCode: 'BB kód',
enqueue: 'Kezdés',
openWindowTitle: 'Megnyitás',
refreshTitle: 'Frissítés',
feedbackTitle: 'Visszajelzés küldése',
feedbackWindowTitle: 'Gold Jobs visszajelzés',
feedbackDescription: 'Ha találkoztál hibákkal (bug), vagy javaslatod lenne a szkript bővítéséhez írd le őket. Értek angolul, németül és franciául.',
update: 'Frissítés',
updateAvailable: 'Egy új változata a script elérhető',
cancel: 'Érvénytelenít',
},
ro_RO: {
language: 'Romanian (român)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Contact',
jobIcon: 'Imagine',
jobName: 'Denumirea muncii',
distanceTime: 'Distanţa',
showJob: 'Arată',
title: 'Munci aurii şi argintii',
loading: 'Se încarcă... Poate dura ceva timp!',
exportButtonTitle: 'Distribuiţi',
generatedBy: 'Generat cu TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Generat cu TW Gold Jobs Finder[/url][/i]',
plainText: 'Text simplu',
bbCode: 'BB code',
enqueue: 'Start',
openWindowTitle: 'Deschide',
refreshTitle: 'Reîmprospăta',
feedbackTitle: 'Trimite feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English, German or French please..',
update: 'Actualizare',
updateAvailable: 'O nouă versiune este disponibilă',
cancel: 'Anula',
},
pl_PL: {
language: 'Polish (polski)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Kontakt',
jobIcob: 'Ikona',
jobName: 'Nazwa pracy',
distanceTime: 'Dystans',
showJob: 'Pokaż',
title: 'Złote i srebrne prace',
loading: 'Ładowanie... To zajmie moment',
exportButtonTitle: 'Eksport',
generatedBy: 'Stworzone przez TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Stworzone przez TW Gold Jobs Finder[/url][/i]',
plainText: 'Zwykły tekst',
bbCode: 'BB code',
enqueue: 'Startuj',
openWindowTitle: 'Otwierać',
refreshTitle: 'Odświeżanie danych',
feedbackTitle: 'Wysłać opinię',
feedbackWindowTitle: 'Gold Jobs Opinię',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English, German or French please..',
update: 'Aktualizacja',
updateAvailable: 'Nowa wersja skryptu jest dostępny',
cancel: 'Anuluj',
},
cs_CZ: {
language: 'Czech (čeština)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Kontakt',
jobIcon: 'Ikonka',
jobName: 'Práce',
distanceTime: 'Vzdálenost',
showJob: 'Ukaž',
title: 'Zlaté a stříbrné práce',
loading: 'Nahrávám...',
exportButtonTitle: 'Sdílet',
generatedBy: 'Generated by TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Generated by TW Gold Jobs Finder[/url][/i]',
plainText: 'Prostý Text',
bbCode: 'BB code',
enqueue: 'Zadat',
openWindowTitle: 'Otevřít okno',
refreshTitle: 'Obnovit',
feedbackTitle: 'Pošli zpětnou vazbu',
feedbackWindowTitle: 'Gold Jobs Feedback',
feedbackDescription: 'Pokud jste nalezli bug nebo máte nápad na zlepšení skriptu, napište je..v angličtině, němčině nebo francouzštině prosím..',
update: 'Aktualizovat',
updateAvailable: 'Nová verze skriptu je k dispozici',
cancel: 'Zrušit',
},
es_ES: {
language: 'Spanish (español)',
ApiGui: 'This script adds a button on the right side, where you can load all the silver and gold jobs.
So they can be easily found on the map.',
contact: 'Contacto',
jobIcon: 'Icono',
jobName: 'Nombre Trabajo',
distanceTime: 'Tiempo viaje',
showJob: 'Mostrar',
title: 'Trabajos con Bonus Oro y Plata',
loading: 'Cargando...',
exportButtonTitle: 'Compartir',
generatedBy: 'Generado por TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Generado por TW Gold Jobs Finder[/url][/i]',
plainText: 'Texto plano',
bbCode: 'BB code',
enqueue: 'Poner en cola',
openWindowTitle: 'Abrir ventana',
refreshTitle: 'Refrescar',
feedbackTitle: 'Enviar comentarios',
feedbackWindowTitle: 'Gold Jobs comentarios',
feedbackDescription: 'Si ha encontrado algún error o tiene ideas de cómo mejorar este script, descríbalos.. por favor en inglés, alemán o francés..',
update: 'Actualización',
updateAvailable: 'Una nueva versión está disponible',
cancel: 'Cancelar',
},
de_DE: {
language: 'German (Deutsch)',
ApiGui: 'Das Script fügt am rechten Rand einen Button hinzu, wo man alle Gold- und Silber-Arbeiten laden kann.
So findet man sie ganz einfach auf der Karte.',
contact: 'Kontakt',
jobIcon: 'Bild',
jobName: 'Arbeit',
distanceTime: 'Distanz',
showJob: 'Zeigen',
title: 'Gold und Silber Arbeiten',
loading: 'Laden...',
exportButtonTitle: 'Teilen',
generatedBy: 'Gefunden mit TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.website + ']Gefunden mit TW Gold Jobs Finder[/url][/i]',
plainText: 'Klartext',
bbCode: 'BB Code',
enqueue: 'Einstellen',
openWindowTitle: 'Fenster öffnen',
refreshTitle: 'Aktualisieren',
feedbackTitle: 'Feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
feedbackDescription: 'Falls du auf Fehler gestossen bist oder Ideen hast, das Script zu verbesseren, beschreibe diese.. auf Deutsch, Englisch oder Französisch bitte..',
update: 'Update',
updateAvailable: 'Für das Script ist eine neue Version erhältlich',
cancel: 'Abbrechen',
},
};
lang = langs.hasOwnProperty(Game.locale) ? langs[Game.locale] : langs.en_US;
var GoldJobsApi = TheWestApi.register('GoldJobs', GoldJobs.name, GoldJobs.minGame, GoldJobs.maxGame, GoldJobs.author, GoldJobs.website);
GoldJobsApi.setGui('
Language detected: ' + lang.language + '
' + lang.ApiGui + '
' + GoldJobs.name + ' v' + GoldJobs.version + '');
GoldJobs.parseWholeMap = function (tiles, onLoad) {
this.loaded = 0;
var x,
y;
var arr = [
];
var currentBlock = 0;
var currentBlockLength = 0;
for (x in tiles) {
for (y in tiles[x]) {
if (isNaN(x) || isNaN(y)) {
continue;
}
if (currentBlockLength == 0) {
arr[currentBlock] = [
];
}
arr[currentBlock].push([parseInt(x),
parseInt(y)]);
if (++currentBlockLength == this.blockMaxLength) {
currentBlock++;
currentBlockLength = 0;
}
}
}
var i,
to = arr.length;
this.toLoad = to;
for (i = 0; i < to; i++) {
Map.Data.Loader.load(arr[i], function () {
GoldJobs.loaded++;
if (GoldJobs.loaded == GoldJobs.toLoad) {
onLoad();
}
});
}
};
GoldJobs.getJobIcon = function (jobId, x, y, shortname, gold) {
var pos = {
'x': x,
'y': y
};
var t = gold ? 'gold' : 'silver';
return '