elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación General / Como mejorar esta función en: 23 Diciembre 2016, 03:46 am
Tengo un juego basado en agar.io y quiero mejorar está función de modo que el juego vaya más rapido , alguien que de verdad sepa puede hacerlo ?

 
Código
  1. function updateNodes(view, offset) {
  2.        timestamp = +new Date;
  3.        var code = Math.random();
  4.        ua = false;
  5.        var queueLength = view.getUint16(offset, true);
  6.        offset += 2;
  7.  
  8.        for (i = 0; i < queueLength; ++i) {
  9.            var killer = nodes[view.getUint32(offset, true)],
  10.                killedNode = nodes[view.getUint32(offset + 4, true)];
  11.            offset += 8;
  12.            if (killer && killedNode) {
  13.                killedNode.destroy();
  14.                killedNode.ox = killedNode.x;
  15.                killedNode.oy = killedNode.y;
  16.                killedNode.oSize = killedNode.size;
  17.                killedNode.nx = killer.x;
  18.                killedNode.ny = killer.y;
  19.                killedNode.nSize = killedNode.size;
  20.                killedNode.updateTime = timestamp;
  21.            }
  22.        }
  23.  
  24.        for (var i = 0;;) {
  25.            var nodeid = view.getUint32(offset, true);
  26.            offset += 4;
  27.            if (0 == nodeid) break;
  28.            ++i;
  29.  
  30.            var size, posY, posX = view.getInt32(offset, true);
  31.            offset += 4;
  32.            posY = view.getInt32(offset, true);
  33.            offset += 4;
  34.            size = view.getInt16(offset, true);
  35.            offset += 2;
  36.  
  37.            for (var r = view.getUint8(offset++), g = view.getUint8(offset++), b = view.getUint8(offset++),
  38.                    color = (r << 16 | g << 8 | b).toString(16); 6 > color.length;) color = "0" + color;
  39.            var colorstr = "#" + color,
  40.                flags = view.getUint8(offset++),
  41.                flagVirus = !!(flags & 0x01),
  42.                flagEjected = !!(flags & 0x20),
  43.                flagAgitated = !!(flags & 0x10),
  44.                _skin = "";
  45.  
  46.            flags & 2 && (offset += 4);
  47.  
  48.            if (flags & 4) {
  49.                for (;;) { // skin name
  50.                    t = view.getUint8(offset, true) & 0x7F;
  51.                    offset += 1;
  52.                    if (0 == t) break;
  53.                    _skin += String.fromCharCode(t);
  54.                }
  55.            }
  56.  
  57.            for (var char, name = "";;) { // nick name
  58.                char = view.getUint16(offset, true);
  59.                offset += 2;
  60.                if (0 == char) break;
  61.                name += String.fromCharCode(char);
  62.            }
  63.  
  64.            var node = null;
  65.            if (nodes.hasOwnProperty(nodeid)) {
  66.                node = nodes[nodeid];
  67.                node.updatePos();
  68.                node.ox = node.x;
  69.                node.oy = node.y;
  70.                node.oSize = node.size;
  71.                node.color = colorstr;
  72.            } else {
  73.                node = new Cell(nodeid, posX, posY, size, colorstr, name, _skin);
  74.                nodelist.push(node);
  75.                nodes[nodeid] = node;
  76.                node.ka = posX;
  77.                node.la = posY;
  78.            }
  79.            node.isVirus = flagVirus;
  80.            node.isEjected = flagEjected;
  81.            node.isAgitated = flagAgitated;
  82.            node.nx = posX;
  83.            node.ny = posY;
  84.            node.setSize(size);
  85.            node.updateCode = code;
  86.            node.updateTime = timestamp;
  87.            node.flag = flags;
  88.            name && node.setName(name);
  89.            if (-1 != nodesOnScreen.indexOf(nodeid) && -1 == playerCells.indexOf(node)) {
  90.                document.getElementById("overlays").style.display = "none";
  91.                playerCells.push(node);
  92.                if (1 == playerCells.length) {
  93.                    nodeX = node.x;
  94.                    nodeY = node.y;
  95.                }
  96.            }
  97.        }
  98.        queueLength = view.getUint32(offset, true);
  99.        offset += 4;
  100.        for (i = 0; i < queueLength; i++) {
  101.            var nodeId = view.getUint32(offset, true);
  102.            offset += 4;
  103.            node = nodes[nodeId];
  104.            null != node && node.destroy();
  105.        }
  106.        ua && 0 == playerCells.length && showOverlays(false)
  107.    }
[/i]

ARCHIVO COMPLETO POR SI DESEAS VERLO: http://ogar.pw/assets/js/main_out.js
2  Programación / Programación General / Error with javascript code en: 31 Julio 2016, 16:20 pm
i have a my own game , They have given me a map for the game

but the draw of .js exits of minimap.png

see the photo


https://cloud.githubusercontent.com/assets/20700185/17277044/aad9c740-5707-11e6-952a-dffe9f15f366.png


see the map..


code:


!function(){function i(i,t){var n=u("<div>").attr("id","mini-map-token-"+ i).css({position:"absolute",width:"5%",height:"5%",background:t,top:"0%",left:"0%"});return n} function t(i,t){void 0===window.mini_map_tokens&&(window.mini_map.append(t),window.mini_map_tokens=t)} function n(i){void 0!==window.mini_map_tokens&&(window.mini_map_tokens.detach(),delete window.mini_map_tokens)} function e(i){return void 0!==window.mini_map_tokens} function o(i,t,n){return void 0!==window.mini_map_tokens?(window.mini_map_tokens.css("left",t/26e3*104+"%").css("top",n/26e3*104+"%"),!0):!1} function s(i,t){window.mini_map_pos.text("x: "+ i.toFixed(0)+" / y: "+ t.toFixed(0))} function a(){var i=window.jQuery;if(window.mini_map_tokens={},0===i("#mini-map-pos").length&&(window.mini_map_pos=i("<div>").attr("id","mini-map-pos").css({top:50,left:10,color:"white",background:"rgba(155, 155, 155, 0.6)",fontSize:14,fontWeight:800,position:"fixed",padding:"0px 10px"}).appendTo(document.body)),0===i("#mini-map-wrapper").length){var t=i("<div>").attr("id","mini-map-wrapper").css({position:"fixed",top:"80px",left:"10px",width:"150px",height:"150px",background:"url('img/mini.png')"}),n=i("<div>").attr("id","mini-map").css({width:"100%",height:"100%",position:"relative"});t.append(n).appendTo(document.body),window.mini_map=n}} function r(i,t,n,e,o,s){m=this,this.id=i,this.ox=this.x=t,this.oy=this.y=n,this.oSize=this.size=e,this.color=o,this.points=[],this.pointsAcc=[],this.setName(s)} function d(i,t,n){Object.defineProperty(i,n,{get:function(){return t[n]},set:function(i){t[n]=i},enumerable:!0,configurable:!0})} function p(i,t){var n=+new Date,e=Math.random(),o=t,s=i.getUint16(o,!0);o+=2;for(var a=0;s>a;++a){var d=m[i.getUint32(o,!0)],p=m[i.getUint32(o+ 4,!0)],o=o+ 8;d&&p&&(p.destroy(),p.ox=p.x,p.oy=p.y,p.oSize=p.size,p.nx=d.x,p.ny=d.y,p.nSize=p.size,p.updateTime=n)} for(a=0;;){var c=i.getUint32(o,!0);if(o+=4,0==c)break;++a;var d=i.getInt16(o,!0),o=o+ 2,p=i.getInt16(o,!0),o=o+ 2;g=i.getInt16(o,!0),o+=2;for(var h=i.getUint8(o++),u=i.getUint8(o++),l=i.getUint8(o++),h=(h<<16|u<<8|l).toString(16);6>h.length;)h="0"+ h;var h="#"+ h,w=i.getUint8(o++),u=!!(1&w),l=!!(16&w);2&w&&(o+=4),4&w&&(o+=8),8&w&&(o+=16);for(var f,w="";f=i.getUint16(o,!0),o+=2,0!=f;)w+=String.fromCharCode(f);f=w,w=null,m.hasOwnProperty(c)?(w=m[c],w.updatePos(),w.ox=w.x,w.oy=w.y,w.oSize=w.size,w.color=h):(w=new r(c,d,p,g,h,f),w.pX=d,w.pY=p),w.isVirus=u,w.isAgitated=l,w.nx=d,w.ny=p,w.nSize=g,w.updateCode=e,w.updateTime=n,f&&w.setName(f)} for(e=i.getUint32(o,!0),o+=4,a=0;e>a;a++)c=i.getUint32(o,!0),o+=4,w=m[c],null!=w&&w.destroy()} function c(i){var t=0,n=new DataView(i.data);switch(240==n.getUint8(t)&&(t+=5),n.getUint8(t++)){case 16:p(n,t);break;case 20:l=[];break;case 32:var e=n.getUint32(t,!0);l.push(e)}} var h=window.WebSocket,u=window.jQuery,m=[],l=[];r.prototype={id:0,points:null,pointsAcc:null,name:null,nameCache:null,sizeCache:null,x:0,y:0,size:0,ox:0,oy:0,oSize:0,nx:0,ny:0,nSize:0,updateTime:0,updateCode:0,drawTime:0,destroyed:!1,isVirus:!1,isAgitated:!1,wasSimpleDrawing:!0,destroy:function(){delete m[this.id],id=l.indexOf(this.id),-1!=id&&l.splice(id,1),this.destroyed=!0,n(this.id)},setName:function(i){this.name=i},updatePos:function(){-1!=l.indexOf(this.id)&&(e(this.id)||t(this.id,i(this.id,this.color)),o(this.id,this.nx,this.ny),s(this.nx,this.ny))}},window.WebSocket=function(i,t){void 0===t&&(t=[]);var n=new h(i,t);d(this,n,"binaryType"),d(this,n,"bufferedAmount"),d(this,n,"extensions"),d(this,n,"protocol"),d(this,n,"readyState"),d(this,n,"url"),this.send=function(i){return n.send.call(n,i)},this.close=function(i,t){return n.close.call(n,i,t)},this.onopen=function(){},this.onclose=function(){},this.onerror=function(){},this.onmessage=function(){},n.onopen=function(i){if(this.onopen!=null){return this.onopen.call(n,i)}}.bind(this),n.onmessage=function(i){if(this.onmessage!=null){return c(i),this.onmessage.call(n,i)}}.bind(this),n.onclose=function(i){return this.onclose.call(n,i)}.bind(this),n.onerror=function(i){return this.onerror.call(n,i)}.bind(this)},window.WebSocket.prototype=h,a()}();
3  Programación / Programación General / Re: Alguien que sepa de javascript, que me ayude en: 9 Julio 2016, 19:37 pm
Solo necesito que al cambiar la calidad a low el juego se vea en baja calidad y si pones high pues en alta , porfavor veer en agar.io

HIGH QUALITY

http://i.imgur.com/I9dg8XC.png


EXTRA LOW QUALITY

http://i.imgur.com/62QwOzX.png


4  Programación / Programación General / Alguien que sepa de javascript, que me ayude en: 9 Julio 2016, 18:53 pm
Hola ForoElHacker , veo que aqui saben mucho y bueno tengo una duda , yo tengo un juego que es similar a agar.io. En agar.io puedes definir la calidad de juego en un <select> que dice

graphics : - high
             - normal
              - medium
              - low
              - extra low
 y bueno yo  nosé como hacer eso , creo que es javascript , si alguien supiera y me ayudaria se lo agradeceria , en otro agar ya lo tienen y tienen esto miren:


select style="width: 62%; margin-left: 20%; display: none;" id="resolution" class="form-control" onchange="setCookie('lulzyserver_graphics', this.value, 365); setQuality($('#resolution').val());">
               <option disabled value="">-- Graphics Quality --</option>
               <option  selected value="1">Graphics: NORMAL</option>
               <option value="0.8">Graphics: MEDIUM</option>
               <option value="0.65">Graphics: LOW</option>
               <option value="0.5">Graphics: VERY LOW</option>
            </select


PERO ESE ES EL CODIGO HTML , NOSE NADA DEL CODIGO javascript , que esta ofuscado..
5  Programación / Scripting / descifrar CODIGO en: 6 Julio 2016, 23:50 pm
Hola me gustaria descifrar lo siguiente:



