Skip to content

Commit e6c072f

Browse files
feat: add NPC (#11)
* . * Update QueueListNPC.cpp * . * Update src/QueueListNPC.cpp Co-authored-by: Winfidonarleyan <[email protected]> * Update * Update QueueListNPC.cpp --------- Co-authored-by: Winfidonarleyan <[email protected]>
1 parent df2f4c0 commit e6c072f

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DELETE FROM `creature_template` WHERE `entry` = 93080;
2+
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES
3+
(93080, 0, 0, 0, 0, 0, 'Show Queues', '', 'Speak', 0, 30, 30, 0, 35, 1, 1, 1, 1, 1, 20, 1, 0, 0, 1, 0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 16777218, 'queue_list_npc', 0);
4+
5+
DELETE FROM `creature_template_model` WHERE (`CreatureID` = 93080);
6+
INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES (93080, 0, 28205, 1, 1, 0);

src/QueueListCache_SC.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "ScriptMgr.h"
99
#include "Config.h"
1010
#include "Chat.h"
11+
#include "QueueListNPC.h"
1112

1213
using namespace Acore::ChatCommands;
1314

@@ -89,4 +90,5 @@ void AddSC_QueueListCache()
8990
{
9091
new QueueListCache_Command();
9192
new QueueListCache_World();
93+
new QueueListCache_Npc();
9294
}

src/QueueListNPC.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include "QueueListNPC.h"
2+
#include "QueueListCache.h"
3+
4+
QueueListCache_Npc::QueueListCache_Npc() : CreatureScript("queue_list_npc") { }
5+
6+
bool QueueListCache_Npc::OnGossipHello(Player* player, Creature* creature)
7+
{
8+
if (!player || !creature)
9+
return true;
10+
11+
if (sConfigMgr->GetOption<bool>("QLC.Enable", true) == false)
12+
{
13+
ChatHandler(player->GetSession()).SendSysMessage("NPC disabled!");
14+
return true;
15+
}
16+
17+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_arena_2v2_7:25|t Show Rated Arena queues", GOSSIP_SENDER_MAIN, SHOW_RATED_ARENA_QUEUES);
18+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_arena_2v2_2:25|t Show Skirmish Arena queues", GOSSIP_SENDER_MAIN, SHOW_SKIRMISH_ARENA_QUEUES);
19+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_bg_killxenemies_generalsroom:25|t Show BG queues", GOSSIP_SENDER_MAIN, SHOW_BATTLEGROUND_QUEUES);
20+
21+
player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
22+
return true;
23+
}
24+
25+
bool QueueListCache_Npc::OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
26+
{
27+
if (!player || !creature)
28+
return true;
29+
30+
player->PlayerTalkClass->ClearMenus();
31+
32+
ChatHandler handler(player->GetSession());
33+
34+
switch (uiAction)
35+
{
36+
case SHOW_RATED_ARENA_QUEUES:
37+
sQueueListCache->ShowArenaRated(&handler);
38+
break;
39+
case SHOW_SKIRMISH_ARENA_QUEUES:
40+
sQueueListCache->ShowArenaNonRated(&handler);
41+
break;
42+
case SHOW_BATTLEGROUND_QUEUES:
43+
sQueueListCache->ShowBg(&handler);
44+
break;
45+
}
46+
47+
CloseGossipMenuFor(player);
48+
49+
return true;
50+
}

src/QueueListNPC.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef QUEUE_LIST_NPC_H
2+
#define QUEUE_LIST_NPC_H
3+
4+
#include "Chat.h"
5+
#include "Config.h"
6+
#include "Player.h"
7+
#include "ScriptMgr.h"
8+
#include "ScriptedGossip.h"
9+
10+
enum Gossips : uint8
11+
{
12+
SHOW_RATED_ARENA_QUEUES = 1,
13+
SHOW_SKIRMISH_ARENA_QUEUES = 2,
14+
SHOW_BATTLEGROUND_QUEUES = 3
15+
};
16+
17+
class QueueListCache_Npc : public CreatureScript
18+
{
19+
public:
20+
QueueListCache_Npc();
21+
22+
bool OnGossipHello(Player* player, Creature* creature) override;
23+
bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) override;
24+
};
25+
26+
#endif

0 commit comments

Comments
 (0)