Пример #1
0
        public static void FindNewFriends(Session Session, ClientMessage Message)
        {
            IEnumerable <RoomInstance> SelectedInstance =
                (from RoomInstance in RoomManager.RoomInstances
                 where (RoomInstance.Value.HumanActorCount > 0 &&
                        RoomInstance.Value.Info.AccessType == RoomAccessType.Open &&
                        RoomInstance.Value.HumanActorCount < RoomInstance.Value.Info.MaxUsers &&
                        RoomInstance.Value.Info.Type == RoomType.Flat)
                 orderby RoomInstance.Value.HumanActorCount descending
                 select RoomInstance.Value).Take(1);

            if (SelectedInstance.Count() != 1)
            {
                Session.SendData(FriendBarResultComposer.Compose(false));
                return;
            }

            Session.SendData(FriendBarResultComposer.Compose(true));
            Session.SendData(MessengerFollowResultComposer.Compose(SelectedInstance.First().Info));
        }
Пример #2
0
        private static void OnFollowBuddy(Session Session, ClientMessage Message)
        {
            uint BuddyId = Message.PopWiredUInt32();

            if (!Session.MessengerFriendCache.Friends.Contains(BuddyId))
            {
                return;
            }

            Session BuddySession = SessionManager.GetSessionByCharacterId(BuddyId);

            if (BuddySession == null || !BuddySession.InRoom)
            {
                return;
            }

            RoomInfo Info = RoomInfoLoader.GetRoomInfo(BuddySession.CurrentRoomId);

            if (Info != null)
            {
                Session.SendData(MessengerFollowResultComposer.Compose(Info));
            }
        }