Czogista

Zestaw młodego setupopisarza

Aug 5th, 2020
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Zestaw młodego setupopisarza
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @author       Czogi
  6. // @match        http://*.margonem.pl/
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. //Przejścia
  11. newGateway = a=>{
  12.     var b = [];
  13.     for (var e = 0; e < a.length; e += 5) {
  14.         var c = "gw" + (a[e + 2] * 256 + a[e + 1]);
  15.         var l = htmlspecialchars(g.townname[a[e]]) + (a[e + 3] ? "<br>(" + _t("require_key", null, "gtw") + ")" : "");
  16.         var h = {
  17.             min: (parseInt(a[e + 4]) & 65535),
  18.             max: ((parseInt(a[e + 4]) >> 16) & 65535)
  19.         };
  20.         var d = true;
  21.         if (a[e + 4] != 0) {
  22.             if (h.min != h.max) {
  23.                 l += "<br>" + _t("gateway_availavle", null, "gtw") + (h.min != 0 ? _t("from_lvl %lvl%", {
  24.                     "%lvl%": h.min
  25.                 }, "gtw") : "") + (h.max >= 1000 ? "" : _t("to_lvl %lvl%", {
  26.                     "%lvl%": h.max
  27.                 }, "gtw")) + _t("lvl_lvl", null, "gtw");
  28.                 if (h.min != 0 && h.min > hero.lvl) {
  29.                     d = false
  30.                 } else {
  31.                     if (h.max < 1000 && h.max < hero.lvl) {
  32.                         d = false
  33.                     }
  34.                 }
  35.             } else {
  36.                 l += "<br>" + _t("gateway_availavle_for %lvl%", {
  37.                     "%lvl%": h.max
  38.                 }, "gtw");
  39.                 if (h.max != hero.lvl) {
  40.                     d = false
  41.                 }
  42.             }
  43.         }
  44.         $('<div class="gw gwmap' + a[e] + '" id=' + c + " style='top:" + (a[e + 2] * 32) + "px; left:" + (a[e + 1] * 32) + "px' tip='" + l + "<br><center>"+a[e]+"</center>'><br><br><strong><center style='color:red'>"+a[e]+"</strong></div>").click(function(i) {
  45.             hero.mClick(i)
  46.         }).appendTo("#base");
  47.         g.gw[a[e + 1] + "." + a[e + 2]] = d;
  48.         g.gwIds[a[e]] = a[e + 1] + "." + a[e + 2]
  49.     }
  50.     if (isset(g.gw[hero.x + "." + hero.y])) {
  51.         hero.autoWalkLock = true
  52.     }
  53.     for (var j in g.gw) {
  54.         var f = j.split(".");
  55.         questTrack.removePlaceholder([1, f[0], f[1]]);
  56.         for (var j in g.gwIds) {
  57.             questTrack.checkGwAndHighlight(j)
  58.         }
  59.     }
  60. }
  61. //Mapa
  62.   $('#inmap2 IMG').mousemove(function(e){
  63.     var $in2=$('#inmap2'), mx=e.clientX-g.left, my=e.clientY-g.top, o=map.overmap, top=false;
  64.     if(my>350) top=true;
  65.     mx+=$in2.scrollLeft();
  66.     my+=$in2.scrollTop();
  67.     if(o && mx>=o.x && mx<=o.x+o.width && my>=o.y && my<=o.y+o.width) return;
  68.     for(var k in map.maplist)
  69.     {
  70.       o=map.maplist[k];
  71.       if(mx>=o.x+20 && mx<=o.x+o.width+20 && my>=o.y+5 && my<=o.y+o.height+5)
  72.       {
  73.         map.overmap=o;
  74.         var mt=$('#maptip');
  75.         mt.html(o.name+"<br><center>"+k+"</center>").css({
  76.           left:o.x
  77.           });
  78.         mt.css({
  79.           top:top?(o.y-mt.outerHeight()):(o.y+o.height)
  80.           }).show();
  81.         return;
  82.       }
  83.     }
  84.     map.overmap=false;
  85.     $('#maptip').hide();
  86.   });
  87. //minimapPlus
  88. g.loadQueue.push({fun:()=>{
  89. if(typeof miniMapPlus == 'object'){
  90. for(i in document.getElementsByClassName('mmp-gw')){
  91. let gw = document.getElementsByClassName('mmp-gw')[i]
  92. if(typeof gw.setAttribute !== 'undefined')gw.setAttribute('tip',gw.getAttribute('tip')+'<br><center style="color:red">'+Object.keys(g.townname).find(x=>{return gw.getAttribute('tip').includes(g.townname[x]);}))
  93. }}
  94. }})
Add Comment
Please, Sign In to add comment