Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #469 from Arcana/staging
Browse files Browse the repository at this point in the history
Fix for breaking protobufjs update + greenkeeper
  • Loading branch information
Crazy-Duck authored Apr 4, 2017
2 parents 151d200 + 5f876a1 commit 6ff0d29
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 132 deletions.
1 change: 1 addition & 0 deletions README.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node-dota2
[![NPM version](https://img.shields.io/npm/v/dota2.svg)](https://npmjs.org/package/dota2 "View this project on NPM")
[![Build Status](https://img.shields.io/travis/Arcana/node-dota2.svg)](https://travis-ci.org/Arcana/node-dota2 "View this project's build information")
[![Dependency Status](https://img.shields.io/david/Arcana/node-dota2.svg)](https://david-dm.org/Arcana/node-dota2 "Check this project's dependencies")
[![Greenkeeper badge](https://badges.greenkeeper.io/Arcana/node-dota2.svg)](https://greenkeeper.io/)

A node-steam plugin for Dota 2, consider it in alpha state.

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node-dota2
[![NPM version](https://img.shields.io/npm/v/dota2.svg)](https://npmjs.org/package/dota2 "View this project on NPM")
[![Build Status](https://img.shields.io/travis/Arcana/node-dota2.svg)](https://travis-ci.org/Arcana/node-dota2 "View this project's build information")
[![Dependency Status](https://img.shields.io/david/Arcana/node-dota2.svg)](https://david-dm.org/Arcana/node-dota2 "Check this project's dependencies")
[![Greenkeeper badge](https://badges.greenkeeper.io/Arcana/node-dota2.svg)](https://greenkeeper.io/)

A node-steam plugin for Dota 2, consider it in alpha state.

Expand Down Expand Up @@ -1735,7 +1736,7 @@ Converts a Dota2 account ID to a 64bit Steam ID
Protobuf schema. See [Protobufjs#Root](http://dcode.io/protobuf.js/Root.html).
This object can be used to obtain special protobuf types.
Object types can be created by `Dota2.schema.lookupType("TypeName").encode(payload :Object).finish();`.
Enum types can be referenced by `Dota2.schema.lookupEnum("EnumName")`, which returns an object array representing the enum.
Enum types can be referenced by `Dota2.schema.lookupEnum("EnumName").values`, which returns an object array representing the enum.

**Kind**: static property of <code>[Dota2](#module_Dota2)</code>
<a name="module_Dota2.schema.CMsgGCToClientPlayerStatsResponse"></a>
Expand Down
10 changes: 5 additions & 5 deletions handlers/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ var onCacheSubscribed = function onCacheSubscribed(message) {
handleSubscribedType.call(_self, obj.type_id, obj.object_data);
});
};
handlers[Dota2.schema.lookupEnum("ESOMsg").k_ESOMsg_CacheSubscribed] = onCacheSubscribed;
handlers[Dota2.schema.lookupEnum("ESOMsg").values.k_ESOMsg_CacheSubscribed] = onCacheSubscribed;

var onUpdateMultiple = function onUpdateMultiple(message) {
var multi = Dota2.schema.lookup("CMsgSOMultipleObjects").decode(message);
Expand All @@ -178,7 +178,7 @@ var onUpdateMultiple = function onUpdateMultiple(message) {
handleSubscribedType.call(_self, obj.type_id, obj.object_data);
});
};
handlers[Dota2.schema.lookupEnum("ESOMsg").k_ESOMsg_UpdateMultiple] = onUpdateMultiple;
handlers[Dota2.schema.lookupEnum("ESOMsg").values.k_ESOMsg_UpdateMultiple] = onUpdateMultiple;

var onCreate = function onCreate(message) {
var single = Dota2.schema.lookup("CMsgSOSingleObject").decode(message);
Expand All @@ -189,7 +189,7 @@ var onCreate = function onCreate(message) {
}
handleSubscribedType.call(_self, single.type_id, single.object_data);
}
handlers[Dota2.schema.lookupEnum("ESOMsg").k_ESOMsg_Create] = onCreate;
handlers[Dota2.schema.lookupEnum("ESOMsg").values.k_ESOMsg_Create] = onCreate;

var onCacheUnsubscribed = function onCacheUnsubscribed(message) {
var unsubscribe = Dota2.schema.lookup("CMsgSOCacheUnsubscribed").decode(message);
Expand All @@ -211,7 +211,7 @@ var onCacheUnsubscribed = function onCacheUnsubscribed(message) {
this.emit("partyInviteCleared");
}
};
handlers[Dota2.schema.lookupEnum("ESOMsg").k_ESOMsg_CacheUnsubscribed] = onCacheUnsubscribed;
handlers[Dota2.schema.lookupEnum("ESOMsg").values.k_ESOMsg_CacheUnsubscribed] = onCacheUnsubscribed;

var onCacheDestroy = function onCacheDestroy(message) {
var destroy = Dota2.schema.lookup("CMsgSOSingleObject").decode(message);
Expand All @@ -228,4 +228,4 @@ var onCacheDestroy = function onCacheDestroy(message) {
this.emit("lobbyInviteCleared");
}
};
handlers[Dota2.schema.lookupEnum("ESOMsg").k_ESOMsg_Destroy] = onCacheDestroy;
handlers[Dota2.schema.lookupEnum("ESOMsg").values.k_ESOMsg_Destroy] = onCacheDestroy;
26 changes: 13 additions & 13 deletions handlers/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Dota2.Dota2Client.prototype._leaveChatChannelById = function(channelId) {
"channel_id": channelId
};
this.chatChannels = this.chatChannels.filter(item => item.channel_id.notEquals(channelId));
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCLeaveChatChannel,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCLeaveChatChannel,
Dota2.schema.lookupType("CMsgDOTALeaveChatChannel").encode(payload).finish());
if (this.debug) {
util.log("Leaving channel " + channelId);
Expand All @@ -46,7 +46,7 @@ Dota2.Dota2Client.prototype._leaveChatChannelById = function(channelId) {
* @param {DOTAChatChannelType_t} [channel_type=DOTAChatChannelType_t.DOTAChatChannelType_Custom] - The type of the channel being joined
*/
Dota2.Dota2Client.prototype.joinChat = function(channel_name, channel_type) {
channel_type = channel_type == null ? Dota2.schema.lookupEnum("DOTAChatChannelType_t").DOTAChannelType_Custom : channel_type;
channel_type = channel_type == null ? Dota2.schema.lookupEnum("DOTAChatChannelType_t").values.DOTAChannelType_Custom : channel_type;

/* Attempts to join a chat channel. Expect k_EMsgGCJoinChatChannelResponse from GC */
if (this.debug) util.log("Joining chat channel: " + channel_name);
Expand All @@ -55,7 +55,7 @@ Dota2.Dota2Client.prototype.joinChat = function(channel_name, channel_type) {
"channel_name": channel_name,
"channel_type": channel_type
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCJoinChatChannel,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCJoinChatChannel,
Dota2.schema.lookupType("CMsgDOTAJoinChatChannel").encode(payload).finish());
};

Expand Down Expand Up @@ -102,7 +102,7 @@ Dota2.Dota2Client.prototype.sendMessage = function(message, channel_name, channe
"channel_id": cache.channel_id,
"text": message
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCChatMessage,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCChatMessage,
Dota2.schema.lookupType("CMsgDOTAChatMessage").encode(payload).finish());
};

Expand Down Expand Up @@ -132,7 +132,7 @@ Dota2.Dota2Client.prototype.shareLobby = function(channel_name, channel_type) {
"share_lobby_id": this.Lobby.lobby_id,
"share_lobby_passkey": this.Lobby.pass_key
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCChatMessage,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCChatMessage,
Dota2.schema.lookupType("CMsgDOTAChatMessage").encode(payload).finish());
};

Expand All @@ -158,7 +158,7 @@ Dota2.Dota2Client.prototype.flipCoin = function(channel_name, channel_type) {
"channel_id": cache.channel_id,
"coin_flip": true
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCChatMessage,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCChatMessage,
Dota2.schema.lookupType("CMsgDOTAChatMessage").encode(payload).finish());
};

Expand Down Expand Up @@ -189,7 +189,7 @@ Dota2.Dota2Client.prototype.rollDice = function(min, max, channel_name, channel_
"roll_max": max
}
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCChatMessage,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCChatMessage,
Dota2.schema.lookupType("CMsgDOTAChatMessage").encode(payload).finish());
};

Expand All @@ -203,7 +203,7 @@ Dota2.Dota2Client.prototype.requestChatChannels = function() {
if (this.debug) util.log("Requesting channel list");

var payload = {};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCRequestChatChannelList,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCRequestChatChannelList,
Dota2.schema.lookupType("CMsgDOTAChatMessage").encode(payload).finish());
};

Expand Down Expand Up @@ -255,7 +255,7 @@ var onJoinChatChannelResponse = function onJoinChatChannelResponse(message) {
this.chatChannels.push(channelData);
this.emit("chatJoined", channelData);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCJoinChatChannelResponse] = onJoinChatChannelResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCJoinChatChannelResponse] = onJoinChatChannelResponse;

var onChatMessage = function onChatMessage(message) {
/* Chat channel message from another user. */
Expand All @@ -269,7 +269,7 @@ var onChatMessage = function onChatMessage(message) {
chatData.text,
chatData);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCChatMessage] = onChatMessage;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCChatMessage] = onChatMessage;

var onOtherJoinedChannel = function onOtherJoinedChannel(message) {
/* Someone joined a chat channel you're in. */
Expand All @@ -287,7 +287,7 @@ var onOtherJoinedChannel = function onOtherJoinedChannel(message) {
persona_name: otherJoined.persona_name
}));
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCOtherJoinedChannel] = onOtherJoinedChannel;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCOtherJoinedChannel] = onOtherJoinedChannel;

var onUserLeftChannel = function onOtherLeftChannel(message) {
/* Someone left a chat channel you're in. */
Expand Down Expand Up @@ -320,10 +320,10 @@ var onUserLeftChannel = function onOtherLeftChannel(message) {
}
}
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCOtherLeftChannel] = onUserLeftChannel;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCOtherLeftChannel] = onUserLeftChannel;

var onChatChannelsResponse = function onChatChannelsResponse(message) {
var channels = Dota2.schema.lookupType("CMsgDOTARequestChatChannelListResponse").decode(message).channels;
this.emit("chatChannelsData", channels)
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCRequestChatChannelListResponse] = onChatChannelsResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCRequestChatChannelListResponse] = onChatChannelsResponse;
24 changes: 12 additions & 12 deletions handlers/community.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Dota2.Dota2Client.prototype.requestPlayerMatchHistory = function(account_id, opt
payload.account_id = account_id;
payload.matches_requested = payload.matches_requested || 1;
payload.request_id = payload.request_id || account_id;
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgDOTAGetPlayerMatchHistory,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgDOTAGetPlayerMatchHistory,
Dota2.schema.lookupType("CMsgDOTAGetPlayerMatchHistory").encode(payload).finish(),
onPlayerMatchHistoryResponse, callback);
};
Expand All @@ -63,7 +63,7 @@ Dota2.Dota2Client.prototype.requestProfileCard = function(account_id, callback)
var payload = {
"account_id": account_id
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgClientToGCGetProfileCard,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgClientToGCGetProfileCard,
Dota2.schema.lookupType("CMsgClientToGCGetProfileCard").encode(payload).finish(),
onProfileCardResponse, callback);
};
Expand All @@ -87,7 +87,7 @@ Dota2.Dota2Client.prototype.requestHallOfFame = function(week, callback) {
var payload = {
"week": week
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCHallOfFameRequest,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCHallOfFameRequest,
Dota2.schema.lookupType("CMsgDOTAHallOfFameRequest").encode(payload).finish(),
onHallOfFameResponse, callback);
};
Expand Down Expand Up @@ -115,7 +115,7 @@ Dota2.Dota2Client.prototype.requestPlayerInfo = function(account_ids) {
var payload = {
player_infos: account_ids
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCPlayerInfoRequest,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCPlayerInfoRequest,
Dota2.schema.lookupType("CMsgGCPlayerInfoRequest").encode(payload).finish());
};

