-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathQueueListCache_SC.cpp
More file actions
98 lines (82 loc) · 2.53 KB
/
QueueListCache_SC.cpp
File metadata and controls
98 lines (82 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
*/
#include "QueueListCache.h"
#include "Log.h"
#include "ScriptMgr.h"
#include "Config.h"
#include "Chat.h"
#include "QueueListNPC.h"
using namespace Acore::ChatCommands;
class QueueListCache_Command : public CommandScript
{
public:
QueueListCache_Command() : CommandScript("QueueListCache_Command") { }
ChatCommandTable GetCommands() const override
{
static ChatCommandTable queueShowArenaCommandTable = // .queue show arena
{
{ "rated", HandleQueueShowArenaRatedCommand, SEC_PLAYER, Console::Yes },
{ "normal", HandleQueueShowArenaNormalCommand, SEC_PLAYER, Console::Yes }
};
static ChatCommandTable queueShowCommandTable = // .queue show
{
{ "bg", HandleQueueShowBgCommand, SEC_PLAYER, Console::Yes },
{ "arena", queueShowArenaCommandTable }
};
static ChatCommandTable queueCommandTable = // .queue
{
{ "show", queueShowCommandTable }
};
static ChatCommandTable commandTable =
{
{ "queue", queueCommandTable }
};
return commandTable;
}
static bool HandleQueueShowArenaRatedCommand(ChatHandler* handler)
{
sQueueListCache->ShowArenaRated(handler);
return true;
}
static bool HandleQueueShowArenaNormalCommand(ChatHandler* handler)
{
sQueueListCache->ShowArenaNonRated(handler);
return true;
}
static bool HandleQueueShowBgCommand(ChatHandler* handler)
{
sQueueListCache->ShowBg(handler);
return true;
}
};
class QueueListCache_World : public WorldScript
{
public:
QueueListCache_World() : WorldScript("QueueListCache_World", {
WORLDHOOK_ON_BEFORE_CONFIG_LOAD,
WORLDHOOK_ON_STARTUP,
WORLDHOOK_ON_UPDATE
}) { }
void OnBeforeConfigLoad(bool reload) override
{
sQueueListCache->Init(reload);
}
void OnStartup() override
{
LOG_INFO("server.loading", "Loading Queue cache...");
sQueueListCache->Init(false);
}
void OnUpdate(uint32 diff) override
{
sQueueListCache->Update(diff);
}
};
// Group all custom scripts
void AddSC_QueueListCache()
{
new QueueListCache_Command();
new QueueListCache_World();
new QueueListCache_Npc();
}