Exemple #1
0
        public void Invoke(Session Session, Messages.PacketEvent Packet)
        {
            string Name = Packet.PopString();
            string Model = Packet.PopString();

            System.IOStreamer.AppendLine("Caption: {0}, Model: {1}", Name, Model);
        }
Exemple #2
0
 public void Invoke(Session Session, Messages.PacketEvent Packet)
 {
     switch (Packet.PopString())
     {
         case "Performance":
             switch (Packet.PopString())
             {
                 case "fps":
                     Session.UpdateFramesPerSecond(int.Parse(Packet.PopString()));
                     break;
             }
             break;
     }
 }
Exemple #3
0
        public void Invoke(Session Session, Messages.PacketEvent Packet)
        {
            RoomAdapter Adapter;

            if (System.HabboSystem.CharacterManager.GetCurrentRoom(Session.Character.Id, out Adapter))
            {
                RoomUnit Unit;

                if (Adapter.GetUnit(Session.Character.Id, out Unit))
                {
                    Adapter.WriteComposer(new ChatMessageComposer(Unit.Id, Packet.PopString()));
                }
            }
        }
Exemple #4
0
        public void Invoke(Session Session, Messages.PacketEvent Packet)
        {
            string Ticket = Packet.PopString();

            Character CharObj = System.HabboSystem.CharacterManager.Authenticate(Ticket);

            if (CharObj == null)
            {
                System.IOStreamer.AppendColor(ConsoleColor.Red);
                System.IOStreamer.AppendLine("Failed to Authenticate: {0}", Ticket);
                System.NetworkSocket.CloseSession(Session);
            }
            else
            {
                Session.UpdateCharacter(CharObj);
                Session.WriteComposer(new AuthenticationOKMessageComposer());
            }
        }
Exemple #5
0
        public void Invoke(Session Session, Messages.PacketEvent Packet)
        {
            Room Room;

            if (System.HabboSystem.RoomManager.EnterRoom(Session, Packet.PopInt32(), Packet.PopString(), out Room))
            {
                Session.WriteComposer(new RoomUrlMessageComposer(Room.Id));
                Session.WriteComposer(new RoomReadyMessageComposer(Room.Model.Caption, Room.Id));

                /*
                 * Wallpaper
                 * Floor
                 * Landscape
                 * Rating
                 * Event
                 * */
                Session.Character.UpdateLoadingRoom(Room.Id);
                Session.Character.UpdateConnectedRoom(0);
            }
            else
            {
                Session.WriteComposer(new CloseConnectionMessageComposer());
            }
        }
Exemple #6
0
        public void Invoke(Network.Session Session, Messages.PacketEvent Packet)
        {
            // TODO ? IF(!INROOM)

            if (Session.Character.Muted)
            {
                Session.WriteComposer(new ModMessageComposer("You are muted, only someone with an higher rank can unmute you."));
                return;
            }

            ICollection<int> Targets = Packet.PopCollection();

            string Message = Packet.PopString();

            foreach (int TargetId in Targets)
            {
                if (TargetId < 1 || TargetId == Session.Character.Id)
                {
                    continue;
                }

                if (System.HabboSystem.CharacterManager.GetStatus(TargetId) == CharacterStatus.Offline)
                {
                    continue;
                }

                if (!Session.Character.MessengerFriends.Contains(TargetId))
                {
                    Session.WriteComposer(new RoomInviteErrorComposer());
                    continue;
                }

                var TargetSession = System.NetworkSocket.GetSession(TargetId);

                if (TargetSession == null)
                {
                    Session.WriteComposer(new RoomInviteErrorComposer());
                    continue;
                }

                if (TargetSession.Character.Muted)
                {
                    Session.WriteComposer(new ModMessageComposer(string.Format("{0} is muted.", Session.Character.Username)));
                    continue;
                }

                TargetSession.WriteComposer(new RoomInviteComposer(Session.Character.Id, Message));
            }
        }
Exemple #7
0
        public void Invoke(Network.Session Session, Messages.PacketEvent Packet)
        {
            // TODO IF(BUSY)

            var TargetId = Packet.PopInt32();

             /* ChatErrorId(s)
             * 3 = Friend Muted x
             * 4 = You are muted x
             * 5 = offline x
             * 6 = not friend x
             * 7 = friend is busy
             * */

            if (TargetId < 1 || TargetId == Session.Character.Id)
            {
                return;
            }

            if (Session.Character.Muted)
            {
                Session.WriteComposer(new InstantMessageErrorComposer(4, TargetId));
                return;
            }

            if (!Session.Character.MessengerFriends.Contains(TargetId))
            {
                Session.WriteComposer(new InstantMessageErrorComposer(6, TargetId));
                return;
            }

            if (System.HabboSystem.CharacterManager.GetStatus(TargetId) == CharacterStatus.Offline)
            {
                Session.WriteComposer(new InstantMessageErrorComposer(5, TargetId));
                return;
            }

            var TargetSession = System.NetworkSocket.GetSession(TargetId);

            if (TargetSession == null)
            {
                Session.WriteComposer(new InstantMessageErrorComposer(5, TargetId));
                return;
            }

            if (TargetSession.Character.Muted)
            {
                Session.WriteComposer(new InstantMessageErrorComposer(3, TargetId));
                return;
            }

            TargetSession.WriteComposer(new NewConsoleMessageComposer(Session.Character.Id, Packet.PopString()));
        }
Exemple #8
0
        public void Invoke(Network.Session Session, Messages.PacketEvent Packet)
        {
            int TargetId = System.HabboSystem.CharacterManager.GetId(Packet.PopString());

            if (Session.Character.MessengerFriends.Count >= System.HabboSystem.MessengerManager.GetLimitFriends(Session.Character.Id))
            {
                Session.WriteComposer(new MessengerErrorComposer(39, 2));
                return;
            }

            if (TargetId < 1 || TargetId == Session.Character.Id)
            {
                return;
            }

            if (Session.Character.MessengerRequests.Contains(TargetId))
            {
                return;
            }

            if (Session.Character.MessengerFriends.Contains(TargetId))
            {
                return;
            }

            if (!System.HabboSystem.CharacterManager.GetAllowNewFriends(TargetId))
            {
                Session.WriteComposer(new MessengerErrorComposer(39, 3));
                return;
            }

            CharacterStatus Status = System.HabboSystem.CharacterManager.GetStatus(TargetId);

            bool Flag = false;

            if (Status == CharacterStatus.Online)
            {
                var TargetSession = System.NetworkSocket.GetSession(TargetId);

                if (TargetSession == null)
                {
                    return;
                }

                if (TargetSession.Character.MessengerFriends.Count >= System.HabboSystem.MessengerManager.GetLimitFriends(TargetSession.Character.Id))
                {
                    Session.WriteComposer(new MessengerErrorComposer(39, 2));
                    return;
                }

                if (!TargetSession.Character.MessengerRequests.Contains(Session.Character.Id))
                {
                    TargetSession.Character.MessengerRequests.Add(Session.Character.Id);

                    TargetSession.WriteComposer(new NewBuddyRequestComposer(Session.Character.Id, Session.Character.Username, Session.Character.Figure));
                    Flag = true;
                }
            }
            else
            {
                if (System.HabboSystem.MessengerManager.GetMessengerFriends(TargetId).Count >= System.HabboSystem.MessengerManager.GetLimitFriends(TargetId))
                {
                    Session.WriteComposer(new MessengerErrorComposer(39, 2));
                    return;
                }

                if (!System.HabboSystem.MessengerManager.GetMessengerRequests(TargetId).Contains(Session.Character.Id))
                {
                    Flag = true;
                }
            }

            if (Flag)
            {
                System.MySQLManager.InvokeQuery(new MessengerRequestFriendQuery(Session.Character.Id, TargetId));
            }
        }
Exemple #9
0
        public void Invoke(Network.Session Session, Messages.PacketEvent Packet)
        {
            string Username = Packet.PopString();

            ICollection<int> Friends = new List<int>();
            ICollection<int> NoFriends = new List<int>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new MessengerCharacterSearchQuery(Username)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    int CharacterId = Adapter.PopInt32("id");

                    if (Session.Character.MessengerFriends.Contains(CharacterId))
                    {
                        Friends.Add(CharacterId);
                    }
                    else NoFriends.Add(CharacterId);
                }
            }

            Session.WriteComposer(new HabboSearchResultComposer(Session.Character, Friends, NoFriends));
        }