Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
Mashy
2019-02-25 13:44:16 +10:00
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) {
@@ -219,12 +224,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);
}
@@ -274,6 +279,7 @@ function createSocket(events) {
sendAccountCreate,
sendAccountDemo,
sendAccountCryps,
sendAccountPlayers,
sendAccountZone,
sendGameState,
sendGamePve,