From a004f5a4590b5d41cbc79bc06b73f8715c0224c0 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Wed, 27 Mar 2024 04:24:37 -0300 Subject: [PATCH] Fix. Bug with buffs (#29) Co-authored-by: MrLavender <2496738+MrLavender@users.noreply.github.com> --- conf/npc_buffer.conf.dist | 221 ++++++++++++++++------------ data/sql/db-world/npc_buffer.sql | 40 ----- data/sql/db-world/npc_buffer_00.sql | 37 +++++ data/sql/db-world/npc_buffer_01.sql | 1 + src/npc_buffer.cpp | 65 ++++---- 5 files changed, 190 insertions(+), 174 deletions(-) delete mode 100644 data/sql/db-world/npc_buffer.sql create mode 100644 data/sql/db-world/npc_buffer_00.sql create mode 100644 data/sql/db-world/npc_buffer_01.sql diff --git a/conf/npc_buffer.conf.dist b/conf/npc_buffer.conf.dist index 554b8a4..14a31f9 100644 --- a/conf/npc_buffer.conf.dist +++ b/conf/npc_buffer.conf.dist @@ -1,88 +1,111 @@ [worldserver] -################################################################################################### -# BUFFER NPC -################################################################################################### - -# ------------------------------------------------------------------------------------- -# Enable the module -# Enable : 1 -# Disable: 0 -# ------------------------------------------------------------------------------------- + +# +# Buff.Enable +# Description: Enable or disable the module. +# Default: 1 (Enable) +# Value: +# 1 (Enable) +# 0 (Disable) +# + Buff.Enable = 1 -# ------------------------------------------------------------------------------------- -# Announce the module when the player logs in? -# Enable : 1 -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.Announce +# Description: Announce the module when the player logs in? +# Default: 1 (Enable) +# Value: +# 1 (Enable) +# 0 (Disable) +# + Buff.Announce = 1 -# ------------------------------------------------------------------------------------- -# Cure Resurrection Sickness? -# Enable : 1 -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.CureRes +# Description: Remove Resurrection Sickness? ID: 15007 +# Default: 1 (Enable) +# Value: +# 1 (Enable) +# 0 (Disable) +# + Buff.CureRes = 1 -# ------------------------------------------------------------------------------------- -# Limit buffs by level -# Enable : 1 -# Disabled: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.ByLevel +# Description: Limit buffs by level +# Default: 1 (Enable) +# Value: +# 1 (Enable) +# 0 (Disable) +# + Buff.ByLevel = 1 -# ------------------------------------------------------------------------------------- -# Buff Defaults (Leave blank to disable a buff) -# This function is not active if Buff.ByLevel = 1 -# -# 1. Prayer of Fortitude (48162) -# 2. Greater Blessing of Kings (43223) -# 3. Mark of the Wild (48469) -# 4. Prayer of Spirit (48074) -# 5. Prayer of Shadow Protection (48170) -# 6. Arcane Intellect (36880) -# -# Fun Stuff -# 48612 (Dalron the Controller) -# ------------------------------------------------------------------------------------- -Buff.Spells = "48162;43223;48469;48074;48170;36880;" - -# ------------------------------------------------------------------------------------- -# How often does the NPC emote in milliseconds? -# Randomly caclulated within range 60000 (1 min, minumum) to 3000000 (5 minutes, max) -# Default: 60000 (1 minutes, minimum) -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.Spells +# Description: Buff Defaults (Leave blank to disable a buff) +# This function is not active if Buff.ByLevel = 1 +# +# 1. Prayer of Fortitude (48162) +# 2. Greater Blessing of Kings (43223) +# 3. Mark of the Wild (48469) +# 4. Prayer of Spirit (48074) +# 5. Prayer of Shadow Protection (48170) +# 6. Arcane Intellect (42995) +# +# Fun Stuff +# 48612 (Dalron the Controller) +# + +Buff.Spells = "48162;43223;48469;48074;48170;42995;" + +# +# Buff.MessageTimer +# Description: How often does the NPC emote in milliseconds? +# Randomly caclulated within range 60000 (1 min, minumum) to 3000000 (5 minutes, max) +# Default: 60000 (1 minutes, minimum) +# Disable: 0 +# + Buff.MessageTimer = 60000 -# ------------------------------------------------------------------------------------- -# How many pharases does the NPC have? -# Default: 3 -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.NumPhrases +# Description: How many pharases does the NPC have? +# Default: 4 +# Disable: 0 +# + Buff.NumPhrases = 4 -# ------------------------------------------------------------------------------------- -# NPC Phrases - Add your own! -# Spoken randomly to the world -# ------------------------------------------------------------------------------------- +# +# NPC Phrases - Add your own! +# Spoken randomly to the world +# + BF.P1 = "Come get buffed, taste my stuff, the elven females can't get enuff!" BF.P2 = "She never shook the stars from the swirling cosmos, but she loved good tauren and rode good kodos." BF.P3 = "Mr. Grubbs is the toughest grub around. No doubt about it." BF.P4 = "Those trolls sure now how to dance! I hear they like to party in the mountains of Darkshore." -# ------------------------------------------------------------------------------------- -# How many whispers does the NPC have? -# Default: 3 -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.NumWhispers +# Description: How many whispers does the NPC have? +# Default: 10 +# Disable: 0 +# + Buff.NumWhispers = 10 -# ------------------------------------------------------------------------------------- -# NPC Whisper Phrases - Add your own! -# Whispered to the player after interaction -# Use '%s%' to include the player's name -# ------------------------------------------------------------------------------------- +# +# NPC Whisper Phrases - Add your own! +# Whispered to the player after interaction +# Use '%s%' to include the player's name +# + BF.W1 = "Koiter's spirit stands watch looking out over the Barrens. Have you visted the shrine yet %s?" BF.W2 = "The king's bones are still there. Everlasting in the dust. The weapons are there too.. if you know where to look %s." BF.W3 = "Oh %s, how I miss those days in the wastes.. watching the sun set over Nagrand." @@ -94,38 +117,42 @@ BF.W8 = "Indeed.. %s. The dwarves keep many secrets about that which lies beyond BF.W9 = "A little bit of this.. a dab of that.. ahh.. there we go %s." BF.W10 = "No %s, I never did hear if they found the children that disappeared from Nagrand and Zangarmarsh." -# ------------------------------------------------------------------------------------- -# The spell cast to get the player's attention -# Default: 44940 -# Disable: 0 -# ------------------------------------------------------------------------------------- +# +# Buff.EmoteSpell +# Description: The spell cast to get the player's attention +# Default: 44940 +# Disable: 0 +# + Buff.EmoteSpell = 0 -# ------------------------------------------------------------------------------------- -# The gesture the NPC performs when speaking emote text -# Default: 3 (Wave) -# Disable: 0 -# ------------------------------------------------------------------------------------- -# 0 - NONE -# 1 - TALK -# 2 - BOW -# 3 - WAVE -# 4 - CHEER -# 5 - EXCLAMATION -# 6 - QUESTION -# 7 - EAT -# 11 - LAUGH -# 14 - RUDE -# 15 - ROAR -# 16 - KNEEL -# 17 - KISS -# 18 - CRY -# 19 - CHICKEN -# 20 - BEG -# 21 - APPLAUD -# 22 - SHOUT -# 23 - FLEX -# 24 - SHY -# 25 - POINT -# ------------------------------------------------------------------------------------- +# +# Buff.EmoteCommand +# Description: The gesture the NPC performs when speaking emote text +# Default: 3 (Wave) +# Disable: 0 +# +# 0 - NONE +# 1 - TALK +# 2 - BOW +# 3 - WAVE +# 4 - CHEER +# 5 - EXCLAMATION +# 6 - QUESTION +# 7 - EAT +# 11 - LAUGH +# 14 - RUDE +# 15 - ROAR +# 16 - KNEEL +# 17 - KISS +# 18 - CRY +# 19 - CHICKEN +# 20 - BEG +# 21 - APPLAUD +# 22 - SHOUT +# 23 - FLEX +# 24 - SHY +# 25 - POINT +# + Buff.EmoteCommand = 3 diff --git a/data/sql/db-world/npc_buffer.sql b/data/sql/db-world/npc_buffer.sql deleted file mode 100644 index 600d6aa..0000000 --- a/data/sql/db-world/npc_buffer.sql +++ /dev/null @@ -1,40 +0,0 @@ --- -------------------------------------------------------------------------------------- --- BUFFER - 601016 --- -------------------------------------------------------------------------------------- -SET -@Entry := 601016, --- Alliance Version --- @Model := 4309, -- Human Male Tuxedo --- @Name := "Bruce Buffer", --- @Title := "Ph.D.", --- Horde Version -@Model := 14612, -- Tauren Warmaster -@Name := "Buffmaster Hasselhoof", -@Title := "", -@Icon := "Speak", -@GossipMenu := 0, -@MinLevel := 80, -@MaxLevel := 80, -@Faction := 35, -@NPCFlag := 80, -@Scale := 1.0, -@Rank := 0, -@Type := 7, -@TypeFlags := 0, -@FlagsExtra := 2, -@AIName := "SmartAI", -@Script := "buff_npc"; - --- NPC -DELETE FROM creature_template WHERE entry = @Entry; -INSERT INTO creature_template (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `unit_class`, `unit_flags`, `type`, `type_flags`, `RegenHealth`, `flags_extra`, `AiName`, `ScriptName`) VALUES -(@Entry, @Model, @Name, @Title, @Icon, @GossipMenu, @MinLevel, @MaxLevel, @Faction, @NPCFlag, 1, 1.14286, @Scale, @Rank, 1, 2, @Type, @TypeFlags, 1, @FlagsExtra, @AIName, @Script); - --- NPC EQUIPPED -DELETE FROM `creature_equip_template` WHERE `CreatureID`=@Entry AND `ID`=1; -INSERT INTO `creature_equip_template` VALUES (@Entry, 1, 1906, 0, 0, 18019); -- War Axe(14824), Torch - --- creatture_template_movement -DELETE FROM `creature_template_movement` WHERE `CreatureId` IN (@Entry); -INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`, `InteractionPauseTimer`) VALUES -(@Entry, 1, 1, 0, 0, 0, 0, NULL); diff --git a/data/sql/db-world/npc_buffer_00.sql b/data/sql/db-world/npc_buffer_00.sql new file mode 100644 index 0000000..4fb20ac --- /dev/null +++ b/data/sql/db-world/npc_buffer_00.sql @@ -0,0 +1,37 @@ +-- -------------------------------------------------------------------------------------- +-- BUFFER - 601016 +-- -------------------------------------------------------------------------------------- +SET +@Entry := 601016, +@Model := 14612, -- Tauren Warmaster +@Name := "Buffmaster Hasselhoof", +@Title := "", +@Icon := "Speak", +@GossipMenu := 0, +@MinLevel := 80, +@MaxLevel := 80, +@Faction := 35, +@NPCFlag := 80, +@Scale := 1.0, +@Rank := 0, +@Type := 7, +@TypeFlags := 0, +@FlagsExtra := 2, +@AIName := "SmartAI", +@Script := "buff_npc"; + +-- NPC +DELETE FROM `creature_template` WHERE `entry`=@Entry; +INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `unit_class`, `unit_flags`, `type`, `type_flags`, `RegenHealth`, `flags_extra`, `AiName`, `ScriptName`) VALUES +(@Entry, @Model, @Name, @Title, @Icon, @GossipMenu, @MinLevel, @MaxLevel, @Faction, @NPCFlag, 1, 1.14286, @Scale, @Rank, 1, 2, @Type, @TypeFlags, 1, @FlagsExtra, @AIName, @Script); + +-- NPC EQUIPPED +-- War Axe(14824), Torch +DELETE FROM `creature_equip_template` WHERE `CreatureID`=@Entry AND `ID`=1; +INSERT INTO `creature_equip_template` VALUES +(@Entry, 1, 1906, 0, 0, 18019); + +-- creatture_template_movement +DELETE FROM `creature_template_movement` WHERE `CreatureId`=@Entry; +INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`, `InteractionPauseTimer`) VALUES +(@Entry, 1, 1, 0, 0, 0, 0, NULL); diff --git a/data/sql/db-world/npc_buffer_01.sql b/data/sql/db-world/npc_buffer_01.sql new file mode 100644 index 0000000..bccbdc5 --- /dev/null +++ b/data/sql/db-world/npc_buffer_01.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `npcflag`=`npcflag`|1 WHERE `entry`=601016; diff --git a/src/npc_buffer.cpp b/src/npc_buffer.cpp index 3bdef06..15aa30a 100644 --- a/src/npc_buffer.cpp +++ b/src/npc_buffer.cpp @@ -174,7 +174,7 @@ class buff_npc : public CreatureScript return randMsg.c_str(); } - bool OnGossipSelect(Player *player, Creature *creature, uint32 /*uiSender*/, uint32 /* uiAction */) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 /* uiAction */) { if (!BFEnableModule) { @@ -187,7 +187,7 @@ class buff_npc : public CreatureScript uint32 PlayerLevel = player->getLevel(); // Store Buff IDs - std::vector vecBuffs; + std::vector vecBuffs = {}; std::stringstream ss(sConfigMgr->GetOption("Buff.Spells", "")); for (std::string buff; std::getline(ss, buff, ';');) { @@ -213,14 +213,12 @@ class buff_npc : public CreatureScript player->CastSpell(player, 21562, true); // Prayer of Fortitude (Rank 1) player->CastSpell(player, 1126, true); // Mark of the Wild (Rank 1) player->CastSpell(player, 27683, true); // Prayer of Shadow Protection (Rank 1) - } // 1-9 else if (PlayerLevel >= 10 && PlayerLevel < 20) { player->CastSpell(player, 21562, true); // Prayer of Fortitude (Rank 1) player->CastSpell(player, 1126, true); // Mark of the Wild (Rank 1) player->CastSpell(player, 27683, true); // Prayer of Shadow Protection (Rank 1) - } // 10-19 else if (PlayerLevel >= 20 && PlayerLevel < 30) { @@ -228,7 +226,6 @@ class buff_npc : public CreatureScript player->CastSpell(player, 1126, true); // Mark of the Wild (Rank 1) player->CastSpell(player, 27683, true); // Prayer of Shadow Protection (Rank 1) player->CastSpell(player, 13326, true); // Arcane Intellect (Rank 1) - } // 20-29 else if (PlayerLevel >= 30 && PlayerLevel < 40) { @@ -238,56 +235,50 @@ class buff_npc : public CreatureScript player->CastSpell(player, 27681, true); // Prayer of Spirit (Rank 1) player->CastSpell(player, 27683, true); // Prayer of Shadow Protection (Rank 1) player->CastSpell(player, 13326, true); // Arcane Intellect (Rank 1) - } // 30-39 else if (PlayerLevel >= 40 && PlayerLevel < 50) { player->CastSpell(player, 21562, true); // Prayer of Fortitude (Rank 1) - player->CastSpell(player, vecBuffs[3], true); // Mark of the Wild(48469) + player->CastSpell(player, vecBuffs[2], true); // Mark of the Wild(48469) player->CastSpell(player, 27681, true); // Prayer of Spirit (Rank 1) - player->CastSpell(player, vecBuffs[5], true); // Prayer of Shadow Protection(48170) + player->CastSpell(player, vecBuffs[4], true); // Prayer of Shadow Protection(48170) player->CastSpell(player, 13326, true); // Arcane Intellect (Rank 1) - } // 40-49 else if (PlayerLevel >= 50 && PlayerLevel < 60) { - player->CastSpell(player, vecBuffs[1], true); // Prayer of Fortitude(48162) - player->CastSpell(player, vecBuffs[2], true); // Greater Blessing of Kings(43223) - player->CastSpell(player, vecBuffs[3], true); // Mark of the Wild(48469) - player->CastSpell(player, vecBuffs[4], true); // Prayer of Spirit(48074) - player->CastSpell(player, vecBuffs[5], true); // Prayer of Shadow Protection(48170) - player->CastSpell(player, vecBuffs[6], true); // Arcane Intellect(36880) - + player->CastSpell(player, vecBuffs[0], true); // Prayer of Fortitude(48162) + player->CastSpell(player, vecBuffs[1], true); // Greater Blessing of Kings(43223) + player->CastSpell(player, vecBuffs[2], true); // Mark of the Wild(48469) + player->CastSpell(player, vecBuffs[3], true); // Prayer of Spirit(48074) + player->CastSpell(player, vecBuffs[4], true); // Prayer of Shadow Protection(48170) + player->CastSpell(player, vecBuffs[5], true); // Arcane Intellect(42995) } // 50-59 else if (PlayerLevel >= 60 && PlayerLevel < 70) { - player->CastSpell(player, vecBuffs[1], true); // Prayer of Fortitude(48162) - player->CastSpell(player, vecBuffs[2], true); // Greater Blessing of Kings(43223) - player->CastSpell(player, vecBuffs[3], true); // Mark of the Wild(48469) - player->CastSpell(player, vecBuffs[4], true); // Prayer of Spirit(48074) - player->CastSpell(player, vecBuffs[5], true); // Prayer of Shadow Protection(48170) - player->CastSpell(player, vecBuffs[6], true); // Arcane Intellect(36880) - + player->CastSpell(player, vecBuffs[0], true); // Prayer of Fortitude(48162) + player->CastSpell(player, vecBuffs[1], true); // Greater Blessing of Kings(43223) + player->CastSpell(player, vecBuffs[2], true); // Mark of the Wild(48469) + player->CastSpell(player, vecBuffs[3], true); // Prayer of Spirit(48074) + player->CastSpell(player, vecBuffs[4], true); // Prayer of Shadow Protection(48170) + player->CastSpell(player, vecBuffs[5], true); // Arcane Intellect(42995) } // 60-69 else if (PlayerLevel >= 70 && PlayerLevel < 80) { - player->CastSpell(player, vecBuffs[1], true); // Prayer of Fortitude(48162) - player->CastSpell(player, vecBuffs[2], true); // Greater Blessing of Kings(43223) - player->CastSpell(player, vecBuffs[3], true); // Mark of the Wild(48469) - player->CastSpell(player, vecBuffs[4], true); // Prayer of Spirit(48074) - player->CastSpell(player, vecBuffs[5], true); // Prayer of Shadow Protection(48170) - player->CastSpell(player, vecBuffs[6], true); // Arcane Intellect(36880) - + player->CastSpell(player, vecBuffs[0], true); // Prayer of Fortitude(48162) + player->CastSpell(player, vecBuffs[1], true); // Greater Blessing of Kings(43223) + player->CastSpell(player, vecBuffs[2], true); // Mark of the Wild(48469) + player->CastSpell(player, vecBuffs[3], true); // Prayer of Spirit(48074) + player->CastSpell(player, vecBuffs[4], true); // Prayer of Shadow Protection(48170) + player->CastSpell(player, vecBuffs[5], true); // Arcane Intellect(42995) } // 70-79 else { - player->CastSpell(player, vecBuffs[1], true); // Prayer of Fortitude(48162) - player->CastSpell(player, vecBuffs[2], true); // Greater Blessing of Kings(43223) - player->CastSpell(player, vecBuffs[3], true); // Mark of the Wild(48469) - player->CastSpell(player, vecBuffs[4], true); // Prayer of Spirit(48074) - player->CastSpell(player, vecBuffs[5], true); // Prayer of Shadow Protection(48170) - player->CastSpell(player, vecBuffs[6], true); // Arcane Intellect(36880) - + player->CastSpell(player, vecBuffs[0], true); // Prayer of Fortitude (48162) + player->CastSpell(player, vecBuffs[1], true); // Greater Blessing of Kings (43223) + player->CastSpell(player, vecBuffs[2], true); // Mark of the Wild (48469) + player->CastSpell(player, vecBuffs[3], true); // Prayer of Spirit (48074) + player->CastSpell(player, vecBuffs[4], true); // Prayer of Shadow Protection (48170) + player->CastSpell(player, vecBuffs[5], true); // Arcane Intellect (42995) } // LEVEL 80 } else