From 53fa27f48ee2903a9b505a37d59f35a73199607a Mon Sep 17 00:00:00 2001 From: Helias Date: Fri, 27 Sep 2024 17:37:36 +0200 Subject: [PATCH 1/3] feat: add Help gossip option --- conf/QueueListCache.conf.dist | 2 +- data/sql/db-world/{base => }/NPCQueueList.sql | 9 +++++++-- src/QueueListNPC.cpp | 15 +++++++++++++-- src/QueueListNPC.h | 6 +++++- 4 files changed, 26 insertions(+), 6 deletions(-) rename data/sql/db-world/{base => }/NPCQueueList.sql (51%) diff --git a/conf/QueueListCache.conf.dist b/conf/QueueListCache.conf.dist index d1b5d64..5c96c2d 100644 --- a/conf/QueueListCache.conf.dist +++ b/conf/QueueListCache.conf.dist @@ -26,7 +26,7 @@ # 1 - Enabled # -QLC.Enable = 0 +QLC.Enable = 1 # # QLC.Update.Delay diff --git a/data/sql/db-world/base/NPCQueueList.sql b/data/sql/db-world/NPCQueueList.sql similarity index 51% rename from data/sql/db-world/base/NPCQueueList.sql rename to data/sql/db-world/NPCQueueList.sql index 00f3345..360f04d 100644 --- a/data/sql/db-world/base/NPCQueueList.sql +++ b/data/sql/db-world/NPCQueueList.sql @@ -1,6 +1,11 @@ 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); +(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); +INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES +(93080, 0, 28205, 1, 1, 0); + +DELETE FROM `npc_text` WHERE `id`=93081; +INSERT INTO `npc_text` (`id`, `text0_0`, `text0_1`, `Probability0`) VALUES +(93081, "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).","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).", 1); diff --git a/src/QueueListNPC.cpp b/src/QueueListNPC.cpp index 64e373a..3710097 100644 --- a/src/QueueListNPC.cpp +++ b/src/QueueListNPC.cpp @@ -17,6 +17,7 @@ bool QueueListCache_Npc::OnGossipHello(Player* player, Creature* creature) 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_CHAT, "|TInterface\\gossipframe\\dailyactivequesticon:16|tHelp", GOSSIP_SENDER_MAIN, ACTION_HELP); player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID()); return true; @@ -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, 11, "<- Back", GOSSIP_SENDER_MAIN, SHOW_MAIN_MENU); + SendGossipMenuFor(player, NPC_TEXT_ENTRY_QUEUE_LIST, creature->GetGUID()); + break; + default: break; } - CloseGossipMenuFor(player); - return true; } diff --git a/src/QueueListNPC.h b/src/QueueListNPC.h index 6f31590..3409dc3 100644 --- a/src/QueueListNPC.h +++ b/src/QueueListNPC.h @@ -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 From 081aba1e5494276966e6b012058b28997255948b Mon Sep 17 00:00:00 2001 From: Helias Date: Fri, 27 Sep 2024 17:41:56 +0200 Subject: [PATCH 2/3] chore: add commands informations, fix #9 --- data/sql/db-world/NPCQueueList.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/data/sql/db-world/NPCQueueList.sql b/data/sql/db-world/NPCQueueList.sql index 360f04d..79ec424 100644 --- a/data/sql/db-world/NPCQueueList.sql +++ b/data/sql/db-world/NPCQueueList.sql @@ -9,3 +9,14 @@ INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, DELETE FROM `npc_text` WHERE `id`=93081; INSERT INTO `npc_text` (`id`, `text0_0`, `text0_1`, `Probability0`) VALUES (93081, "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).","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).", 1); + +SET @NPC_QUEUE_COMMAND_DESC = 'Syntax .queue show bg or .queue show arena normal/rated'; + +-- Command +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); From ffd3dd384166a63623cd6629e073bfa83314b427 Mon Sep 17 00:00:00 2001 From: Helias Date: Sun, 29 Sep 2024 22:27:05 +0200 Subject: [PATCH 3/3] chore: improve gossip option icons --- data/sql/db-world/NPCQueueList.sql | 6 +++--- src/QueueListNPC.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/sql/db-world/NPCQueueList.sql b/data/sql/db-world/NPCQueueList.sql index 79ec424..98d41a3 100644 --- a/data/sql/db-world/NPCQueueList.sql +++ b/data/sql/db-world/NPCQueueList.sql @@ -6,13 +6,13 @@ 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, "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).","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).", 1); - -SET @NPC_QUEUE_COMMAND_DESC = 'Syntax .queue show bg or .queue show arena normal/rated'; +(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), diff --git a/src/QueueListNPC.cpp b/src/QueueListNPC.cpp index 3710097..7a8c302 100644 --- a/src/QueueListNPC.cpp +++ b/src/QueueListNPC.cpp @@ -14,10 +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_CHAT, "|TInterface\\gossipframe\\dailyactivequesticon:16|tHelp", GOSSIP_SENDER_MAIN, ACTION_HELP); + 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; @@ -50,7 +50,7 @@ bool QueueListCache_Npc::OnGossipSelect(Player* player, Creature* creature, uint CloseGossipMenuFor(player); break; case ACTION_HELP: - AddGossipItemFor(player, 11, "<- Back", GOSSIP_SENDER_MAIN, SHOW_MAIN_MENU); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "<- Back", GOSSIP_SENDER_MAIN, SHOW_MAIN_MENU); SendGossipMenuFor(player, NPC_TEXT_ENTRY_QUEUE_LIST, creature->GetGUID()); break; default: