[BREAKING CHANGES] - Add new commands module for the Friends list, add new events for friends online/offline, friend rights management, friend map lookup

This commit is contained in:
Casper Warden
2018-10-12 14:34:43 +01:00
parent 375abc433e
commit 2a0c4dc3e8
86 changed files with 1406 additions and 330 deletions

53
lib/classes/Vector2.ts Normal file
View File

@@ -0,0 +1,53 @@
import {vec2} from '../tsm/vec2';
export class Vector2 extends vec2
{
static getZero(): Vector2
{
return new Vector2();
}
constructor(buf?: Buffer | number[], pos?: number, double?: boolean)
{
if (double === undefined)
{
double = false;
}
if (buf !== undefined && pos !== undefined && buf instanceof Buffer)
{
if (!double)
{
const x = buf.readFloatLE(pos);
const y = buf.readFloatLE(pos + 4);
super([x, y]);
}
else
{
const x = buf.readDoubleLE(pos);
const y = buf.readDoubleLE(pos + 8);
super([x, y]);
}
}
else if (buf !== undefined && Array.isArray(buf))
{
super(buf);
}
else
{
super();
}
}
writeToBuffer(buf: Buffer, pos: number, double: boolean)
{
if (double)
{
buf.writeDoubleLE(this.x, pos);
buf.writeDoubleLE(this.y, pos + 8);
}
else
{
buf.writeFloatLE(this.x, pos);
buf.writeFloatLE(this.y, pos + 4);
}
}
}