internal void GetGroupForumThreadRoot()
        {
            uint GroupId = Request.PopWiredUInt();
            int StartIndex = Request.PopWiredInt32();
            int EndIndex = Request.PopWiredInt32(); // igual siempre será 20.

            Guild Group = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND parent_id = 0 ORDER BY timestamp DESC;");
                DataTable Table = dbClient.getTable();

                if (Table == null)
                {
                    ServerMessage Méssich = new ServerMessage(Outgoing.GroupForumThreadRootMessageComposer);
                    Méssich.AppendUInt(GroupId);
                    Méssich.AppendInt32(0);
                    Méssich.AppendInt32(0);
                    Session.SendMessage(Méssich);
                    return;
                }

                int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
                List<GroupForumPost> Threads = new List<GroupForumPost>();
                int i = 1;
                while (i <= b)
                {
                    DataRow Row = Table.Rows[i - 1];
                    if (Row == null)
                    {
                        b--;
                        continue;
                    }
                    GroupForumPost thread = new GroupForumPost(Row);
                    
                    Threads.Add(thread);
                    i++;
                }
                Threads = Threads.OrderByDescending(x => x.Pinned).ToList();

                ServerMessage Message = new ServerMessage(Outgoing.GroupForumThreadRootMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendInt32(StartIndex);
                Message.AppendInt32(b);
                foreach (GroupForumPost Thread in Threads)
                {
                    Message.AppendUInt(Thread.Id);
                    Message.AppendUInt(Thread.PosterId);
                    Message.AppendString(Thread.PosterName);
                    Message.AppendString(Thread.Subject);
                    Message.AppendBoolean(Thread.Pinned);
                    Message.AppendBoolean(Thread.Locked);
                    Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                    Message.AppendInt32(Thread.MessageCount + 1);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);//readtimes?
                    Message.AppendInt32(0);
                    Message.AppendString("");
                    Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                    Message.AppendByte((Thread.Hidden) ? 10 : 1);
                    Message.AppendInt32(0);
                    Message.AppendString(Thread.Hider);
                    Message.AppendInt32(0);//Unknown, but unused. Parece ID
                }
                Session.SendMessage(Message);
            }
        }
        internal void AlterForumThreadState()
        {
            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            int StateToSet = Request.PopWiredInt32();


            using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND id = '" + ThreadId + "' LIMIT 1;");
                DataRow Row = dbClient.getRow();
                Guild Group = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
                if (Row != null)
                {
                    if ((uint)Row["poster_id"] == Session.GetHabbo().Id || Group.Admins.ContainsKey(Session.GetHabbo().Id))
                    {
                        dbClient.setQuery("UPDATE group_forum_posts SET hidden = @hid WHERE id = " + ThreadId + ";");
                        dbClient.addParameter("hid", (StateToSet == 10) ? "1" : "0");
                        dbClient.runQuery();
                    }
                }

                GroupForumPost Thread = new GroupForumPost(Row);

                ServerMessage Notif = new ServerMessage(Outgoing.SuperNotificationMessageComposer);
                Notif.AppendString((StateToSet == 10) ? "forums.thread.hidden" : "forums.thread.restored");
                    Notif.AppendInt32(0);
                    Session.SendMessage(Notif);

                if (Thread.ParentId != 0)
                {
                    return;
                }
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumThreadUpdateMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(Thread.Id);
                Message.AppendUInt(Thread.PosterId);
                Message.AppendString(Thread.PosterName);
                Message.AppendString(Thread.Subject);
                Message.AppendBoolean(Thread.Pinned);
                Message.AppendBoolean(Thread.Locked);
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                Message.AppendInt32(Thread.MessageCount + 1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);//readtimes?
                Message.AppendInt32(0);
                Message.AppendString("");
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Thread.Timestamp));
                Message.AppendByte(StateToSet);
                Message.AppendInt32(0);
                Message.AppendString(Thread.Hider);
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
        }
        internal void ReadForumThread()
        {
            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            int StartIndex = Request.PopWiredInt32();
            int EndIndex = Request.PopWiredInt32();

            Guild Group = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                dbClient.setQuery("SELECT * FROM group_forum_posts WHERE group_id = '" + GroupId + "' AND parent_id = '" + ThreadId + "' OR id = '" + ThreadId + "' ORDER BY timestamp ASC;");
                DataTable Table = dbClient.getTable();

                if (Table == null)
                {
                    return;
                }

                int b = (Table.Rows.Count <= 20) ? Table.Rows.Count : 20;
                List<GroupForumPost> posts = new List<GroupForumPost>();
                int i = 1;
                while (i <= b)
                {
                    DataRow Row = Table.Rows[i - 1];
                    if (Row == null)
                    {
                        b--;
                        continue;
                    }
                    GroupForumPost thread = new GroupForumPost(Row);
                    if (thread.ParentId == 0 && thread.Hidden)
                    {
                        return;//
                    }

                    posts.Add(thread);
                    i++;
                }

                ServerMessage Message = new ServerMessage(Outgoing.GroupForumReadThreadMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendInt32(StartIndex);
                Message.AppendInt32(b);

                int indx = 0;

                foreach (GroupForumPost Post in posts)
                {
                    Message.AppendInt32(indx++ - 1);
                    Message.AppendInt32(indx - 1);
                    Message.AppendUInt(Post.PosterId);
                    Message.AppendString(Post.PosterName);
                    Message.AppendString(Post.PosterLook);
                    Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Post.Timestamp));
                    Message.AppendString(Post.PostContent);
                    Message.AppendByte(0);
                    Message.AppendInt32(0);
                    Message.AppendString(Post.Hider);
                    Message.AppendInt32(0);//Unknown, but unused. Parece ID
                }
                Session.SendMessage(Message);
            }
        }
        internal void PublishForumThread()
        {
            if ((CyberEnvironment.GetUnixTimestamp() - Session.GetHabbo().lastSqlQuery) < 20)
            {
                Session.SendNotif("Please wait 20 seconds before publishing the next post!");
                return;
            }

            uint GroupId = Request.PopWiredUInt();
            uint ThreadId = Request.PopWiredUInt();
            string Subject = Request.PopFixedString();
            string Content = Request.PopFixedString();

            Guild Group = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId);
            
            if (Group == null || !Group.HasForum)
            {
                return;
            }

            int Timestamp = CyberEnvironment.GetUnixTimestamp();

            using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                if (ThreadId != 0)
                {
                    dbClient.setQuery("SELECT * FROM group_forum_posts WHERE id = " + ThreadId);
                    DataRow Row = dbClient.getRow();
                    GroupForumPost Post = new GroupForumPost(Row);

                    if (Post.Locked || Post.Hidden)
                    {
                        Session.SendNotif("¡No puedes publicar a este tema porque está oculto y/o bloqueado! Por favor, haz clic en 'Cancelar'.");
                        return;
                    }
                }

                this.Session.GetHabbo().lastSqlQuery = CyberEnvironment.GetUnixTimestamp();
                dbClient.setQuery("INSERT INTO group_forum_posts (group_id, parent_id, timestamp, poster_id, poster_name, poster_look, subject, post_content) VALUES (@gid, @pard, @ts, @pid, @pnm, @plk, @subjc, @content)");
                dbClient.addParameter("gid", GroupId);
                dbClient.addParameter("pard", ThreadId);
                dbClient.addParameter("ts", Timestamp);
                dbClient.addParameter("pid", Session.GetHabbo().Id);
                dbClient.addParameter("pnm", Session.GetHabbo().Username);
                dbClient.addParameter("plk", Session.GetHabbo().Look);
                dbClient.addParameter("subjc", Subject);
                dbClient.addParameter("content", Content);
                ThreadId = (uint)dbClient.getInteger();
            }

            Group.ForumScore += 0.25;
            Group.ForumLastPosterName = Session.GetHabbo().Username;
            Group.ForumLastPosterId = Session.GetHabbo().Id;
            Group.ForumLastPosterTimestamp = Timestamp;
            Group.ForumMessagesCount++;
            Group.UpdateForum();

            if (ThreadId == 0)
            {
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumNewThreadMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendUInt(Session.GetHabbo().Id);
                Message.AppendString(Subject);
                Message.AppendString(Content);
                Message.AppendBoolean(false);
                Message.AppendBoolean(false);
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendInt32(1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);//readtimes?
                Message.AppendInt32(1);
                Message.AppendString("");
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendByte(1);
                Message.AppendInt32(1);
                Message.AppendString("");
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
            else
            {
                ServerMessage Message = new ServerMessage(Outgoing.GroupForumNewResponseMessageComposer);
                Message.AppendUInt(GroupId);
                Message.AppendUInt(ThreadId);
                Message.AppendUInt(Group.ForumMessagesCount);//something quick
                Message.AppendInt32(0);//something quick
                Message.AppendUInt(Session.GetHabbo().Id);
                Message.AppendString(Session.GetHabbo().Username);
                Message.AppendString(Session.GetHabbo().Look);
                Message.AppendInt32((CyberEnvironment.GetUnixTimestamp() - Timestamp));
                Message.AppendString(Content);
                Message.AppendByte(0);
                Message.AppendInt32(0);
                Message.AppendString("");
                Message.AppendInt32(0);//Unknown, but unused. Parece ID
                Session.SendMessage(Message);
            }
        }