internal static void SendTicketToModerators(SupportTicket Ticket) { PiciEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(Ticket.Serialize(), "acc_supporttool"); }
internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp) { Room currentRoom = PiciEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id); ServerMessage Message = new ServerMessage(534); Message.AppendUInt(Ticket.TicketId); Message.AppendUInt(Ticket.SenderId); Message.AppendUInt(Ticket.ReportedId); Message.AppendBoolean(RoomData.IsPublicRoom); Message.AppendUInt(RoomData.Id); Message.AppendStringWithBreak(RoomData.Name); if (currentRoom == null) { Message.AppendInt32(0); return Message; } else { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = " + RoomData.Id + " AND timestamp >= " + (Timestamp - 300) + " AND timestamp <= " + Timestamp + " ORDER BY timestamp DESC"); DataTable Data = dbClient.getTable(); Message = new ServerMessage(534); Message.AppendUInt(Ticket.TicketId); Message.AppendUInt(Ticket.SenderId); Message.AppendUInt(Ticket.ReportedId); Message.AppendBoolean(RoomData.IsPublicRoom); Message.AppendUInt(RoomData.Id); Message.AppendStringWithBreak(RoomData.Name); if (Data != null) { Message.AppendInt32(Data.Rows.Count); foreach (DataRow Row in Data.Rows) { Message.AppendInt32((int)Row["hour"]); Message.AppendInt32((int)Row["minute"]); Message.AppendUInt((UInt32)Row["user_id"]); Message.AppendStringWithBreak((String)Row["user_name"]); Message.AppendStringWithBreak((String)Row["message"]); } } else { Message.AppendInt32(0); } return Message; } } }
internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, String Message) { if (Session.GetHabbo().CurrentRoomId <= 0) { return; } RoomData Data = PiciEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId); uint TicketId = 0; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == Pici.Storage.Database.DatabaseType.MSSQL) dbClient.setQuery("INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) OUTPUT INSERTED.* VALUES (1,'" + Category + "','open','" + Session.GetHabbo().Id + "','" + ReportedUser + "','0',@message,'" + Data.Id + "',@name,'" + PiciEnvironment.GetUnixTimestamp() + "')"); else dbClient.setQuery("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,'" + PiciEnvironment.GetUnixTimestamp() + "')"); dbClient.addParameter("message", Message); dbClient.addParameter("name", Data.Name); TicketId = (uint)dbClient.insertQuery(); dbClient.runFastQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = " + Session.GetHabbo().Id + ""); //dbClient.setQuery("SELECT id FROM moderation_tickets WHERE sender_id = " + Session.GetHabbo().Id + " ORDER BY id DESC LIMIT 1"); //TicketId = (uint)dbClient.getRow()[0]; } SupportTicket Ticket = new SupportTicket(TicketId, 1, Category, Session.GetHabbo().Id, ReportedUser, Message, Data.Id, Data.Name, PiciEnvironment.GetUnixTimestamp()); Tickets.Add(Ticket); SendTicketToModerators(Ticket); }