-
Notifications
You must be signed in to change notification settings - Fork 6
/
packets.js
68 lines (67 loc) · 2.29 KB
/
packets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class Packets {
'http://agar.red'(){
return {
handshakeProtocol: new Buffer([254, 5, 0, 0, 0]),
handshakeKey: new Buffer([255, 0, 0, 0, 0]),
ping: new Buffer([31]),
pingTime: 1000,
spawn(name){
const buf = new Buffer(1 + 2 * name.length);
buf.writeUInt8(0, 0);
for(let i = 0; i < name.length; i++) buf.writeUInt16LE(name.charCodeAt(i), 1 + 2 * i);
return buf;
},
move(x, y){
const buf = new Buffer(21);
buf.writeUInt8(16, 0);
buf.writeDoubleLE(x, 1);
buf.writeDoubleLE(y, 9);
buf.writeUInt32LE(0, 17);
return buf;
}
};
}
'http://agar.bio'(){
return {
handshakeProtocol: new Buffer([254, 1, 0, 0, 0]),
handshakeKey: new Buffer([255, 114, 97, 103, 79]),
spawn(name){
const buf = new Buffer(1 + 2 * name.length);
buf.writeUInt8(0, 0);
for(let i = 0; i < name.length; i++) buf.writeUInt16LE(name.charCodeAt(i), 1 + 2 * i);
return buf;
},
move(x, y){
const buf = new Buffer(21);
buf.writeUInt8(16, 0);
buf.writeDoubleLE(x, 1);
buf.writeDoubleLE(y, 9);
buf.writeUInt32LE(0, 17);
return buf;
}
};
}
'http://agar.pro'(){
return {
handshakeProtocol: new Buffer([254, 5, 0, 0, 0]),
handshakeKey: new Buffer([255, 0, 0, 0, 0]),
ping: new Buffer([31]),
pingTime: 1500,
spawn(name){
const buf = new Buffer(1 + 2 * name.length);
buf.writeUInt8(0, 0);
for(let i = 0; i < name.length; i++) buf.writeUInt16LE(name.charCodeAt(i), 1 + 2 * i);
return buf;
},
move(x, y){
const buf = new Buffer(21);
buf.writeUInt8(16, 0);
buf.writeDoubleLE(x, 1);
buf.writeDoubleLE(y, 9);
buf.writeUInt32LE(0, 17);
return buf;
}
};
}
}
module.exports = Packets;