diff options
-rw-r--r-- | sql/updates/world/3.3.5/2020_03_07_03_world.sql | 23 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 103 |
2 files changed, 73 insertions, 53 deletions
diff --git a/sql/updates/world/3.3.5/2020_03_07_03_world.sql b/sql/updates/world/3.3.5/2020_03_07_03_world.sql new file mode 100644 index 00000000000..96fad14cdd0 --- /dev/null +++ b/sql/updates/world/3.3.5/2020_03_07_03_world.sql @@ -0,0 +1,23 @@ +-- Scarlet Ghoul +DELETE FROM `creature_text` WHERE `CreatureID`=28845; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(28845,0,0,'So hungry...',12,0,100,0,0,0,28955,0,'Scarlet Ghoul'), +(28845,0,1,'Must feed...',12,0,100,0,0,0,28956,0,'Scarlet Ghoul'), +(28845,0,2,'GIVE ME BRAINS!',12,0,100,0,0,0,28957,0,'Scarlet Ghoul'), +(28845,0,3,'Smell flesh... close...',12,0,100,0,0,0,28958,0,'Scarlet Ghoul'), +(28845,0,4,'Mommy?',12,0,100,0,0,0,28959,0,'Scarlet Ghoul'), +(28845,0,5,'$g Poppy:Mama;!',12,0,100,0,0,0,28960,0,'Scarlet Ghoul'); + +-- Scarlet Ghost +DELETE FROM `creature_text` WHERE `CreatureID`=28846; +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(28846,0,0,'Vengeance is mine!',12,0,100,0,0,0,28969,0,'Scarlet Ghost'), +(28846,0,1,'I\'ll take you with me!',12,0,100,0,0,0,28964,0,'Scarlet Ghost'), +(28846,0,2,'The grave calls to us all!',12,0,100,0,0,0,28966,0,'Scarlet Ghost'), +(28846,0,3,'Die, Scourge filth!',12,0,100,0,0,0,28968,0,'Scarlet Ghost'), +(28846,0,4,'YOU KILLED ME!',12,0,100,0,0,0,28967,0,'Scarlet Ghost'); + +UPDATE `creature_template` SET `ScriptName`='',`AIName`='SmartAI' WHERE `entry`=28846; +DELETE FROM `smart_scripts` WHERE `entryorguid`=28846 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(28846,0,0,0,54,0,50,0,0,0,0,0,0,1,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,"Scarlet Ghost - On Just Appeared -Say Line 0"); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index a96883e0a73..19513b177f7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -947,11 +947,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: @@ -996,83 +999,77 @@ public: }; -class npc_scarlet_ghoul : public CreatureScript +struct npc_scarlet_ghoul : public ScriptedAI { -public: - npc_scarlet_ghoul() : CreatureScript("npc_scarlet_ghoul") { } + npc_scarlet_ghoul(Creature* creature) : ScriptedAI(creature) + { + me->SetReactState(REACT_DEFENSIVE); + } - CreatureAI* GetAI(Creature* creature) const override + void JustAppeared() override { - return new npc_scarlet_ghoulAI(creature); + CreatureAI::JustAppeared(); + + if (urand(0, 1)) + if (Unit* owner = me->GetOwner()) + Talk(SAY_LINE_0, owner); } - struct npc_scarlet_ghoulAI : public ScriptedAI + void FindMinions(Unit* owner) { - 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); - } + std::list<Creature*> MinionList; + owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); - void FindMinions(Unit* owner) + if (!MinionList.empty()) { - std::list<Creature*> MinionList; - owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); - - if (!MinionList.empty()) + for (Creature* creature : MinionList) { - for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) + if (creature->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) { - if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) + if (creature->IsInCombat() && creature->getAttackerForHelper()) { - if ((*itr)->IsInCombat() && (*itr)->getAttackerForHelper()) - { - AttackStart((*itr)->getAttackerForHelper()); - } + AttackStart(creature->getAttackerForHelper()); } } } } + } - void UpdateAI(uint32 /*diff*/) override + void UpdateAI(uint32 /*diff*/) override + { + if (!me->IsInCombat()) { - if (!me->IsInCombat()) + if (Unit* owner = me->GetOwner()) { - if (Unit* owner = me->GetOwner()) + Player* plrOwner = owner->ToPlayer(); + if (plrOwner && plrOwner->IsInCombat()) { - Player* plrOwner = owner->ToPlayer(); - if (plrOwner && plrOwner->IsInCombat()) - { - if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == NPC_GHOSTS) - AttackStart(plrOwner->getAttackerForHelper()); - else - FindMinions(owner); - } + if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == NPC_GHOSTS) + AttackStart(plrOwner->getAttackerForHelper()); + else + FindMinions(owner); } } + } - if (!UpdateVictim() || !me->GetVictim()) - return; + if (!UpdateVictim() || !me->GetVictim()) + return; - //ScriptedAI::UpdateAI(diff); - //Check if we have a current target - if (me->EnsureVictim()->GetEntry() == NPC_GHOSTS) + //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 @@ -1123,6 +1120,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); } |