public void SendWhisper(BnetGameAccountId gameAccount, string message) { if (!string.IsNullOrEmpty(message)) { bnet.protocol.notification.Notification notification = new bnet.protocol.notification.Notification(); notification.SetType("WHISPER"); EntityId val = new EntityId(); val.SetLow(gameAccount.GetLo()); val.SetHigh(gameAccount.GetHi()); notification.SetTargetId(val); bnet.protocol.attribute.Attribute attribute = new bnet.protocol.attribute.Attribute(); attribute.SetName("whisper"); bnet.protocol.attribute.Variant variant = new bnet.protocol.attribute.Variant(); variant.SetStringValue(message); attribute.SetValue(variant); notification.AddAttribute(attribute); base.m_rpcConnection.QueueRequest(base.m_battleNet.NotificationService.Id, 1, notification, new RPCContextDelegate(this.WhisperSentCallback), 0); BnetGameAccountId id = BnetGameAccountId.CreateFromDll(BattleNet.GetMyGameAccountId()); BnetWhisper item = new BnetWhisper(); item.SetSpeakerId(id); item.SetReceiverId(gameAccount); item.SetMessage(message); TimeSpan elapsedTimeSinceEpoch = TimeUtils.GetElapsedTimeSinceEpoch(null); item.SetTimestampMilliseconds(elapsedTimeSinceEpoch.TotalMilliseconds); this.m_whispers.Add(item); } }
public static BnetWhisper CreateFromDll(BattleNet.DllWhisper src) { return new BnetWhisper { m_speakerId = BnetGameAccountId.CreateFromDll(src.speakerId), m_receiverId = BnetGameAccountId.CreateFromDll(src.receiverId), m_message = MemUtils.StringFromUtf8Ptr(src.message), m_timestampMicrosec = src.timestampMicrosec, m_errorInfo = BnetErrorInfo.CreateFromDll(src.errorInfo) }; }
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); } } } } } }