public static BnetAccountId CreateFromDll(BattleNet.DllEntityId src) { BnetAccountId id = new BnetAccountId(); id.CopyFrom(src); return(id); }
public static BnetAccountId CreateFromBnetEntityId(BnetEntityId src) { BnetAccountId id = new BnetAccountId(); id.CopyFrom(src); return(id); }
public bool Equals(BnetAccountId other) { if (other == null) { return(false); } return(this.m_id.Equals((BnetEntityId)other)); }
private BnetPlayer FindNearbyPlayer(BnetAccountId id, List <BnetPlayer> bnetPlayers) { int num = this.FindNearbyPlayerIndex(id, bnetPlayers); if (num < 0) { return(null); } return(bnetPlayers[num]); }
public BnetPlayer FindNonPendingFriend(BnetAccountId id) { foreach (BnetPlayer player in this.m_friends) { if (player.GetAccountId() == id) { return(player); } } return(null); }
public override string ToString() { BnetAccountId accountId = this.GetAccountId(); BnetBattleTag battleTag = this.GetBattleTag(); if ((accountId == null) && (battleTag == null)) { return("UNKNOWN PLAYER"); } return(string.Format("[account={0} battleTag={1} numGameAccounts={2}]", accountId, battleTag, this.m_gameAccounts.Count)); }
public Network.RecruitInfo GetRecruitInfoFromAccountId(BnetAccountId gameAccountID) { foreach (Network.RecruitInfo info in this.m_recruits) { if (info.RecruitID == gameAccountID) { return(info); } } return(null); }
public BnetPlayer FindFriend(BnetAccountId id) { BnetPlayer player = this.FindNonPendingFriend(id); if (player != null) { return(player); } player = this.FindPendingFriend(id); if (player != null) { return(player); } return(null); }
private int FindNearbyPlayerIndex(BnetAccountId id, List <BnetPlayer> bnetPlayers) { if (id != null) { for (int i = 0; i < bnetPlayers.Count; i++) { BnetPlayer player = bnetPlayers[i]; if (id == player.GetAccountId()) { return(i); } } } return(-1); }
private int FindNearbyPlayerIndex(BnetPlayer bnetPlayer, List <BnetPlayer> bnetPlayers) { if (bnetPlayer == null) { return(-1); } BnetAccountId accountId = bnetPlayer.GetAccountId(); if (accountId != null) { return(this.FindNearbyPlayerIndex(accountId, bnetPlayers)); } BnetGameAccountId hearthstoneGameAccountId = bnetPlayer.GetHearthstoneGameAccountId(); return(this.FindNearbyPlayerIndex(hearthstoneGameAccountId, bnetPlayers)); }
public void SendRecruitAFriendInvite(string email) { Network.RecruitInfo info; Network.RecruitInfo info3; char[] separator = new char[] { ':' }; string[] strArray = email.Split(separator); ulong result = 0L; if (ulong.TryParse(strArray[0], out result)) { BnetAccountId gameAccountID = new BnetAccountId(); gameAccountID.SetHi(0x100000000000000L); gameAccountID.SetLo(result); info3 = new Network.RecruitInfo { RecruitID = gameAccountID }; info = info3; Network.RecruitInfo recruitInfoFromAccountId = this.GetRecruitInfoFromAccountId(gameAccountID); if (recruitInfoFromAccountId != null) { this.m_recruits.Remove(recruitInfoFromAccountId); } } else { ulong num2; info3 = new Network.RecruitInfo(); this.s_id = (num2 = this.s_id) + ((ulong)1L); info3.ID = num2; info = info3; } info.Nickname = strArray[0]; if (strArray.Length > 1) { info.Status = int.Parse(strArray[1]); } if (strArray.Length > 2) { info.Level = int.Parse(strArray[2]); } info.CreationTimeMicrosec = (ulong)((this.secondsSinceEpoch() * 0x3e8L) * 0x3e8L); this.m_recruits.Add(info); this.OnRecruitListResponse(); }
private void CreateAccount(BnetAccountId id, BattleNet.PresenceUpdate update, BnetPlayerChangelist changelist) { BnetAccount account = new BnetAccount(); this.m_accounts.Add(id, account); account.SetId(id); BnetPlayer player = null; if (!this.m_players.TryGetValue(id, out player)) { player = new BnetPlayer(); this.m_players.Add(id, player); BnetPlayerChange change = new BnetPlayerChange(); change.SetNewPlayer(player); changelist.AddChange(change); } player.SetAccount(account); this.UpdateAccount(account, update, changelist); }
public void RemoveFriend(BnetAccountId account) { if (this.m_state == FriendsAPIState.INITIALIZED) { EntityId val = new EntityId(); val.SetLow(account.GetLo()); val.SetHigh(account.GetHi()); GenericFriendRequest request = new GenericFriendRequest(); request.SetTargetId(val); GenericFriendRequest message = request; if (!message.IsInitialized) { base.ApiLog.LogWarning("Battle.net Friends API C#: Failed to RemoveFriend."); base.m_battleNet.EnqueueErrorInfo(BnetFeature.Friends, BnetFeatureEvent.Friends_OnRemoveFriend, BattleNetErrors.ERROR_API_NOT_READY, 0); } else { base.m_rpcConnection.QueueRequest(this.m_friendsService.Id, 8, message, new RPCContextDelegate(this.RemoveFriendCallback), 0); } } }
private void CacheMyAccountInfo() { if (this.m_idString == null) { BnetGameAccountId myGameAccountId = BnetPresenceMgr.Get().GetMyGameAccountId(); if (myGameAccountId != null) { BnetPlayer myPlayer = BnetPresenceMgr.Get().GetMyPlayer(); if (myPlayer != null) { BnetAccountId accountId = myPlayer.GetAccountId(); if (accountId != null) { BnetBattleTag battleTag = myPlayer.GetBattleTag(); if (battleTag != null) { this.m_myGameAccountLo = myGameAccountId.GetLo(); StringBuilder builder = new StringBuilder(); builder.Append(accountId.GetHi()); builder.Append(','); builder.Append(accountId.GetLo()); builder.Append(','); builder.Append(myGameAccountId.GetHi()); builder.Append(','); builder.Append(myGameAccountId.GetLo()); builder.Append(','); builder.Append(battleTag.GetName()); builder.Append(','); builder.Append(battleTag.GetNumber()); builder.Append(','); builder.Append(BattleNet.GetVersion()); builder.Append(','); builder.Append(BattleNet.GetEnvironment()); this.m_idString = builder.ToString(); } } } } } }
public bool IsNonPendingFriend(BnetPlayer player) { if (player != null) { if (this.m_friends.Contains(player)) { return(true); } BnetAccountId accountId = player.GetAccountId(); if (accountId != null) { return(this.IsFriend(accountId)); } foreach (BnetGameAccountId id2 in player.GetGameAccounts().Keys) { if (this.IsFriend(id2)) { return(true); } } } return(false); }
public bool IsFriend(BnetAccountId id) { return(this.IsNonPendingFriend(id) || this.IsPendingFriend(id)); }
public bool IsFriend() { BnetAccountId accountId = this.GetAccountId(); return(BnetFriendMgr.Get().IsFriend(accountId)); }
public BnetPlayer FindNearbyStranger(BnetAccountId id) { return(this.FindNearbyPlayer(id, this.m_nearbyStrangers)); }
public bool IsFriend(BnetAccountId id) { return(this.FindFriend(id) != null); }
public void SetId(BnetAccountId id) { this.m_id = id; }
public BnetPlayerChange FindChange(BnetAccountId id) { BnetPlayer player = BnetPresenceMgr.Get().GetPlayer(id); return(this.FindChange(player)); }
public BnetPlayer FindNearbyFriend(BnetAccountId id) { return(this.FindNearbyPlayer(id, this.m_nearbyFriends)); }
public static void RemoveFriend(BnetAccountId account) { s_impl.RemoveFriend(account); }
public void SetOwnerId(BnetAccountId id) { this.m_ownerId = id; }
private void OnFriendsUpdate(BattleNet.FriendsUpdate[] updates) { BnetFriendChangelist changelist = new BnetFriendChangelist(); foreach (BattleNet.FriendsUpdate update in updates) { switch (((BattleNet.FriendsUpdate.Action)update.action)) { case BattleNet.FriendsUpdate.Action.FRIEND_REMOVED: { BnetAccountId id2 = BnetAccountId.CreateFromBnetEntityId(update.entity1); BnetPlayer item = BnetPresenceMgr.Get().GetPlayer(id2); this.m_friends.Remove(item); changelist.AddRemovedFriend(item); this.RemovePendingFriend(item); break; } case BattleNet.FriendsUpdate.Action.FRIEND_INVITE: { BnetInvitation invitation = BnetInvitation.CreateFromFriendsUpdate(update); this.m_receivedInvites.Add(invitation); changelist.AddAddedReceivedInvite(invitation); break; } case BattleNet.FriendsUpdate.Action.FRIEND_INVITE_REMOVED: { BnetInvitation invitation2 = BnetInvitation.CreateFromFriendsUpdate(update); this.m_receivedInvites.Remove(invitation2); changelist.AddRemovedReceivedInvite(invitation2); break; } case BattleNet.FriendsUpdate.Action.FRIEND_SENT_INVITE: { BnetInvitation invitation3 = BnetInvitation.CreateFromFriendsUpdate(update); this.m_sentInvites.Add(invitation3); changelist.AddAddedSentInvite(invitation3); break; } case BattleNet.FriendsUpdate.Action.FRIEND_SENT_INVITE_REMOVED: { BnetInvitation invitation4 = BnetInvitation.CreateFromFriendsUpdate(update); this.m_sentInvites.Remove(invitation4); changelist.AddRemovedSentInvite(invitation4); break; } case BattleNet.FriendsUpdate.Action.FRIEND_ADDED: { BnetAccountId id = BnetAccountId.CreateFromBnetEntityId(update.entity1); BnetPlayer player = BnetPresenceMgr.Get().RegisterPlayer(id); if (player.IsDisplayable()) { this.m_friends.Add(player); changelist.AddAddedFriend(player); } else { this.AddPendingFriend(player); } break; } } } if (!changelist.IsEmpty()) { this.FireChangeEvent(changelist); } }
public bool IsPendingFriend(BnetAccountId id) { return(this.m_pendingChangelist.IsFriend(id)); }
public void SetAccountId(BnetAccountId accountId) { this.m_accountId = accountId; }
public BnetPlayer FindPendingFriend(BnetAccountId id) { return(this.m_pendingChangelist.FindFriend(id)); }
public bool IsNonPendingFriend(BnetAccountId id) { return(this.FindNonPendingFriend(id) != null); }
public void SetAccount(BnetAccount account) { this.m_account = account; this.m_accountId = account.GetId(); }