NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name FK-Sektornamen // @name:it The West - Mapa de Setores // @name:pt The West - Mapa de Setores // @description Show name of the sectors during fort battle (Mostra os setores durante as batalhas de forte) // @description:it Visualiza nomes dos setores na batalha // @description:pt Visualiza nomes dos setores na batalha // @namespace Esperiano // @author Esperiano (edited by GL) // @include https://*.the-west.*.*/game.php* // @include http*://*.the-west.*/game.php* // @version 0.3.4 // @exclude http*://www.the-west.* // @exclude http*://forum.the-west.* // @updateURL https://openuserjs.org/meta/Glubbrer/FK-Sektornamen.meta.js // @downloadURL https://openuserjs.org/install/Glubbrer/FK-Sektornamen.user.js // @grant none // @copyright none // @license MIT // ==/UserScript== TWNS_inject = function(){ if (document.getElementById('TWNS_js')) { alert("Script giĆ installato"); return; } var TWNSjs = document.createElement('script'); TWNSjs.setAttribute('type', 'text/javascript'); TWNSjs.setAttribute('language', 'javascript'); TWNSjs.setAttribute('id', 'TWNS_js'); TWNSjs.innerHTML = "("+(function(){ /*inizio corpo script*/ var TWNS_api = TheWestApi.register('tw-namesector', 'TW - Name Sectors', 'v2.123.1', Game.version.toString(), 'Esperiano [Edited by Hay Jay]'); TWNS_api.setGui('Nome settori in battaglia'); var datafort= {}; $('#windows').on('DOMNodeInserted', function(e) { var element = e.target; if($(element).is("div[class*='fortbattle-']")) { var NSfortID, NSfortType, NSman; NSfortID = $.grep(element.className.split(" "), function(v, i){ return v.indexOf('fortbattle-') === 0; }).join(); NSman=NSfortID=NSfortID.split("-")[1]; if (NSfortID.startsWith("m")) {NSfortID=NSfortID.substr(1);} //manovra if (!datafort[NSfortID]){ Ajax.remoteCallMode('fort', 'display', { fortid: NSfortID, }, function (data) { var fD = data.data; datafort[NSfortID] = fD.type; });}else{NSfortType=datafort[NSfortID];} setTimeout(function(){ var NSurl; var NSlang = Game.locale.substr(0, 2); switch (datafort[NSfortID]) { case 0: //PICCOLO if(NSlang=='pt') NSurl='https://iili.io/J5o5jp.png'; else if(NSlang=='it') NSurl='https://iili.io/J5o5jp.png'; else if(NSlang=='de' || document.URL.includes("events.")) NSurl='https://i.imgur.com/XdJVKDN.png'; else NSurl='https://iili.io/J5o5jp.png'; break; case 2: //GRANDE if(NSlang=='pt') NSurl='https://iili.io/J5oanI.png'; else if(NSlang=='it') NSurl='https://iili.io/J5oanI.png'; else if(NSlang=='de' || document.URL.includes("events.")) NSurl='https://i.imgur.com/EQevzV9.png'; else NSurl='https://iili.io/J5oanI.png'; break; default: //MEDIO if(NSlang=='pt') NSurl='https://iili.io/J5o7ZN.png'; else if(NSlang=='it') NSurl='https://iili.io/J5o7ZN.png'; else if(NSlang=='de' || document.URL.includes("events.")) NSurl='https://i.imgur.com/UxP9xWV.png'; else NSurl='https://iili.io/J5o7ZN.png'; } if((!$('#NSectors'+NSman).length)&&($('.fortbattle-'+NSman+' .fort_battle_buttons').length)) $('.fortbattle-'+NSman+' .tw2gui_window_content_pane').append('<div id="NSectors'+NSman+'" class="fort_battle_battleground" style="background-image: url("'+NSurl+'"); z-index: 1;pointer-events: none"></div>'); if(!$('.fortbattle-'+NSman+' .fort_NS').length) $('.fortbattle-'+NSman+' .fort_battle_buttons').append('<div class="fort_battle_button fort_NS" style="left: 105px;" onclick="javascript:$(\'#NSectors'+NSman+'\').toggle();"></div>'); }, 2000); } }); /*fine corpo script*/ } ).toString()+")();"; document.body.appendChild(TWNSjs); }; if (location.href.indexOf(".the-west.") != -1 && location.href.indexOf("game.php") != -1) setTimeout(TWNS_inject, 2000, false);