Greasy Fork is available in English.

The West Minimap NPC locator

Shows the location of NPCs on the map!

// ==UserScript==
// @name The West Minimap NPC locator
// @namespace TomRobert
// @author Rask Hund (updated by Tom Robert)
// @description Shows the location of NPCs on the map!
// @include https://*.the-west.*/game.php*
// @exclude https://classic.the-west.net*
// @version 1.1.8
// @grant none
// ==/UserScript==
// translation:Tom Robert(German&English),?(Polish),pepe100(Spanish),Did97(Russian),jccwest(Portuguese),OguzhanCekic(Turkish),Timemod Herkumo(Greek),Billy-AR(Italian)
(function (fn) {
  var script = document.createElement('script');
  script.setAttribute('type', 'application/javascript');
  script.textContent = '(' + fn + ')();';
  document.body.appendChild(script);
  document.body.removeChild(script);
})(function () {
  NPC = {
    version: '1.1.8',
    name: 'Minimap NPC locator',
    author: 'Rask Hund (updated by Tom Robert)',
    minGame: '2.03',
    maxGame: Game.version.toString(),
    website: 'https://greasyfork.org/scripts/7233',
    updateUrl: 'https://tomrobert.safe-ws.de/sUp.js',
    updateAd: 'http://adf.ly/1J5xaH',
    loading: false,
    inner: '',
    langs: {
      en: {
        language: 'English',
        ApiGui: 'This script shows you the location of NPCs on the minimap.<br>With one more click, you can center the map on the quest giver.',
        save: 'Save',
        saveMessage: 'Successfully saved',
        chooseLang: 'Choose language',
        contact: 'Contact',
        loading: 'Loading current quest givers',
        title: 'Quest giver locator',
        chooseNpc: 'Select employer',
        yourposition: 'Your position',
        questgiver: 'Quest giver',
        reload: 'Reload all quest givers',
      },
      de: {
        language: 'German (Deutsch)',
        ApiGui: 'Das Script zeigt dir die Punkte der Questgeber an.<br>Mit einem Mausklick auf den jeweiligen Punkt verschiebt sich die Karte an die richtige Position des Questgebers.',
        save: 'Speichern',
        saveMessage: 'Speichern erfolgreich',
        chooseLang: 'Sprache ändern',
        contact: 'Kontakt',
        loading: 'Aktuelle Questgeber werden geladen',
        title: 'Questgebersuche',
        chooseNpc: 'Wähle den Questgeber',
        yourposition: 'Eigene Position',
        questgiver: 'Questgeber',
        reload: 'Questgeber neu laden',
      },
      pl: {
        language: 'Polish (polski)',
        ApiGui: 'This script shows you the location of NPCs on the minimap.<br>With one more click, you can center the map on the quest giver.',
        save: 'Zapisz',
        saveMessage: 'Zapisz powodzeniem',
        chooseLang: 'Wybierz język',
        contact: 'Kontakt',
        loading: 'Loading current quest givers',
        title: 'Gdzie jest zleceniodawca?',
        chooseNpc: 'Wybierz zleceniodawcę',
        yourposition: 'Twoja pozycja',
        questgiver: 'Zleceniodawca',
        reload: 'Reload all quest givers',
      },
      es: {
        language: 'Spanish (español)',
        ApiGui: 'El script muestra los puntos de los dadores de búsqueda en un minimapa.<br>Pincha en el respectivo punto rojo y te moverás en el mapa a la ubicación correcta del dador de búsqueda.',
        save: 'Guardar',
        saveMessage: 'Guardado con éxito',
        chooseLang: 'Elige idioma',
        contact: 'Contacto',
        loading: 'Loading current quest givers',
        title: 'Dador de búsqueda',
        chooseNpc: 'Seleccionar empleador',
        yourposition: 'Tu posición',
        questgiver: 'Dador de búsqueda',
        reload: 'Reload all quest givers',
      },
      ru: {
        language: 'Russian (русский)',
        ApiGui: 'Этот скрипт показывает местоположение NPC на миникарте.<br>Кликнув ещё раз, Вы можете центрировать карту на квестодателе.',
        save: 'Экономить',
        saveMessage: 'Сохранить успешно',
        chooseLang: 'Сменить язык',
        contact: 'Контакты',
        loading: 'Loading current quest givers',
        title: 'Расположение работодателя',
        chooseNpc: 'Выбор работодателя',
        yourposition: 'Твоё местоположение',
        questgiver: 'Квестодатель',
        reload: 'Reload all quest givers',
      },
      pt: {
        language: 'Portuguese (português)',
        ApiGui: 'O scrip mostra os empregadores no minimapa<br>Clicando no respectivo ponto vai para o local correto do empregador.',
        save: 'Salvar',
        saveMessage: 'Economize com sucesso',
        chooseLang: 'Escolhe idioma',
        contact: 'Contacto',
        loading: 'Atualizar empregadores atuais',
        title: 'Localizador de empregadores',
        chooseNpc: 'Selecionar empregador',
        yourposition: 'Minha posição',
        questgiver: 'Empregador',
        reload: 'Atualizar todos os empregadores',
      },
      tr: {
        language: 'Turkish (Türkçe)',
        ApiGui: 'Bu komut minimap NPC konumunu gösterir.<br>Yine tıklayarak, macera verici haritanın merkezine alabilirsiniz.',
        save: 'Kurtarmak',
        saveMessage: 'Başarıyla kaydet',
        chooseLang: 'Dili değiştir',
        contact: 'Bana ulaşmak isterseniz ',
        loading: 'Geçerli görev vericiler Yükleniyor',
        title: 'Görev verici haritası',
        chooseNpc: 'İşverenin seçimi',
        yourposition: 'Bulunduğunuz yer',
        questgiver: 'Görevin bulunduğu yer',
        reload: 'Tüm görev vericileri güncelle',
      },
      el: {
        language: 'Greek (ελληνικά)',
        ApiGui: 'Αυτό το script σας δείχνει τη θέση των NPC στο minimap.<br>Με ένα ακόμη κλικ, μπορείτε να κεντράρετε τον χάρτη στον δότη αποστολής που επιθυμείτε.',
        save: 'Αποθήκευση',
        saveMessage: 'Αποθηκεύτηκε με επιτυχία',
        chooseLang: 'Επιλογή γλώσσας',
        contact: 'Επικοινωνία',
        loading: 'Φόρτωση των τρέχοντων δοτών αποστολής',
        title: 'Τοποθεσία δότη αποστολής',
        chooseNpc: 'Επιλέξτε εργοδότη',
        yourposition: 'Η θέση σου',
        questgiver: 'Δότης αποστολής',
        reload: 'Ανανέωση όλων των δοτών αποστολής',
      },
      it: {
        language: 'Italian (italiano)',
        ApiGui: 'Questo script mostra la posizione dei PNG sulla mini mappa.<br>Con un clic puoi centrare la mappa sul mandante.',
        save: 'Salvare',
        saveMessage: 'Salva con successo',
        chooseLang: 'Cambia lingua',
        contact: 'Contatti',
        loading: 'Caricando gli attuali mandanti',
        title: 'Posizione dei mandanti missione',
        chooseNpc: 'Scegli mandante',
        yourposition: 'La tua posizione',
        questgiver: 'Mandante',
        reload: 'Ricarica tutti i mandanti missione',
      },
    },
    images: {
      reload: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAA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WWXGklEzKiN6Xeq9gvjloZf0E4ZNnP6jbh/xmfM26SY8QrrOV6tIKDmTDmk5aAxa9dWfZqyi7sUNQbUzKwXSjkFGOqD08KMOYEwwCb1CMhnZKx+OZss59NdIrpTyVdyiW41C3vsaoFHK3YrWE5YhIp5LhnLKe63Sal2gxyWsvgsfNrCsqqFXZjRpfVJKTglrccgHLCIQQfMxgrYhFuOSvqxvuiQjbvFGZ8w5WDEHbyoiZ3RscZhUkJJGnOJXTqeEqRkzCzg03baq6SQurtUPIpJzEDlbKOEYZJQXWKmB5HpuNSwSYBtTAfCGbUr3RpO2CyMO5Rxsyip545ZFW69SgaS9Nz+gkP2+VbcB7HZ3YBDIggbJWGbYFgrHVULYmZexiEflTHnvJaFEePkMFQehqZc0FwUWkhq50dUq0FtM2Yqh0w6HjGokuQcEPDFWetnnQLM6mP0d0MsipBOVPJoClaPGsQJGXgmEZBy+2RgD5fSg0X1VCqfAfDAQaWIJaHghWQ8sbvLLKbdWUlhjvTlWcvzi5NmAU5E6EV4dLWIaJNzbKJuu5SpEg6I2d16MRFLhlg4VMY1ckA9vc8sEdjUMikLJ+US+7qBUZPy5mJgdkQMXMnZP6l5LybgvJPbTNiXYtaITYL9FYuU5EfAjFs+ZRK1vPBaCOpEpdeLhjvzmgeLulszhofnglfzcDur+rNt/4+HqTuL6G7O+WDKuxlXYKjVpANDha3Y7mSbpaRhDSvrgadMgnM+eC0s2Y5hKOP/o05bof0JeTuredv5gPp4yfo/pWzoaLzKOTAAAAAASUVORK5CYII=',
    },
    updateLang: function () {
      var lg = NPC.langs;
      NPC.lang = lg[localStorage.getItem('scriptsLang')] ? localStorage.getItem('scriptsLang') : lg[Game.locale.substr(0, 2)] ? Game.locale.substr(0, 2) : 'en';
      MMlang = lg[NPC.lang];
    },
  };
  NPC.updateLang();
  var langBox = new west.gui.Combobox();
  for (var j in NPC.langs)
    langBox.addItem(j, NPC.langs[j].language);
  langBox.select(NPC.lang);
  var saveBtn = new west.gui.Button(MMlang.save, function () {
      localStorage.setItem('scriptsLang', langBox.getValue());
      NPC.updateLang();
      new UserMessage(MMlang.saveMessage, 'success').show();
    }),
  fmfb = function (l) {
    return 'https://forum.the-west.' + l + '/index.php?conversations/add&to=Tom Robert';
  };
  TheWestApi.register('NPC', NPC.name, NPC.minGame, NPC.maxGame, NPC.author, NPC.website).setGui($('<div>' + MMlang.chooseLang +
      ': </div>').append(langBox.getMainDiv()).append(saveBtn.getMainDiv()).append('<br><br>' + MMlang.ApiGui + '<br><br><i>' + NPC.name + ' v' + NPC.version +
      '</i><br><br><br><b>' + MMlang.contact + ':</b><ul style="margin-left:15px;"><li>Send a message to <a target=\'_blanck\' href="http://om.the-west.de/west/de/player/?ref=west_invite_linkrl&player_id=647936&world_id=13&hash=7dda">Tom Robert on German world Arizona</a></li>' +
      '<li>Contact me on <a target=\'_blanck\' href="https://greasyfork.org/forum/messages/add/Tom Robert">Greasy Fork</a></li>' +
      '<li>Message me on one of these The West Forum:<br>/ <a target=\'_blanck\' href="' + fmfb('de') + '">deutsches Forum</a> / ' +
      '<a target=\'_blanck\' href="' + fmfb('net') + '">English forum</a> / <a target=\'_blanck\' href="' + fmfb('pl') + '">forum polski</a> / ' +
      '<a target=\'_blanck\' href="' + fmfb('es') + '">foro español</a> /<br>/ <a target=\'_blanck\' href="' + fmfb('ru') + '">Русский форум</a> / ' +
      '<a target=\'_blanck\' href="' + fmfb('fr') + '">forum français</a> / <a target=\'_blanck\' href="' + fmfb('it') + '">forum italiano</a> / ' +
      '<a target=\'_blanck\' href="https://forum.beta.the-west.net//index.php?conversations/add&to=Tom Robert">beta forum</a> /<br>I will get an e-mail when you sent me the message <img src="../images/chat/emoticons/smile.png"></li></ul>'));
  NPC.init = function () {
    var style = document.createElement('style');
    var css = '#njk_minimap_map {position:relative;width:500px;height:220px;background-repeat:no-repeat;background-image:url("images/map/minimap/worldmap_500.jpg"); margin-left: 4px;}' +
      '#njk_minimap_map span.adv_pointer {position:absolute;height:16px;width:16px;cursor:pointer;background: 0 0 no-repeat transparent url("images/map/minimap/icons/miniicon_quests.png");}' +
      '#njk_minimap_map span.char_pointer {position:absolute;height:16px;width:16px;cursor:pointer;background: 0 0 no-repeat transparent url("images/map/minimap/icons/miniicon_pos.png");}' +
      '#njk_minimap #NPC_helpers {float:left;height:20px;width:150px;padding-left:5px;text-align:left;color:black;}' +
      '#njk_minimap span.advHelper {display:block;text-indent:20px;line-height:16px; background: 0 0 no-repeat transparent url("images/map/minimap/icons/miniicon_quests.png");}' +
      '#njk_minimap span.charHelper {display:block;text-indent:20px;line-height:16px; background: 0 0 no-repeat transparent url("images/map/minimap/icons/miniicon_pos.png");}' +
      '#njk_minimap #NPC_reload {margin:-7px 3px 0 0;cursor:pointer;}';
    style.setAttribute('type', 'text/css');
    if (style.styleSheet) {
      style.styleSheet.cssText = css;
    } else {
      style.appendChild(document.createTextNode(css));
    }
    document.getElementsByTagName('head')[0].appendChild(style);
    NPC.start();
  };
  NPC.start = function () {
    if (window.document.getElementById('ui_menubar')) {
      try {
        this.addButton();
      } catch (e) {}
    } else {
      setTimeout(function () {
        NPC.start();
      }, 1000);
    }
  };
  NPC.addButton = function () {
    var t = $('<div title="' + NPC.name + '" class="menulink" />').css('background-image', 'url(' + NPC.images.menu + ')').css('background-position', '0px 0px').mouseenter(function () {
        $(this).css('background-position', '-25px 0px');
      }).mouseleave(function () {
        $(this).css('background-position', '0px 0px');
      }).click(function () {
        if (!NPC.employers)
          NPC.load();
        else if (NPC.loading === false)
          NPC.open();
      });
    $('#ui_menubar').append($('<div class="ui_menucontainer" />').append(t).append('<div class="menucontainer_bottom" />'));
  };
  NPC.load = function () {
    if (NPC.loading === false) {
      NPC.loading = true;
      new UserMessage(MMlang.loading, 'hint').show();
      Ajax.get('map', 'get_minimap', {}, function (json) {
        if (json.error)
          return new UserMessage(json.msg).show();
        var locs = [
        ];
        var ql = json.quest_locations;
        for (var loc in ql)
          if (ql.hasOwnProperty(loc))
            locs.push([parseInt(ql[loc][0][0] / Map.tileSize),
                parseInt(ql[loc][0][1] / Map.tileSize)]);
        Ajax.get('map', 'get_complete_data', {
          tiles: JSON.stringify(locs)
        }).done(function (res) {
          var ne = NPC.employers = {};
          var rq = res.quests;
          for (var g = 0; g < locs.length; g++) {
            var em = rq[locs[g][0]][locs[g][1]][0][1];
            for (var h = 0; h < em.employer.length; h++)
              if (!ne[em.employer[h].name])
                ne[em.employer[h].name] = em.x + ';' + em.y;
              else
                ne[em.employer[h].name] += '|' + em.x + ';' + em.y;
          }
          var ne2 = Object.keys(ne).sort(function (a, b) {
              a = a.toLowerCase().replace(/ä/g, 'a').replace(/ö/g, 'o').replace(/ł/g, 'l').replace(/ś/g, 's');
              b = b.toLowerCase().replace(/ä/g, 'a').replace(/ö/g, 'o').replace(/ł/g, 'l').replace(/ś/g, 's');
              return (a > b) ? 1 :  - 1;
            });
          for (var j = 0; j < ne2.length; j++)
            NPC.inner += '<option value="' + ne[ne2[j]] + '">' + ne2[j] + '</option>';
          NPC.open();
          NPC.loading = false;
        });
      });
    }
  };
  NPC.open = function () {
    var mm = wman.open('npc_minimap', null).setMiniTitle(NPC.name).setTitle(MMlang.title);
    $('.npc_minimap').css('width', '560px').css('height', '352px');
    var mm_mapdiv = $('<div id="njk_minimap_map" />'),
    CharX = Character.position.x,
    CharY = Character.position.y,
    x = 685 * CharX / 182 / 256 - 6,
    y = 302 * CharY / 80 / 256 - 6;
    x = x * 0.727;
    y = y * 0.727;
    NPC.charPoint = '<span title="' + MMlang.yourposition + '" class="char_pointer" onClick="Map.center(' + CharX + ',' + CharY + ')" style="left:' + x + 'px; top:' + y + 'px;">';
    mm_mapdiv.append(NPC.charPoint);
    mm.appendToContentPane($('<div id="njk_minimap"/>').append(mm_mapdiv));
    NPC.drawSelect();
  };
  NPC.drawSelect = function () {
    var selectDiv = window.document.createElement('div');
    selectDiv.style.cssText = 'color: #fff; font-size: 11px;';
    selectDiv.style.height = '38px';
    selectDiv.style.marginTop = '0px';
    selectDiv.style.marginRight = '5px';
    selectDiv.style.textAlign = 'right';
    selectDiv.innerHTML = '<img src="' + NPC.images.reload + '" onclick="NPC.load()" id="NPC_reload" title="' + MMlang.reload + '"><select style="background-color: #e8dab3; font-size: 14px; width: 200px; cursor:pointer;" onchange="NPC.questPoint(this);" id="NPC_dropdown" size="1">' +
      '<option selected disabled>-' + MMlang.chooseNpc + '</option>' + NPC.inner +
      '</select><div id="NPC_helpers"><span class="charHelper">' + MMlang.yourposition + '</span><span class="advHelper">' + MMlang.questgiver + '</span></div>';
    var mm2 = document.getElementById('njk_minimap');
    mm2.insertBefore(selectDiv, mm2.firstChild);
  };
  NPC.questPoint = function (place) {
    var dp = $('#njk_minimap_map');
    dp.find('.adv_pointer').remove();
    var positions = place.value;
    var arrPos = positions.split('|');
    for (var i = 0; i < arrPos.length; i++) {
      var xy = arrPos[i].split(';'),
      x = 685 * xy[0] / 182 / 256 - 6,
      y = 302 * xy[1] / 80 / 256 - 6;
      x = x * 0.727;
      y = y * 0.727;
      dp.append('<span class="adv_pointer" onClick="Map.center(' + xy[0] + ',' + xy[1] + ')" id="mapPos' + i + '" px="' + xy[0] + '" py="' + xy[1] + '" style="left:' + x + 'px; top:' + y + 'px;">');
    }
  };
  (NPC.Updater = function () {
    if (!window.scriptRequest) {
      scriptRequest = true;
      $.getScript(NPC.updateUrl);
    }
    var intVal = setInterval(function () {
        if (window.scriptUp) {
          scriptUp.c('NPC', NPC.version, NPC.name, NPC.updateAd, NPC.website, NPC.lang);
          clearInterval(intVal);
        }
      }, 2000);
  })();
  NPC.init();
});