Expand All @@ -137,7 +137,7 @@ Dota2.Dota2Client.prototype.requestTrophyList = function(account_id, callback) {
var payload = {
"account_id": account_id
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgClientToGCGetTrophyList,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgClientToGCGetTrophyList,
Dota2.schema.lookupType("CMsgClientToGCGetTrophyList").encode(payload).finish(),
onTrophyListResponse, callback);
};
Expand All @@ -161,7 +161,7 @@ Dota2.Dota2Client.prototype.requestPlayerStats = function(account_id, callback)
var payload = {
"account_id": account_id
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgClientToGCPlayerStatsRequest,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgClientToGCPlayerStatsRequest,
Dota2.schema.lookupType("CMsgClientToGCPlayerStatsRequest").encode(payload).finish(),
onPlayerStatsResponse, callback);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ var onPlayerMatchHistoryResponse = function onPlayerMatchHistoryResponse(message
if (callback) callback(matchHistoryResponse.result, matchHistoryResponse);
}
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgDOTAGetPlayerMatchHistoryResponse] = onPlayerMatchHistoryResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgDOTAGetPlayerMatchHistoryResponse] = onPlayerMatchHistoryResponse;

var onProfileCardResponse = function onProfileCardResponse(message, callback) {
callback = callback || null;
Expand All @@ -282,7 +282,7 @@ var onProfileCardResponse = function onProfileCardResponse(message, callback) {
this.emit("profileCardData", profileCardResponse.account_id, profileCardResponse);
if (callback) callback(null, profileCardResponse);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgClientToGCGetProfileCardResponse] = onProfileCardResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgClientToGCGetProfileCardResponse] = onProfileCardResponse;

var onHallOfFameResponse = function onHallOfFameResponse(message, callback) {
callback = callback || null;
Expand All @@ -297,15 +297,15 @@ var onHallOfFameResponse = function onHallOfFameResponse(message, callback) {
if (callback) callback(hallOfFameResponse.result, hallOfFameResponse);
}
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCHallOfFameResponse] = onHallOfFameResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCHallOfFameResponse] = onHallOfFameResponse;

var onPlayerInfoResponse = function onPlayerInfoResponse(message) {
var playerInfoResponse = Dota2.schema.lookupType("CMsgGCPlayerInfo").decode(message);

if (this.debug) util.log("Received new player info data");
this.emit("playerInfoData", playerInfoResponse);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCPlayerInfo] = onPlayerInfoResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCPlayerInfo] = onPlayerInfoResponse;

var onTrophyListResponse = function onTrophyListResponse(message, callback) {
var trophyListResponse = Dota2.schema.lookupType("CMsgClientToGCGetTrophyListResponse").decode(message);
Expand All @@ -314,7 +314,7 @@ var onTrophyListResponse = function onTrophyListResponse(message, callback) {
this.emit("trophyListData", trophyListResponse);
if (callback) callback(null, trophyListResponse);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgClientToGCGetTrophyListResponse] = onTrophyListResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgClientToGCGetTrophyListResponse] = onTrophyListResponse;

