Skip to content

Commit 426ff49

Browse files
authored
feat: add Help gossip option (#12)
* feat: add Help gossip option * chore: add commands informations, fix #9 * chore: improve gossip option icons
1 parent e6c072f commit 426ff49

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

conf/QueueListCache.conf.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# 1 - Enabled
2727
#
2828

29-
QLC.Enable = 0
29+
QLC.Enable = 1
3030

3131
#
3232
# QLC.Update.Delay

data/sql/db-world/NPCQueueList.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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
7+
(93080, 0, 28205, 1, 1, 0);
8+
9+
SET @NPC_TEXT_QUEUE="This NPC lets you display all active battleground or arena queues (if any). $B$BAlternatively, you can check the queues without interacting with the NPC by using the following commands: $B$B.queue show bg $B$B.queue show arena normal $B$B.queue show arena rated $B$BNote that the queue doesn't update in real-time; it refreshes periodically (by default every 5 seconds).";
10+
DELETE FROM `npc_text` WHERE `id`=93081;
11+
INSERT INTO `npc_text` (`id`, `text0_0`, `text0_1`, `Probability0`) VALUES
12+
(93081, @NPC_TEXT_QUEUE, @NPC_TEXT_QUEUE, 1);
13+
14+
-- Command
15+
SET @NPC_QUEUE_COMMAND_DESC = 'Syntax .queue show bg or .queue show arena normal/rated';
16+
DELETE FROM `command` WHERE `name` IN ('queue', 'queue show', 'queue show bg', 'queue show arena', 'queue show arena normal', 'queue show arena rated');
17+
INSERT INTO `command` (`name`, `security`, `help`) VALUES
18+
('queue', 0, @NPC_QUEUE_COMMAND_DESC),
19+
('queue show', 0, @NPC_QUEUE_COMMAND_DESC),
20+
('queue show bg', 0, @NPC_QUEUE_COMMAND_DESC),
21+
('queue show arena normal', 0, @NPC_QUEUE_COMMAND_DESC),
22+
('queue show arena rated', 0, @NPC_QUEUE_COMMAND_DESC);

data/sql/db-world/base/NPCQueueList.sql

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/QueueListNPC.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ bool QueueListCache_Npc::OnGossipHello(Player* player, Creature* creature)
1414
return true;
1515
}
1616

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);
17+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_arena_2v2_7:30:30:-20:0|t Show Rated Arena queues", GOSSIP_SENDER_MAIN, SHOW_RATED_ARENA_QUEUES);
18+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_arena_2v2_2:30:30:-20:0|t Show Skirmish Arena queues", GOSSIP_SENDER_MAIN, SHOW_SKIRMISH_ARENA_QUEUES);
19+
AddGossipItemFor(player, GOSSIP_ICON_BATTLE, "|TInterface\\icons\\Achievement_bg_killxenemies_generalsroom:30:30:-20:0|t Show BG queues", GOSSIP_SENDER_MAIN, SHOW_BATTLEGROUND_QUEUES);
20+
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "|TInterface/ICONS/inv_misc_questionmark:30:30:-20:0|t Help", GOSSIP_SENDER_MAIN, ACTION_HELP);
2021

2122
player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
2223
return true;
@@ -33,18 +34,28 @@ bool QueueListCache_Npc::OnGossipSelect(Player* player, Creature* creature, uint
3334

3435
switch (uiAction)
3536
{
37+
case SHOW_MAIN_MENU:
38+
OnGossipHello(player, creature);
39+
break;
3640
case SHOW_RATED_ARENA_QUEUES:
3741
sQueueListCache->ShowArenaRated(&handler);
42+
CloseGossipMenuFor(player);
3843
break;
3944
case SHOW_SKIRMISH_ARENA_QUEUES:
4045
sQueueListCache->ShowArenaNonRated(&handler);
46+
CloseGossipMenuFor(player);
4147
break;
4248
case SHOW_BATTLEGROUND_QUEUES:
4349
sQueueListCache->ShowBg(&handler);
50+
CloseGossipMenuFor(player);
51+
break;
52+
case ACTION_HELP:
53+
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "<- Back", GOSSIP_SENDER_MAIN, SHOW_MAIN_MENU);
54+
SendGossipMenuFor(player, NPC_TEXT_ENTRY_QUEUE_LIST, creature->GetGUID());
55+
break;
56+
default:
4457
break;
4558
}
4659

47-
CloseGossipMenuFor(player);
48-
4960
return true;
5061
}

src/QueueListNPC.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
#include "ScriptMgr.h"
88
#include "ScriptedGossip.h"
99

10+
#define NPC_TEXT_ENTRY_QUEUE_LIST 93081
11+
1012
enum Gossips : uint8
1113
{
14+
SHOW_MAIN_MENU = 0,
1215
SHOW_RATED_ARENA_QUEUES = 1,
1316
SHOW_SKIRMISH_ARENA_QUEUES = 2,
14-
SHOW_BATTLEGROUND_QUEUES = 3
17+
SHOW_BATTLEGROUND_QUEUES = 3,
18+
ACTION_HELP = 4
1519
};
1620

1721
class QueueListCache_Npc : public CreatureScript

0 commit comments

Comments
 (0)