Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Help gossip option #12

Merged
merged 3 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/QueueListCache.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# 1 - Enabled
#

QLC.Enable = 0
QLC.Enable = 1

#
# QLC.Update.Delay
Expand Down
22 changes: 22 additions & 0 deletions data/sql/db-world/NPCQueueList.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DELETE FROM `creature_template` WHERE `entry` = 93080;
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
(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);

DELETE FROM `creature_template_model` WHERE (`CreatureID` = 93080);
INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES
(93080, 0, 28205, 1, 1, 0);

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).";
DELETE FROM `npc_text` WHERE `id`=93081;
INSERT INTO `npc_text` (`id`, `text0_0`, `text0_1`, `Probability0`) VALUES
(93081, @NPC_TEXT_QUEUE, @NPC_TEXT_QUEUE, 1);

-- Command
SET @NPC_QUEUE_COMMAND_DESC = 'Syntax .queue show bg or .queue show arena normal/rated';
DELETE FROM `command` WHERE `name` IN ('queue', 'queue show', 'queue show bg', 'queue show arena', 'queue show arena normal', 'queue show arena rated');
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('queue', 0, @NPC_QUEUE_COMMAND_DESC),
('queue show', 0, @NPC_QUEUE_COMMAND_DESC),
('queue show bg', 0, @NPC_QUEUE_COMMAND_DESC),
('queue show arena normal', 0, @NPC_QUEUE_COMMAND_DESC),
('queue show arena rated', 0, @NPC_QUEUE_COMMAND_DESC);
6 changes: 0 additions & 6 deletions data/sql/db-world/base/NPCQueueList.sql

This file was deleted.

21 changes: 16 additions & 5 deletions src/QueueListNPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ bool QueueListCache_Npc::OnGossipHello(Player* player, Creature* creature)
return true;
}

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

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

switch (uiAction)
{
case SHOW_MAIN_MENU:
OnGossipHello(player, creature);
break;
case SHOW_RATED_ARENA_QUEUES:
sQueueListCache->ShowArenaRated(&handler);
CloseGossipMenuFor(player);
break;
case SHOW_SKIRMISH_ARENA_QUEUES:
sQueueListCache->ShowArenaNonRated(&handler);
CloseGossipMenuFor(player);
break;
case SHOW_BATTLEGROUND_QUEUES:
sQueueListCache->ShowBg(&handler);
CloseGossipMenuFor(player);
break;
case ACTION_HELP:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "<- Back", GOSSIP_SENDER_MAIN, SHOW_MAIN_MENU);
SendGossipMenuFor(player, NPC_TEXT_ENTRY_QUEUE_LIST, creature->GetGUID());
break;
default:
break;
}

CloseGossipMenuFor(player);

return true;
}
6 changes: 5 additions & 1 deletion src/QueueListNPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
#include "ScriptMgr.h"
#include "ScriptedGossip.h"

#define NPC_TEXT_ENTRY_QUEUE_LIST 93081

enum Gossips : uint8
{
SHOW_MAIN_MENU = 0,
SHOW_RATED_ARENA_QUEUES = 1,
SHOW_SKIRMISH_ARENA_QUEUES = 2,
SHOW_BATTLEGROUND_QUEUES = 3
SHOW_BATTLEGROUND_QUEUES = 3,
ACTION_HELP = 4
};

class QueueListCache_Npc : public CreatureScript
Expand Down