internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, String Message) { if (Session.GetHabbo().CurrentRoomId <= 0) { return; } RoomData Data = FirewindEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData(Session.GetHabbo().CurrentRoomId); uint TicketId = 0; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { 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,'" + FirewindEnvironment.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, FirewindEnvironment.GetUnixTimestamp()); Tickets.Add(Ticket); SendTicketToModerators(Ticket); }
internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp) { Room currentRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id); ServerMessage Message = new ServerMessage(Outgoing.IssueChatlog); Message.AppendUInt(Ticket.TicketId); Message.AppendUInt(Ticket.SenderId); Message.AppendUInt(Ticket.ReportedId); Message.AppendUInt(RoomData.Id); //maybe? Message.AppendBoolean(false); // is public Message.AppendUInt(RoomData.Id); Message.AppendString(RoomData.Name); if (currentRoom == null) { Message.AppendInt32(0); return Message; } else { ChatMessageManager manager = currentRoom.GetChatMessageManager(); Message.AppendInt32(manager.messageCount); manager.Serialize(ref Message); return Message; } //using (IQueryAdapter dbClient = FirewindEnvironment.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(); // 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.AppendString(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.AppendString((String)Row["user_name"]); // Message.AppendString((String)Row["message"]); // } // } // else // { // Message.AppendInt32(0); // } // return Message; //} }
internal static void SendTicketUpdateToModerators(SupportTicket Ticket) { //FirewindEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(Ticket.SerializeUpdate(), "fuse_mod"); }
internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp) { Room currentRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id); ServerMessage Message = new ServerMessage(Outgoing.IssueChatlog); Message.AppendUInt(Ticket.TicketId); Message.AppendInt32(Ticket.SenderId); Message.AppendInt32(Ticket.ReportedId); Message.AppendUInt(RoomData.Id); //maybe? Message.AppendBoolean(false); // is public Message.AppendUInt(RoomData.Id); Message.AppendString(RoomData.Name); if (currentRoom == null) { Message.AppendInt32(0); return(Message); } else { ChatMessageManager manager = currentRoom.GetChatMessageManager(); Message.AppendInt32(manager.messageCount); manager.Serialize(ref Message); return(Message); } //using (IQueryAdapter dbClient = FirewindEnvironment.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(); // 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.AppendString(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.AppendString((String)Row["user_name"]); // Message.AppendString((String)Row["message"]); // } // } // else // { // Message.AppendInt32(0); // } // return Message; //} }
internal static void SendTicketToModerators(SupportTicket Ticket) { FirewindEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(Ticket.Serialize(), "fuse_mod"); }
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; } GameClient Client = FirewindEnvironment.GetGame().GetClientManager().GetClientByUserID(Ticket.SenderId); TicketStatus NewStatus; int ResultCode; switch (Result) { case 1: ResultCode = 1; NewStatus = TicketStatus.INVALID; break; case 2: ResultCode = 2; NewStatus = TicketStatus.ABUSIVE; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_info SET cfhs_abusive = cfhs_abusive + 1 WHERE user_id = " + Ticket.SenderId + ""); } break; case 3: default: ResultCode = 0; NewStatus = TicketStatus.RESOLVED; break; } if (Client != null) { Client.GetMessageHandler().GetResponse().Init(3800); Client.GetMessageHandler().GetResponse().AppendInt32(ResultCode); Client.GetMessageHandler().SendResponse(); /*Client.GetMessageHandler().GetResponse().Init(Outgoing.UpdateIssue); * Client.GetMessageHandler().GetResponse().AppendInt32(1); // size * Client.GetMessageHandler().GetResponse().AppendUInt(Ticket.TicketId); * Client.GetMessageHandler().GetResponse().AppendUInt(Ticket.ModeratorId); * Client.GetMessageHandler().GetResponse().AppendString((FirewindEnvironment.getHabboForId(Ticket.ModeratorId) != null) ? (FirewindEnvironment.getHabboForId(Ticket.ModeratorId).Username) : "Undefined"); * Client.GetMessageHandler().GetResponse().AppendBoolean(false); // retryEnabled * Client.GetMessageHandler().GetResponse().AppendInt32(0); // retryEnabled * Client.GetMessageHandler().SendResponse();*/ } Ticket.Close(NewStatus, true); //SendTicketUpdateToModerators(Ticket); SendTicketToModerators(Ticket); }