Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Dota2.Dota2Client.prototype.getFantasyCards = function(account_id, item_ids, callback) {
  2. callback = callback || null;
  3.  
  4. if (!this._gcReady) {
  5. if (this.debug) util.log("GC not ready, please listen for the 'ready' event.");
  6. return null;
  7. }
  8.  
  9. if (this.debug) util.log("Sending CMsgGCGetPlayerCardItemInfo");
  10. var payload = new Dota2.schema.CMsgGCGetPlayerCardItemInfo({
  11. "account_id": account_id,
  12. "player_card_item_ids": item_ids
  13. });
  14.  
  15. this.sendToGC(Dota2.schema.EDOTAGCMsg.k_EMsgGCGetPlayerCardItemInfo,
  16. payload,
  17. onPlayerCardsResponse, callback);
  18. };
  19.  
  20. var handlers = Dota2.Dota2Client.prototype._handlers;
  21.  
  22. var onPlayerCardsResponse = function onPlayerCardsResponse(message, callback) {
  23. callback = callback || null;
  24. console.log("Poke!");
  25. var response = Dota2.schema.CMsgGCGetPlayerCardItemInfoResponse.decode(message);
  26.  
  27. if (response.eresult === 1) {
  28. if (this.debug) util.log("Recevied onPlayerCardsResponse result " + response.eresult);
  29. this.emit("playerCardsResponse", response.eresult, response);
  30. if (callback) callback(null, response);
  31. }
  32. else {
  33. util.log("Received a bad onPlayerCardsResponse");
  34. if (callback) callback(response.eresult, response);
  35. }
  36. };
  37. handlers[Dota2.schema.EDOTAGCMsg.k_EMsgGCGetPlayerCardItemInfoResponse] = onPlayerCardsResponse;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement