fix(Scripts/Events): Fix not being able to start the Apothecary Trio … (#10596)

* fix(Scripts/Events): Fix not being able to start the Apothecary Trio encounter

* ops

* Update love_in_air.cpp

* Update love_in_air.cpp
This commit is contained in:
Skjalf
2022-02-09 04:13:38 -03:00
committed by GitHub
parent 096b95a9be
commit 4b32ad1853
+40 -11
View File
@@ -24,6 +24,7 @@
#include "PassiveAI.h" #include "PassiveAI.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "SpellScript.h" #include "SpellScript.h"
/////////////////////////////////////// ///////////////////////////////////////
@@ -295,9 +296,14 @@ enum HummelSay
SAY_HUMMEL_5 = 5 SAY_HUMMEL_5 = 5
}; };
struct npc_love_in_air_hummel : public ScriptedAI class npc_love_in_air_hummel : public CreatureScript
{ {
npc_love_in_air_hummel(Creature* creature) : ScriptedAI(creature), summons(me) { } public:
npc_love_in_air_hummel() : CreatureScript("npc_love_in_air_hummel") { }
struct npc_love_in_air_hummelAI : public ScriptedAI
{
npc_love_in_air_hummelAI(Creature* creature) : ScriptedAI(creature), summons(me) { speachTimer = 0; }
SummonList summons; SummonList summons;
EventMap events; EventMap events;
@@ -332,7 +338,7 @@ struct npc_love_in_air_hummel : public ScriptedAI
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->AI()->Talk(SAY_HUMMEL_5); Talk(SAY_HUMMEL_5);
Map::PlayerList const& players = me->GetMap()->GetPlayers(); Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (!players.IsEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) if (!players.IsEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup())
sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), lfg::LFG_DUNGEON_CROWN_CHEMICAL_CO, me->FindMap()); sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), lfg::LFG_DUNGEON_CROWN_CHEMICAL_CO, me->FindMap());
@@ -353,17 +359,17 @@ struct npc_love_in_air_hummel : public ScriptedAI
speachTimer += diff; speachTimer += diff;
if (speachTimer < 10000) if (speachTimer < 10000)
{ {
me->AI()->Talk(SAY_HUMMEL_0); Talk(SAY_HUMMEL_0);
speachTimer = 10000; speachTimer = 10000;
} }
else if (speachTimer >= 16000 && speachTimer < 20000) else if (speachTimer >= 16000 && speachTimer < 20000)
{ {
me->AI()->Talk(SAY_HUMMEL_1); Talk(SAY_HUMMEL_1);
speachTimer = 20000; speachTimer = 20000;
} }
else if (speachTimer >= 26000 && speachTimer < 30000) else if (speachTimer >= 26000 && speachTimer < 30000)
{ {
me->AI()->Talk(SAY_HUMMEL_2); Talk(SAY_HUMMEL_2);
speachTimer = 0; speachTimer = 0;
me->SetFaction(FACTION_MONSTER_2); me->SetFaction(FACTION_MONSTER_2);
me->SetInCombatWithZone(); me->SetInCombatWithZone();
@@ -405,17 +411,40 @@ struct npc_love_in_air_hummel : public ScriptedAI
break; break;
} }
case EVENT_SPELL_PERFUME_SPRAY: case EVENT_SPELL_PERFUME_SPRAY:
me->CastSpell(me->GetVictim(), SPELL_ALLURING_PERFUME_SPRAY, false); DoCastVictim(SPELL_ALLURING_PERFUME_SPRAY);
events.RepeatEvent(6000); events.RepeatEvent(6000);
break; break;
case EVENT_SPELL_CHAIN_REACTION: case EVENT_SPELL_CHAIN_REACTION:
me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); DoCastVictim(SPELL_CHAIN_REACTION);
events.RepeatEvent(12000); events.RepeatEvent(12000);
break; break;
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
};
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
{
creature->AI()->DoAction(ACTION_START_EVENT);
CloseGossipMenuFor(player);
return true;
}
bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest* _Quest, uint32 /*slot*/) override
{
if (_Quest->GetQuestId() == QUEST_YOUVE_BEEN_SERVED)
{
creature->AI()->DoAction(ACTION_START_EVENT);
}
return true;
}
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_love_in_air_hummelAI(creature);
};
}; };
enum HummelHelperSay enum HummelHelperSay
@@ -482,11 +511,11 @@ struct npc_love_in_air_hummel_helper : public ScriptedAI
switch (events.ExecuteEvent()) switch (events.ExecuteEvent())
{ {
case EVENT_SPELL_PERFUME_SPRAY: case EVENT_SPELL_PERFUME_SPRAY:
me->CastSpell(me->GetVictim(), SPELL_COLOGNE_SPRAY, false); DoCastVictim(SPELL_COLOGNE_SPRAY);
events.RepeatEvent(6000); events.RepeatEvent(6000);
break; break;
case EVENT_SPELL_CHAIN_REACTION: case EVENT_SPELL_CHAIN_REACTION:
me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); DoCastVictim(SPELL_CHAIN_REACTION);
events.RepeatEvent(12000); events.RepeatEvent(12000);
break; break;
case EVENT_SPELL_THROW: case EVENT_SPELL_THROW:
@@ -745,7 +774,7 @@ void AddSC_event_love_in_the_air()
RegisterCreatureAI(npc_love_in_air_snivel_real); RegisterCreatureAI(npc_love_in_air_snivel_real);
// Boss // Boss
RegisterCreatureAI(npc_love_in_air_hummel); new npc_love_in_air_hummel;
RegisterCreatureAI(npc_love_in_air_hummel_helper); RegisterCreatureAI(npc_love_in_air_hummel_helper);
// Spells // Spells