/// <summary> /// Delete the specified ticket /// </summary> /// <param name="plr"></param> /// <param name="values"></param> /// <returns></returns> public static bool DeleteTicket(Player plr, ref List <string> values) { if (values.Count < 1) { plr.SendClientMessage("Usage: .ticket deleteticket <bugtrackerID>"); return(true); } string reportID = GetTotalString(ref values).Trim(); if (string.IsNullOrEmpty(reportID)) { plr.SendClientMessage("you need to specify the ticketID"); return(true); } Bug_report report = CharMgr.GetReport(reportID); if (report == null) { plr.SendClientMessage("The Specified report does not exist"); return(true); } if (report.Assigned != plr.Client._Account.Username) { plr.SendClientMessage("You cannot close a ticket not assigned to you(username), assign it to yourself first if you fixed the ticket"); return(true); } else { plr.SendClientMessage("You have deleted ticket: " + reportID); GMCommandLog log = new GMCommandLog { PlayerName = plr.Client._Account.Username, AccountId = (uint)plr.Client._Account.AccountId, Command = $"Removed Ticket: {reportID} from characterID: {report.CharacterId}. containing the following message: {report.Message} {report.FieldSting}", Date = DateTime.Now }; CharMgr.Database.AddObject(log); lock (CharMgr._report) { CharMgr._report.Remove(report); CharMgr.Database.DeleteObject(report); CharMgr.Database.ForceSave(); } return(true); } }
/// <summary> /// Assigns a person to a ticket /// </summary> /// <param name="plr"></param> /// <param name="values"></param> /// <returns></returns> public static bool Assign(Player plr, ref List <string> values) { if (values.Count < 2) { plr.SendClientMessage("Usage: .ticket assign <accountname> <bugtrackerID>"); return(true); } string account = GetString(ref values); string reportID = GetTotalString(ref values).Trim(); if (string.IsNullOrEmpty(account)) { plr.SendClientMessage("you need to specify a person for the ticket"); return(true); } if (string.IsNullOrEmpty(reportID)) { plr.SendClientMessage("you need to specify the ticketID"); return(true); } Bug_report report = CharMgr.GetReport(reportID); if (report == null) { plr.SendClientMessage("The Specified report does not exist"); return(true); } else { if (account == "nobody") { plr.SendClientMessage("You have unassigned yourself from ticket: " + reportID); } else { plr.SendClientMessage("You have assigned " + account + " to ticket: " + reportID); } lock (CharMgr._report) { report.Assigned = account; CharMgr.Database.SaveObject(report); CharMgr.Database.ForceSave(); } return(true); } }
/// <summary> /// assigns the current player as the person responsible for the ticket /// </summary> /// <param name="plr"></param> /// <param name="values"></param> /// <returns></returns> public static bool AssignMe(Player plr, ref List <string> values) { if (values.Count < 1) { plr.SendClientMessage("Usage: .ticket assignme <bugtrackerID>"); return(true); } string reportID = GetTotalString(ref values).Trim(); if (string.IsNullOrEmpty(reportID)) { plr.SendClientMessage("you need to specify the ticketID"); return(true); } Bug_report report = CharMgr.GetReport(reportID); if (report == null) { plr.SendClientMessage("The Specified report does not exist"); return(true); } else { plr.SendClientMessage("You have assigned yourself to ticket: " + reportID); lock (CharMgr._report) { report.Assigned = plr.Client._Account.Username; CharMgr.Database.SaveObject(report); CharMgr.Database.ForceSave(); } return(true); } }
public static void F_HELP_DATA(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; if (!cclient.IsPlaying() || !cclient.Plr.IsInWorld()) { return; } Player Plr = cclient.Plr; GameData.HelpType Type = (GameData.HelpType)packet.GetUint8(); switch (Type) { case GameData.HelpType.HELPTYPE_CREATE_APPEAL_VIOLATION_REPORT: // Violation Report case GameData.HelpType.HELPTYPE_CREATE_APPEAL_NAMING_VIOLATION: // Name Violation case GameData.HelpType.HELPTYPE_CREATE_APPEAL_GOLD_SELLER: // Gold Seller { GameData.AppealTopic Category = (GameData.AppealTopic)packet.GetUint8(); ushort ReportTypeSize = packet.GetUint16R(); packet.Skip(2); string ReportType = ""; if (ReportTypeSize > 0) { ReportType = packet.GetString(ReportTypeSize - 1); } packet.Skip(1); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } packet.Skip(1); ushort NameSize = packet.GetUint16R(); packet.Skip(2); string Name = packet.GetString(NameSize - 1); Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; //fix for when someone right clicks chat to report or report spam on mails, because mythic thought it was good to classify these as goldsellers... if (Message.StartsWith("[") || Message.StartsWith($"\n[") || Message.StartsWith($"\n [")) { report.Type = 2; // Violation report report.Category = 4; //Violation report report.ReportType = "General"; //General subcategory of violation report } else { report.Type = (byte)Type; report.Category = (byte)Category; report.ReportType = ReportType; } if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; report.Fields.Add(new KeyValuePair <uint, string>(0, Name.Replace("|", "").Replace(":", ""))); //lets not allow players to report server automated mails if (Message.Contains("[Mail Subject]: Public Quest Loot [Mail Message Body]: You won a Public Quest Loot Bag") || Message.Contains("[Mail Subject]: Medallion Reward [Mail Message Body]: You've received a medallion reward for your realm's victory in a recent battle in which you were a participant.") || Message.Contains(" [Mail Message Body]: Your mail expired and has been returned to you.")) { Plr.SendClientMessage("This is a server generated mail, this ticket will be discarded.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR); break; } CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_MISC, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; case GameData.HelpType.HELPTYPE_CREATE_APPEAL_NON_VALIDATED: // CSR Appeal { GameData.AppealTopic Category = (GameData.AppealTopic)packet.GetUint8(); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } packet.Skip(1); byte FieldsCount = packet.GetUint8(); Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; report.Type = (byte)Type; report.Category = (byte)Category; if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; for (int i = 0; i < FieldsCount; i++) { GameData.HelpField FieldType = (GameData.HelpField)packet.GetUint8(); ushort FieldSize = packet.GetUint16R(); packet.Skip(2); string Field = packet.GetString(FieldSize - 1); packet.Skip(1); report.Fields.Add(new KeyValuePair <uint, string>((byte)FieldType, Field.Replace("|", "").Replace(":", ""))); } CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_MISC, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; case GameData.HelpType.HELPTYPE_CREATE_BUG_REPORT: // Bug Report case GameData.HelpType.HELPTYPE_CREATE_FEEDBACK: // Feedback { byte Category = packet.GetUint8(); ushort MessageSize = packet.GetUint16R(); packet.Skip(2); string Message = ""; if (MessageSize > 0) { Message = packet.GetString(MessageSize - 1); } Bug_report report = new Bug_report(); report.Time = (uint)TCPManager.GetTimeStamp(); report.AccountId = (uint)Plr.Client._Account.AccountId; report.CharacterId = Plr.CharacterId; report.Type = (byte)Type; report.Category = Category; if (Message.Contains(";")) { Message = Message.Replace(';', ':'); } if (Message.Contains("^")) { Message = Message.Replace('^', ' '); } report.Message = Message; report.ZoneId = Plr.Zone.Info.ZoneId; report.X = (ushort)(Plr.X / 64); report.Y = (ushort)(Plr.Y / 64); report.Assigned = "nobody"; CharMgr.Database.AddObject(report); lock (CharMgr._report) CharMgr._report.Add(report); Plr.SendLocalizeString("", ChatLogFilters.CHATLOGFILTERS_USER_ERROR, GameData.Localized_text.TEXT_COPTER_GENERAL_FEEDBACK_SENT); foreach (Player plr in GmMgr.GmList) { plr.SendClientMessage("NEW_TICKET", ChatLogFilters.CHATLOGFILTERS_CHANNEL_9); } } break; } }
/// <summary> /// To answer and close a ticket (answer will be sent as an ingame mail) /// </summary> /// <param name="plr"></param> /// <param name="values"></param> /// <returns></returns> public static bool Answer(Player plr, ref List <string> values) { if (values.Count < 2) { plr.SendClientMessage("Usage: .ticket answer <bugtrackerID> <message>"); return(true); } string reportID = GetString(ref values); string message = GetTotalString(ref values).Trim(); if (string.IsNullOrEmpty(message)) { plr.SendClientMessage("you need to specify a message to send"); return(true); } if (string.IsNullOrEmpty(reportID)) { plr.SendClientMessage("you need to specify the ticketID"); return(true); } Bug_report report = CharMgr.GetReport(reportID); if (report == null) { plr.SendClientMessage("The Specified report does not exist"); return(true); } if (report.Assigned != plr.Client._Account.Username) { plr.SendClientMessage("You cannot answer a ticket not assigned to you(username), assign it to yourself first if you want to answer this ticket"); return(true); } if (CharMgr.GetCharacter(report.CharacterId, false) == null) { plr.SendClientMessage("The player who created this ticket is deleted or has not logged in for over the preload period, as such we cannot send a mail to the character."); return(true); } else { plr.SendClientMessage("You have answered ticket: " + reportID); GMCommandLog log = new GMCommandLog { PlayerName = plr.Client._Account.Username, AccountId = (uint)plr.Client._Account.AccountId, Command = $"Answered Ticket: {reportID} from characterID: {report.CharacterId}. Containing message: {report.Message} {report.FieldSting} with the following reply: {message}", Date = DateTime.Now }; Character chara = CharMgr.GetCharacter(report.CharacterId, false); Character_mail ticketMail = new Character_mail { Guid = CharMgr.GenerateMailGuid(), CharacterId = chara.CharacterId, CharacterIdSender = chara.CharacterId, SenderName = chara.Name, ReceiverName = chara.Name, SendDate = (uint)TCPManager.GetTimeStamp(), Title = "Answered Ticket", Content = $"Your ticket has been answered by: {report.Assigned} with the following message: \n \n {message}", Money = 0, Opened = false }; CharMgr.AddMail(ticketMail); CharMgr.Database.AddObject(log); lock (CharMgr._report) { CharMgr._report.Remove(report); CharMgr.Database.DeleteObject(report); CharMgr.Database.ForceSave(); } return(true); } }