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

            Azure.GetGame().GetClientManager().StaffAlert(message);
        }
Exemplo n.º 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 = AzureEmulator.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','','", AzureEmulator.GetUnixTimeStamp(), "')"));
                    dbClient.AddParameter("message", message);
                    id = (uint)dbClient.InsertQuery();
                    dbClient.RunFastQuery(string.Format("UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {0}", session.GetHabbo().Id));
                }

                var ticket = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message, 0u, "",
                    AzureEmulator.GetUnixTimeStamp(), messages);
                Tickets.Add(ticket);
                SendTicketToModerators(ticket);
                return;
            }

            RoomData data = AzureEmulator.GetGame().GetRoomManager().GenerateNullableRoomData(session.GetHabbo().CurrentRoomId);
            using (IQueryAdapter dbClient = AzureEmulator.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,'", AzureEmulator.GetUnixTimeStamp(), "')"));
                dbClient.AddParameter("message", message);
                dbClient.AddParameter("name", data.Name);
                id = (uint)dbClient.InsertQuery();
                dbClient.RunFastQuery(string.Format("UPDATE users_info SET cfhs = cfhs + 1 WHERE user_id = {0}", session.GetHabbo().Id));
            }
            var ticket2 = new SupportTicket(id, 1, category, type, session.GetHabbo().Id, reportedUser, message, data.Id, data.Name,
                AzureEmulator.GetUnixTimeStamp(), messages);
            Tickets.Add(ticket2);
            SendTicketToModerators(ticket2);
        }
Exemplo n.º 3
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)
        {
            var message = new ServerMessage();
            RoomData room = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);
            //if (room == null)
            //{
            //    throw new NullReferenceException("No room found.");
            //}

            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);

            var tempChatlogs = room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();

            message.AppendShort(tempChatlogs.Count());
            foreach (var chatLog in tempChatlogs)
            {
                chatLog.Serialize(ref message);
            }
            tempChatlogs = null;

            return message;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sends the ticket update to moderators.
 /// </summary>
 /// <param name="ticket">The ticket.</param>
 internal static void SendTicketUpdateToModerators(SupportTicket ticket)
 {
 }