Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dota2.Dota2Client.prototype.getFantasyCards = function(account_id, item_ids, callback) {
- callback = callback || null;
- if (!this._gcReady) {
- if (this.debug) util.log("GC not ready, please listen for the 'ready' event.");
- return null;
- }
- if (this.debug) util.log("Sending CMsgGCGetPlayerCardItemInfo");
- var payload = new Dota2.schema.CMsgGCGetPlayerCardItemInfo({
- "account_id": account_id,
- "player_card_item_ids": item_ids
- });
- this.sendToGC(Dota2.schema.EDOTAGCMsg.k_EMsgGCGetPlayerCardItemInfo,
- payload,
- onPlayerCardsResponse, callback);
- };
- var handlers = Dota2.Dota2Client.prototype._handlers;
- var onPlayerCardsResponse = function onPlayerCardsResponse(message, callback) {
- callback = callback || null;
- console.log("Poke!");
- var response = Dota2.schema.CMsgGCGetPlayerCardItemInfoResponse.decode(message);
- if (response.eresult === 1) {
- if (this.debug) util.log("Recevied onPlayerCardsResponse result " + response.eresult);
- this.emit("playerCardsResponse", response.eresult, response);
- if (callback) callback(null, response);
- }
- else {
- util.log("Received a bad onPlayerCardsResponse");
- if (callback) callback(response.eresult, response);
- }
- };
- handlers[Dota2.schema.EDOTAGCMsg.k_EMsgGCGetPlayerCardItemInfoResponse] = onPlayerCardsResponse;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement