account players method

This commit is contained in:
ntr
2019-02-25 14:06:41 +11:00
parent c6329de8ab
commit afe992d986
5 changed files with 67 additions and 3 deletions
+7 -1
View File
@@ -45,6 +45,10 @@ function createSocket(events) {
send({ method: 'account_cryps', params: {} });
}
function sendAccountPlayers() {
send({ method: 'account_players', params: {} });
}
function sendAccountZone() {
send({ method: 'account_zone', params: {} });
}
@@ -150,6 +154,7 @@ function createSocket(events) {
account = login;
events.setAccount(login);
sendAccountCryps();
sendAccountPlayers();
}
function accountCryps(response) {
@@ -222,12 +227,12 @@ function createSocket(events) {
// decode binary msg from server
const blob = new Uint8Array(event.data);
const res = cbor.decode(blob);
const { method, params } = res;
console.log(res);
// check for error and split into response type and data
if (res.err) return errHandler(res.err);
const { method, params } = res;
if (!handlers[method]) return errorToast(`${method} handler missing`);
return handlers[method](params);
}
@@ -277,6 +282,7 @@ function createSocket(events) {
sendAccountCreate,
sendAccountDemo,
sendAccountCryps,
sendAccountPlayers,
sendAccountZone,
sendGameState,
sendGamePve,