Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.36 KB | None | 0 0
  1. // ==UserScript==
  2. // @name pies
  3. // @version 21.37
  4. // @description chuj
  5. // @author hunti
  6. // @match http://*.margonem.pl/
  7. // @require https://pastebin.com/raw/jPTNZbLY
  8. // @grant none
  9. // ==/UserScript==
  10. ((a,b,c)=>{const e=new class{constructor(){this.drag=!1,this.x=0,this.start_x=0,this.names={fr:`Przyjaciół`,en:`Wrogów`,cl:`Klanowiczy`,"cl-fr":`Sojuszników`,"cl-en":`Rywali klanu`,rights:`Osob funkcyjnych`,grp:`Członków grupy`},this.relation=localStorage.getItem(`ktj_custom_colors`)?JSON.parse(localStorage.getItem(`ktj_custom_colors`)):{fr:`#00ff00`,en:`#ff0000`,cl:`#0797ff`,"cl-fr":`#9bf6ff`,"cl-en":`#ff5656`,rights:`#ffdd00`,grp:`#00b7ff`},this.opacity=localStorage.getItem(`ktj_custom_opacity`)?JSON.parse(localStorage.getItem(`ktj_custom_opacity`)):{fr:255,en:255,cl:255,"cl-fr":255,"cl-en":255,rights:255,grp:50},this.height=localStorage.getItem(`ktj_max_height`)?localStorage.getItem(`ktj_max_height`):18,this.thickness=localStorage.getItem(`ktj_thickness`)?localStorage.getItem(`ktj_thickness`):24,this.info=18>+this.height,this.infot=0==this.thickness,this.y=0,this.start_y=0,this.target=!1,this.party={}}draggable(a,b){const c=this,d=`undefined`!=typeof window.orientation||-1!==navigator.userAgent.indexOf(`IEMobile`);a.ondragstart=()=>{},a.addEventListener(d?`touchstart`:`mousedown`,b=>{window.g.lock.add(`ktj_click`);`INPUT`==b.target.tagName||(c.drag=!0,d&&(c.x=b.touches[0].pageX,c.y=b.touches[0].pageY),c.start_x=c.x-a.offsetLeft,c.start_y=c.y-a.offsetTop)}),document.addEventListener(d?`touchmove`:`mousemove`,b=>{if(b.pageX&&(c.x=b.pageX,c.y=b.pageY),d&&(c.x=b.touches[0].pageX,c.y=b.touches[0].pageY),c.drag){let b=a.offsetWidth,d=a.offsetHeight,e=c.x-c.start_x,f=c.y-c.start_y;0>e&&(e=0),e+b>window.innerWidth&&(e=window.innerWidth-b),a.style.left=`${e}px`,0>f&&(f=0),f+d>window.innerHeight&&(f=window.innerHeight-d),a.style.top=`${f}px`}}),document.addEventListener(d?`touchend`:`mouseup`,()=>{window.g.lock.remove(`ktj_click`),localStorage.setItem(b,JSON.stringify([a.style.left,a.style.top])),c.drag=!1})}hex(a){return a=a.toString(16),1==a.length?`0${a}`:a}make_div(){const a=localStorage.getItem(`ktj_position`)?JSON.parse(localStorage.getItem(`ktj_position`)):[`0px`,`0px`],b=document.createElement(`span`),c=document.createElement(`div`),d=document.createElement(`span`),f=document.createElement(`div`),g=document.createElement(`span`),h=document.createElement(`span`);for(let a in b.textContent=`Gracze na mapie`,d.textContent=`Ustawienia`,d.style.float=`right`,c.classList.add(`ktj_settings`),c.style.display=`none`,g.textContent=`Wybierz kolor dla:`,g.style.textAlign=`center`,c.appendChild(g),this.relation){const b=document.createElement(`input`),d=document.createElement(`input`),e=document.createElement(`label`),f=document.createElement(`div`);d.type=`range`,d.min=0,d.max=255,d.step=1,d.value=this.opacity[a],d.addEventListener(`change`,()=>{const b=+d.value;this.opacity[a]=b,e.style[`grp`==a?`background`:`color`]=this.relation[a]+this.hex(this.opacity[a]),localStorage.setItem(`ktj_custom_opacity`,JSON.stringify(this.opacity)),this.update_div()}),d.setAttribute(`ktj_tip`,`Przesuń aby zmienić transparentność ${this.names[a].toLowerCase()}`),b.type=`color`,b.value=this.relation[a],b.addEventListener(`change`,()=>{const c=`${b.value}`;e.style[`grp`==a?`background`:`color`]=c+this.hex(this.opacity[a]),this.relation[a]=c,localStorage.setItem(`ktj_custom_colors`,JSON.stringify(this.relation)),this.update_div()}),f.textContent=this.names[a],f.setAttribute(`ktj_tip`,`Kliknij aby zmienić kolor ${this.names[a].toLowerCase()}`),f.classList.add(`ktj_colors`),e.style[`grp`==a?`background`:`color`]=`${b.value}${this.hex(this.opacity[a])}`,e.style.color||(e.style.color=`#ffffff`),e.appendChild(f),e.appendChild(b),e.appendChild(d),c.appendChild(e)}const i=document.createElement(`div`);let j=document.createElement(`input`);i.textContent=`Maksymalna wysokość okienka`,i.style.textAlign=`center`,j.type=`range`,j.min=0,j.max=100,j.step=1,j.style.width=`100%`,j.value=this.height,j.addEventListener(`change`,()=>{const a=+j.value;localStorage.setItem(`ktj_max_height`,a),this.height=a,!this.info&&18>+this.height&&(this.info=!0,window.message(`Tryb minimalistyczny włączony<br>Nazwy klanów będą wyświetlane po najechaniu na nick!`)),this.update_div()}),j.setAttribute(`ktj_tip`,`Przesuń aby zmienić maksymalną wysokośc okna`),i.appendChild(j),c.appendChild(i);const k=document.createElement(`div`);let l=document.createElement(`input`);k.textContent=`Grubość trackera`,k.style.textAlign=`center`,l.type=`range`,l.min=0,l.max=30,l.step=1,l.style.width=`100%`,l.value=this.thickness,l.addEventListener(`change`,()=>{const a=+l.value;localStorage.setItem(`ktj_thickness`,a),this.thickness=a,this.infot||0!=a||(window.message(`Tracker wyłączony`),this.infot=!0),e.active&&e.reconnect()}),l.setAttribute(`ktj_tip`,`Przesuń aby zmienić grubość trackera`),k.appendChild(l),c.appendChild(k),h.textContent=`Zresetuj ustawienia`,h.style.textAlign=`center`,h.addEventListener(`click`,()=>{confirm(`Czy na pewno chcesz zresetować ustawienia dodatku?`)&&(localStorage.removeItem(`ktj_custom_colors`),localStorage.removeItem(`ktj_custom_opacity`),localStorage.removeItem(`ktj_max_height`),window.location.href=window.location.href)}),h.setAttribute(`ktj_tip`,`Kliknij aby zresetować ustawienia`),c.appendChild(h),f.style.padding=`3px`,f.style.fontWeight=`bold`,f.appendChild(b),f.appendChild(d),f.appendChild(c),this.div=document.createElement(`div`),this.div.id=`ktj_box`,this.div.style.top=a[1],this.div.style.left=a[0],this.div.appendChild(f),this.div.appendChild(this.content_div),this.draggable(this.div,`ktj_position`),this.css(),document.body.appendChild(this.div),d.addEventListener(`click`,()=>{c.style.display=`none`==c.style.display?`flex`:`none`}),d.setAttribute(`ktj_tip`,`Kliknij aby wyświetlić ustawienia`)}async update_div(){const a=this.content_div,b=document.querySelector(`.ktj_content`).scrollTop;this.div.removeChild(this.div.childNodes[1]),this.div.appendChild(a),document.querySelector(`.ktj_content`).scroll(0,b)}get no_other(){const a=document.createElement(`div`);return a.textContent=`Brak graczy na mapie`,a}get content_div(){const a=document.createElement(`div`);let b=[];for(let c in a.classList.add(`ktj_content`),a.style.maxHeight=`${this.height}vh`,window.g.other)window.g.other[c].nick&&b.push(this.add_other(c));if(0===b.length)a.appendChild(this.no_other);else for(let c in b=b.sort((c,a)=>a[0]-c[0]),b){const d=document.createElement(`div`);d.textContent=`${+c+1}.`,b[c][1].insertBefore(d,b[c][1].firstChild),a.appendChild(b[c][1])}return a}calc(a){const b=[`aldous`,`berufs`,`brutal`,`classic`,`gefion`,`hutena`,`jaruna`,`katahha`,`lelwani`,`majuna`,`nomada`,`perkun`,`tarhuna`,`telawel`,`tempest`,`zemyna`,`zorza`,`fobos`],c=Math.max(Math.round(a*(b.includes(window.g.worldname)?1.2:1.4)+4)-a,13),e=Math.max(a-Math.round((a-4)/(b.includes(window.g.worldname)?1.2:1.4)),13);return[a-e,a+c]}div_pos(a){const b=a.getBoundingClientRect();return{left:+a.style.left.replace(`px`,``),top:+a.style.top.replace(`px`,``),width:b.width||a.offsetWidth,height:b.height||a.offsetHeight}}disconnect(){this.active=void 0,document.querySelector(`#ktj_line`)&&document.querySelector(`#ktj_line`).remove()}reconnect(){this.connect(this.active[0],this.active[1],this.active[2],this.active[3])}connect(a,b,c,d){if(0!=this.thickness){if(!a||!a||!document.querySelector(`#other${d}`))return this.disconnect();let e=this.div_pos(a),f=this.div_pos(b),g=e.left+e.width/2,h=e.top+e.height/2,i=f.left+f.width/2,j=f.top+f.height/2,k=Math.sqrt((i-g)*(i-g)+(j-h)*(j-h)),l=(h+j)/2-this.thickness/2,m=Math.atan2(h-j,g-i)*(180/Math.PI),n=document.createElement(`div`);document.querySelector(`#ktj_line`)&&`${k}px`==document.querySelector(`#ktj_line`).style.width||(n.id=`ktj_line`,n.style.padding=`0`,n.style.margin=`0`,n.style.height=`${this.thickness}px`,n.style.background=`linear-gradient(to right, orange, ${c}33, ${c}44, ${c}77, ${c})`,n.style.position=`absolute`,n.style.left=`${(g+i)/2-k/2}px`,n.style.top=`${l}px`,n.style.width=`${k}px`,n.style.opacity=`0.5`,n.style[`-moz-transform`]=`rotate(${m}deg)`,n.style[`-webkit-transform`]=`rotate(${m}deg)`,n.style[`-o-transform`]=`rotate(${m}deg)`,n.style[`-ms-transform`]=`rotate(${m}deg)`,n.style.transform=`rotate(${m}deg)`,n.style.borderRadius=`50px`,document.querySelector(`#ktj_line`)&&document.querySelector(`#ktj_line`).style.width==n.style.width||(this.disconnect(),this.active=[a,b,c,d],document.querySelector(`#base`).appendChild(n)))}}add_other(a){const b=window.g.other[a],c=document.createElement(`div`),d=document.createElement(`div`),e=document.createElement(`div`),f=!!(window.g.party&&window.g.party[b.id])&&(c.style.background=`${this.relation.grp}${this.hex(this.opacity.grp)}`),g=!!(b.clan&&b.clan.id);c.classList.add(`ktj_other_line`),d.textContent=b.nick,d.style.fontWeight=`bold`,0<b.rights&&(d.style.color=`${this.relation.rights}${this.hex(this.opacity.rights)}`),this.relation[b.relation]&&(d.style.color=`${this.relation[b.relation]}${this.hex(this.opacity[b.relation])}`)||0==b.rights&&(d.style.color=`#ffffff`),d.addEventListener(`click`,()=>{window.chatTo(b.nick)}),e.textContent=`${b.lvl}${b.prof}`;let h=this.calc(window.hero.lvl);if(b.lvl>h[1]&&(e.style.color=`#ff4747`)||b.lvl<h[0]&&(e.style.color=`#d6d6d6`)||(e.style.color=`#86ff68`),c.appendChild(d),c.appendChild(e),18>+this.height)g&&d.setAttribute(`ktj_tip`,`${b.clan.name}`);else if(g){const a=document.createElement(`div`);a.textContent=`${b.clan.name}`,c.appendChild(a)}this.dev_div&&2==window.map.pvp&&c.appendChild(this.dev_div(b.id));let i=!1;if(window.g.party&&window.g.party[a]&&(i=!0,this.party.members&&this.party.members[a])){const b=document.createElement(`div`),d=this.party.members[a],e=Math.round(1e3*(d.hp_cur/d.hp_max))/10;b.setAttribute(`ktj_tip`,`${d.hp_cur}/${d.hp_max}`),b.textContent=`(${e}%)`,b.style.color=25>e?`red`:66>e?`orange`:`lime`,b.classList.add(`ktj_hp_percent`),c.appendChild(b)}return c.addEventListener(`mouseenter`,()=>{const b=document.querySelector(`#other${a}`);b&&(this.connect(document.querySelector(`#hero`),b,d.style.color.replace(/rgb\((.+)\)/,(a,b)=>{b=b.replace(/ /g,``).split(`,`);let c=[(+b[0]).toString(16),(+b[1]).toString(16),(+b[2]).toString(16)];for(let d in c)2>c[d].length&&(c[d]=`0${c[d]}`);return`#${c.join(``)}`}),a),b.style.filter=`drop-shadow(0px 0px 3px orange)`)}),c.addEventListener(`mouseleave`,()=>{const b=document.querySelector(`#other${a}`);b&&(this.disconnect(),b.style.filter=``)}),[+(i?999999:g?b.clan.id:g),c]}css(){const a=document.createElement("style");a.innerHTML="#ktj_box{min-width:180px;}\n#ktj_box,#ktj_box *[ktj_tip]::before{\nposition: absolute;\nbackground: #2d2828;\nborder: 2px solid #7b7b7b;\nz-index: 99999;\npadding: 3px;\nfont-size: 12px;\n-moz-user-select: none;\n-khtml-user-select: none;\n-webkit-user-select: none;\n-ms-user-select: none;\nuser-select: none;\n}\n#ktj_box input[type=\"color\"]{\ndisplay: none;\n}\n\n.ktj_settings{\nborder: 2px solid black;\npadding: 3px;\nbackground: #3c3c3c;\nmargin: 3px;\nwidth:200px;\nflex-direction: column;\nmargin-left:auto;\nmargin-right:auto;\n}\n.ktj_content{\noverflow-y: auto;\n}\n.ktj_other_line{\npadding: 2px;\n}\n.ktj_other_line div{\ndisplay: inline-block;\nmargin-left: 2px;\nmargin-right: 2px;\n}\n.ktj_content::-webkit-scrollbar {\nwidth: 6px;\n}\n.ktj_content::-webkit-scrollbar-track {\nbackground: #7b7b7b;\n}\n.ktj_content::-webkit-scrollbar-thumb {\nbackground: #4a4a4a;\nborder: 2px solid #47474759;\n}\n.ktj_content::-webkit-scrollbar-thumb:hover {\nbackground:#47aeff;\nborder-color:#007a8722;\n}\n.ktj_hp_percent{\nfloat:right;\n}\n\n#ktj_box input[type=\"range\"]{\nheight: 18px;\nwidth: 50%;\nfloat: right;\nmargin: 0;\n-webkit-appearance: none;\nbackground:none;\n}\n#ktj_box input[type=range]:focus {outline: none;}\n#ktj_box input[type=range]::-webkit-slider-runnable-track {width:100%;height:5px;cursor:pointer;animate:0.2s;box-shadow:0px 0px 2px #000000;background:#9C9C9C;border-radius:50px;border:1px solid #000000;}\n#ktj_box input[type=range]::-webkit-slider-thumb {box-shadow: 0px 0px 3px #545454;border: 2px solid #e5e5e533;height: 10px;width: 10px;border-radius: 50px;background: #bababa;cursor: pointer;-webkit-appearance: none;margin-top: -4px;}\n#ktj_box input[type=range]:focus::-webkit-slider-runnable-track {background: #9C9C9C;}\n#ktj_box input[type=range]::-moz-range-track {width: 100%;height: 5px;cursor: pointer;animate: 0.2s;box-shadow: 0px 0px 2px #000000;background: #9C9C9C;border-radius: 50px;border: 1px solid #000000;}\n#ktj_box input[type=range]::-moz-range-thumb {box-shadow: 0px 0px 3px #545454;border: 2px solid #068EB8;height: 10px;width: 10px;border-radius: 50px;background: #0690BA;cursor: pointer;}\n#ktj_box input[type=range]::-ms-track {width: 100%;height: 5px;cursor: pointer;animate: 0.2s;background: transparent;border-color: transparent;color: transparent;}\n#ktj_box input[type=range]::-ms-fill-lower {background: #9C9C9C;border: 1px solid #000000;border-radius: 100px;box-shadow: 0px 0px 2px #000000;}\n#ktj_box input[type=range]::-ms-fill-upper {background: #9C9C9C;border: 1px solid #000000;border-radius: 100px;box-shadow: 0px 0px 2px #000000;}\n#ktj_box input[type=range]::-ms-thumb {margin-top: 1px;box-shadow: 0px 0px 3px #545454;border: 2px solid #068EB8;height: 10px;width: 10px;border-radius: 50px;background: #0690BA;cursor: pointer;}\n#ktj_box input[type=range]:focus::-ms-fill-lower {background: #9C9C9C;}\n#ktj_box input[type=range]:focus::-ms-fill-upper {background: #9C9C9C;}\n\n#ktj_box *[ktj_tip]::before{\ncontent: attr(ktj_tip);\ndisplay: none;\nfont-weight: normal;\ntransition: all ease-out 150ms;\nfont-size:10px;\nmargin-top:-25px;\nwidth: max-content;\ncolor: rgb(196, 196, 196);\n}\n#ktj_box *[ktj_tip]:hover::before{\ndisplay:inline-block;\n}\n.ktj_colors{\ndisplay:inline-block;\nmargin-top:2px;\n}\n.ktj_other_line div:nth-child(1){\nmargin-right:5px;\n}\n",document.head.appendChild(a)}dev_div(a){const b=document.createElement(`div`);return b.textContent=`X`,b.style.color=`red`,b.style.float=`right`,b.addEventListener(`click`,()=>{window.g.party[a]?window.message(`Ziomka z grupy chcesz ujebać? ...`):window.g.other[a]?this.target==a?(this.target=!1,window.message(`Przerwano wpierdol dla ${window.g.other[a].nick}`)):(this.target=a,window.message(`Jedzie wpierdol dla ${window.g.other[a].nick}`)):this.update_div()}),b}};e.make_div(),window.newOther=function(){a.apply(this,arguments),e.update_div()};let d=0,f=a=>{Date.now()>d&&(d=Date.now()+300,window._g(`fight&a=attack&id=${a}`,b=>{b.alert&&(document.querySelector(`#alert`).style.display=`none`,window.message(document.querySelector(`#alert .a2`).innerHTML)),`ok`!=b.e&&f(a)}))},g=[];window.parseInput=function(b){if(b.emo)for(let a in b.emo)`battle`!=b.emo[a].name||g.includes(b.emo[a].source_id)?`battle`!=b.emo[a].name&&g.includes(b.emo[a].source_id)&&g.splice(g.indexOf(b.emo[a].source_id),1):g.push(b.emo[a].source_id);if(b.other)for(let a in b.other)g.includes(+a)&&b.other[a].del&&g.splice(g.indexOf(+a),1);b.party&&(e.party=b.party,e.update_div()),c.apply(this,arguments)},window.hero.run=function(){if(e.active&&e.reconnect(),e.target){let a=window.g.other[e.target];!window.g.battle&&a?2>=Math.abs(a.x-window.hero.x)&&2>=Math.abs(a.y-window.hero.y)?!g.includes(+a.id)&&f(a.id):(window.road&&window.road[0]&&(window.road[0].x!=a.x||window.road[0].y!=a.y)||!window.road[0])&&window.hero.ooooooooooooooooooooooooo(a.x,a.y):(e.target=!1,window.road=[],window.message(`Przerwano dobijanie`))}b.apply(this,arguments)}})(window.newOther,window.hero.run,window.parseInput);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement