public void HandlePresenceUpdates(ChannelState channelState, ChannelAPI.ChannelReferenceObject channelRef) { BattleNet.DllEntityId id; id.hi = channelRef.m_channelData.m_channelId.High; id.lo = channelRef.m_channelData.m_channelId.Low; FieldKey key = new FieldKey(); key.SetProgram(BnetProgramId.BNET.GetValue()); key.SetGroup(1); key.SetField(3); FieldKey key2 = key; List <BattleNet.PresenceUpdate> collection = new List <BattleNet.PresenceUpdate>(); foreach (FieldOperation operation in channelState.FieldOperationList) { BattleNet.PresenceUpdate item = new BattleNet.PresenceUpdate { entityId = id, programId = operation.Field.Key.Program, groupId = operation.Field.Key.Group, fieldId = operation.Field.Key.Field, index = operation.Field.Key.Index, boolVal = false, intVal = 0L, stringVal = string.Empty, valCleared = false, blobVal = new byte[0] }; if (operation.Operation == FieldOperation.Types.OperationType.CLEAR) { item.valCleared = true; bool flag = key2.Program == operation.Field.Key.Program; bool flag2 = key2.Group == operation.Field.Key.Group; bool flag3 = key2.Field == operation.Field.Key.Field; if ((flag && flag2) && flag3) { BnetEntityId entityId = BnetEntityId.CreateFromDll(item.entityId); base.m_battleNet.Friends.RemoveFriendsActiveGameAccount(entityId, operation.Field.Key.Index); } } else if (operation.Field.Value.HasBoolValue) { item.boolVal = operation.Field.Value.BoolValue; } else if (operation.Field.Value.HasIntValue) { item.intVal = operation.Field.Value.IntValue; } else if (operation.Field.Value.HasStringValue) { item.stringVal = operation.Field.Value.StringValue; } else if (operation.Field.Value.HasFourccValue) { item.stringVal = new BnetProgramId(operation.Field.Value.FourccValue).ToString(); } else if (operation.Field.Value.HasEntityidValue) { item.entityIdVal.hi = operation.Field.Value.EntityidValue.High; item.entityIdVal.lo = operation.Field.Value.EntityidValue.Low; bool flag4 = key2.Program == operation.Field.Key.Program; bool flag5 = key2.Group == operation.Field.Key.Group; bool flag6 = key2.Field == operation.Field.Key.Field; if ((flag4 && flag5) && flag6) { BnetEntityId id3 = BnetEntityId.CreateFromDll(item.entityId); base.m_battleNet.Friends.AddFriendsActiveGameAccount(id3, operation.Field.Value.EntityidValue, operation.Field.Key.Index); } } else { if (!operation.Field.Value.HasBlobValue) { continue; } item.blobVal = operation.Field.Value.BlobValue; } collection.Add(item); } collection.Reverse(); this.m_presenceUpdates.AddRange(collection); }
private void OnPartyUpdate(BattleNet.PartyEvent[] updates) { for (int i = 0; i < updates.Length; i++) { BattleNet.PartyEvent event2 = updates[i]; BnetEntityId partyId = BnetEntityId.CreateFromDll(event2.partyId); BnetGameAccountId otherMemberId = BnetGameAccountId.CreateFromDll(event2.otherMemberId); if (event2.eventName == "s1") { if (event2.eventData == "wait") { this.OnPartyUpdate_CreatedParty(partyId, otherMemberId); } else if (event2.eventData == "deck") { if (this.DidReceiveChallenge() && this.m_challengerDeckSelected) { this.m_challengerDeckSelected = false; this.FireChangedEvent(FriendChallengeEvent.DESELECTED_DECK, this.m_challenger); } } else if (event2.eventData == "game") { if (this.DidReceiveChallenge()) { this.m_challengerDeckSelected = true; this.FireChangedEvent(FriendChallengeEvent.SELECTED_DECK, this.m_challenger); } } else if (event2.eventData == "goto") { this.m_challengerDeckSelected = false; } } else if (event2.eventName == "s2") { if (event2.eventData == "wait") { this.OnPartyUpdate_JoinedParty(partyId, otherMemberId); } else if (event2.eventData == "deck") { if (this.DidSendChallenge()) { if (this.m_challengeeAccepted) { this.m_challengeeDeckSelected = false; this.FireChangedEvent(FriendChallengeEvent.DESELECTED_DECK, this.m_challengee); } else { this.m_challengeeAccepted = true; this.FireChangedEvent(FriendChallengeEvent.OPPONENT_ACCEPTED_CHALLENGE, this.m_challengee); } } } else if (event2.eventData == "game") { if (this.DidSendChallenge()) { this.m_challengeeDeckSelected = true; this.FireChangedEvent(FriendChallengeEvent.SELECTED_DECK, this.m_challengee); } } else if (event2.eventData == "goto") { this.m_challengeeDeckSelected = false; } } else if (event2.eventName == "left") { if (this.DidSendChallenge()) { BnetPlayer challengee = this.m_challengee; bool challengeeAccepted = this.m_challengeeAccepted; this.RevertTavernBrawlStatus(); this.CleanUpChallengeData(true); if (challengeeAccepted) { this.FireChangedEvent(FriendChallengeEvent.OPPONENT_CANCELED_CHALLENGE, challengee); } else { this.FireChangedEvent(FriendChallengeEvent.OPPONENT_DECLINED_CHALLENGE, challengee); } } else if (this.DidReceiveChallenge()) { BnetPlayer challenger = this.m_challenger; bool flag2 = this.m_challengeeAccepted; this.RevertTavernBrawlStatus(); this.CleanUpChallengeData(true); if (challenger != null) { if (flag2) { this.FireChangedEvent(FriendChallengeEvent.OPPONENT_CANCELED_CHALLENGE, challenger); } else { this.FireChangedEvent(FriendChallengeEvent.OPPONENT_RESCINDED_CHALLENGE, challenger); } } } } } }