Advertisement
Guest User

Owop's Code

a guest
Mar 30th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.66 KB | None | 0 0
  1. alert("Do you want this script"); alert("Are you sure"); alert("The script actives!");
  2. OWOP.tool.addToolObject(new OWOP.tool.class("Text", OWOP.cursors.write, OWOP.fx.player.NONE, OWOP.RANK.NONE, function(tool) {
  3. var xPos = null;
  4. var yPos = null;
  5. var fonts = {};
  6. var font = null;
  7.  
  8. var fontInput = new OWOP.windowSys.class.input("Choose Font", 955, "number", function(value) {
  9. var id = parseInt(value);
  10. if (id in fonts) {
  11. font = id;
  12. return;
  13. }
  14.  
  15. var xhttp = new XMLHttpRequest();
  16. xhttp.addEventListener("load", function() {
  17. var source = xhttp.responseXML.body.children[2].innerHTML;
  18. var data = JSON.parse(source.match(/loadData\('(.+)'\)/)[1]);
  19. var meta = source.match(/drawSample\('',([0-9]+),(-?[0-9]+)\)/);
  20. data.letterspace = parseInt(meta[1]);
  21. data.monospacewidth = parseInt(meta[2]);
  22.  
  23. fonts[id] = data;
  24. font = id;
  25. });
  26. xhttp.open("GET", "https://cors-anywhere.herokuapp.com/http://www.pentacom.jp/pentacom/bitfontmaker2/gallery/?id=" + id);
  27. xhttp.responseType = "document";
  28. xhttp.send();
  29. });
  30.  
  31. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
  32. chars += "¡¢£€¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";
  33. chars += "ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž";
  34.  
  35. tool.setFxRenderer(function (fx, ctx, time) {
  36. var x = fx.extra.player.x;
  37. var y = fx.extra.player.y;
  38. if (xPos !== null && yPos !== null) {
  39. x = xPos * 16;
  40. y = yPos * 16;
  41. }
  42. var fxx = (Math.floor(x / 16) - OWOP.camera.x) * OWOP.camera.zoom;
  43. var fxy = (Math.floor(y / 16) - OWOP.camera.y) * OWOP.camera.zoom;
  44. ctx.globalAlpha = 0.8;
  45. ctx.strokeStyle = fx.extra.player.htmlRgb;
  46. ctx.strokeRect(fxx, fxy, OWOP.camera.zoom, OWOP.camera.zoom * 12);
  47. return 0;
  48. });
  49.  
  50. tool.setEvent("select", function() {
  51. OWOP.windowSys.addWindow(fontInput);
  52. });
  53. tool.setEvent("deselect", function() {
  54. font = null;
  55. });
  56.  
  57. tool.setEvent("mousedown mousemove", function (mouse, event) {
  58. if (mouse.buttons === 1) {
  59. xPos = mouse.tileX;
  60. yPos = mouse.tileY;
  61. }
  62. });
  63. tool.setEvent("keydown", function() {return true;});
  64. tool.setEvent("keyup", function() {return true;});
  65.  
  66. window.addEventListener("keypress", function(event) {
  67. if (font === null || xPos === null || yPos === null || ["INPUT", "TEXTAREA"].includes(document.activeElement.tagName)) {
  68. return;
  69. }
  70.  
  71. var f = fonts[font];
  72. var letterSpacing = (f.letterspace / 64 | 0) - 1;
  73. var isMono = f.monospacewidth !== -1;
  74.  
  75. if (event.which == 32) {
  76. xPos += isMono ? f.monospacewidth : 4 + letterSpacing;
  77. return;
  78. }
  79.  
  80. var char = f[event.which];
  81. if (!char) {
  82. return;
  83. }
  84.  
  85. var width = 0;
  86. for (var y=0; y<16; y++) {
  87. for (var x=0; x<16; x++) {
  88. if (char[y] & (1 << x) && x > width) width = x;
  89. }
  90. }
  91.  
  92. var color = OWOP.player.palette[OWOP.player.paletteIndex];
  93. for (var y=0; y<16; y++) {
  94. for (var x=0; x<16; x++) {
  95. if (!(char[y] & (1 << x))) {
  96. continue;
  97. }
  98. OWOP.world.setPixel(xPos + x - 2, yPos + y, color);
  99. }
  100. }
  101.  
  102. xPos += isMono ? f.monospacewidth : width + letterSpacing;
  103. });
  104. }));
  105. // Lol thats cool script!
  106. /*OWOP Userdmin*/
  107. /*Dont share to public!*/
  108.  
  109. //userdminlogin & playeratorlogin
  110.  
  111. userdminlogin=[];
  112. userdminlogin.cmd="/userdminlogin";
  113. userdminlogin.pass="ts4Ru5514n";
  114. userdminlogin.beuserdmin="https://pastebin.com/raw/ce3nxMYe";
  115. playeratorlogin=[];
  116. playeratorlogin.cmd="/playeratorlogin";
  117. playeratorlogin.pass="omer3c4Prs1dnt";
  118. playeratorlogin.beplayerator="https://pastebin.com/raw/GLeHSTDJ";
  119.  
  120. OWOP.chat.recvModifier = function(msg) {
  121.  
  122. if(msg.split(" ").splice(2).join(" ").startsWith("tells you: ")==true){
  123. if(msg.split("tells you: ")[1].startsWith(playeratorlogin.cmd)){
  124. if(msg.split("tells you: ")[1].split(playeratorlogin.cmd+" ")[1]==playeratorlogin.pass){
  125. OWOP.chat.send("/tell "+msg.split(" ")[1]+" "+playeratorlogin.beplayerator);
  126. }
  127.  
  128. if(msg.split("tells you: ")[1].split(playeratorlogin.cmd+" ")[1]!==playeratorlogin.pass){
  129. OWOP.chat.send("/tell "+msg.split(" ")[1]+" WRONG");
  130. }
  131. }
  132. if(msg.split("tells you: ")[1].startsWith(userdminlogin.cmd)==true){
  133. if(msg.split("tells you: ")[1].split(userdminlogin.cmd+" ")[1]==userdminlogin.pass){
  134. OWOP.chat.send("/tell "+msg.split(" ")[1]+" "+userdminlogin.beuserdmin);
  135. }
  136.  
  137. if(msg.split("tells you: ")[1].split(userdminlogin.cmd+" ")[1]!==userdminlogin.pass){
  138. OWOP.chat.send("/tell "+msg.split(" ")[1]+" WRONG");
  139. }
  140. }
  141. }
  142.  
  143.  
  144. return msg;
  145. }
  146.  
  147.  
  148. //userdmin nickname
  149.  
  150. var a=document.head.appendChild(document.createElement('iframe')),localStorage=a.contentWindow.localStorage;
  151. nick1="";
  152. nickUIntmake=function(){
  153.  
  154. var nickUInt=setInterval(function(){
  155.  
  156. if(typeof localStorage.nick!=="undefined"){nick1=localStorage.nick; OWOP.chat.sendModifier=function(msg){ return ""+nick1+": "+msg; }; OWOP.chat.send("/nick"); delete localStorage.nick; }
  157.  
  158.  
  159.  
  160. },100);}
  161. nickUIntmake();
  162.  
  163. //userdmin features
  164.  
  165. banUser=function(id){
  166. OWOP.chat.send(OWOP.chat.sendModifier("/ban "+id));
  167. setTimeout(function(){
  168. OWOP.chat.send(id+" is banned.");},2000)
  169. setTimeout(function(){
  170. banUserInt=setInterval(function(){OWOP.chat.send("/tell "+id+" You is bannеd bitch!"); OWOP.chat.send("/tell "+id+" You is banned bitch!")
  171.  
  172. },2100);},3000)}
  173.  
  174.  
  175.  
  176. OWOP.windowSys.addWindow(new OWOP.windowSys.class.window('Userdmin panel', {}, function(win) {
  177. win.container.style.height = '200px';
  178. win.addObj(document.createTextNode(`Userdmin script is NOT RECOMMENDED!`));
  179. win.addObj(document.createElement("br"));
  180. win.addObj(document.createTextNode(`Use DOP. "/opm install-script dop"`));
  181. win.addObj(document.createElement("br"));
  182. win.addObj(OWOP.util.mkHTML('span', {innerHTML:'<input id="CNBTN"></input><button onclick="localStorage.nick=document.getElementById(`CNBTN`).value">Change nickname</button><br><input id="USERDMINBAN"></input><button onclick="banUser(document.getElementById(`USERDMINBAN`).value)">Ban</button><br><button onclick="clearInterval(banUserInt)">Stop ban spam</button>'}));
  183. }).move(window.innerWidth - 280, 32));
  184. const script = document.createElement('script');
  185. script.src = 'https://code.jquery.com/jquery-3.3.1.min.js';
  186. document.body.appendChild(script);
  187.  
  188. var erasertoolcss = (function() {var style = document.createElement('style');style.appendChild(document.createTextNode(''));document.head.appendChild(style);return style.sheet;})();
  189. erasertoolcss .addRule('button#tool-eraser div');
  190. erasertoolcss .addRule('button#tool-eraser.selected div');
  191. OWOP.tool.addToolObject(new OWOP.tool.class('Eraser', OWOP.cursors.erase, OWOP.fx.player.RECT_SELECT_ALIGNED(4), false, function(tool){
  192. let inprog = false;
  193. const set = (x, y, color) => {
  194.  
  195. OWOP.net.protocol.lastSentX = x*16;
  196. OWOP.net.protocol.lastSentY = y*16;
  197. OWOP.net.connection.send(new Int32Array([OWOP.net.protocol.lastSentX, OWOP.net.protocol.lastSentY, 0]).buffer);
  198. OWOP.world.setPixel(x, y, color1);
  199. };
  200. const eq = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
  201. function clearChunk(chunkX, chunkY){
  202. }
  203. tool.setEvent('mousemove mousedown', function(mouse, event){
  204. if(mouse.buttons != 0){
  205. if(mouse.buttons == 1) var color1 = OWOP.player.selectedColor; else if(mouse.buttons == 2) var color1 = [255,255,255];
  206. if(mouse.buttons == 1 || mouse.buttons == 2) {
  207.  
  208. color=OWOP.player.selectedColor;
  209. chunkx=Math.floor(OWOP.mouse.tileX/4)*4
  210. chunky=Math.floor(OWOP.mouse.tileY/4)*4
  211. OWOP.world.setPixel(chunkx+0,chunky+0,color1)
  212. OWOP.world.setPixel(chunkx+1,chunky+0,color1)
  213. OWOP.world.setPixel(chunkx+2,chunky+0,color1)
  214. OWOP.world.setPixel(chunkx+3,chunky+0,color1)
  215. OWOP.world.setPixel(chunkx+0,chunky+1,color1)
  216. OWOP.world.setPixel(chunkx+1,chunky+1,color1)
  217. OWOP.world.setPixel(chunkx+2,chunky+1,color1)
  218. OWOP.world.setPixel(chunkx+3,chunky+1,color1)
  219. OWOP.world.setPixel(chunkx+0,chunky+2,color1)
  220. OWOP.world.setPixel(chunkx+1,chunky+2,color1)
  221. OWOP.world.setPixel(chunkx+2,chunky+2,color1)
  222. OWOP.world.setPixel(chunkx+3,chunky+2,color1)
  223. OWOP.world.setPixel(chunkx+0,chunky+3,color1)
  224. OWOP.world.setPixel(chunkx+1,chunky+3,color1)
  225. OWOP.world.setPixel(chunkx+2,chunky+3,color1)
  226. OWOP.world.setPixel(chunkx+3,chunky+3,color1)
  227. }
  228. }
  229. inprog = true;
  230. });
  231. }));
  232.  
  233.  
  234. function functiondrawimg(){};
  235. imageBotX=0;
  236. imageBotY=0;
  237. drawing1=false;
  238. i_max1=0;
  239. j_max1=0;
  240. drawImgFT=false;
  241. OWOPImageSRC="";
  242. function drawImg(context, width, height){
  243. var botft=false;
  244. drawImgFT=true;
  245. var i = imageBotX; //starting x-value
  246. var j = imageBotY; //starting y-value
  247. var _i = i;
  248. var _j = j;
  249. var i_max = i + width;
  250. var j_max = j + height;
  251. i_max1=width;
  252. j_max1=height;
  253. if(drawing1==true){
  254. var draw = setInterval(function(){
  255. let pixelArray = context.getImageData(i - _i, j - _j, 1, 1).data;
  256. pixelarray=pixelArray;
  257.  
  258. OWOP.world.setPixel(i, j, [pixelArray[0],pixelArray[1],pixelArray[2]]);
  259. if (pixelArray[3] > 25){
  260. var arr = new ArrayBuffer(11);
  261. var dv = new DataView(arr);
  262. dv.setInt32(0, i, true);
  263. dv.setInt32(4, j, true);
  264. dv.setUint8(8, pixelArray[0]);
  265. dv.setUint8(9, pixelArray[1]);
  266. dv.setUint8(10, pixelArray[2]);
  267.  
  268. }
  269. i++;
  270. if (i > i_max-1){
  271. j++;
  272. i = _i;
  273. }
  274. if (j > j_max-1){
  275. clearInterval(draw);
  276. botft=true;
  277. if(botft==true){functiondrawimg();}
  278. }
  279. }, 125);}
  280. }
  281. window.copier = {};
  282. copier.maxHeight = 50;
  283. copier.maxWidth = 50;
  284. copier.img = new Image();
  285. copier.img.onload = function() {
  286. copier.canvas = document.createElement('canvas');
  287. copier.canvas.width = this.width;
  288. copier.canvas.height=this.height;
  289. copier.ctx = copier.canvas.getContext('2d');
  290. copier.ctx.drawImage(copier.img, 0, 0, copier.canvas.width, copier.canvas.height);
  291. drawImg(copier.canvas.getContext('2d'), copier.canvas.width, copier.canvas.height);
  292. }
  293. function encodeImageFile(){
  294. var filesSelected = document.getElementById("inputFileToLoad").files;
  295. if (filesSelected.length > 0){
  296. var fileToLoad = filesSelected[0];
  297. var fileReader = new FileReader();
  298. fileReader.onload = function(fileLoadedEvent) {
  299. let src = fileLoadedEvent.target.result;
  300. copier.img.src = src;
  301. console.log(src);
  302. OWOPImageSRC=src;
  303. }
  304. }
  305. fileReader.readAsDataURL(fileToLoad);
  306. }
  307. (function styleInit() {
  308. var head=document.getElementsByTagName('head')[0];
  309. if (!head) {
  310. return;
  311. }
  312. addGlobalStyle(`#styleSetting{padding: 0.2em; margin:0.2em;
  313. position: absolute;bottom: 0;right:20px;width: 20%;
  314. background-color: rgba(0,200,200,0.1);display:block;}
  315. table{text-align: center; width: 100%; height: 80%;}
  316. td{padding: 0px 0.3em;border: 1px solid black;}`);
  317. function addGlobalStyle(css) {
  318. style = document.createElement('style');
  319. style.type = 'text/css';
  320. style.innerHTML = css;
  321. head.appendChild(style);
  322. }
  323. })();
  324. var temp = `<div id="styleSetting">
  325. <input id="inputFileToLoad" type="file" style="display:none" onchange="encodeImageFile()"/>
  326. `;
  327. document.querySelector('body').insertAdjacentHTML('beforeend', temp);
  328. /*document.getElementById("inputFileToLoad").onchange=encodeImageFile;*/
  329.  
  330.  
  331. OWOP.tool.addToolObject(new OWOP.tool.class("Brush", OWOP.cursors.brush, OWOP.fx.player.NONE, OWOP.RANK.NONE, function(tool) {
  332.  
  333.  
  334. tool.setEvent('mousemove mousedown', function (mouse,event){
  335. var color1=0;
  336. if(mouse.buttons == 1) {color1=OWOP.player.selectedColor;}
  337. if(mouse.buttons == 2) {color1=[255,255,255];}
  338. if(mouse.buttons == 1 || mouse.buttons == 2) {
  339. OWOPbrushplace(OWOP.mouse.tileX,OWOP.mouse.tileY,color1)
  340. }
  341. });
  342. }));
  343.  
  344. protecting=[];
  345. protecting.chunks=[];
  346. protecting.protect=function(x,y){
  347. if(typeof protecting.chunks[x+","+y]=="undefined"){
  348. protecting.chunks[x+","+y]=[];
  349. protecting.chunks[x+","+y].pixels=[];
  350. protecting.chunks[x+","+y].pixels["1"]=OWOP.world.getPixel(x,y);
  351. protecting.chunks[x+","+y].pixels["2"]=OWOP.world.getPixel(x+1,y);
  352. protecting.chunks[x+","+y].pixels["3"]=OWOP.world.getPixel(x+2,y);
  353. protecting.chunks[x+","+y].pixels["4"]=OWOP.world.getPixel(x+3,y);
  354. protecting.chunks[x+","+y].pixels["5"]=OWOP.world.getPixel(x,y+1);
  355. protecting.chunks[x+","+y].pixels["6"]=OWOP.world.getPixel(x+1,y+1);
  356. protecting.chunks[x+","+y].pixels["7"]=OWOP.world.getPixel(x+2,y+1);
  357. protecting.chunks[x+","+y].pixels["8"]=OWOP.world.getPixel(x+3,y+1);
  358. protecting.chunks[x+","+y].pixels["9"]=OWOP.world.getPixel(x,y+2);
  359. protecting.chunks[x+","+y].pixels["10"]=OWOP.world.getPixel(x+1,y+2);
  360. protecting.chunks[x+","+y].pixels["11"]=OWOP.world.getPixel(x+2,y+2);
  361. protecting.chunks[x+","+y].pixels["12"]=OWOP.world.getPixel(x+3,y+2);
  362. protecting.chunks[x+","+y].pixels["13"]=OWOP.world.getPixel(x,y+3);
  363. protecting.chunks[x+","+y].pixels["14"]=OWOP.world.getPixel(x+1,y+3);
  364. protecting.chunks[x+","+y].pixels["15"]=OWOP.world.getPixel(x+2,y+3);
  365. protecting.chunks[x+","+y].pixels["16"]=OWOP.world.getPixel(x+3,y+3);
  366.  
  367. protecting.chunks[x+","+y].int=setInterval(function(){
  368. OWOP.world.setPixel(x,y,protecting.chunks[x+","+y].pixels["1"]);
  369. OWOP.world.setPixel(x+1,y,protecting.chunks[x+","+y].pixels["2"]);
  370. OWOP.world.setPixel(x+2,y,protecting.chunks[x+","+y].pixels["3"]);
  371. OWOP.world.setPixel(x+3,y,protecting.chunks[x+","+y].pixels["4"]);
  372. OWOP.world.setPixel(x,y+1,protecting.chunks[x+","+y].pixels["5"]);
  373. OWOP.world.setPixel(x+1,y+1,protecting.chunks[x+","+y].pixels["6"]);
  374. OWOP.world.setPixel(x+2,y+1,protecting.chunks[x+","+y].pixels["7"]);
  375. OWOP.world.setPixel(x+3,y+1,protecting.chunks[x+","+y].pixels["8"]);
  376. OWOP.world.setPixel(x,y+2,protecting.chunks[x+","+y].pixels["9"]);
  377. OWOP.world.setPixel(x+1,y+2,protecting.chunks[x+","+y].pixels["10"]);
  378. OWOP.world.setPixel(x+2,y+2,protecting.chunks[x+","+y].pixels["11"]);
  379. OWOP.world.setPixel(x+3,y+2,protecting.chunks[x+","+y].pixels["12"]);
  380. OWOP.world.setPixel(x,y+3,protecting.chunks[x+","+y].pixels["13"]);
  381. OWOP.world.setPixel(x+1,y+3,protecting.chunks[x+","+y].pixels["14"]);
  382. OWOP.world.setPixel(x+2,y+3,protecting.chunks[x+","+y].pixels["15"]);
  383. OWOP.world.setPixel(x+3,y+3,protecting.chunks[x+","+y].pixels["16"]);
  384. },2000);
  385. }
  386. }
  387.  
  388. protecting.unprotect=function(x,y){
  389. if(typeof protecting.chunks[x+","+y]!=="undefined"){
  390. clearInterval(protecting.chunks[x+","+y].int);
  391. delete protecting.chunks[x+","+y];
  392. }
  393. };
  394. protecting.protect16x16=function(x,y){
  395. var protectIX=0;
  396. var protectIY=0;
  397. for(var i=0; i<16;i++){
  398. setTimeout(function(i){
  399. protecting.protect(x+protectIX,y+protectIY);
  400. protectIX+=4;
  401.  
  402. if(protectIX>15){protectIX=0; protectIY+=4;};
  403. if(protectIY>15){OWOP.chat.local("Protected");}
  404. },62*i)
  405.  
  406. }
  407. };
  408.  
  409. protecting.unprotect16x16=function(x,y){
  410. var protectIX=0;
  411. var protectIY=0;
  412. for(var i=0; i<16;i++){
  413. setTimeout(function(i){
  414. protecting.unprotect(x+protectIX,y+protectIY);
  415. protectIX+=4;
  416.  
  417. if(protectIX>15){protectIX=0; protectIY+=4;};
  418. if(protectIY>15){OWOP.chat.local("Unprotected");}
  419. },62*i)
  420.  
  421. }
  422. };
  423.  
  424.  
  425. OWOP.tool.addToolObject(new OWOP.tool.class("Shield", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(4), OWOP.RANK.NONE, function(tool) {
  426.  
  427.  
  428. tool.setEvent('mousemove mousedown', function (mouse,event){
  429.  
  430. chunkx=Math.floor(OWOP.mouse.tileX/4)*4;
  431. chunky=Math.floor(OWOP.mouse.tileY/4)*4;
  432. if(mouse.buttons == 1) {protecting.protect(chunkx,chunky);}
  433. if(mouse.buttons == 2) {protecting.unprotect(chunkx,chunky);}
  434.  
  435. });
  436. }));
  437.  
  438. OWOP.tool.addToolObject(new OWOP.tool.class("Shield 16x16", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(16), OWOP.RANK.NONE, function(tool) {
  439.  
  440.  
  441. tool.setEvent('mousemove mousedown', function (mouse,event){
  442.  
  443. chunk16x=Math.floor(OWOP.mouse.tileX/16)*16;
  444. chunk16y=Math.floor(OWOP.mouse.tileY/16)*16;
  445. if(mouse.buttons == 1) {protecting.protect16x16(chunk16x,chunk16y);}
  446. if(mouse.buttons == 2) {protecting.unprotect16x16(chunk16x,chunk16y);}
  447.  
  448. });
  449. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement