private void HandleChannelSubscriber_NotifyLeave(RPCContext context) { LeaveNotification leaveNotification = LeaveNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyLeave: " + leaveNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyLeave had unexpected traffic for objectId : " + context.Header.ObjectId); return; } switch (channelReferenceObject.m_channelData.m_channelType) { case ChannelAPI.ChannelType.CHAT_CHANNEL: case ChannelAPI.ChannelType.GAME_CHANNEL: break; case ChannelAPI.ChannelType.PARTY_CHANNEL: this.m_battleNet.Party.PartyMemberLeft(channelReferenceObject, leaveNotification); break; default: return; } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { channelData.m_members.Remove(leaveNotification.MemberId); if (!this.m_battleNet.GameAccountId.Equals(leaveNotification.MemberId)) { this.m_battleNet.Presence.PresenceUnsubscribe(leaveNotification.MemberId); } } }
public void RemoveInviteRequestsFor(EntityId channelId, EntityId suggesteeId, uint removeReason) { if (this.m_receivedInviteRequests == null || suggesteeId == null) { return; } ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(channelId); bool flag = channelReferenceObject != null && channelReferenceObject.m_channelData.m_channelType == ChannelAPI.ChannelType.PARTY_CHANNEL; List <Suggestion> list; if (this.m_receivedInviteRequests.TryGetValue(channelId, out list)) { for (int i = 0; i < list.get_Count(); i++) { Suggestion suggestion = list.get_Item(i); if (suggesteeId.Equals(suggestion.SuggesterId)) { list.RemoveAt(i); i--; if (flag) { this.m_battleNet.Party.ReceivedInviteRequestDelta(channelId, suggestion, new uint?(removeReason)); } } } if (list.get_Count() == 0) { this.m_receivedInviteRequests.Remove(channelId); if (this.m_receivedInviteRequests.Count == 0) { this.m_receivedInviteRequests = null; } } } }
private void HandleChannelSubscriber_NotifyJoin(RPCContext context) { JoinNotification joinNotification = JoinNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyJoin: " + joinNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyJoin had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; switch (channelType) { case ChannelAPI.ChannelType.PRESENCE_CHANNEL: goto IL_103; } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { EntityId gameAccountId = joinNotification.Member.Identity.GameAccountId; channelData.m_members.Add(gameAccountId, joinNotification.Member); if (!this.m_battleNet.GameAccountId.Equals(gameAccountId)) { this.m_battleNet.Presence.PresenceSubscribe(joinNotification.Member.Identity.GameAccountId); } } IL_103: if (channelType == ChannelAPI.ChannelType.PARTY_CHANNEL) { this.m_battleNet.Party.PartyMemberJoined(channelReferenceObject, joinNotification); } }
private void HandleChannelInvitation_NotifyReceivedSuggestionAdded(RPCContext context) { SuggestionAddedNotification suggestionAddedNotification = SuggestionAddedNotification.ParseFrom(context.Payload); EntityId entityId = (!suggestionAddedNotification.Suggestion.HasChannelId) ? null : suggestionAddedNotification.Suggestion.ChannelId; ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(entityId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelInvitation_NotifyReceivedSuggestionAdded had unexpected traffic for channelId: " + entityId); return; } base.ApiLog.LogDebug("HandleChannelInvitation_NotifyReceivedSuggestionAdded: " + suggestionAddedNotification); if (this.m_receivedInviteRequests == null) { this.m_receivedInviteRequests = new Map <EntityId, List <Suggestion> >(); } List <Suggestion> list; if (!this.m_receivedInviteRequests.TryGetValue(entityId, out list)) { list = new List <Suggestion>(); this.m_receivedInviteRequests[entityId] = list; } if (list.IndexOf(suggestionAddedNotification.Suggestion) < 0) { list.Add(suggestionAddedNotification.Suggestion); } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; if (channelType == ChannelAPI.ChannelType.PARTY_CHANNEL) { this.m_battleNet.Party.ReceivedInviteRequestDelta(entityId, suggestionAddedNotification.Suggestion, default(uint?)); } }
public void GameLeft(ChannelAPI.ChannelReferenceObject channelRefObject, RemoveNotification notification) { base.ApiLog.LogDebug(string.Concat(new object[] { "GameLeft ChannelID: ", channelRefObject.m_channelData.m_channelId, " notification: ", notification })); if (this.s_gameRequest != (long)0) { this.s_gameRequest = (ulong)0; } }
public void RemoveActiveChannel(ulong objectId) { ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(objectId); if (channelReferenceObject != null) { this.m_channelEntityObjectMap.Remove(channelReferenceObject.m_channelData.m_channelId); this.m_activeChannels.Remove(objectId); } }
private void HandleChannelSubscriber_NotifySendMessage(RPCContext context) { SendMessageNotification sendMessageNotification = SendMessageNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifySendMessage: " + sendMessageNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifySendMessage had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; if (channelType == ChannelAPI.ChannelType.PARTY_CHANNEL) { this.m_battleNet.Party.PartyMessageReceived(channelReferenceObject, sendMessageNotification); } }
private void HandleChannelSubscriber_NotifyAdd(RPCContext context) { AddNotification addNotification = AddNotification.ParseFrom(context.Payload); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyAdd had unexpected traffic for objectId : " + context.Header.ObjectId); return; } base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyAdd: " + addNotification); ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; switch (channelType) { case ChannelAPI.ChannelType.PRESENCE_CHANNEL: if (addNotification.ChannelState.HasPresence) { bnet.protocol.presence.ChannelState presence = addNotification.ChannelState.Presence; this.m_battleNet.Presence.HandlePresenceUpdates(presence, channelReferenceObject); } goto IL_16E; } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { channelData.m_channelState = addNotification.ChannelState; using (List <Member> .Enumerator enumerator = addNotification.MemberList.GetEnumerator()) { while (enumerator.MoveNext()) { Member current = enumerator.get_Current(); EntityId gameAccountId = current.Identity.GameAccountId; channelData.m_members.Add(gameAccountId, current); if (!this.m_battleNet.GameAccountId.Equals(gameAccountId)) { this.m_battleNet.Presence.PresenceSubscribe(current.Identity.GameAccountId); } } } } IL_16E: if (channelType == ChannelAPI.ChannelType.PARTY_CHANNEL) { this.m_battleNet.Party.PartyJoined(channelReferenceObject, addNotification); } }
private void HandleChannelSubscriber_NotifyRemove(RPCContext context) { RemoveNotification removeNotification = RemoveNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyRemove: " + removeNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyRemove had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; if (channelType != ChannelAPI.ChannelType.PARTY_CHANNEL) { if (channelType != ChannelAPI.ChannelType.GAME_CHANNEL) { if (channelType != ChannelAPI.ChannelType.CHAT_CHANNEL) { goto IL_147; } } else { this.m_battleNet.Games.GameLeft(channelReferenceObject, removeNotification); } } else { this.m_battleNet.Party.PartyLeft(channelReferenceObject, removeNotification); } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { foreach (Member member in channelData.m_members.Values) { if (!this.m_battleNet.GameAccountId.Equals(member.Identity.GameAccountId)) { this.m_battleNet.Presence.PresenceUnsubscribe(member.Identity.GameAccountId); } } } IL_147: this.RemoveActiveChannel(context.Header.ObjectId); }
private void HandleChannelSubscriber_NotifyUpdateMemberState(RPCContext context) { UpdateMemberStateNotification updateMemberStateNotification = UpdateMemberStateNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyUpdateMemberState: " + updateMemberStateNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyUpdateMemberState had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; EntityId channelId = channelData.m_channelId; List <EntityId> list = null; for (int i = 0; i < updateMemberStateNotification.StateChangeList.get_Count(); i++) { Member deltaMember = updateMemberStateNotification.StateChangeList.get_Item(i); if (!deltaMember.Identity.HasGameAccountId) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyUpdateMemberState no identity/gameAccount in Member list at index={0} channelId={1}-{2}", new object[] { i, channelId.High, channelId.Low }); } else { EntityId gameAccountId = deltaMember.Identity.GameAccountId; Map <string, Variant> map = null; Member member; Member cachedMember; if (!channelData.m_members.TryGetValue(gameAccountId, out cachedMember)) { member = deltaMember; } else { Member cachedMember2 = cachedMember; MemberState state = cachedMember.State; if (deltaMember.State.AttributeCount > 0) { if (map == null) { map = new Map <string, Variant>(); } for (int j = 0; j < deltaMember.State.AttributeCount; j++) { Attribute attribute = deltaMember.State.AttributeList.get_Item(j); int num = -1; for (int k = 0; k < state.AttributeList.get_Count(); k++) { Attribute attribute2 = state.AttributeList.get_Item(k); if (attribute2.Name == attribute.Name) { num = k; break; } } if (attribute.Value.IsNone()) { if (num >= 0) { state.AttributeList.RemoveAt(num); } } else if (num >= 0) { state.Attribute.set_Item(num, attribute); } else { state.AddAttribute(attribute); } map.Add(attribute.Name, attribute.Value); } } else { if (deltaMember.State.HasPrivileges) { state.Privileges = deltaMember.State.Privileges; } if (cachedMember.State.RoleCount != deltaMember.State.RoleCount || !Enumerable.All <uint>(cachedMember.State.RoleList, (uint roleId) => deltaMember.State.RoleList.Contains(roleId)) || !Enumerable.All <uint>(deltaMember.State.RoleList, (uint roleId) => cachedMember.State.RoleList.Contains(roleId))) { if (list == null) { list = new List <EntityId>(); } list.Add(gameAccountId); state.ClearRole(); state.Role.AddRange(deltaMember.State.RoleList); } if (deltaMember.State.HasInfo) { if (state.HasInfo) { if (deltaMember.State.Info.HasBattleTag) { state.Info.SetBattleTag(deltaMember.State.Info.BattleTag); } } else { state.SetInfo(deltaMember.State.Info); } } } cachedMember2.SetState(state); member = cachedMember2; } if (member != null) { channelData.m_members[gameAccountId] = member; } if (map != null) { } } } if (list != null) { bool flag = channelType == ChannelAPI.ChannelType.PARTY_CHANNEL; if (flag) { this.m_battleNet.Party.MemberRolesChanged(channelReferenceObject, list); } } }
private void HandleChannelSubscriber_NotifyUpdateChannelState(RPCContext context) { UpdateChannelStateNotification updateChannelStateNotification = UpdateChannelStateNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyUpdateChannelState: " + updateChannelStateNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyUpdateChannelState had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; switch (channelType) { case ChannelAPI.ChannelType.PRESENCE_CHANNEL: if (updateChannelStateNotification.StateChange.HasPresence) { bnet.protocol.presence.ChannelState presence = updateChannelStateNotification.StateChange.Presence; this.m_battleNet.Presence.HandlePresenceUpdates(presence, channelReferenceObject); } return; case ChannelAPI.ChannelType.CHAT_CHANNEL: case ChannelAPI.ChannelType.GAME_CHANNEL: break; case ChannelAPI.ChannelType.PARTY_CHANNEL: this.m_battleNet.Party.PreprocessPartyChannelUpdated(channelReferenceObject, updateChannelStateNotification); break; default: return; } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { bool flag = channelType == ChannelAPI.ChannelType.PARTY_CHANNEL; bool flag2 = false; Map <string, Variant> map = null; bnet.protocol.channel.ChannelState channelState = channelData.m_channelState; bnet.protocol.channel.ChannelState stateChange = updateChannelStateNotification.StateChange; if (stateChange.HasMaxMembers) { channelState.MaxMembers = stateChange.MaxMembers; } if (stateChange.HasMinMembers) { channelState.MinMembers = stateChange.MinMembers; } if (stateChange.HasMaxInvitations) { channelState.MaxInvitations = stateChange.MaxInvitations; } if (stateChange.HasPrivacyLevel && channelState.PrivacyLevel != stateChange.PrivacyLevel) { channelState.PrivacyLevel = stateChange.PrivacyLevel; flag2 = true; } if (stateChange.HasName) { channelState.Name = stateChange.Name; } if (stateChange.HasDelegateName) { channelState.DelegateName = stateChange.DelegateName; } if (stateChange.HasChannelType) { if (!flag) { channelState.ChannelType = stateChange.ChannelType; } if (flag && stateChange.ChannelType != PartyAPI.PARTY_TYPE_DEFAULT) { channelState.ChannelType = stateChange.ChannelType; int num = -1; for (int i = 0; i < channelState.AttributeList.get_Count(); i++) { if (channelState.AttributeList.get_Item(i).Name == "WTCG.Party.Type") { num = i; break; } } Attribute attribute = ProtocolHelper.CreateAttribute("WTCG.Party.Type", channelState.ChannelType); if (num >= 0) { channelState.AttributeList.set_Item(num, attribute); } else { channelState.AttributeList.Add(attribute); } } } if (stateChange.HasProgram) { channelState.Program = stateChange.Program; } if (stateChange.HasAllowOfflineMembers) { channelState.AllowOfflineMembers = stateChange.AllowOfflineMembers; } if (stateChange.HasSubscribeToPresence) { channelState.SubscribeToPresence = stateChange.SubscribeToPresence; } if (stateChange.AttributeCount > 0 && map == null) { map = new Map <string, Variant>(); } for (int j = 0; j < stateChange.AttributeCount; j++) { Attribute attribute2 = stateChange.AttributeList.get_Item(j); int num2 = -1; for (int k = 0; k < channelState.AttributeList.get_Count(); k++) { Attribute attribute3 = channelState.AttributeList.get_Item(k); if (attribute3.Name == attribute2.Name) { num2 = k; break; } } if (attribute2.Value.IsNone()) { if (num2 >= 0) { channelState.AttributeList.RemoveAt(num2); } } else if (num2 >= 0) { channelState.Attribute.set_Item(num2, attribute2); } else { channelState.AddAttribute(attribute2); } map.Add(attribute2.Name, attribute2.Value); } if (stateChange.HasReason) { IList <Invitation> invitationList = stateChange.InvitationList; IList <Invitation> invitationList2 = channelState.InvitationList; for (int l = 0; l < invitationList.get_Count(); l++) { Invitation invitation = invitationList.get_Item(l); for (int m = 0; m < invitationList2.get_Count(); m++) { Invitation invitation2 = invitationList2.get_Item(m); if (invitation2.Id == invitation.Id) { channelState.InvitationList.RemoveAt(m); break; } } } } else { channelState.Invitation.AddRange(stateChange.InvitationList); } channelData.m_channelState = channelState; if (flag) { if (flag2) { this.m_battleNet.Party.PartyPrivacyChanged(channelData.m_channelId, channelState.PrivacyLevel); } if (stateChange.InvitationList.get_Count() > 0) { uint?removeReason = default(uint?); if (stateChange.HasReason) { removeReason = new uint?(stateChange.Reason); } using (List <Invitation> .Enumerator enumerator = stateChange.InvitationList.GetEnumerator()) { while (enumerator.MoveNext()) { Invitation current = enumerator.get_Current(); this.m_battleNet.Party.PartyInvitationDelta(channelData.m_channelId, current, removeReason); } } } if (map != null) { foreach (KeyValuePair <string, Variant> current2 in map) { this.m_battleNet.Party.PartyAttributeChanged(channelData.m_channelId, current2.get_Key(), current2.get_Value()); } } } } }
public void AddActiveChannel(ulong objectId, ChannelAPI.ChannelReferenceObject channelRefObject) { this.m_activeChannels.Add(objectId, channelRefObject); this.m_channelEntityObjectMap[channelRefObject.m_channelData.m_channelId] = objectId; }
public void HandlePresenceUpdates(ChannelState channelState, ChannelAPI.ChannelReferenceObject channelRef) { bgs.types.EntityId entityId; entityId.hi = channelRef.m_channelData.m_channelId.High; entityId.lo = channelRef.m_channelData.m_channelId.Low; FieldKey fieldKey = new FieldKey(); fieldKey.SetProgram(BnetProgramId.BNET.GetValue()); fieldKey.SetGroup(1u); fieldKey.SetField(3u); FieldKey fieldKey2 = fieldKey; List <PresenceUpdate> list = new List <PresenceUpdate>(); foreach (FieldOperation fieldOperation in channelState.FieldOperationList) { if (fieldOperation.Operation == FieldOperation.Types.OperationType.CLEAR) { this.m_presenceCache.SetCache(entityId, fieldOperation.Field.Key, null); } else { this.m_presenceCache.SetCache(entityId, fieldOperation.Field.Key, fieldOperation.Field.Value); } PresenceUpdate presenceUpdate = default(PresenceUpdate); presenceUpdate.entityId = entityId; presenceUpdate.programId = fieldOperation.Field.Key.Program; presenceUpdate.groupId = fieldOperation.Field.Key.Group; presenceUpdate.fieldId = fieldOperation.Field.Key.Field; presenceUpdate.index = fieldOperation.Field.Key.Index; presenceUpdate.boolVal = false; presenceUpdate.intVal = 0L; presenceUpdate.stringVal = string.Empty; presenceUpdate.valCleared = false; presenceUpdate.blobVal = new byte[0]; if (fieldOperation.Operation == FieldOperation.Types.OperationType.CLEAR) { presenceUpdate.valCleared = true; bool flag = fieldKey2.Program == fieldOperation.Field.Key.Program; bool flag2 = fieldKey2.Group == fieldOperation.Field.Key.Group; bool flag3 = fieldKey2.Field == fieldOperation.Field.Key.Field; if (flag && flag2 && flag3) { BnetEntityId entityId2 = BnetEntityId.CreateFromEntityId(presenceUpdate.entityId); this.m_battleNet.Friends.RemoveFriendsActiveGameAccount(entityId2, fieldOperation.Field.Key.Index); } } else if (fieldOperation.Field.Value.HasBoolValue) { presenceUpdate.boolVal = fieldOperation.Field.Value.BoolValue; } else if (fieldOperation.Field.Value.HasIntValue) { presenceUpdate.intVal = fieldOperation.Field.Value.IntValue; } else if (fieldOperation.Field.Value.HasStringValue) { presenceUpdate.stringVal = fieldOperation.Field.Value.StringValue; } else if (fieldOperation.Field.Value.HasFourccValue) { presenceUpdate.stringVal = new BnetProgramId(fieldOperation.Field.Value.FourccValue).ToString(); } else if (fieldOperation.Field.Value.HasEntityidValue) { presenceUpdate.entityIdVal.hi = fieldOperation.Field.Value.EntityidValue.High; presenceUpdate.entityIdVal.lo = fieldOperation.Field.Value.EntityidValue.Low; bool flag4 = fieldKey2.Program == fieldOperation.Field.Key.Program; bool flag5 = fieldKey2.Group == fieldOperation.Field.Key.Group; bool flag6 = fieldKey2.Field == fieldOperation.Field.Key.Field; if (flag4 && flag5 && flag6) { BnetEntityId entityId3 = BnetEntityId.CreateFromEntityId(presenceUpdate.entityId); this.m_battleNet.Friends.AddFriendsActiveGameAccount(entityId3, fieldOperation.Field.Value.EntityidValue, fieldOperation.Field.Key.Index); } } else if (fieldOperation.Field.Value.HasBlobValue) { presenceUpdate.blobVal = fieldOperation.Field.Value.BlobValue; } else { if (!fieldOperation.Field.Value.HasMessageValue) { continue; } if (fieldOperation.Field.Key.Field == 8u) { this.FetchRichPresenceResource(fieldOperation.Field.Value); this.HandleRichPresenceUpdate(presenceUpdate, fieldOperation.Field.Key); continue; } continue; } list.Add(presenceUpdate); } list.Reverse(); this.m_presenceUpdates.AddRange(list); }
public void HandlePresenceUpdates(ChannelState channelState, ChannelAPI.ChannelReferenceObject channelRef) { bgs.types.EntityId high = new bgs.types.EntityId(); high.hi = channelRef.m_channelData.m_channelId.High; high.lo = channelRef.m_channelData.m_channelId.Low; FieldKey fieldKey = new FieldKey(); fieldKey.SetProgram(BnetProgramId.BNET.GetValue()); fieldKey.SetGroup(1); fieldKey.SetField(3); FieldKey fieldKey1 = fieldKey; List <PresenceUpdate> presenceUpdates = new List <PresenceUpdate>(); foreach (FieldOperation fieldOperationList in channelState.FieldOperationList) { if (fieldOperationList.Operation != FieldOperation.Types.OperationType.CLEAR) { this.m_presenceCache.SetCache(high, fieldOperationList.Field.Key, fieldOperationList.Field.Value); } else { this.m_presenceCache.SetCache(high, fieldOperationList.Field.Key, null); } PresenceUpdate boolValue = new PresenceUpdate() { entityId = high, programId = fieldOperationList.Field.Key.Program, groupId = fieldOperationList.Field.Key.Group, fieldId = fieldOperationList.Field.Key.Field, index = fieldOperationList.Field.Key.Index, boolVal = false, intVal = (long)0, stringVal = string.Empty, valCleared = false, blobVal = new byte[0] }; if (fieldOperationList.Operation == FieldOperation.Types.OperationType.CLEAR) { boolValue.valCleared = true; bool program = fieldKey1.Program == fieldOperationList.Field.Key.Program; bool group = fieldKey1.Group == fieldOperationList.Field.Key.Group; bool field = fieldKey1.Field == fieldOperationList.Field.Key.Field; if (program && group && field) { BnetEntityId bnetEntityId = BnetEntityId.CreateFromEntityId(boolValue.entityId); this.m_battleNet.Friends.RemoveFriendsActiveGameAccount(bnetEntityId, fieldOperationList.Field.Key.Index); } } else if (fieldOperationList.Field.Value.HasBoolValue) { boolValue.boolVal = fieldOperationList.Field.Value.BoolValue; } else if (fieldOperationList.Field.Value.HasIntValue) { boolValue.intVal = fieldOperationList.Field.Value.IntValue; } else if (fieldOperationList.Field.Value.HasStringValue) { boolValue.stringVal = fieldOperationList.Field.Value.StringValue; } else if (fieldOperationList.Field.Value.HasFourccValue) { boolValue.stringVal = (new BnetProgramId(fieldOperationList.Field.Value.FourccValue)).ToString(); } else if (fieldOperationList.Field.Value.HasEntityidValue) { boolValue.entityIdVal.hi = fieldOperationList.Field.Value.EntityidValue.High; boolValue.entityIdVal.lo = fieldOperationList.Field.Value.EntityidValue.Low; bool flag = fieldKey1.Program == fieldOperationList.Field.Key.Program; bool group1 = fieldKey1.Group == fieldOperationList.Field.Key.Group; bool field1 = fieldKey1.Field == fieldOperationList.Field.Key.Field; if (flag && group1 && field1) { BnetEntityId bnetEntityId1 = BnetEntityId.CreateFromEntityId(boolValue.entityId); this.m_battleNet.Friends.AddFriendsActiveGameAccount(bnetEntityId1, fieldOperationList.Field.Value.EntityidValue, fieldOperationList.Field.Key.Index); } } else if (fieldOperationList.Field.Value.HasBlobValue) { boolValue.blobVal = fieldOperationList.Field.Value.BlobValue; } else if (!fieldOperationList.Field.Value.HasMessageValue) { continue; } else if (fieldOperationList.Field.Key.Field != 8) { continue; } else { this.FetchRichPresenceResource(fieldOperationList.Field.Value); this.HandleRichPresenceUpdate(boolValue, fieldOperationList.Field.Key); continue; } presenceUpdates.Add(boolValue); } presenceUpdates.Reverse(); this.m_presenceUpdates.AddRange(presenceUpdates); }