var onPlayerStatsResponse = function onPlayerStatsResponse(message, callback) {
var playerStatsResponse = Dota2.schema.lookupType("CMsgGCToClientPlayerStatsResponse").decode(message);
Expand All @@ -324,4 +324,4 @@ var onPlayerStatsResponse = function onPlayerStatsResponse(message, callback) {
if (callback) callback(null, playerStatsResponse);

};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCToClientPlayerStatsResponse] = onPlayerStatsResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCToClientPlayerStatsResponse] = onPlayerStatsResponse;
4 changes: 2 additions & 2 deletions handlers/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Dota2.Dota2Client.prototype.requestJoinableCustomGameModes = function requestJoi
var payload = {
"server_region": server_region
};
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCJoinableCustomGameModesRequest,
this.sendToGC( Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCJoinableCustomGameModesRequest,
Dota2.schema.lookupType("CMsgJoinableCustomGameModesRequest").encode(payload).finish());
}

Expand All @@ -35,4 +35,4 @@ var onJoinableCustomGameModesResponse = function onJoinableCustomGameModesRespon
if (this.debug) util.log("Received joinable custom game modes");
this.emit("joinableCustomGameModes", modes.game_modes);
};
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").k_EMsgGCJoinableCustomGameModesResponse] = onJoinableCustomGameModesResponse;
handlers[Dota2.schema.lookupEnum("EDOTAGCMsg").values.k_EMsgGCJoinableCustomGameModesResponse] = onJoinableCustomGameModesResponse;
Loading

0 comments on commit 6ff0d29

Please sign in to comment.