put client login sequence in createClient.js

This commit is contained in:
Romain Beaumont 2016-04-06 03:06:34 +02:00
commit 522afb4dfd
3 changed files with 21 additions and 20 deletions

View file

@ -1,6 +1,8 @@
'use strict';
const assert = require('assert');
const raknet = require('raknet');
const fs = require("fs");
const path = require("path");
function createClient(options) {
assert.ok(options, "options is required");
@ -22,6 +24,25 @@ function createClient(options) {
});
};
client.on('login', function() {
client.writeMCPE("mcpe_login",
{
username: client.username,
protocol: 45,
protocol2: 45,
client_id: [ -1, -697896776 ],
client_uuid: '86372ed8-d055-b23a-9171-5e3ac594d766',
server_address: client.host+":"+client.port,
client_secret: new Buffer("e8 88 db 7b 9f f2 f0 44 a3 51 08 18 4e 8c 7f 9a".replace(/ /g,""),"hex"),
skin:
{
skinType: 'Standard_Steve',
texture: fs.readFileSync(path.join(__dirname,"texture"))
}
}
)
});
return client;
}

BIN
src/texture Normal file

Binary file not shown.