UNPKG

1.09 kBJavaScriptView Raw
1var CSGO = require("../index"),
2 util = require("util"),
3 protos = require("../helpers/protos");
4
5CSGO.CSGOClient.prototype.playerProfileRequest = function(accountId, req_level, callback) {
6 callback = callback || null;
7 if (!this._gcReady) {
8 if (this.debug) {
9 util.log("GC not ready");
10 }
11 return null;
12 }
13
14 if (this.debug) {
15 util.log("Sending player profile request");
16 }
17
18 var payload = new protos.CMsgGCCStrike15_v2_ClientRequestPlayersProfile({
19 account_id: accountId,
20 request_level: req_level || 32
21 });
22 this._gc.send({msg:CSGO.ECSGOCMsg.k_EMsgGCCStrike15_v2_ClientRequestPlayersProfile, proto: {}},
23 payload.toBuffer(), callback);
24};
25
26var handlers = CSGO.CSGOClient.prototype._handlers;
27
28handlers[CSGO.ECSGOCMsg.k_EMsgGCCStrike15_v2_PlayersProfile] = function onPlayerProfileResponse(message) {
29 var playerProfileResponse = protos.CMsgGCCStrike15_v2_PlayersProfile.decode(message);
30
31 if (this.debug) {
32 util.log("Received player profile");
33 }
34 this.emit("playerProfile", playerProfileResponse);
35};
\No newline at end of file