Código
  1. ;var serverip=$(_0x1ce8[1])_0x1ce8[0];function checkServer(){var _0xf6b7x3;var _0xf6b7x4=$(_0x1ce8[1])_0x1ce8[0];switch(_0xf6b7x4){case _0x1ce8[3]:_0xf6b7x3= _0x1ce8[2];break;case _0x1ce8[5]:_0xf6b7x3= _0x1ce8[4];break;case _0x1ce8[7]:_0xf6b7x3= _0x1ce8[6];break;case _0x1ce8[9]:_0xf6b7x3= _0x1ce8[8];break;default:_0xf6b7x3= _0x1ce8[10]};$(_0x1ce8[12])_0x1ce8[11]}setInterval(checkServer,2000);function pingServer(){ping(serverip_0x1ce8[27])_0x1ce8[26]_0x1ce8[15]}setInterval(pingServer,2000);function serverPlayers(){var _0xf6b7x9;var serverip=$(_0x1ce8[1])_0x1ce8[0];switch(serverip){case _0x1ce8[3]:_0xf6b7x9= _0x1ce8[28];break;case _0x1ce8[5]:_0xf6b7x9= _0x1ce8[29];break;case _0x1ce8[7]:_0xf6b7x9= _0x1ce8[30];break;case _0x1ce8[9]:_0xf6b7x9= _0x1ce8[31];break;default:_0xf6b7x9= _0x1ce8[10]};$_0x1ce8[37]}setInterval(serverPlayers,1000);function serverPlayersButtons(){$_0x1ce8[37];$_0x1ce8[37];$_0x1ce8[37];$_0x1ce8[37]}setInterval(serverPlayersButtons,6000);function hideSkinUrl(){$(_0x1ce8[49])_0x1ce8[48];$(_0x1ce8[52])_0x1ce8[51]}function showSkinUrl(){$(_0x1ce8[49])_0x1ce8[48];$(_0x1ce8[55])_0x1ce8[51]}function hideTeam(){$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[58])_0x1ce8[51]}function showTeam(){$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[60])_0x1ce8[51]}deletead();function deletead(){$(_0x1ce8[62])_0x1ce8[61]}$(_0x1ce8[64])_0x1ce8[63];$(_0x1ce8[65])_0x1ce8[61];$(_0x1ce8[66])_0x1ce8[61];$(_0x1ce8[67])_0x1ce8[61];$(_0x1ce8[68])_0x1ce8[61];$(_0x1ce8[70])_0x1ce8[69];$(_0x1ce8[70])_0x1ce8[61];$(_0x1ce8[71])_0x1ce8[61];$(_0x1ce8[72])_0x1ce8[61];$(_0x1ce8[73])_0x1ce8[61];$(_0x1ce8[74])_0x1ce8[61];$(_0x1ce8[75])_0x1ce8[61];$(_0x1ce8[77])_0x1ce8[51];$(_0x1ce8[80])_0x1ce8[79];$(_0x1ce8[81])_0x1ce8[79];$(_0x1ce8[1])_0x1ce8[83];$(_0x1ce8[85])_0x1ce8[83];$(_0x1ce8[1])_0x1ce8[51];$(_0x1ce8[87])_0x1ce8[51];$(_0x1ce8[88])_0x1ce8[61];$(_0x1ce8[89])_0x1ce8[83];$(_0x1ce8[49])_0x1ce8[83];$(_0x1ce8[92])_0x1ce8[91];$(_0x1ce8[94])_0x1ce8[83];$(_0x1ce8[54])_0x1ce8[91];$(_0x1ce8[59])_0x1ce8[91];$(_0x1ce8[97])_0x1ce8[96];$(_0x1ce8[97])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[103])_0x1ce8[96];$(_0x1ce8[105])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[105])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[80])_0x1ce8[20];$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[94])_0x1ce8[83];$(_0x1ce8[121])_0x1ce8[48];window_0x1ce8[127];$(_0x1ce8[49])_0x1ce8[129];$(_0x1ce8[130])_0x1ce8[0];connect(_0x1ce8[3]);localStorage_0x1ce8[132];document[_0x1ce8[133]]= _0x1ce8[134];$(document)_0x1ce8[135]



ME HAN DICHO QUE UN TAL JXBEUTIFIER ES LO MAS LEJOS QUE SE PUEDE LLEGAR , PERO NO ME descifra BIEN QUE HAGO !!
6  Programación / Programación C/C++ / conectar ip a un boton en: 29 Mayo 2016, 23:48 pm
Necesito crear el botones que conecten a ip diferentes osea ws://127.0.0.1:444 y ws://127.0.0.1:445

por ejemplo cuando juegas y te dice server1 y server2 eso quiero hacer

por ejemplo los botones de esta web
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines