Beispiel #1
0
        /// <summary>
        ///     Sends the ticket to moderators.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        internal static void SendTicketToModerators(SupportTicket ticket)
        {
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolIssueMessageComposer"));
            message = ticket.Serialize(message);

            Yupi.GetGame().GetClientManager().StaffAlert(message);
        }
Beispiel #2
0
        /// <summary>
        ///     Sends the new ticket.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="category">The category.</param>
        /// <param name="type">The type.</param>
        /// <param name="reportedUser">The reported user.</param>
        /// <param name="message">The message.</param>
        /// <param name="messages">The messages.</param>
        internal void SendNewTicket(GameClient session, int category, int type, uint reportedUser, string message,
            List<string> messages)
        {
            uint id;

            if (session.GetHabbo().CurrentRoomId <= 0)
            {
                using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery(
                        string.Concat(
                            "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                            category, "','open','", session.GetHabbo().Id, "','", reportedUser,
                            "','0',@message,'0','','", Yupi.GetUnixTimeStamp(), "')"));
                    dbClient.AddParameter("message", message);
                    id = (uint) dbClient.InsertQuery();
                    dbClient.RunFastQuery(
                        $"UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {session.GetHabbo().Id}");
                }

                SupportTicket ticket = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message, 0u,
                    "", Yupi.GetUnixTimeStamp(), messages);

                Tickets.Add(ticket);
                SendTicketToModerators(ticket);
            }
            else
            {
                RoomData data = Yupi.GetGame().GetRoomManager().GenerateNullableRoomData(session.GetHabbo().CurrentRoomId);

                using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery(
                        string.Concat(
                            "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'",
                            category, "','open','", session.GetHabbo().Id, "','", reportedUser, "','0',@message,'",
                            data.Id, "',@name,'", Yupi.GetUnixTimeStamp(), "')"));
                    dbClient.AddParameter("message", message);
                    dbClient.AddParameter("name", data.Name);
                    id = (uint) dbClient.InsertQuery();
                    dbClient.RunFastQuery(
                        $"UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {session.GetHabbo().Id}");
                }

                SupportTicket ticket2 = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message,
                    data.Id, data.Name, Yupi.GetUnixTimeStamp(), messages);

                Tickets.Add(ticket2);
                SendTicketToModerators(ticket2);
            }
        }
Beispiel #3
0
 /// <summary>
 ///     Sends the ticket update to moderators.
 /// </summary>
 /// <param name="ticket">The ticket.</param>
 internal static void SendTicketUpdateToModerators(SupportTicket ticket)
 {
 }
Beispiel #4
0
        /// <summary>
        ///     Serializes the ticket chatlog.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="roomData">The room data.</param>
        /// <param name="timestamp">The timestamp.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">No room found.</exception>
        internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp)
        {
            ServerMessage message = new ServerMessage();

            RoomData room = Yupi.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);

            if (room != null)
            {
                message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer"));

                message.AppendInteger(ticket.TicketId);
                message.AppendInteger(ticket.SenderId);
                message.AppendInteger(ticket.ReportedId);
                message.AppendInteger(ticket.RoomId);

                message.AppendByte(1);
                message.AppendShort(2);
                message.AppendString("roomName");
                message.AppendByte(2);
                message.AppendString(ticket.RoomName);
                message.AppendString("roomId");
                message.AppendByte(1);
                message.AppendInteger(ticket.RoomId);

                List<Chatlog> tempChatlogs =
                    room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();

                message.AppendShort(tempChatlogs.Count);

                foreach (Chatlog chatLog in tempChatlogs)
                    chatLog.Serialize(ref message);

                return message;
            }
            return null;
        }
Beispiel #5
0
        /// <summary>
        ///     Closes the ticket.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="ticketId">The ticket identifier.</param>
        /// <param name="result">The result.</param>
        internal void CloseTicket(GameClient session, uint ticketId, int result)
        {
            SupportTicket ticket = GetTicket(ticketId);

            if (ticket == null || ticket.Status != TicketStatus.Picked || ticket.ModeratorId != session.GetHabbo().Id)
            {
                return;
            }

            Habbo senderUser = Yupi.GetHabboById(ticket.SenderId);

            if (senderUser == null)
            {
                return;
            }

            uint statusCode;

            TicketStatus newStatus;

            switch (result)
            {
            case 1:
                statusCode = 1;
                newStatus  = TicketStatus.Invalid;
                break;

            case 2:
                statusCode = 2;
                newStatus  = TicketStatus.Abusive;
                break;

            default:
                statusCode = 0;
                newStatus  = TicketStatus.Resolved;
                break;
            }

            if (statusCode == 2)
            {
                using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    AbusiveCooldown.Add(ticket.SenderId, Yupi.GetUnixTimeStamp() + 600);
                    queryReactor.RunFastQuery(
                        $"UPDATE users_info SET cfhs_abusive = cfhs_abusive + 1 WHERE user_id = {ticket.SenderId}");
                }
            }

            GameClient senderClient = Yupi.GetGame().GetClientManager().GetClientByUserId(senderUser.Id);

            if (senderClient != null)
            {
                foreach (
                    SupportTicket current2 in
                    Tickets.FindAll(
                        current => current.ReportedId == ticket.ReportedId && current.Status == TicketStatus.Picked)
                    )
                {
                    current2.Delete(true);
                    SendTicketToModerators(current2);
                    current2.Close(newStatus, true);
                }

                senderClient.GetMessageHandler()
                .GetResponse()
                .Init(LibraryParser.OutgoingRequest("ModerationToolUpdateIssueMessageComposer"));
                senderClient.GetMessageHandler().GetResponse().AppendInteger(1);
                senderClient.GetMessageHandler().GetResponse().AppendInteger(ticket.TicketId);
                senderClient.GetMessageHandler().GetResponse().AppendInteger(ticket.ModeratorId);
                senderClient.GetMessageHandler()
                .GetResponse()
                .AppendString(Yupi.GetHabboById(ticket.ModeratorId) != null
                        ? Yupi.GetHabboById(ticket.ModeratorId).UserName
                        : "******");
                senderClient.GetMessageHandler().GetResponse().AppendBool(false);
                senderClient.GetMessageHandler().GetResponse().AppendInteger(0);
                senderClient.GetMessageHandler()
                .GetResponse()
                .Init(LibraryParser.OutgoingRequest("ModerationTicketResponseMessageComposer"));
                senderClient.GetMessageHandler().GetResponse().AppendInteger(statusCode);
                senderClient.GetMessageHandler().SendResponse();
            }
            else
            {
                foreach (
                    SupportTicket current2 in
                    Tickets.FindAll(
                        current => current.ReportedId == ticket.ReportedId && current.Status == TicketStatus.Picked)
                    )
                {
                    current2.Delete(true);
                    SendTicketToModerators(current2);
                    current2.Close(newStatus, true);
                }
            }

            using (IQueryAdapter queryreactor2 = Yupi.GetDatabaseManager().GetQueryReactor())
                queryreactor2.RunFastQuery(
                    $"UPDATE users_stats SET tickets_answered = tickets_answered+1 WHERE id={session.GetHabbo().Id} LIMIT 1");
        }
Beispiel #6
0
 /// <summary>
 ///     Sends the ticket update to moderators.
 /// </summary>
 /// <param name="ticket">The ticket.</param>
 internal static void SendTicketUpdateToModerators(SupportTicket ticket)
 {
 }