Ejemplo n.º 1
0
        void RecvGetFriends(IIPSocket conn, BitStream r)
        {
            var account = TryGetAccount(conn);

            if (account == null)
            {
                return;
            }

            User user;

            if ((user = TryGetUser(conn)) == null)
            {
                return;
            }

            string FriendsString = account.Friends;

            List <string> FriendsList         = FriendsString.Split(',').ToList <string>();
            string        OnlineFriendsString = "";
            string        FriendsMap          = "";

            var OnlineMembers = Server.World.GetUsers();

            foreach (var Member in OnlineMembers)
            {
                if (FriendsList.Contains(Member.Name))
                {
                    OnlineFriendsString += Member.Name + ",";
                    var parentMap = World.GetMap(Member.Map.ParentMapID);
                    FriendsMap += parentMap.Name + ",";
                }
            }

            using (var pw = ServerPacket.ReceiveFriends(OnlineFriendsString, FriendsMap, FriendsString))
            {
                user.Send(pw, ServerMessageType.GUI);
            }
        }