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

Implement Rich Presence handling #12

Merged
merged 1 commit into from
Oct 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Dota2/GC/Callbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ internal LeagueViewPassesSnapshot(IEnumerable<CSOEconItemLeagueViewPass> passes)
/// </summary>
public sealed class GameAccountClientSnapshot : CallbackMsg
{
/// <summary>
/// The game account client.
/// <summary>
/// The game account client.
/// </summary>
public CSOEconGameAccountClient client;

Expand Down Expand Up @@ -699,5 +699,21 @@ internal ProfileCardResponse(CMsgDOTAProfileCard msg)
result = msg;
}
}

/// <summary>
/// Called upon a rich presence update
/// </summary>
public sealed class RichPresenceUpdate : CallbackMsg
{
/// <summary>
/// The rich presence info
/// </summary>
public CMsgClientRichPresenceInfo result;

internal RichPresenceUpdate(CMsgClientRichPresenceInfo msg)
{
result = msg;
}
}
}
}
16 changes: 11 additions & 5 deletions Dota2/GC/DotaGCHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ public void RequestGuildData()
{
var request = new ClientGCMsgProtobuf<CMsgDOTARequestGuildData>((uint) EDOTAGCMsg.k_EMsgGCRequestGuildData);
Send(request);
}

}
/// <summary>
/// Requests someone's profile cards
/// </summary>
Expand Down Expand Up @@ -830,7 +830,7 @@ public override void HandleMsg(IPacketMsg packetMsg)
{(uint) EDOTAGCMsg.k_EMsgGCGuildInviteAccountResponse, HandleGuildInviteAccountResponse},
{(uint) EDOTAGCMsg.k_EMsgGCGuildCancelInviteResponse, HandleGuildCancelInviteResponse},
{(uint) EDOTAGCMsg.k_EMsgGCGuildData, HandleGuildData},
{(uint) EDOTAGCMsg.k_EMsgClientToGCGetProfileCardResponse, HandleProfileCardResponse },
{(uint) EDOTAGCMsg.k_EMsgClientToGCGetProfileCardResponse, HandleProfileCardResponse},
};
Action<IPacketGCMsg> func;
if (!messageMap.TryGetValue(gcmsg.MsgType, out func))
Expand Down Expand Up @@ -865,6 +865,12 @@ public override void HandleMsg(IPacketMsg packetMsg)
Client.PostCallback(new BeginSessionResponse(msg.Body));
}
break;
case EMsg.ClientRichPresenceInfo:
{
var msg = new ClientMsgProtobuf<CMsgClientRichPresenceInfo>(packetMsg);
Client.PostCallback(new RichPresenceUpdate(msg.Body));
}
break;
}
}
}
Expand Down Expand Up @@ -1260,8 +1266,8 @@ private void HandleGuildData(IPacketGCMsg obj)
{
var resp = new ClientGCMsgProtobuf<CMsgDOTAGuildSDO>(obj);
Client.PostCallback(new GuildDataResponse(resp.Body));
}

}
private void HandleProfileCardResponse(IPacketGCMsg obj)
{
var resp = new ClientGCMsgProtobuf<CMsgDOTAProfileCard>(obj);
Expand Down