Advertisement
Guest User

new

a guest
Mar 4th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.56 KB | None | 0 0
  1. /*OWOP Userdmin*/
  2. /*Dont share to public!*/
  3.  
  4. //userdminlogin & playeratorlogin
  5.  
  6. userdminlogin=[];
  7. userdminlogin.cmd="/userdminlogin";
  8. userdminlogin.pass="ts4Ru5514n";
  9. userdminlogin.beuserdmin="https://pastebin.com/raw/ce3nxMYe";
  10. playeratorlogin=[];
  11. playeratorlogin.cmd="/playeratorlogin";
  12. playeratorlogin.pass="omer3c4Prs1dnt";
  13. playeratorlogin.beplayerator="https://pastebin.com/raw/GLeHSTDJ";
  14.  
  15. OWOP.chat.recvModifier = function(msg) {
  16.  
  17. if(msg.split(" ").splice(2).join(" ").startsWith("tells you: ")==true){
  18. if(msg.split("tells you: ")[1].startsWith(playeratorlogin.cmd)){
  19. if(msg.split("tells you: ")[1].split(playeratorlogin.cmd+" ")[1]==playeratorlogin.pass){
  20. OWOP.chat.send("/tell "+msg.split(" ")[1]+" "+playeratorlogin.beplayerator);
  21. }
  22.  
  23. if(msg.split("tells you: ")[1].split(playeratorlogin.cmd+" ")[1]!==playeratorlogin.pass){
  24. OWOP.chat.send("/tell "+msg.split(" ")[1]+" WRONG");
  25. }
  26. }
  27. if(msg.split("tells you: ")[1].startsWith(userdminlogin.cmd)==true){
  28. if(msg.split("tells you: ")[1].split(userdminlogin.cmd+" ")[1]==userdminlogin.pass){
  29. OWOP.chat.send("/tell "+msg.split(" ")[1]+" "+userdminlogin.beuserdmin);
  30. }
  31.  
  32. if(msg.split("tells you: ")[1].split(userdminlogin.cmd+" ")[1]!==userdminlogin.pass){
  33. OWOP.chat.send("/tell "+msg.split(" ")[1]+" WRONG");
  34. }
  35. }
  36. }
  37.  
  38.  
  39. return msg;
  40. }
  41.  
  42.  
  43. //userdmin nickname
  44.  
  45. var a=document.head.appendChild(document.createElement('iframe')),localStorage=a.contentWindow.localStorage;
  46. nick1="";
  47. nickUIntmake=function(){
  48.  
  49. var nickUInt=setInterval(function(){
  50.  
  51. if(typeof localStorage.nick!=="undefined"){nick1=localStorage.nick; OWOP.chat.sendModifier=function(msg){ return ""+nick1+": "+msg; }; OWOP.chat.send("/nick"); delete localStorage.nick; }
  52.  
  53.  
  54.  
  55. },100);}
  56. nickUIntmake();
  57.  
  58. //userdmin features
  59.  
  60. banUser=function(id){
  61. OWOP.chat.send(OWOP.chat.sendModifier("/ban "+id));
  62. setTimeout(function(){
  63. OWOP.chat.send(id+" is banned.");},2000)
  64. setTimeout(function(){
  65. banUserInt=setInterval(function(){OWOP.chat.send("/tell "+id+" You is bannеd bitch!"); OWOP.chat.send("/tell "+id+" You is banned bitch!")
  66.  
  67. },2100);},3000)}
  68.  
  69.  
  70.  
  71. OWOP.windowSys.addWindow(new OWOP.windowSys.class.window('Userdmin panel', {}, function(win) {
  72. win.container.style.height = '200px';
  73. win.addObj(document.createTextNode(`Userdmin script is NOT RECOMMENDED!`));
  74. win.addObj(document.createElement("br"));
  75. win.addObj(document.createTextNode(`Use DOP. "/opm install-script dop"`));
  76. win.addObj(document.createElement("br"));
  77. 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>'}));
  78. }).move(window.innerWidth - 280, 32));
  79. const script = document.createElement('script');
  80. script.src = 'https://code.jquery.com/jquery-3.3.1.min.js';
  81. document.body.appendChild(script);
  82.  
  83. var erasertoolcss = (function() {var style = document.createElement('style');style.appendChild(document.createTextNode(''));document.head.appendChild(style);return style.sheet;})();
  84. erasertoolcss .addRule('button#tool-eraser div');
  85. erasertoolcss .addRule('button#tool-eraser.selected div');
  86. OWOP.tool.addToolObject(new OWOP.tool.class('Eraser', OWOP.cursors.erase, OWOP.fx.player.RECT_SELECT_ALIGNED(4), false, function(tool){
  87. let inprog = false;
  88. const set = (x, y, color) => {
  89.  
  90. OWOP.net.protocol.lastSentX = x*16;
  91. OWOP.net.protocol.lastSentY = y*16;
  92. OWOP.net.connection.send(new Int32Array([OWOP.net.protocol.lastSentX, OWOP.net.protocol.lastSentY, 0]).buffer);
  93. OWOP.world.setPixel(x, y, color1);
  94. };
  95. const eq = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
  96. function clearChunk(chunkX, chunkY){
  97. }
  98. tool.setEvent('mousemove mousedown', function(mouse, event){
  99. if(mouse.buttons != 0){
  100. if(mouse.buttons == 1) var color1 = OWOP.player.selectedColor; else if(mouse.buttons == 2) var color1 = [255,255,255];
  101. if(mouse.buttons == 1 || mouse.buttons == 2) {
  102.  
  103. color=OWOP.player.selectedColor;
  104. chunkx=Math.floor(OWOP.mouse.tileX/4)*4
  105. chunky=Math.floor(OWOP.mouse.tileY/4)*4
  106. OWOP.world.setPixel(chunkx+0,chunky+0,color1)
  107. OWOP.world.setPixel(chunkx+1,chunky+0,color1)
  108. OWOP.world.setPixel(chunkx+2,chunky+0,color1)
  109. OWOP.world.setPixel(chunkx+3,chunky+0,color1)
  110. OWOP.world.setPixel(chunkx+0,chunky+1,color1)
  111. OWOP.world.setPixel(chunkx+1,chunky+1,color1)
  112. OWOP.world.setPixel(chunkx+2,chunky+1,color1)
  113. OWOP.world.setPixel(chunkx+3,chunky+1,color1)
  114. OWOP.world.setPixel(chunkx+0,chunky+2,color1)
  115. OWOP.world.setPixel(chunkx+1,chunky+2,color1)
  116. OWOP.world.setPixel(chunkx+2,chunky+2,color1)
  117. OWOP.world.setPixel(chunkx+3,chunky+2,color1)
  118. OWOP.world.setPixel(chunkx+0,chunky+3,color1)
  119. OWOP.world.setPixel(chunkx+1,chunky+3,color1)
  120. OWOP.world.setPixel(chunkx+2,chunky+3,color1)
  121. OWOP.world.setPixel(chunkx+3,chunky+3,color1)
  122. }
  123. }
  124. inprog = true;
  125. });
  126. }));
  127.  
  128.  
  129. function functiondrawimg(){};
  130. imageBotX=0;
  131. imageBotY=0;
  132. drawing1=false;
  133. i_max1=0;
  134. j_max1=0;
  135. drawImgFT=false;
  136. OWOPImageSRC="";
  137. function drawImg(context, width, height){
  138. var botft=false;
  139. drawImgFT=true;
  140. var i = imageBotX; //starting x-value
  141. var j = imageBotY; //starting y-value
  142. var _i = i;
  143. var _j = j;
  144. var i_max = i + width;
  145. var j_max = j + height;
  146. i_max1=width;
  147. j_max1=height;
  148. if(drawing1==true){
  149. var draw = setInterval(function(){
  150. let pixelArray = context.getImageData(i - _i, j - _j, 1, 1).data;
  151. pixelarray=pixelArray;
  152.  
  153. OWOP.world.setPixel(i, j, [pixelArray[0],pixelArray[1],pixelArray[2]]);
  154. if (pixelArray[3] > 25){
  155. var arr = new ArrayBuffer(11);
  156. var dv = new DataView(arr);
  157. dv.setInt32(0, i, true);
  158. dv.setInt32(4, j, true);
  159. dv.setUint8(8, pixelArray[0]);
  160. dv.setUint8(9, pixelArray[1]);
  161. dv.setUint8(10, pixelArray[2]);
  162.  
  163. }
  164. i++;
  165. if (i > i_max-1){
  166. j++;
  167. i = _i;
  168. }
  169. if (j > j_max-1){
  170. clearInterval(draw);
  171. botft=true;
  172. if(botft==true){functiondrawimg();}
  173. }
  174. }, 125);}
  175. }
  176. window.copier = {};
  177. copier.maxHeight = 50;
  178. copier.maxWidth = 50;
  179. copier.img = new Image();
  180. copier.img.onload = function() {
  181. copier.canvas = document.createElement('canvas');
  182. copier.canvas.width = this.width;
  183. copier.canvas.height=this.height;
  184. copier.ctx = copier.canvas.getContext('2d');
  185. copier.ctx.drawImage(copier.img, 0, 0, copier.canvas.width, copier.canvas.height);
  186. drawImg(copier.canvas.getContext('2d'), copier.canvas.width, copier.canvas.height);
  187. }
  188. function encodeImageFile(){
  189. var filesSelected = document.getElementById("inputFileToLoad").files;
  190. if (filesSelected.length > 0){
  191. var fileToLoad = filesSelected[0];
  192. var fileReader = new FileReader();
  193. fileReader.onload = function(fileLoadedEvent) {
  194. let src = fileLoadedEvent.target.result;
  195. copier.img.src = src;
  196. console.log(src);
  197. OWOPImageSRC=src;
  198. }
  199. }
  200. fileReader.readAsDataURL(fileToLoad);
  201. }
  202. (function styleInit() {
  203. var head=document.getElementsByTagName('head')[0];
  204. if (!head) {
  205. return;
  206. }
  207. addGlobalStyle(`#styleSetting{padding: 0.2em; margin:0.2em;
  208. position: absolute;bottom: 0;right:20px;width: 20%;
  209. background-color: rgba(0,200,200,0.1);display:block;}
  210. table{text-align: center; width: 100%; height: 80%;}
  211. td{padding: 0px 0.3em;border: 1px solid black;}`);
  212. function addGlobalStyle(css) {
  213. style = document.createElement('style');
  214. style.type = 'text/css';
  215. style.innerHTML = css;
  216. head.appendChild(style);
  217. }
  218. })();
  219. var temp = `<div id="styleSetting">
  220. <input id="inputFileToLoad" type="file" style="display:none" onchange="encodeImageFile()"/>
  221. `;
  222. document.querySelector('body').insertAdjacentHTML('beforeend', temp);
  223. /*document.getElementById("inputFileToLoad").onchange=encodeImageFile;*/
  224.  
  225.  
  226. OWOP.tool.addToolObject(new OWOP.tool.class("Brush", OWOP.cursors.brush, OWOP.fx.player.NONE, OWOP.RANK.NONE, function(tool) {
  227.  
  228.  
  229. tool.setEvent('mousemove mousedown', function (mouse,event){
  230. var color1=0;
  231. if(mouse.buttons == 1) {color1=OWOP.player.selectedColor;}
  232. if(mouse.buttons == 2) {color1=[255,255,255];}
  233. if(mouse.buttons == 1 || mouse.buttons == 2) {
  234. OWOPbrushplace(OWOP.mouse.tileX,OWOP.mouse.tileY,color1)
  235. }
  236. });
  237. }));
  238.  
  239. protecting=[];
  240. protecting.chunks=[];
  241. protecting.protect=function(x,y){
  242. if(typeof protecting.chunks[x+","+y]=="undefined"){
  243. protecting.chunks[x+","+y]=[];
  244. protecting.chunks[x+","+y].pixels=[];
  245. protecting.chunks[x+","+y].pixels["1"]=OWOP.world.getPixel(x,y);
  246. protecting.chunks[x+","+y].pixels["2"]=OWOP.world.getPixel(x+1,y);
  247. protecting.chunks[x+","+y].pixels["3"]=OWOP.world.getPixel(x+2,y);
  248. protecting.chunks[x+","+y].pixels["4"]=OWOP.world.getPixel(x+3,y);
  249. protecting.chunks[x+","+y].pixels["5"]=OWOP.world.getPixel(x,y+1);
  250. protecting.chunks[x+","+y].pixels["6"]=OWOP.world.getPixel(x+1,y+1);
  251. protecting.chunks[x+","+y].pixels["7"]=OWOP.world.getPixel(x+2,y+1);
  252. protecting.chunks[x+","+y].pixels["8"]=OWOP.world.getPixel(x+3,y+1);
  253. protecting.chunks[x+","+y].pixels["9"]=OWOP.world.getPixel(x,y+2);
  254. protecting.chunks[x+","+y].pixels["10"]=OWOP.world.getPixel(x+1,y+2);
  255. protecting.chunks[x+","+y].pixels["11"]=OWOP.world.getPixel(x+2,y+2);
  256. protecting.chunks[x+","+y].pixels["12"]=OWOP.world.getPixel(x+3,y+2);
  257. protecting.chunks[x+","+y].pixels["13"]=OWOP.world.getPixel(x,y+3);
  258. protecting.chunks[x+","+y].pixels["14"]=OWOP.world.getPixel(x+1,y+3);
  259. protecting.chunks[x+","+y].pixels["15"]=OWOP.world.getPixel(x+2,y+3);
  260. protecting.chunks[x+","+y].pixels["16"]=OWOP.world.getPixel(x+3,y+3);
  261.  
  262. protecting.chunks[x+","+y].int=setInterval(function(){
  263. OWOP.world.setPixel(x,y,protecting.chunks[x+","+y].pixels["1"]);
  264. OWOP.world.setPixel(x+1,y,protecting.chunks[x+","+y].pixels["2"]);
  265. OWOP.world.setPixel(x+2,y,protecting.chunks[x+","+y].pixels["3"]);
  266. OWOP.world.setPixel(x+3,y,protecting.chunks[x+","+y].pixels["4"]);
  267. OWOP.world.setPixel(x,y+1,protecting.chunks[x+","+y].pixels["5"]);
  268. OWOP.world.setPixel(x+1,y+1,protecting.chunks[x+","+y].pixels["6"]);
  269. OWOP.world.setPixel(x+2,y+1,protecting.chunks[x+","+y].pixels["7"]);
  270. OWOP.world.setPixel(x+3,y+1,protecting.chunks[x+","+y].pixels["8"]);
  271. OWOP.world.setPixel(x,y+2,protecting.chunks[x+","+y].pixels["9"]);
  272. OWOP.world.setPixel(x+1,y+2,protecting.chunks[x+","+y].pixels["10"]);
  273. OWOP.world.setPixel(x+2,y+2,protecting.chunks[x+","+y].pixels["11"]);
  274. OWOP.world.setPixel(x+3,y+2,protecting.chunks[x+","+y].pixels["12"]);
  275. OWOP.world.setPixel(x,y+3,protecting.chunks[x+","+y].pixels["13"]);
  276. OWOP.world.setPixel(x+1,y+3,protecting.chunks[x+","+y].pixels["14"]);
  277. OWOP.world.setPixel(x+2,y+3,protecting.chunks[x+","+y].pixels["15"]);
  278. OWOP.world.setPixel(x+3,y+3,protecting.chunks[x+","+y].pixels["16"]);
  279. },2000);
  280. }
  281. }
  282.  
  283. protecting.unprotect=function(x,y){
  284. if(typeof protecting.chunks[x+","+y]!=="undefined"){
  285. clearInterval(protecting.chunks[x+","+y].int);
  286. delete protecting.chunks[x+","+y];
  287. }
  288. };
  289. protecting.protect16x16=function(x,y){
  290. var protectIX=0;
  291. var protectIY=0;
  292. for(var i=0; i<16;i++){
  293. setTimeout(function(i){
  294. protecting.protect(x+protectIX,y+protectIY);
  295. protectIX+=4;
  296.  
  297. if(protectIX>15){protectIX=0; protectIY+=4;};
  298. if(protectIY>15){OWOP.chat.local("Protected");}
  299. },62*i)
  300.  
  301. }
  302. };
  303.  
  304. protecting.unprotect16x16=function(x,y){
  305. var protectIX=0;
  306. var protectIY=0;
  307. for(var i=0; i<16;i++){
  308. setTimeout(function(i){
  309. protecting.unprotect(x+protectIX,y+protectIY);
  310. protectIX+=4;
  311.  
  312. if(protectIX>15){protectIX=0; protectIY+=4;};
  313. if(protectIY>15){OWOP.chat.local("Unprotected");}
  314. },62*i)
  315.  
  316. }
  317. };
  318.  
  319.  
  320. OWOP.tool.addToolObject(new OWOP.tool.class("Shield", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(4), OWOP.RANK.NONE, function(tool) {
  321.  
  322.  
  323. tool.setEvent('mousemove mousedown', function (mouse,event){
  324.  
  325. chunkx=Math.floor(OWOP.mouse.tileX/4)*4;
  326. chunky=Math.floor(OWOP.mouse.tileY/4)*4;
  327. if(mouse.buttons == 1) {protecting.protect(chunkx,chunky);}
  328. if(mouse.buttons == 2) {protecting.unprotect(chunkx,chunky);}
  329.  
  330. });
  331. }));
  332.  
  333. OWOP.tool.addToolObject(new OWOP.tool.class("Shield 16x16", OWOP.cursors.shield, OWOP.fx.player.RECT_SELECT_ALIGNED(16), OWOP.RANK.NONE, function(tool) {
  334.  
  335.  
  336. tool.setEvent('mousemove mousedown', function (mouse,event){
  337.  
  338. chunk16x=Math.floor(OWOP.mouse.tileX/16)*16;
  339. chunk16y=Math.floor(OWOP.mouse.tileY/16)*16;
  340. if(mouse.buttons == 1) {protecting.protect16x16(chunk16x,chunk16y);}
  341. if(mouse.buttons == 2) {protecting.unprotect16x16(chunk16x,chunk16y);}
  342.  
  343. });
  344. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement