aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2019-07-16 15:04:14 +0200
committerTreeston <treeston.mmoc@gmail.com>2019-07-16 15:04:14 +0200
commit293ba08d21c4e9634229bb5015445ecc0cc08fef (patch)
tree625d2a1581762a6b1171d0860a06c9208ee9e500
parent2c1b87ca298bce37405329b3af0b5e375f4e53ef (diff)
Scripts/Commands: Add .debug questreset to force daily/weekly/monthly quest reset.
-rw-r--r--sql/base/auth_database.sql23
-rw-r--r--sql/updates/auth/3.3.5/2019_07_16_00_auth.sql6
-rw-r--r--sql/updates/world/3.3.5/2019_07_16_00_world.sql7
-rw-r--r--src/server/game/Accounts/RBAC.h1
-rw-r--r--src/server/game/World/World.h2
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp40
6 files changed, 69 insertions, 10 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql
index f714714f6a7..58d7daf859c 100644
--- a/sql/base/auth_database.sql
+++ b/sql/base/auth_database.sql
@@ -774,6 +774,7 @@ INSERT INTO `rbac_linked_permissions` VALUES
(196,875),
(196,876),
(196,877),
+(196,878),
(197,232),
(197,236),
(197,237),
@@ -1656,7 +1657,8 @@ INSERT INTO `rbac_permissions` VALUES
(874,'Command: debug asan'),
(875,'Command: lookup map id'),
(876,'Command: lookup item id'),
-(877,'Command: lookup quest id');
+(877,'Command: lookup quest id'),
+(878,'Command: debug questreset');
/*!40000 ALTER TABLE `rbac_permissions` ENABLE KEYS */;
UNLOCK TABLES;
@@ -1786,15 +1788,16 @@ INSERT INTO `updates` VALUES
('2018_09_06_00_auth.sql','309D21E0DF82ED8921F77EAFDE741F38AC32BB13','ARCHIVED','2018-09-06 00:00:00',0),
('2018_09_17_00_auth.sql','4DB671F0A4FA1A93AF28FB6426AF13DE72C7DA3D','ARCHIVED','2018-09-17 00:00:00',0),
('2018_12_30_00_auth.sql','680F4F9194FC37592041C2DB5B2B7006B14E836D','ARCHIVED','2018-12-30 00:00:00',0),
-('2019_03_19_00_auth.sql','03BA8CFC60ACD5B874840A3E50F11CD2643730A0','ARCHIVED','2019-03-19 07:17:45',0),
-('2019_04_15_00_auth.sql','EC67389946A24BFAA226B9DFCFEDB3BA095B4C42','ARCHIVED','2019-04-15 06:16:09',0),
-('2019_04_27_00_auth.sql','84B1EB9CC9B09BAF55E6295D202EC57D99B1B60E','ARCHIVED','2019-04-27 18:07:18',0),
-('2019_05_15_00_auth.sql','8A7B96E66D689DA63380654142FF60A1EE938697','ARCHIVED','2019-05-15 06:13:20',0),
-('2019_06_06_00_auth.sql','6DE8159E04BEE7BA0A4A81D72D160EB74934B6A5','ARCHIVED','2019-06-06 18:09:54',0),
-('2019_06_15_00_auth.sql','456B92D99FFD2E7B6CBF64F4C68555A42B24B298','ARCHIVED','2019-06-15 07:33:45',0),
-('2019_06_16_00_auth.sql','B14AED4D3387B56FF8C8161D3671750AEEAE0F2E','ARCHIVED','2019-06-15 23:32:12',0),
-('2019_06_21_00_auth.sql','C519239830204B68E710F698BC0C9E89B6D5FD24','ARCHIVED','2019-06-20 19:43:50',0),
-('2019_07_15_00_auth.sql','64B491CD197A4466D7F739D67DD30C9502FF393A','ARCHIVED','2019-07-15 05:57:41',5);
+('2019_03_19_00_auth.sql','03BA8CFC60ACD5B874840A3E50F11CD2643730A0','ARCHIVED','2019-03-19 00:00:00',0),
+('2019_04_15_00_auth.sql','EC67389946A24BFAA226B9DFCFEDB3BA095B4C42','ARCHIVED','2019-04-15 00:00:00',0),
+('2019_04_27_00_auth.sql','84B1EB9CC9B09BAF55E6295D202EC57D99B1B60E','ARCHIVED','2019-04-27 00:00:00',0),
+('2019_05_15_00_auth.sql','8A7B96E66D689DA63380654142FF60A1EE938697','ARCHIVED','2019-05-15 00:00:00',0),
+('2019_06_06_00_auth.sql','6DE8159E04BEE7BA0A4A81D72D160EB74934B6A5','ARCHIVED','2019-06-06 00:00:00',0),
+('2019_06_15_00_auth.sql','456B92D99FFD2E7B6CBF64F4C68555A42B24B298','ARCHIVED','2019-06-15 00:00:00',0),
+('2019_06_16_00_auth.sql','B14AED4D3387B56FF8C8161D3671750AEEAE0F2E','ARCHIVED','2019-06-16 00:00:00',0),
+('2019_06_21_00_auth.sql','C519239830204B68E710F698BC0C9E89B6D5FD24','ARCHIVED','2019-06-21 00:00:00',0),
+('2019_07_15_00_auth.sql','64B491CD197A4466D7F739D67DD30C9502FF393A','ARCHIVED','2019-07-15 00:00:00',0),
+('2019_07_16_00_auth.sql','36CB53A9EBD64BFDCF7030083E36E534F1753773','ARCHIVED','2019-07-16 00:00:00',0);
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/sql/updates/auth/3.3.5/2019_07_16_00_auth.sql b/sql/updates/auth/3.3.5/2019_07_16_00_auth.sql
new file mode 100644
index 00000000000..bbec0eb65aa
--- /dev/null
+++ b/sql/updates/auth/3.3.5/2019_07_16_00_auth.sql
@@ -0,0 +1,6 @@
+--
+DELETE FROM `rbac_permissions` WHERE `id`=878;
+INSERT INTO `rbac_permissions` (`id`,`name`) VALUES (878, 'Command: debug questreset');
+
+DELETE FROM `rbac_linked_permissions` WHERE `linkedId`=878;
+INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES (196,878);
diff --git a/sql/updates/world/3.3.5/2019_07_16_00_world.sql b/sql/updates/world/3.3.5/2019_07_16_00_world.sql
new file mode 100644
index 00000000000..e61738a3eaa
--- /dev/null
+++ b/sql/updates/world/3.3.5/2019_07_16_00_world.sql
@@ -0,0 +1,7 @@
+--
+DELETE FROM `command` WHERE `name`='debug questreset';
+INSERT INTO `command` (`name`,`permission`,`help`) VALUES
+('debug questreset',878,'Syntax: .debug questreset <daily/weekly/monthly/all>
+
+Performs quest reset procedure for the specified type (or all types).
+Quest pools will be re-generated, and quest completion status will be reset.');
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index 94e9aa7463c..58f4db7afe1 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -775,6 +775,7 @@ enum RBACPermissions
RBAC_PERM_COMMAND_LOOKUP_MAP_ID = 875,
RBAC_PERM_COMMAND_LOOKUP_ITEM_ID = 876,
RBAC_PERM_COMMAND_LOOKUP_QUEST_ID = 877,
+ RBAC_PERM_COMMAND_DEBUG_QUESTRESET = 878,
//
// IF YOU ADD NEW PERMISSIONS, ADD THEM IN MASTER BRANCH AS WELL!
//
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 502c913ad30..a8dd0dfe04f 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -880,6 +880,8 @@ class TC_GAME_API World
bool _guidAlert;
uint32 _warnDiff;
time_t _warnShutdownTime;
+
+ friend class debug_commandscript;
};
TC_GAME_API extern Realm realm;
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 65971bc1200..fba83d2edfb 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "BattlegroundMgr.h"
#include "CellImpl.h"
#include "Chat.h"
+#include "GameTime.h"
#include "GossipDef.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
@@ -46,6 +47,7 @@ EndScriptData */
#include <map>
#include <set>
+using namespace Trinity::ChatCommands;
class debug_commandscript : public CommandScript
{
public:
@@ -116,6 +118,7 @@ public:
{ "dummy", rbac::RBAC_PERM_COMMAND_DEBUG_DUMMY, false, &HandleDebugDummyCommand, "" },
{ "asan", rbac::RBAC_PERM_COMMAND_DEBUG_ASAN, true, nullptr, "", debugAsanCommandTable },
{ "guidlimits", rbac::RBAC_PERM_COMMAND_DEBUG, true, &HandleDebugGuidLimitsCommand, "" },
+ { "questreset", rbac::RBAC_PERM_COMMAND_DEBUG_QUESTRESET, true, &HandleDebugQuestResetCommand, "" }
};
static std::vector<ChatCommand> commandTable =
{
@@ -1698,6 +1701,43 @@ public:
return true;
}
+ static bool HandleDebugQuestResetCommand(ChatHandler* handler, std::string arg)
+ {
+ if (!Utf8ToUpperOnlyLatin(arg))
+ return false;
+
+ bool daily = false, weekly = false, monthly = false;
+ if (arg == "ALL")
+ daily = weekly = monthly = true;
+ else if (arg == "DAILY")
+ daily = true;
+ else if (arg == "WEEKLY")
+ weekly = true;
+ else if (arg == "MONTHLY")
+ monthly = true;
+ else
+ return false;
+
+ time_t const now = GameTime::GetGameTime();
+ if (daily)
+ {
+ sWorld->m_NextDailyQuestReset = now;
+ handler->SendSysMessage("Daily quest reset scheduled for next tick.");
+ }
+ if (weekly)
+ {
+ sWorld->m_NextWeeklyQuestReset = now;
+ handler->SendSysMessage("Weekly quest reset scheduled for next tick.");
+ }
+ if (monthly)
+ {
+ sWorld->m_NextMonthlyQuestReset = now;
+ handler->SendSysMessage("Monthly quest reset scheduled for next tick.");
+ }
+
+ return true;
+ }
+
static bool HandleDebugNearGraveyard(ChatHandler* handler, char const* args)
{
Player* player = handler->GetSession()->GetPlayer();