// ==UserScript==
// @name TW Gold Jobs Finder (More Languages)
// @namespace TomRobert
// @author Tom Robert (officially by Macabre2077)
// @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 0.99
// @supportURL https://greasyfork.org/forum/discussion/2673
// @grant none
// @downloadURL none
// ==/UserScript==
function exec(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
}
exec(function () {
var VERSION = 0.99;
if (window.hasOwnProperty('GoldJobs') && GoldJobs.version > VERSION) return;
GoldJobs = {
version: VERSION,
author: 'Tom Robert (officially by Macabre2077)',
CHECK_FILE_URL: 0,
FEEDBACK_URL: 'http://shelimov.me/macabre2077/userscripts/goldjobs/sendFeedback.php',
CHECK_FILE_URL: 'http://pastebin.com/raw.php?i=1NHRGWVx',
SCRIPT_SITE: 'https://greasyfork.org/de/scripts/7226',
SCRIPT_NAME: 'TW Gold Jobs Finder',
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,
GAME_VERSION_SUPPORTED_MIN: '2.05',
GAME_VERSION_SUPPORTED_MAX: Game.version.toString(),
bestJobTime: 0
};
GoldJobs.languages = {
'en_US': {
language: 'English',
jobIcon: 'Icon',
jobName: 'Job name',
distanceTime: 'Travel time',
showJob: 'Show',
title: 'Gold And Silver Jobs',
loaded: 'Loaded: ',
changelist: 'Changelist',
version: 'version',
update_available: 'Gold Jobs update available',
update_question: 'You can download the latest version from greasyfork.org. Visit the site?',
loading: 'Loading...',
exportTitle: 'Share',
exportButtonTitle: 'Share',
generatedBy: 'Generated by TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Generated by TW Gold Jobs Finder[/url][/i]',
plainText: 'Plain Text',
bbCode: 'BB code',
enqueue: 'Enqueue',
openWindowTitle: 'Open window',
refreshTitle: 'Refresh',
feedback: 'Improvement',
feedbackTitle: 'Send feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
bug: 'Bug',
send: 'Send',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English please..',
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.'
},
'ru_RU': {
language: 'Russian (ру́сский)',
jobIcon: 'Иконка',
jobName: 'Название работы',
distanceTime: 'Время',
showJob: 'Показать',
title: 'Золотые и серебряные работы',
changelist: 'Список изменений',
version: 'версия',
loaded: 'Загружено: ',
update_available: 'Доступно обновление скрипта Gold Jobs',
update_question: 'Вы можете скачать новую версию с сайта greasyfork.org. Перейти?',
loading: 'Загрузка...',
exportTitle: 'Поделиться результатами',
exportButtonTitle: 'Поделиться',
generatedBy: 'Получено с помощью TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Получено с помощью TW Gold Jobs Finder[/url][/i]',
plainText: 'Без BB-кода',
bbCode: 'С BB-кодом',
enqueue: 'Начать',
openWindowTitle: 'Открыть',
refreshTitle: 'Обновить данные',
feedback: 'Предложение',
feedbackTitle: 'Обратная связь',
feedbackWindowTitle: 'Golden Jobs, обратная связь',
bug: 'Баг',
send: 'Отправить',
feedbackDescription: 'Если нашли баги, или есть идеи, как улучшить скрипт, напишите их в поле ниже',
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.'
},
'it_IT': {
language: 'Italian (italiano)',
jobIcon: 'Icona',
jobName: 'Nome lavoro',
distanceTime: 'Tempo di viaggio',
showJob: 'Mostra',
title: 'Lavoro Oro e Argento',
loaded: 'Caricato: ',
changelist: 'Elenco modifiche',
version: 'versione',
update_available: 'E\' disponibile un aggiornamento per TW Gold Jobs Finder',
update_question: 'È possibile scaricare la versione più recente dal greasyfork.org. Visita il sito?',
loading: 'Caricamento in corso ... Ci vorrà un po \'',
exportTitle: 'Cita',
exportButtonTitle: 'Cita',
generatedBy: 'Generato da TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Generato da TW Gold Jobs Finder[/url][/i]',
plainText: 'Testo normale',
bbCode: 'BB code',
enqueue: 'Inizia',
openWindowTitle: 'Aperto',
refreshTitle: 'Aggiornare dati',
feedback: 'Miglioramento',
feedbackTitle: 'Invia feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
bug: 'Bug',
send: 'Inviare',
feedbackDescription: 'Se avete riscontrato qualche bug o avete idee su come migliorare questo script, vi prego di descriverle .. in inglese per favore.',
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.'
},
'hu_HU': {
language: 'Hungarian (Magyar)',
jobIcon: 'Ikon',
jobName: 'Munka neve',
distanceTime: 'Menetidő',
showJob: 'Mutatás',
title: 'Arany és ezüst munkák',
parseMap: '1. Adatok importálása',
openJobsWindow: '2. Munkák mutatása',
loaded: 'Töltés: ',
changelist: 'Változások',
version: 'verzió',
update_available: 'Gold Jobs frissítés elérhető',
update_question: 'Letöltheted a legújabb verziót itt: greasyfork.org. Megnyitod az oldalt?',
loading: 'Kis türelmet, töltés alatt...',
exportTitle: 'Megosztás',
exportButtonTitle: 'Megosztás',
generatedBy: 'TW Gold Jobs Finder által létrehozva',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']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',
feedback: 'Javaslat',
feedbackTitle: 'Visszajelzés küldése',
feedbackWindowTitle: 'Gold Jobs visszajelzés',
bug: 'Bug',
send: 'Küld',
feedbackDescription: 'Ha találkoztál hibákkal (bug), vagy javaslatod lenne a szkript bővítéséhez írd le őket. Szigorúan csak angolul!',
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.'
},
'ro_RO': {
language: 'Romanian (român)',
jobIcon: 'Imagine',
jobName: 'Denumirea muncii',
distanceTime: 'Distanţa',
showJob: 'Arată',
title: 'Munci aurii şi argintii',
parseMap: '1. Obţine datele',
openJobsWindow: '2. Deschide fereastra cu munci',
loaded: 'Încărcat: ',
changelist: 'Lista modificărilor',
version: 'versiune',
update_available: 'Actualizare disponibilă',
update_question: 'Puteţi descărca cea mai recentă versiune de pe greasyfork.org. Doriţi să vizitaţi pagina?',
loading: 'Se încarcă... Poate dura ceva timp!',
exportTitle: 'Distribuiţi',
exportButtonTitle: 'Distribuiţi',
generatedBy: 'Generat cu TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Generat cu TW Gold Jobs Finder[/url][/i]',
plainText: 'Text simplu',
bbCode: 'BB code',
enqueue: 'Start',
openWindowTitle: 'Deschide',
refreshTitle: 'Reîmprospăta',
feedback: 'Îmbunătățire',
feedbackTitle: 'Trimite feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
bug: 'Bug',
send: 'Trimite',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English please..',
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.'
},
'pl_PL': {
language: 'Polish (polski)',
jobIcob: 'Ikona',
jobName: 'Nazwa pracy',
distanceTime: 'Dystans',
showJob: 'Pokaż',
title: 'Złote i srebrne prace',
parseMap: '1. Pobierz dane',
openJobsWindow: '2. Otwórz okno z pracami',
loaded: 'Ładowanie: ',
changelist: 'Lista zmian',
version: 'wersja',
update_available: 'Dostępna aktualizacja',
update_question: 'Możesz pobrać najnowszą wersję z greasyfork.org. Odwiedzić stronę?',
loading: 'Ładowanie... To zajmie moment',
exportTitle: 'Eksport',
exportButtonTitle: 'Eksport',
generatedBy: 'Stworzone przez TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Stworzone przez TW Gold Jobs Finder[/url][/i]',
plainText: 'Zwykły tekst',
bbCode: 'BB code',
enqueue: 'Startuj',
openWindowTitle: 'Otwierać',
refreshTitle: 'Odświeżanie danych',
feedback: 'Poprawa',
feedbackTitle: 'Wysłać opinię',
feedbackWindowTitle: 'Gold Jobs Opinię',
bug: 'Bug',
send: 'Wysłać',
feedbackDescription: 'If you have encountered any bugs or have ideas how to improve this script, describe them..in English please..',
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.'
},
'cs_CZ': {
language: 'Czech (čeština)',
jobIcon: 'Ikonka',
jobName: 'Práce',
distanceTime: 'Vzdálenost',
showJob: 'Ukaž',
title: 'Zlaté a stříbrné práce',
loaded: 'Nahráno: ',
changelist: 'Seznam změn',
version: 'verze',
update_available: 'Gold Jobs update available',
update_question: 'Nejnovější verzi můžete stáhnout z greasyfork.org. Navštívit stránku?',
loading: 'Nahrávám...',
exportTitle: 'Sdílet',
exportButtonTitle: 'Sdílet',
generatedBy: 'Generated by TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Generated by TW Gold Jobs Finder[/url][/i]',
plainText: 'Prostý Text',
bbCode: 'BB code',
enqueue: 'Zadat',
openWindowTitle: 'Otevřít okno',
refreshTitle: 'Obnovit',
feedback: 'Vylepšení',
feedbackTitle: 'Pošli zpětnou vazbu',
feedbackWindowTitle: 'Gold Jobs Feedback',
bug: 'Bug',
send: 'Odešli',
feedbackDescription: 'Pokud jste nalezli bug nebo máte nápad na zlepšení skriptu, napište je..v Angličtine prosím..',
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.'
},
'es_ES': {
language: 'Spanish (español)',
jobIcon: 'Icono',
jobName: 'Nombre Trabajo',
distanceTime: 'Tiempo viaje',
showJob: 'Mostrar',
title: 'Trabajos con Bonus Oro y Plata',
loaded: 'Cargado: ',
changelist: 'Lista de cambios',
version: 'versión',
update_available: 'Actualización disponible Gold Jobs',
update_question: 'Puede descargar la última versión desde greasyfork.org. ¿Visitar el sitio?',
loading: 'Cargando...',
exportTitle: 'Compartir',
exportButtonTitle: 'Compartir',
generatedBy: 'Generado por TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Generado por TW Gold Jobs Finder[/url][/i]',
plainText: 'Texto plano',
bbCode: 'BB code',
enqueue: 'Poner en cola',
openWindowTitle: 'Abrir ventana',
refreshTitle: 'Refrescar',
feedback: 'Mejorar',
feedbackTitle: 'Enviar comentarios',
feedbackWindowTitle: 'Gold Jobs comentarios',
bug: 'Bug',
send: 'Enviar',
feedbackDescription: 'Si ha encontrado algún error o tiene ideas de cómo mejorar este script, descríbalos.. por favor en inglés..',
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.'
},
'de_DE': {
language: 'German (Deutsch)',
jobIcon: 'Bild',
jobName: 'Arbeit',
distanceTime: 'Distanz',
showJob: 'Zeigen',
title: 'Gold und Silber Arbeiten',
loaded: 'Geladen: ',
changelist: 'Changelist',
version: 'Version',
update_available: 'Gold Jobs Update erhältlich',
update_question: 'Du kannst die neuste Version von greasyfork.org herunterladen. Seite besuchen?',
loading: 'Laden...',
exportTitle: 'Teilen',
exportButtonTitle: 'Teilen',
generatedBy: 'Gefunden mit TW Gold Jobs Finder',
generatedByBb: '[i][url=' + GoldJobs.SCRIPT_SITE + ']Gefunden mit TW Gold Jobs Finder[/url][/i]',
plainText: 'Klartext',
bbCode: 'BB Code',
enqueue: 'Einstellen',
openWindowTitle: 'Fenster öffnen',
refreshTitle: 'Aktualisieren',
feedback: 'Verbesserung',
feedbackTitle: 'Feedback',
feedbackWindowTitle: 'Gold Jobs Feedback',
bug: 'Bug',
send: 'Senden',
feedbackDescription: 'Falls du auf Fehler gestossen bist oder Ideen hast, um das Script zu verbesseren, beschreibe diese.. auf Deutsch oder Englisch bitte..',
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.'
},
};
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 '