Description:
While doing the quest "The Force of Neltharaku" (10854), using the item "Enchanted Nethervine Crystal" (31652) on the hostile Enslaved Netherwing Drake to turn them into the friendly Enslaved Netherwing Drake, I noticed that freeing 1 drake counted double for each release. After 1/5 drakes freed, I had received quest credit 2/5 and after freeing drake 2/5 I got 4/5 quest credit.
Expected behaviour:
The spell "Force of Neltharaku" (38775) should only give 1 quest kill credit. (Unfortunately, I did not think of checking the spell details before I left the game, so I did not notice if anything was wrong with the 15% Haste the spell is also supposed to cast on the player.)
Steps to reproduce the problem:
.tele NetherwingFields.quest add 10854Branch(es):
Most likely both, because the quest is still available in retail. I just don't have the master branch client or server available for testing.
TC rev. hash/commit:
TrinityCore rev. f2f4fc921ee8 2020-06-09 09:57:47 -0300 (3.3.5 branch) (Unix, RelWithDebInfo, Static)
Using SSL version: OpenSSL 1.1.1f 31 Mar 2020 (library: OpenSSL 1.1.1f 31 Mar 2020)
Using Boost version: 1.71.0
Using MySQL version: 80020
Using CMake version: 3.16.3
Compiled on: Linux 5.4.0-1016-azure
Automatic database updates are enabled for the following databases: Auth, Characters, World
Worldserver listening connections on port 8085
Realmlist (Realm Id: 1) configured in port 8085
VMAPs status: Enabled. LineOfSight: 1, getHeight: 1, indoorCheck: 1
MMAPs status: Enabled
maps directory located in /build/data/maps. Total size: 251987687 bytes
vmaps directory located in /build/data/vmaps. Total size: 658130721 bytes
mmaps directory located in /build/data/mmaps. Total size: 2010221346 bytes
Using enUS DBC Locale as default. All available DBC locales: enUS
Using World DB: TDB 335.20051
Operating system: Windows 10 Version 2004 Home x64 on client computer.
Ubuntu(?) Linux/Unix on https://tcubuntu.northeurope.cloudapp.azure.com/
I don't know if there is anything wrong with how the spells are used in this script, but maybe it can help tracking where it happens or finding out where to look.
I did not find anything in spell_quest.cpp related to this, so maybe these spells are only sourced from dbc data.
https://github.com/TrinityCore/TrinityCore/blob/e3b232fe0e5c21a87d3fe71813e9d750259823f1/src/server/scripts/Outland/zone_shadowmoon_valley.cpp#L337-L473
the credit spell cast is used several times. i should only be called one time when dragon moves up https://www.wowhead.com/quest=10854/the-force-of-neltharaku#videos:id=59760
Scripts/Quest: Force of Neltharaku - Remove double cillcredit and improve logic of the events + enable flying
-- [Quest] Force of Neltharaku
UPDATE `creature_template_movement` SET `Flight`='1' WHERE `CreatureId`=21722;
UPDATE `creature_addon` SET `bytes1`='0' WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id` = 21722);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index b3e14700bb..0457253d61 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -3403,6 +3403,7 @@ void SpellMgr::LoadSpellInfoCorrections()
52953, // Torch
58121, // Torch
43109, // Throw Torch
+ 38762, // Force of Neltharaku
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 2bc6554b3c..35bab86da1 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -348,7 +348,13 @@ enum EnshlavedNetherwingDrake
// Creatures
NPC_DRAGONMAW_SUBJUGATOR = 21718,
- NPC_ESCAPE_DUMMY = 22317
+ NPC_ESCAPE_DUMMY = 22317,
+
+ // Quests
+ QUEST_THE_FORCE_OF_NELTHARAKU = 10854,
+
+ // Points
+ POINT_MOVE_UP = 1
};
@@ -356,12 +362,7 @@ class npc_enslaved_netherwing_drake : public CreatureScript
{
public:
npc_enslaved_netherwing_drake() : CreatureScript("npc_enslaved_netherwing_drake") { }
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_enslaved_netherwing_drakeAI(creature);
- }
-
+
struct npc_enslaved_netherwing_drakeAI : public ScriptedAI
{
npc_enslaved_netherwing_drakeAI(Creature* creature) : ScriptedAI(creature)
@@ -369,17 +370,12 @@ public:
Tapped = false;
Reset();
}
-
- ObjectGuid PlayerGUID;
- uint32 FlyTimer;
- bool Tapped;
-
+
void Reset() override
{
if (!Tapped)
me->SetFaction(FACTION_ORC_DRAGONMAW);
-
- FlyTimer = 10000;
+
me->SetDisableGravity(false);
}
@@ -395,7 +391,6 @@ public:
PlayerGUID = playerCaster->GetGUID();
me->SetFaction(FACTION_FLAYER_HUNTER);
- DoCast(playerCaster, SPELL_FORCE_OF_NELTHARAKU, true);
Unit* Dragonmaw = me->FindNearestCreature(NPC_DRAGONMAW_SUBJUGATOR, 50);
if (Dragonmaw)
@@ -404,6 +399,7 @@ public:
AttackStart(Dragonmaw);
}
+ FlyTimer = 10 * IN_MILLISECONDS;
me->GetThreatManager().ClearThreat(playerCaster);
}
}
@@ -416,13 +412,7 @@ public:
if (id == 1)
{
if (PlayerGUID)
- {
- Unit* player = ObjectAccessor::GetUnit(*me, PlayerGUID);
- if (player)
- DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true);
-
PlayerGUID.Clear();
- }
me->DespawnOrUnsummon(1);
}
@@ -440,16 +430,9 @@ public:
if (PlayerGUID)
{
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
- if (player && player->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE)
+ if (player && player->GetQuestStatus(QUEST_THE_FORCE_OF_NELTHARAKU) == QUEST_STATUS_INCOMPLETE)
{
DoCast(player, SPELL_FORCE_OF_NELTHARAKU, true);
- /*
- float x, y, z;
- me->GetPosition(x, y, z);
-
- float dx, dy, dz;
- me->GetRandomPoint(x, y, z, 20, dx, dy, dz);
- dz += 20; // so it's in the air, not ground*/
Position pos;
if (Unit* EscapeDummy = me->FindNearestCreature(NPC_ESCAPE_DUMMY, 30))
@@ -460,8 +443,10 @@ public:
pos.m_positionZ += 25;
}
+ me->SetCanFly(true);
me->SetDisableGravity(true);
- me->GetMotionMaster()->MovePoint(1, pos);
+ me->SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
+ me->GetMotionMaster()->MoveTakeoff(POINT_MOVE_UP, pos);
}
}
} else FlyTimer -= diff;
@@ -471,7 +456,17 @@ public:
DoMeleeAttackIfReady();
}
+
+ private:
+ ObjectGuid PlayerGUID;
+ uint32 FlyTimer;
+ bool Tapped;
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_enslaved_netherwing_drakeAI(creature);
+ }
};
/*#####
That looks good, but somewhat more extensive changes than I first anticipated.
Oh well. At first, I thought maybe I could open a PR for it, but TC members expect the PR owner to be able to answer for the PR code changes.
The only things I am good at when it comes to pull requests is to handle files, git commits, GitHub interaction, and codestyle.
@Rushor : Meh, I guess I can deal with general script coding. Would it be OK if I create the PR to close this ticket?
Sure mate :)
Sorry for taking so long before testing the PR content, but I have completed it now.
Slight deviation from my description above. For sentimental reasons, I prefer to start with Quest ID 10804 Kindness (first quest in the questline) and work my way through.
If you have doubts about any details in the contents of PR #24807 , feel free to test it and see for yourself.
Most helpful comment
Sure mate :)