public void Parse(GameClient Session, ClientPacket Packet)
        {
            int forumId     = Packet.PopInt();
            int threadId    = Packet.PopInt();
            int postId      = Packet.PopInt();
            int deleteLevel = Packet.PopInt();

            HabboHotel.Groups.Forums.GroupForum forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(forumId);

            HabboHotel.Groups.Forums.GroupForumThread thread = forum.GetThread(threadId);

            HabboHotel.Groups.Forums.GroupForumThreadPost post = thread.GetPost(postId);

            post.DeletedLevel = deleteLevel / 10;
            post.DeleterId    = Session.GetHabbo().Id;
            post.Save();
            Session.SendMessage(new PostUpdatedComposer(Session, post));

            if (post.DeletedLevel != 0)
            {
                Session.SendMessage(new RoomNotificationComposer("forums.message.hidden"));
            }
            else
            {
                Session.SendMessage(new RoomNotificationComposer("forums.message.restored"));
            }
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int length = Packet.PopInt();

            for (int i = 0; i < length; i++)
            {
                int  forumid = Packet.PopInt();     //Forum ID
                int  postid  = Packet.PopInt();     //Post ID
                bool readall = Packet.PopBoolean(); //Make all read

                HabboHotel.Groups.Forums.GroupForum forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(forumid);
                if (forum == null)
                {
                    continue;
                }

                HabboHotel.Groups.Forums.GroupForumThreadPost post = forum.GetPost(postid);
                if (post == null)
                {
                    continue;
                }

                HabboHotel.Groups.Forums.GroupForumThread thread = post.ParentThread;
                int index = thread.Posts.IndexOf(post);
                thread.AddView(Session.GetHabbo().Id, index + 1);
            }
            //Thread.AddView(Session.GetHabbo().Id);
        }
Exemple #3
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int ForumId     = Packet.PopInt();
            int WhoCanRead  = Packet.PopInt();
            int WhoCanReply = Packet.PopInt();
            int WhoCanPost  = Packet.PopInt();
            int WhoCanMod   = Packet.PopInt();


            HabboHotel.Groups.Forums.GroupForum forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(ForumId);

            if (forum == null)
            {
                Session.SendNotification(("forums.not.found"));
                return;
            }

            if (forum.Settings.GetReasonForNot(Session, forum.Settings.WhoCanModerate) != "")
            {
                Session.SendNotification(("forums.settings.update.error.rights"));
                return;
            }

            forum.Settings.WhoCanRead            = WhoCanRead;
            forum.Settings.WhoCanModerate        = WhoCanMod;
            forum.Settings.WhoCanPost            = WhoCanReply;
            forum.Settings.WhoCanInitDiscussions = WhoCanPost;

            forum.Settings.Save();

            Session.SendMessage(new GetGroupForumsMessageEvent(forum, Session));
            Session.SendMessage(new ThreadsListDataComposer(forum, Session));
        }
Exemple #4
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int ForumId    = Packet.PopInt(); //Maybe Forum ID
            int ThreadId   = Packet.PopInt(); //Maybe Thread ID
            int StartIndex = Packet.PopInt(); //Start index
            int length     = Packet.PopInt(); //List Length

            HabboHotel.Groups.Forums.GroupForum Forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(ForumId);

            if (Forum == null)
            {
                Session.SendNotification(";forum.thread.open.error.forumnotfound");
                return;
            }

            HabboHotel.Groups.Forums.GroupForumThread Thread = Forum.GetThread(ThreadId);
            if (Thread == null)
            {
                Session.SendNotification(";forum.thread.open.error.threadnotfound");
                return;
            }

            if (Thread.DeletedLevel > 1 && (Forum.Settings.GetReasonForNot(Session, Forum.Settings.WhoCanModerate) != ""))
            {
                Session.SendNotification((";forum.thread.open.error.deleted"));
                return;
            }


            Session.SendMessage(new ThreadDataComposer(Thread, StartIndex, length));
        }
Exemple #5
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int  ForumID  = Packet.PopInt();
            int  ThreadID = Packet.PopInt();
            bool Pinned   = Packet.PopBoolean();
            bool Locked   = Packet.PopBoolean();


            HabboHotel.Groups.Forums.GroupForum       forum  = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(ForumID);
            HabboHotel.Groups.Forums.GroupForumThread thread = forum.GetThread(ThreadID);

            if (forum.Settings.GetReasonForNot(Session, forum.Settings.WhoCanModerate) != "")
            {
                Session.SendNotification(("forums.thread.update.error.rights"));
                return;
            }

            bool isPining  = thread.Pinned != Pinned,
                 isLocking = thread.Locked != Locked;

            thread.Pinned = Pinned;
            thread.Locked = Locked;

            thread.Save();

            Session.SendMessage(new Outgoing.Groups.ThreadUpdatedComposer(Session, thread));

            if (isPining)
            {
                if (Pinned)
                {
                    Session.SendMessage(new Outgoing.Rooms.Notifications.RoomNotificationComposer("forums.thread.pinned"));
                }
                else
                {
                    Session.SendMessage(new Outgoing.Rooms.Notifications.RoomNotificationComposer("forums.thread.unpinned"));
                }
            }

            if (isLocking)
            {
                if (Locked)
                {
                    Session.SendMessage(new Outgoing.Rooms.Notifications.RoomNotificationComposer("forums.thread.locked"));
                }
                else
                {
                    Session.SendMessage(new Outgoing.Rooms.Notifications.RoomNotificationComposer("forums.thread.unlocked"));
                }
            }
        }
