Exemple #1
0
 public async Task AddFriendShip(MessengerFriend friend)
 {
     if (!Friends.ContainsKey(friend.Id))
     {
         Friends.Add(friend.Id, friend);
         await _dao.AddPlayerFriendshipAsync(friend.Id, _player.Id);
     }
 }
Exemple #2
0
        internal async Task <Dictionary <int, MessengerFriend> > ReadPlayerFriendshipsAsync(int id)
        {
            Dictionary <int, MessengerFriend> friends = new Dictionary <int, MessengerFriend>();

            await SelectAsync(async reader =>
            {
                while (await reader.ReadAsync())
                {
                    MessengerFriend friend = new MessengerFriend(reader);
                    if (friends.ContainsKey(friend.Id))
                    {
                        friends.Add(friend.Id, friend);
                    }
                }
            }, "SELECT `habbos`.`id`, `habbos`.`username`, `habbos`.`look`, `habbos`.`motto`, `messenger_friends`.`relation` FROM `messenger_friends` INNER JOIN `habbos` ON `habbos`.`id` = `messenger_friends`.`target_id` WHERE `messenger_friends`.`user_id` = @0", id);

            return(friends);
        }
Exemple #3
0
 public bool TryGetFriend(int id, out MessengerFriend friend) => Friends.TryGetValue(id, out friend);
Exemple #4
0
 public async Task UpdateRelation(MessengerFriend friend)
 {
     await _dao.UpdatePlayerFriendshipsAsync(friend, _player.Id);
 }
Exemple #5
0
 internal async Task UpdatePlayerFriendshipsAsync(MessengerFriend friend, int userId)
 {
     await InsertAsync("UPDATE `messenger_friends` SET `relation` = @0 WHERE `target_id` = @1 AND `user_id` = @2;", friend.Relation, friend.Id, userId);
 }