From 06a62538cfca885402da6c2deb3d5428f3fd5193 Mon Sep 17 00:00:00 2001 From: acidmanifesto Date: Fri, 13 May 2022 13:00:59 -0400 Subject: [PATCH 1/9] fix (core\crash): fix client crash dk starter (#11726) * fix (core\crash): fix client crash dk starter Fixing it again. Something regressed. * adjust timer and text playing * improved timing * Update chapter1.cpp --- .../ScarletEnclave/chapter1.cpp | 195 ++++++++++-------- 1 file changed, 104 insertions(+), 91 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 5ab34e0d0..95920a0d5 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -27,120 +27,133 @@ #include "SpellInfo.h" #include "SpellScript.h" #include "Vehicle.h" +#include "MoveSplineInit.h" -// Ours -enum eyeOfAcherus + /*###### + ## npc_eye_of_acherus + ######*/ + +enum EyeOfAcherusMisc { - EVENT_REMOVE_CONTROL = 1, - EVENT_SPEAK_1 = 2, - EVENT_LAUNCH = 3, - EVENT_REGAIN_CONTROL = 4, + SPELL_THE_EYE_OF_ACHERUS = 51852, + SPELL_EYE_OF_ACHERUS_VISUAL = 51892, + SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST = 51923, + SPELL_EYE_OF_ACHERUS_FLIGHT = 51890, + SPELL_ROOT_SELF = 51860, - EYE_TEXT_LAUNCH = 0, - EYE_TEXT_CONTROL = 1, + EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION = 1, + EVENT_UNROOT = 2, + EVENT_LAUNCH_TOWARDS_DESTINATION = 3, + EVENT_GRANT_CONTROL = 4, - EYE_POINT_DESTINATION_1 = 0, - EYE_POINT_DESTINATION_2 = 1, + SAY_LAUNCH_TOWARDS_DESTINATION = 0, + SAY_EYE_UNDER_CONTROL = 1, - SPELL_EYE_OF_ACHERUS_VISUAL = 51892, + POINT_NEW_AVALON = 1, + + EYE_POINT_DESTINATION_0 = 0, + EYE_POINT_DESTINATION_1 = 1, + EYE_POINT_DESTINATION_2 = 2, + EYE_POINT_DESTINATION_3 = 3 }; -class npc_eye_of_acherus : public CreatureScript +struct npc_eye_of_acherus : public ScriptedAI { -public: - npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { } - - CreatureAI* GetAI(Creature* creature) const override + npc_eye_of_acherus(Creature* creature) : ScriptedAI(creature) { - return new npc_eye_of_acherusAI(creature); + creature->SetDisplayId(creature->GetCreatureTemplate()->Modelid1); + creature->SetReactState(REACT_PASSIVE); } - struct npc_eye_of_acherusAI : public NullCreatureAI + void InitializeAI() override { - npc_eye_of_acherusAI(Creature* creature) : NullCreatureAI(creature) { } + DoCastSelf(SPELL_ROOT_SELF); + DoCastSelf(SPELL_EYE_OF_ACHERUS_VISUAL); + _events.ScheduleEvent(EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION, 400ms); + } - EventMap events; - - void InitializeAI() override + void OnCharmed(bool apply) override + { + if (!apply) { - events.Reset(); - - events.ScheduleEvent(EVENT_REMOVE_CONTROL, 500); - events.ScheduleEvent(EVENT_SPEAK_1, 4000); - events.ScheduleEvent(EVENT_LAUNCH, 7000); - - me->CastSpell(me, SPELL_EYE_OF_ACHERUS_VISUAL, true); + me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_THE_EYE_OF_ACHERUS); + me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST); } + } - void MovementInform(uint32 type, uint32 point) override + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (type == POINT_MOTION_TYPE && point == EYE_POINT_DESTINATION_2) + switch (eventId) { - events.ScheduleEvent(EVENT_REGAIN_CONTROL, 1000); + case EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION: + if (Unit* owner = me->GetCharmerOrOwner()) + { + Talk(SAY_LAUNCH_TOWARDS_DESTINATION, owner); + } + _events.ScheduleEvent(EVENT_UNROOT, 400ms); + break; + case EVENT_UNROOT: + me->RemoveAurasDueToSpell(SPELL_ROOT_SELF); + DoCastSelf(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST); + _events.ScheduleEvent(EVENT_LAUNCH_TOWARDS_DESTINATION, 1s + 200ms); + break; + case EVENT_LAUNCH_TOWARDS_DESTINATION: + { + Position const EYE_DESTINATION_1 = { 2361.21f, -5660.45f, 496.744f, 0.0f }; + Position const EYE_DESTINATION_2 = { 2341.571f, -5672.797f, 538.3942f, 0.0f }; + Position const EYE_DESTINATION_3 = { 1957.4f, -5844.1f, 273.867f, 0.0f }; + Position const EYE_DESTINATION_4 = { 1758.01f, -5876.79f, 166.867f, 0.0f }; + + Movement::MoveSplineInit init(me); + init.SetFly(); + if (Unit* owner = me->GetCharmerOrOwner()) + { + init.SetVelocity(owner->GetSpeed(MOVE_RUN)); + } + + me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_0, EYE_DESTINATION_1); + me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_1, EYE_DESTINATION_2); + me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_2, EYE_DESTINATION_3); + me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_3, EYE_DESTINATION_4); + _events.ScheduleEvent(EVENT_GRANT_CONTROL, 22s); + break; + } + case EVENT_GRANT_CONTROL: + if (Unit* owner = me->GetCharmerOrOwner()) + { + Talk(SAY_EYE_UNDER_CONTROL, owner); + } + me->RemoveAurasDueToSpell(SPELL_ROOT_SELF); + DoCastSelf(SPELL_EYE_OF_ACHERUS_FLIGHT); + me->RemoveAurasDueToSpell(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST); + break; + default: + break; } } + } - void SetControl(Player* player, bool on) + void MovementInform(uint32 movementType, uint32 pointId) override + { + if (movementType != POINT_MOTION_TYPE) + return; + + switch (pointId) { - WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, me->GetPackGUID().size() + 1); - data << me->GetPackGUID(); - data << uint8(on ? 1 : 0); - player->GetSession()->SendPacket(&data); + case POINT_NEW_AVALON: + DoCastSelf(SPELL_ROOT_SELF); + break; + default: + break; } + } - void JustSummoned(Creature* creature) override - { - if (Unit* target = creature->SelectNearbyTarget()) - creature->AI()->AttackStart(target); - } - - void UpdateAI(uint32 diff) override - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_REMOVE_CONTROL: - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - me->SetUnitFlag(UNIT_FLAG_STUNNED); - SetControl(player, false); - } - break; - case EVENT_SPEAK_1: - Talk(EYE_TEXT_LAUNCH, me->GetCharmerOrOwnerPlayerOrPlayerItself()); - break; - case EVENT_LAUNCH: - { - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - player->AddAura(SPELL_EYE_OF_ACHERUS_VISUAL, player); - } - me->SetSpeed(MOVE_FLIGHT, 5.0f, true); - - const Position EYE_DESTINATION_1 = { me->GetPositionX() - 40.0f, me->GetPositionY(), me->GetPositionZ() + 10.0f, 0.0f }; - const Position EYE_DESTINATION_2 = { 1768.0f, -5876.0f, 153.0f, 0.0f }; - - me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_1, EYE_DESTINATION_1); - me->GetMotionMaster()->MovePoint(EYE_POINT_DESTINATION_2, EYE_DESTINATION_2); - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - player->RemoveAura(SPELL_EYE_OF_ACHERUS_VISUAL); - } - break; - } - case EVENT_REGAIN_CONTROL: - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - me->RemoveUnitFlag(UNIT_FLAG_STUNNED); - me->SetSpeed(MOVE_FLIGHT, 3.3f, true); - - SetControl(player, true); - Talk(EYE_TEXT_CONTROL, player); - } - break; - } - } - }; +private: + EventMap _events; }; class spell_q12641_death_comes_from_on_high_summon_ghouls : public SpellScriptLoader @@ -1220,7 +1233,7 @@ class spell_death_knight_initiate_visual : public SpellScript void AddSC_the_scarlet_enclave_c1() { // Ours - new npc_eye_of_acherus(); + RegisterCreatureAI(npc_eye_of_acherus); new spell_q12641_death_comes_from_on_high_summon_ghouls(); new npc_death_knight_initiate(); new spell_item_gift_of_the_harvester(); From 11f151a962bfcc5732b40ee38de305e751fc59c7 Mon Sep 17 00:00:00 2001 From: acidmanifesto Date: Fri, 13 May 2022 13:02:43 -0400 Subject: [PATCH 2/9] fix (core): Prevent Forced UpdateObjectVisibility Before in World (#11730) fix (Core): Prevent Forced UpdateObjectVisibility Before in World TC Cherry Pick: https://github.com/TrinityCore/TrinityCore/commit/38dc5667ba13d5c1d094330b0f57ba0ee9b2dde5 Co-Authored-By: Shauren Co-Authored-By: Jurgis <326232+chemicstry@users.noreply.github.com> Co-authored-by: Shauren Co-authored-by: Jurgis <326232+chemicstry@users.noreply.github.com> --- src/server/game/Entities/Player/PlayerUpdates.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 3e861c857..86230835b 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -1548,6 +1548,10 @@ void Player::UpdateVisibilityForPlayer(bool mapChange) void Player::UpdateObjectVisibility(bool forced, bool fromUpdate) { + // Prevent updating visibility if player is not in world (example: LoadFromDB sets drunkstate which updates invisibility while player is not in map) + if (!IsInWorld()) + return; + if (!forced) AddToNotify(NOTIFY_VISIBILITY_CHANGED); else if (!isBeingLoaded()) From e60b953a7a8e9a7db37c3f6b1028c8cf6f75f7dd Mon Sep 17 00:00:00 2001 From: acidmanifesto Date: Fri, 13 May 2022 13:16:36 -0400 Subject: [PATCH 3/9] add (core): Additional Helper (#11731) Anticheat Helper for knock back --- src/server/game/Handlers/MovementHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index a383579af..0c602e8bb 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -764,7 +764,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) WorldPacket data(MSG_MOVE_KNOCK_BACK, 66); data << guid.WriteAsPacked(); _player->m_mover->BuildMovementPacket(&data); - + _player->SetCanTeleport(true); // knockback specific info data << movementInfo.jump.sinAngle; data << movementInfo.jump.cosAngle; From 5474b00a3d4f75245068535c26fa44c70f7ca6b4 Mon Sep 17 00:00:00 2001 From: IntelligentQuantum Date: Sat, 14 May 2022 15:11:34 +0430 Subject: [PATCH 4/9] feat(tools/mmaps): isContinentMap (#11727) * . * . --- src/tools/mmaps_generator/MapBuilder.cpp | 26 +++++++++++++++--------- src/tools/mmaps_generator/MapBuilder.h | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 16e57a6e9..ece132630 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -942,16 +942,8 @@ namespace MMAP return static_cast(m_mapid) != mapID; if (m_skipContinents) - switch (mapID) - { - case 0: - case 1: - case 530: - case 571: - return true; - default: - break; - } + if (isContinentMap(mapID)) + return true; if (m_skipJunkMaps) switch (mapID) @@ -1031,6 +1023,20 @@ namespace MMAP } } + bool MapBuilder::isContinentMap(uint32 mapID) const + { + switch (mapID) + { + case 0: + case 1: + case 530: + case 571: + return true; + default: + return false; + } + } + /**************************************************************************/ bool TileBuilder::shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY) const { diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index e36e1117f..475469bf8 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -185,6 +185,7 @@ namespace MMAP bool shouldSkipMap(uint32 mapID) const; bool isTransportMap(uint32 mapID) const; + bool isContinentMap(uint32 mapID) const; rcConfig GetMapSpecificConfig(uint32 mapID, float bmin[3], float bmax[3], const TileConfig &tileConfig) const; From 822aff29e680d7ddce1064abf8a543999c914c98 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Sun, 15 May 2022 13:28:40 -0300 Subject: [PATCH 5/9] fix(Scripts/World): fix nullptr crash (#11770) --- src/server/scripts/World/npc_stave_of_ancients.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/World/npc_stave_of_ancients.cpp b/src/server/scripts/World/npc_stave_of_ancients.cpp index 81b36ccd9..ee41456bf 100644 --- a/src/server/scripts/World/npc_stave_of_ancients.cpp +++ b/src/server/scripts/World/npc_stave_of_ancients.cpp @@ -358,7 +358,7 @@ public: events.RepeatEvent(urand(3000, 6000)); break; case EVENT_RANGE_CHECK: - if (!me->GetVictim()->IsWithinDist2d(me, 60.0f)) + if (!me->GetVictim() || !me->GetVictim()->IsWithinDist2d(me, 60.0f)) { EnterEvadeMode(); } From 2fe7c4431c36029796972f624a0af3d55745ce24 Mon Sep 17 00:00:00 2001 From: mpfans Date: Mon, 16 May 2022 23:04:11 +0800 Subject: [PATCH 6/9] fix(DB/quest): Forging an Alliance require A Spark of Hope + Mending Fences Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> --- .../updates/pending_db_world/rev_1652695614137243222.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1652695614137243222.sql diff --git a/data/sql/updates/pending_db_world/rev_1652695614137243222.sql b/data/sql/updates/pending_db_world/rev_1652695614137243222.sql new file mode 100644 index 000000000..798590609 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1652695614137243222.sql @@ -0,0 +1,8 @@ +-- fixed quest 12924 spell area +UPDATE `spell_area` SET `quest_start` = 12956 WHERE `spell` = 55858; + +-- (Quests) Forging an Alliance require A Spark of Hope + Mending Fences +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 19 AND `SourceEntry`=12924; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(19, 0, 12924, 0, 0, 8, 0, 12956, 0, 0, 0, 0, 0, '', 'Forging an Alliance - Requires quest rewarded'), +(19, 0, 12924, 0, 0, 8, 0, 12915, 0, 0, 0, 0, 0, '', 'Forging an Alliance - Requires quest rewarded'); From e5e1200dcdbfc5f3cec4c6198c85e1ef1b88cf15 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 16 May 2022 15:06:24 +0000 Subject: [PATCH 7/9] chore(DB): import pending files Referenced commit(s): 2fe7c4431c36029796972f624a0af3d55745ce24 --- .../rev_1652695614137243222.sql => db_world/2022_05_16_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1652695614137243222.sql => db_world/2022_05_16_00.sql} (94%) diff --git a/data/sql/updates/pending_db_world/rev_1652695614137243222.sql b/data/sql/updates/db_world/2022_05_16_00.sql similarity index 94% rename from data/sql/updates/pending_db_world/rev_1652695614137243222.sql rename to data/sql/updates/db_world/2022_05_16_00.sql index 798590609..f9b067603 100644 --- a/data/sql/updates/pending_db_world/rev_1652695614137243222.sql +++ b/data/sql/updates/db_world/2022_05_16_00.sql @@ -1,3 +1,4 @@ +-- DB update 2022_05_12_00 -> 2022_05_16_00 -- fixed quest 12924 spell area UPDATE `spell_area` SET `quest_start` = 12956 WHERE `spell` = 55858; From 7d3809330b5f7104b98a400edc87754e2f4f536b Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 16 May 2022 17:07:55 +0200 Subject: [PATCH 8/9] fix(DB/Quest): Fixed quest "Krolmir, Hammer of Storms". (#11742) Fixes #11728 --- .../updates/pending_db_world/rev_1652543986104470300.sql | 4 ++++ src/server/game/Spells/SpellInfoCorrections.cpp | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1652543986104470300.sql diff --git a/data/sql/updates/pending_db_world/rev_1652543986104470300.sql b/data/sql/updates/pending_db_world/rev_1652543986104470300.sql new file mode 100644 index 000000000..7dc551a4a --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1652543986104470300.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid`=30331 AND `source_type`=0 AND `id`=5; +INSERT INTO `smart_scripts` VALUES +(30331,0,5,0,54,0,100,0,0,0,0,0,0,85,56606,0,0,0,0,0,1,0,0,0,0,0,0,0,0,'Jokkum - on just summoned - Cast Riding Jokkum'); diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index 98dbaf6e4..65fe6641c 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4270,6 +4270,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->DurationEntry = sSpellDurationStore.LookupEntry(21); }); + // Jokkum Summon + ApplySpellFix({ 56541 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_0].MiscValueB = 844; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; From 8eeeefc12efa37d29a547f2964dd78ea9e25da66 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 16 May 2022 15:10:12 +0000 Subject: [PATCH 9/9] chore(DB): import pending files Referenced commit(s): 7d3809330b5f7104b98a400edc87754e2f4f536b --- .../rev_1652543986104470300.sql => db_world/2022_05_16_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1652543986104470300.sql => db_world/2022_05_16_01.sql} (84%) diff --git a/data/sql/updates/pending_db_world/rev_1652543986104470300.sql b/data/sql/updates/db_world/2022_05_16_01.sql similarity index 84% rename from data/sql/updates/pending_db_world/rev_1652543986104470300.sql rename to data/sql/updates/db_world/2022_05_16_01.sql index 7dc551a4a..27fbf4a44 100644 --- a/data/sql/updates/pending_db_world/rev_1652543986104470300.sql +++ b/data/sql/updates/db_world/2022_05_16_01.sql @@ -1,3 +1,4 @@ +-- DB update 2022_05_16_00 -> 2022_05_16_01 -- DELETE FROM `smart_scripts` WHERE `entryorguid`=30331 AND `source_type`=0 AND `id`=5; INSERT INTO `smart_scripts` VALUES