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"));
            }
        }
Example #2
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));
        }
Example #3
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"));
                }
            }
        }
Example #4
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"));
            }
        }
Example #5
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);
            }
        }