Exemple #6
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int ForumId = Packet.PopInt(); //Forum ID
            int Int2    = Packet.PopInt(); //Start Index of Thread Count
            int Int3    = Packet.PopInt(); //Length of Thread Count

            HabboHotel.Groups.Forums.GroupForum Forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(ForumId);
            if (Forum == null)
            {
                return;
            }

            Session.SendMessage(new ThreadsListDataComposer(Forum, Session, Int2, Int3));
        }
Exemple #7
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int int1 = Packet.PopInt();
            int int2 = Packet.PopInt();
            int int3 = Packet.PopInt();

            HabboHotel.Groups.Forums.GroupForum forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(int1);

            if (forum == null)
            {
                Session.SendNotification(("forums.thread.delete.error.forumnotfound"));
                return;
            }

            if (forum.Settings.GetReasonForNot(Session, forum.Settings.WhoCanModerate) != "")
            {
                Session.SendNotification(("forums.thread.delete.error.rights"));
                return;
            }

            HabboHotel.Groups.Forums.GroupForumThread thread = forum.GetThread(int2);
            if (thread == null)
            {
                Session.SendNotification(("forums.thread.delete.error.threadnotfound"));
                return;
            }

            thread.DeletedLevel = int3 / 10;

            thread.DeleterUserId = thread.DeletedLevel != 0 ? Session.GetHabbo().Id : 0;

            thread.Save();

            Session.SendMessage(new ThreadsListDataComposer(forum, Session));

            if (thread.DeletedLevel != 0)
            {
                Session.SendMessage(new RoomNotificationComposer("forums.thread.hidden"));
            }
            else
            {
                Session.SendMessage(new RoomNotificationComposer("forums.thread.restored"));
            }
        }
Exemple #8
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int    ForumId  = Packet.PopInt();
            int    ThreadId = Packet.PopInt();
            string Caption  = Packet.PopString();
            string Message  = Packet.PopString();

            HabboHotel.Groups.Forums.GroupForum Forum = NeonEnvironment.GetGame().GetGroupForumManager().GetForum(ForumId);
            if (Forum == null)
            {
                Session.SendNotification(";forum.thread.post.reply.error.forumnotfound");
                return;
            }
            string e           = "";
            bool   IsNewThread = ThreadId == 0;

            if (IsNewThread)
            {
                if ((e = Forum.Settings.GetReasonForNot(Session, Forum.Settings.WhoCanInitDiscussions)) != "")
                {
                    Session.SendNotification(";forum.thread.create.error." + e);
                    return;
                }

                HabboHotel.Groups.Forums.GroupForumThread     Thread = Forum.CreateThread(Session.GetHabbo().Id, Caption);
                HabboHotel.Groups.Forums.GroupForumThreadPost Post   = Thread.CreatePost(Session.GetHabbo().Id, Message);

                Session.SendMessage(new ThreadCreatedComposer(Session, Thread));

                Session.SendMessage(new ThreadDataComposer(Thread, 0, 2000));

                //Session.SendMessage(new PostUpdatedComposer(Session, Post));
                //Session.SendMessage(new ThreadReplyComposer(Session, Post));

                Thread.AddView(Session.GetHabbo().Id, 1);
            }
            else
            {
                HabboHotel.Groups.Forums.GroupForumThread Thread = Forum.GetThread(ThreadId);
                if (Thread == null)
                {
                    Session.SendNotification(";forum.thread.post.reply.error.threadnotfound");
                    return;
                }

                if (Thread.Locked && Forum.Settings.GetReasonForNot(Session, Forum.Settings.WhoCanModerate) != "")
                {
                    Session.SendNotification(";forum.thread.post.reply.error.locked");
                    return;
                }

                if ((e = Forum.Settings.GetReasonForNot(Session, Forum.Settings.WhoCanPost)) != "")
                {
                    Session.SendNotification(";forum.thread.post.reply.error." + e);
                    return;
                }

                HabboHotel.Groups.Forums.GroupForumThreadPost Post = Thread.CreatePost(Session.GetHabbo().Id, Message);
                Session.SendMessage(new ThreadReplyComposer(Session, Post));
                NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Forum", 1);
            }
        }