예제 #1
0
 //TODO: Figure this out.
 private static void ProcessUnknown(Habbo sender, IncomingMessage message)
 {
     CoreManager.ServerCore.GetStandardOut().
     PrintDebug("Part 1: " + message.PopPrefixedString()).
     PrintDebug("Part 2: " + message.PopPrefixedString()).
     PrintDebug("Part 3: " + message.PopPrefixedString()).
     PrintDebug("Part 4: " + message.PopPrefixedString());
 }
예제 #2
0
        private static void ProcessSSOTicket(Habbo sender, IncomingMessage message)
        {
            Habbo loggedInHabbo = CoreManager.ServerCore.GetHabboDistributor().GetHabbo(
                message.PopPrefixedString(), sender.GetConnection().GetIPAddressRaw());

            if (loggedInHabbo == null)
            {
                new MConnectionClosed
                {
                    Reason = ConnectionClosedReason.InvalidSSOTicket
                }.Send(sender);

                // TODO: Is delay needed?

                sender.GetConnection().Disconnect(); // Invalid SSO Ticket
            }
            else
            {
                // If this Habbo is already connected...
                if (loggedInHabbo.IsLoggedIn())
                {
                    // Disconnect them.
                    new MConnectionClosed
                    {
                        Reason = ConnectionClosedReason.ConcurrentLogin
                    }.Send(loggedInHabbo);
                    loggedInHabbo.GetConnection().Disconnect();
                }
                loggedInHabbo.LoginMerge(sender);
                sender = loggedInHabbo;
                sender.SetLoggedIn(true);
            }
        }
예제 #3
0
        private static void ProcessSendFriendRequest(Habbo sender, IncomingMessage message)
        {
            string username = message.PopPrefixedString();

            sender.GetMessenger()
            .SendFriendRequest(
                CoreManager.
                ServerCore.
                GetHabboDistributor().
                GetHabbo(username));
        }
예제 #4
0
        private static void Process_RequestSubscriptionData(Habbo Sender, IncomingMessage Message)
        {
            string SubscriptionName = Message.PopPrefixedString();

            SubscriptionData Data = new SubscriptionData(Sender, SubscriptionName);

            // 86400    = 24 hours in seconds.
            // 2678400  = 31 days in seconds.
            byte RemainingFullMonths = (byte)(Data.GetRemainingSeconds() / 2678400);
            byte ExpiredFullMonths   = (byte)(Data.GetExpiredSeconds() / 2678400);
            byte ExpiredMonthDays    = (byte)((Data.GetExpiredSeconds() % 2678400) / 86400);

            Sender.GetPacketSender().Send_SubscriptionInfo(SubscriptionName, ExpiredMonthDays, ExpiredFullMonths, RemainingFullMonths, Data.IsActive());
        }
예제 #5
0
        private static void Process_RequestSubscriptionData(Habbo Sender, IncomingMessage Message)
        {
            string SubscriptionName = Message.PopPrefixedString();

            SubscriptionData Data = new SubscriptionData(Sender, SubscriptionName);

            // 86400    = 24 hours in seconds.
            // 2678400  = 31 days in seconds.
            byte RemainingFullMonths = (byte)(Data.GetRemainingSeconds() / 2678400);
            byte ExpiredFullMonths = (byte)(Data.GetExpiredSeconds() / 2678400);
            byte ExpiredMonthDays = (byte)((Data.GetExpiredSeconds() % 2678400) / 86400);

            Sender.GetPacketSender().Send_SubscriptionInfo(SubscriptionName, ExpiredMonthDays, ExpiredFullMonths, RemainingFullMonths, Data.IsActive());
        }
예제 #6
0
        private static void ProcessMessengerSearch(Habbo sender, IncomingMessage message)
        {
            string searchString = message.PopPrefixedString();

            List <IHI.Database.Habbo> matching;

            // Using IHIDB.Habbo rather than IHIDB.Friend because this will be passed to the HabboDistributor
            using (ISession db = CoreManager.ServerCore.GetDatabaseSession())
            {
                matching = db.CreateCriteria <IHI.Database.Habbo>().
                           Add(new LikeExpression("username", searchString + "%")).
                           SetMaxResults(20).     // TODO: External config
                           List <IHI.Database.Habbo>() as List <IHI.Database.Habbo>;
            }

            List <IBefriendable> friends   = new List <IBefriendable>();
            List <IBefriendable> strangers = new List <IBefriendable>();

            MessengerObject  messenger        = sender.GetMessenger();
            HabboDistributor habboDistributor = CoreManager.ServerCore.GetHabboDistributor();

            foreach (IHI.Database.Habbo match in matching)
            {
                IBefriendable habbo = habboDistributor.GetHabbo(match);
                if (messenger.IsFriend(habbo))
                {
                    friends.Add(habbo);
                }
                else
                {
                    strangers.Add(habbo);
                }
            }

            new MMessengerSearchResults(friends, strangers).Send(sender);
        }