Skip to content
Browse files

Core/Commands: Added '.ticket reset' for resetting ticket-id counter.…

… Author: Bizzy
  • Loading branch information...
1 parent 5db7bf9 commit 4112a0d087aa14654c487433edb95b5d7fceeb0c @Bizzy committed Oct 4, 2011
View
4 sql/updates/world/2011_10_04_00_world_trinity_string.sql
@@ -0,0 +1,4 @@
+DELETE FROM `trinity_string` WHERE `entry` IN(2027,2028);
+INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
+('2027', 'There are pending open tickets, please close them first!'),
+('2028', 'All closed tickets were deleted and counter is reseted to |cffff00ff 1|r');
View
3 sql/updates/world/2011_10_04_01_world_command.sql
@@ -0,0 +1,3 @@
+DELETE FROM `command` WHERE `name` = 'ticket reset';
+INSERT INTO `command` (`name`, `security`, `help`) VALUES
+('ticket reset', 3, 'Syntax: .ticket reset\nRemoves all closed tickets and resets the counter, if no pending open tickets are existing.');
View
1 src/server/game/Chat/Chat.cpp
@@ -318,6 +318,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "closedlist", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGMTicketListClosedCommand>, "", NULL },
{ "escalatedlist", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGMTicketListEscalatedCommand>, "", NULL },
{ "delete", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGMTicketDeleteByIdCommand>, "", NULL },
+ { "reset", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGMTicketResetCommand>, "", NULL },
{ "assign", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGMTicketAssignToCommand>, "", NULL },
{ "unassign", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGMTicketUnAssignCommand>, "", NULL },
{ "comment", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGMTicketCommentCommand>, "", NULL },
View
1 src/server/game/Chat/Chat.h
@@ -317,6 +317,7 @@ class ChatHandler
bool HandleGMTicketUnAssignCommand(const char* args);
bool HandleGMTicketCommentCommand(const char* args);
bool HandleGMTicketDeleteByIdCommand(const char* args);
+ bool HandleGMTicketResetCommand(const char* /* args */);
bool HandleGMTicketReloadCommand(const char*);
bool HandleToggleGMTicketSystem(const char* args);
bool HandleGMTicketEscalateCommand(const char* args);
View
16 src/server/game/Chat/Commands/TicketCommands.cpp
@@ -320,6 +320,22 @@ bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args)
return true;
}
+bool ChatHandler::HandleGMTicketResetCommand(const char* /* args */)
+{
+ if (sTicketMgr->GetOpenTicketCount() > 0)
+ {
+ SendSysMessage(LANG_COMMAND_TICKETPENDING);
+ return true;
+ }
+ else
+ {
+ sTicketMgr->ResetTickets();
+ SendSysMessage(LANG_COMMAND_TICKETRESET);
+ }
+
+ return true;
+}
+
bool ChatHandler::HandleToggleGMTicketSystem(const char* /* args */)
{
bool status = !sTicketMgr->GetStatus();
View
2 src/server/game/Miscellaneous/Language.h
@@ -911,6 +911,8 @@ enum TrinityStrings
LANG_COMMAND_TICKETLISTADDCOMMENT = 2024,
LANG_COMMAND_TICKETLISTAGECREATE = 2025,
LANG_COMMAND_TICKETSHOWESCALATEDLIST = 2026,
+ LANG_COMMAND_TICKETPENDING = 2027,
+ LANG_COMMAND_TICKETRESET = 2028,
// Trinity strings 5000-9999
LANG_COMMAND_FREEZE = 5000,
View
10 src/server/game/Tickets/TicketMgr.cpp
@@ -200,6 +200,16 @@ TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _ope
void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); }
+void TicketMgr::ResetTickets()
+{
+ for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
+ if (itr->second->IsClosed())
+ sTicketMgr->RemoveTicket(itr->second->GetId());
+
+ _lastTicketId = 0;
+ CharacterDatabase.PExecute("TRUNCATE TABLE gm_tickets");
+}
+
void TicketMgr::LoadTickets()
{
uint32 oldMSTime = getMSTime();
View
1 src/server/game/Tickets/TicketMgr.h
@@ -213,6 +213,7 @@ class TicketMgr
uint32 GetNextSurveyID() { return ++_lastSurveyId; }
void Initialize();
+ void ResetTickets();
void ShowList(ChatHandler& handler, bool onlineOnly) const;
void ShowClosedList(ChatHandler& handler) const;

2 comments on commit 4112a0d

@pointerxr

XD this is useless you can easily type .reload gm_tickets and counter would reset, too^^

@Expecto
Expecto commented on 4112a0d Oct 5, 2011

Well Done

Please sign in to comment.
Something went wrong with that request. Please try again.