diff options
author | Sorikoff <46191832+Sorikoff@users.noreply.github.com> | 2020-03-07 17:17:00 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-22 22:36:06 +0100 |
commit | 6dd74533d1603dc6948603ded7a452c6f8a60b29 (patch) | |
tree | 4e16382b218df54504214860e868603552c0c544 /src | |
parent | e442a2c52d76e41055a9ee16690caff2cde7f227 (diff) |
Scripts/Ebon Hold: Improve cosmetics for q. The Gift That Keeps On Giving (#24223)
* Scripts/Ebon Hold: Improve cosmetics for q. The Gift That Keeps On Giving
* Improve cosmetics for q. The Gift That Keeps On Giving
* Fixes
* Fix
* Rename 9999_99_99_99_world.sql to 2020_03_07_03_world.sql
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
(cherry picked from commit 41d80f2d43863588dc4516ee80579f965b07391b)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 106 |
1 files changed, 56 insertions, 50 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index d4aa53b7803..6ad9f9d265c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -953,11 +953,14 @@ public: }; // correct way: 52312 52314 52555 ... -enum Creatures_SG +enum TheGiftThatKeepsOnGiving { - NPC_GHOULS = 28845, - NPC_GHOSTS = 28846, + SAY_LINE_0 = 0, + + NPC_GHOULS = 28845, + NPC_GHOSTS = 28846, }; + class npc_dkc1_gothik : public CreatureScript { public: @@ -1002,74 +1005,77 @@ public: }; -class npc_scarlet_ghoul : public CreatureScript +struct npc_scarlet_ghoul : public ScriptedAI { -public: - npc_scarlet_ghoul() : CreatureScript("npc_scarlet_ghoul") { } - - CreatureAI* GetAI(Creature* creature) const override + npc_scarlet_ghoul(Creature* creature) : ScriptedAI(creature) { - return new npc_scarlet_ghoulAI(creature); + me->SetReactState(REACT_DEFENSIVE); } - struct npc_scarlet_ghoulAI : public ScriptedAI + void JustAppeared() override { - npc_scarlet_ghoulAI(Creature* creature) : ScriptedAI(creature) - { - // Ghouls should display their Birth Animation - // Crawling out of the ground - //DoCast(me, 35177, true); - //me->MonsterSay("Mommy?", LANG_UNIVERSAL, 0); - me->SetReactState(REACT_DEFENSIVE); - } + CreatureAI::JustAppeared(); - void FindMinions(Unit* owner) - { - std::list<TempSummon*> MinionList; - owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); + if (urand(0, 1)) + if (Unit* owner = me->GetOwner()) + Talk(SAY_LINE_0, owner); + } - for (TempSummon* summon : MinionList) - if (summon->GetOwnerGUID() == me->GetOwnerGUID()) - if (summon->IsInCombat() && summon->getAttackerForHelper()) - AttackStart(summon->getAttackerForHelper()); - } + void FindMinions(Unit* owner) + { + std::list<TempSummon*> MinionList; + owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); - void UpdateAI(uint32 /*diff*/) override + if (!MinionList.empty()) { - if (!me->IsInCombat()) + for (Creature* creature : MinionList) { - if (Unit* owner = me->GetOwner()) + if (creature->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) { - Player* plrOwner = owner->ToPlayer(); - if (plrOwner && plrOwner->IsInCombat()) + if (creature->IsInCombat() && creature->getAttackerForHelper()) { - if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == NPC_GHOSTS) - AttackStart(plrOwner->getAttackerForHelper()); - else - FindMinions(owner); + AttackStart(creature->getAttackerForHelper()); } } } + } + } - if (!UpdateVictim() || !me->GetVictim()) - return; + void UpdateAI(uint32 /*diff*/) override + { + if (!me->IsInCombat()) + { + if (Unit* owner = me->GetOwner()) + { + Player* plrOwner = owner->ToPlayer(); + if (plrOwner && plrOwner->IsInCombat()) + { + if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == NPC_GHOSTS) + AttackStart(plrOwner->getAttackerForHelper()); + else + FindMinions(owner); + } + } + } - //ScriptedAI::UpdateAI(diff); - //Check if we have a current target - if (me->EnsureVictim()->GetEntry() == NPC_GHOSTS) + if (!UpdateVictim() || !me->GetVictim()) + return; + + //ScriptedAI::UpdateAI(diff); + //Check if we have a current target + if (me->EnsureVictim()->GetEntry() == NPC_GHOSTS) + { + if (me->isAttackReady()) { - if (me->isAttackReady()) + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->GetVictim())) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->AttackerStateUpdate(me->GetVictim()); - me->resetAttackTimer(); - } + me->AttackerStateUpdate(me->GetVictim()); + me->resetAttackTimer(); } } } - }; + } }; enum GiftOfTheHarvester @@ -1120,6 +1126,6 @@ void AddSC_the_scarlet_enclave_c1() RegisterSpellScript(spell_deliver_stolen_horse); new npc_ros_dark_rider(); new npc_dkc1_gothik(); - new npc_scarlet_ghoul(); + RegisterCreatureAI(npc_scarlet_ghoul); RegisterSpellScript(spell_gift_of_the_harvester); } |