public static void Process() { PartyListenerEvent[] array; BattleNet.GetPartyListenerEvents(out array); BattleNet.ClearPartyListenerEvents(); int i = 0; while (i < array.Length) { PartyListenerEvent partyListenerEvent = array[i]; PartyId partyId = partyListenerEvent.PartyId; switch (partyListenerEvent.Type) { case PartyListenerEventType.ERROR_RAISED: case PartyListenerEventType.OPERATION_CALLBACK: { PartyError error = partyListenerEvent.ToPartyError(); if (error.ErrorCode != BattleNetErrors.ERROR_OK) { if (BnetParty.IsIgnorableError(error.FeatureEvent, error.ErrorCode.EnumVal)) { error.ErrorCode = BattleNetErrors.ERROR_OK; if (error.FeatureEvent == BnetFeatureEvent.Party_Leave_Callback) { if (!BnetParty.s_joinedParties.ContainsKey(partyId)) { BnetParty.s_joinedParties[partyId] = PartyType.SPECTATOR_PARTY; } goto IL_22D; } } if (error.IsOperationCallback && error.FeatureEvent == BnetFeatureEvent.Party_Create_Callback) { PartyType partyType = error.PartyType; if (BnetParty.s_pendingPartyCreates.ContainsKey(partyType)) { BnetParty.s_pendingPartyCreates.Remove(partyType); } } } if (error.ErrorCode != BattleNetErrors.ERROR_OK) { BnetParty.RaisePartyError(error); } break; } case PartyListenerEventType.JOINED_PARTY: { string stringData = partyListenerEvent.StringData; PartyType partyTypeFromString = BnetParty.GetPartyTypeFromString(stringData); BnetParty.s_joinedParties[partyId] = partyTypeFromString; if (BnetParty.s_pendingPartyCreates != null) { BnetParty.CreateSuccessCallback createSuccessCallback = null; if (BnetParty.s_pendingPartyCreates.ContainsKey(partyTypeFromString)) { createSuccessCallback = BnetParty.s_pendingPartyCreates[partyTypeFromString]; BnetParty.s_pendingPartyCreates.Remove(partyTypeFromString); } else if (stringData == "default" && BnetParty.s_pendingPartyCreates.Count == 0) { createSuccessCallback = BnetParty.s_pendingPartyCreates.First <KeyValuePair <PartyType, BnetParty.CreateSuccessCallback> >().Value; BnetParty.s_pendingPartyCreates.Clear(); } if (createSuccessCallback != null) { createSuccessCallback(partyTypeFromString, partyId); } } if (BnetParty.OnJoined != null) { BnetParty.OnJoined(OnlineEventType.ADDED, new PartyInfo(partyId, partyTypeFromString), null); } break; } case PartyListenerEventType.LEFT_PARTY: goto IL_22D; case PartyListenerEventType.PRIVACY_CHANGED: if (BnetParty.OnPrivacyLevelChanged != null) { BnetParty.OnPrivacyLevelChanged(BnetParty.GetJoinedParty(partyId), (PrivacyLevel)partyListenerEvent.UintData); } break; case PartyListenerEventType.MEMBER_JOINED: case PartyListenerEventType.MEMBER_LEFT: if (BnetParty.OnMemberEvent != null) { OnlineEventType evt = (partyListenerEvent.Type != PartyListenerEventType.MEMBER_JOINED) ? OnlineEventType.REMOVED : OnlineEventType.ADDED; LeaveReason? reason = null; if (partyListenerEvent.Type == PartyListenerEventType.MEMBER_LEFT) { reason = new LeaveReason?((LeaveReason)partyListenerEvent.UintData); } BnetParty.OnMemberEvent(evt, BnetParty.GetJoinedParty(partyId), partyListenerEvent.SubjectMemberId, false, reason); } break; case PartyListenerEventType.MEMBER_ROLE_CHANGED: if (BnetParty.OnMemberEvent != null) { BnetParty.OnMemberEvent(OnlineEventType.UPDATED, BnetParty.GetJoinedParty(partyId), partyListenerEvent.SubjectMemberId, true, null); } break; case PartyListenerEventType.RECEIVED_INVITE_ADDED: case PartyListenerEventType.RECEIVED_INVITE_REMOVED: if (BnetParty.OnReceivedInvite != null) { OnlineEventType evt2 = (partyListenerEvent.Type != PartyListenerEventType.RECEIVED_INVITE_ADDED) ? OnlineEventType.REMOVED : OnlineEventType.ADDED; PartyType type = PartyType.DEFAULT; if (partyListenerEvent.StringData != null) { EnumUtils.TryGetEnum <PartyType>(partyListenerEvent.StringData, out type); } PartyInfo party = new PartyInfo(partyId, type); InviteRemoveReason?reason2 = null; if (partyListenerEvent.Type == PartyListenerEventType.RECEIVED_INVITE_REMOVED) { reason2 = new InviteRemoveReason?((InviteRemoveReason)partyListenerEvent.UintData); } BnetParty.OnReceivedInvite(evt2, party, partyListenerEvent.UlongData, reason2); } break; case PartyListenerEventType.PARTY_INVITE_SENT: case PartyListenerEventType.PARTY_INVITE_REMOVED: if (BnetParty.OnSentInvite != null) { bool senderIsMyself = partyListenerEvent.SubjectMemberId == BnetGameAccountId.CreateFromEntityId(BattleNet.GetMyGameAccountId()); OnlineEventType evt3 = (partyListenerEvent.Type != PartyListenerEventType.PARTY_INVITE_SENT) ? OnlineEventType.REMOVED : OnlineEventType.ADDED; PartyType type2 = PartyType.DEFAULT; if (partyListenerEvent.StringData != null) { EnumUtils.TryGetEnum <PartyType>(partyListenerEvent.StringData, out type2); } PartyInfo party2 = new PartyInfo(partyId, type2); InviteRemoveReason?reason3 = null; if (partyListenerEvent.Type == PartyListenerEventType.PARTY_INVITE_REMOVED) { reason3 = new InviteRemoveReason?((InviteRemoveReason)partyListenerEvent.UintData); } BnetParty.OnSentInvite(evt3, party2, partyListenerEvent.UlongData, senderIsMyself, reason3); } break; case PartyListenerEventType.INVITE_REQUEST_ADDED: case PartyListenerEventType.INVITE_REQUEST_REMOVED: if (BnetParty.OnSentInvite != null) { OnlineEventType evt4 = (partyListenerEvent.Type != PartyListenerEventType.INVITE_REQUEST_ADDED) ? OnlineEventType.REMOVED : OnlineEventType.ADDED; PartyInfo joinedParty = BnetParty.GetJoinedParty(partyId); InviteRequestRemovedReason?reason4 = null; if (partyListenerEvent.Type == PartyListenerEventType.INVITE_REQUEST_REMOVED) { reason4 = new InviteRequestRemovedReason?((InviteRequestRemovedReason)partyListenerEvent.UintData); } InviteRequest inviteRequest = new InviteRequest(); inviteRequest.TargetId = partyListenerEvent.TargetMemberId; inviteRequest.TargetName = partyListenerEvent.StringData2; inviteRequest.RequesterId = partyListenerEvent.SubjectMemberId; inviteRequest.RequesterName = partyListenerEvent.StringData; BnetParty.OnReceivedInviteRequest(evt4, joinedParty, inviteRequest, reason4); } break; case PartyListenerEventType.CHAT_MESSAGE_RECEIVED: if (BnetParty.OnChatMessage != null) { BnetParty.OnChatMessage(BnetParty.GetJoinedParty(partyId), partyListenerEvent.SubjectMemberId, partyListenerEvent.StringData); } break; case PartyListenerEventType.PARTY_ATTRIBUTE_CHANGED: { PartyInfo joinedParty2 = BnetParty.GetJoinedParty(partyId); string stringData2 = partyListenerEvent.StringData; if (stringData2 == "WTCG.Party.Type") { string partyAttributeString = BnetParty.GetPartyAttributeString(partyId, "WTCG.Party.Type"); PartyType partyTypeFromString2 = BnetParty.GetPartyTypeFromString(partyAttributeString); if (partyTypeFromString2 != PartyType.DEFAULT) { BnetParty.s_joinedParties[partyId] = partyTypeFromString2; } } Variant variant = null; switch (partyListenerEvent.UintData) { case 1u: variant = new Variant(); variant.IntValue = (long)partyListenerEvent.UlongData; break; case 2u: variant = new Variant(); variant.StringValue = partyListenerEvent.StringData2; break; case 3u: variant = new Variant(); variant.BlobValue = partyListenerEvent.BlobData; break; } IL_611: if (BnetParty.OnPartyAttributeChanged != null) { BnetParty.OnPartyAttributeChanged(joinedParty2, stringData2, variant); } List <BnetParty.PartyAttributeChangedHandler> list; if (BnetParty.s_attributeChangedSubscribers != null && BnetParty.s_attributeChangedSubscribers.TryGetValue(stringData2, out list)) { BnetParty.PartyAttributeChangedHandler[] array2 = list.ToArray(); foreach (BnetParty.PartyAttributeChangedHandler partyAttributeChangedHandler in array2) { partyAttributeChangedHandler(joinedParty2, stringData2, variant); } } break; goto IL_611; } } IL_68C: i++; continue; IL_22D: if (BnetParty.s_joinedParties.ContainsKey(partyId)) { PartyType type3 = BnetParty.s_joinedParties[partyId]; BnetParty.s_joinedParties.Remove(partyId); if (BnetParty.OnJoined != null) { BnetParty.OnJoined(OnlineEventType.REMOVED, new PartyInfo(partyId, type3), new LeaveReason?((LeaveReason)partyListenerEvent.UintData)); } } goto IL_68C; } }
public static void GetPartyUpdatesInfo(ref PartyInfo info) { BattleNet.s_impl.GetPartyUpdatesInfo(ref info); }