TrinityCore
Loading...
Searching...
No Matches
boss_apothecary_hummel.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Containers.h"
20#include "GridNotifiersImpl.h"
21#include "Group.h"
22#include "InstanceScript.h"
23#include "LFGMgr.h"
24#include "Map.h"
25#include "MotionMaster.h"
26#include "Player.h"
27#include "ScriptedCreature.h"
28#include "ScriptedGossip.h"
29#include "shadowfang_keep.h"
30#include "SpellScript.h"
31
50
63
78
93
94Position const BaxterMovePos = { -221.4115f, 2206.825f, 79.93151f, 0.0f };
95Position const FryeMovePos = { -196.2483f, 2197.224f, 79.9315f, 0.0f };
96
98{
100
101 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
102 {
103 if (menuId == GOSSIP_MENU_HUMMEL && gossipListId == GOSSIP_OPTION_START)
104 {
106 CloseGossipMenuFor(player);
108 }
109 return false;
110 }
111
112 void Reset() override
113 {
114 _Reset();
115 _deadCount = 0;
116 _isDead = false;
120 }
121
122 void EnterEvadeMode(EvadeReason /*why*/) override
123 {
127 }
128
142
143 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
144 {
145 if (damage >= me->GetHealth())
146 if (_deadCount < 2)
147 {
148 damage = me->GetHealth() - 1;
149 if (!_isDead)
150 {
151 _isDead = true;
156 }
157 }
158 }
159
160 void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
161 {
162 if (summon->GetEntry() == NPC_APOTHECARY_FRYE || summon->GetEntry() == NPC_APOTHECARY_BAXTER)
163 _deadCount++;
164
167 }
168
169 void JustDied(Unit* /*killer*/) override
170 {
171 if (!_isDead)
173
174 events.Reset();
177
178 Map::PlayerList const& players = me->GetMap()->GetPlayers();
179 if (!players.isEmpty())
180 {
181 if (Group* group = players.begin()->GetSource()->GetGroup())
182 if (group->isLFGGroup())
183 sLFGMgr->FinishDungeon(group->GetGUID(), 288, me->GetMap());
184 }
185 }
186
187 void UpdateAI(uint32 diff) override
188 {
190 return;
191
192 events.Update(diff);
193
195 return;
196
197 while (uint32 eventId = events.ExecuteEvent())
198 {
199 switch (eventId)
200 {
204 break;
208 break;
212 break;
214 {
215 me->SetImmuneToAll(false);
223
224 std::vector<Creature*> trashs;
226 for (Creature* crea : trashs)
227 crea->DespawnOrUnsummon();
228
229 break;
230 }
232 {
237 break;
238 }
239 case EVENT_CALL_FRYE:
240 {
244 break;
245 }
248 break;
252 break;
256 break;
260 events.Repeat(Seconds(25));
261 break;
262 default:
263 break;
264 }
265
267 return;
268 }
269
271 }
272
273 void OnQuestReward(Player* /*player*/, Quest const* quest, uint32 /*opt*/) override
274 {
275 if (quest->GetQuestId() == QUEST_YOUVE_BEEN_SERVED)
277 }
278
279 private:
282};
283
285{
286 npc_apothecary_genericAI(Creature* creature, Position pos) : ScriptedAI(creature), _movePos(pos) { }
287
288 void DoAction(int32 action) override
289 {
290 if (action == ACTION_START_EVENT)
291 {
292 me->SetImmuneToPC(true);
295 }
296 else if (action == ACTION_START_FIGHT)
297 {
298 me->SetImmuneToAll(false);
300 }
301 }
302
303 void MovementInform(uint32 type, uint32 pointId) override
304 {
305 if (type == POINT_MOTION_TYPE && pointId == 1)
307 }
308
309protected:
311};
312
314{
316
317 void JustDied(Unit* /*killer*/) override
318 {
320 }
321};
322
324{
326
333
334 void JustDied(Unit* /*killer*/) override
335 {
336 _events.Reset();
338 }
339
340 void UpdateAI(uint32 diff) override
341 {
342 if (!UpdateVictim())
343 return;
344
345 _events.Update(diff);
346
348 return;
349
350 while (uint32 eventId = _events.ExecuteEvent())
351 {
352 switch (eventId)
353 {
357 break;
362 break;
363 default:
364 break;
365 }
366 }
367
369 }
370
371private:
373};
374
375// 68965 - [DND] Lingering Fumes Targetting (starter)
377{
379
381 {
382 Unit* caster = GetCaster();
383 if (!caster->IsInCombat() || roll_chance_i(50))
384 return;
385
386 std::list<Creature*> triggers;
387 caster->GetCreatureListWithEntryInGrid(triggers, NPC_VIAL_BUNNY, 100.0f);
388 if (triggers.empty())
389 return;
390
392 caster->GetMotionMaster()->MovePoint(0, trigger->GetPosition());
393
394 }
395
396 void HandleScript(SpellEffIndex /*effindex*/)
397 {
398 Unit* caster = GetCaster();
399 caster->CastSpell(GetHitUnit(), SPELL_VALIDATE_AREA, true);
400 }
401
407};
408
409// 68644 - [DND] Valentine Boss Validate Area
437
438// 69038 - Throw Cologne
453
454// 68966 - Throw Perfume
469
470// 68798 - Concentrated Alluring Perfume Spill
485
486// 68614 - Concentrated Irresistible Cologne Spill
501
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
@ DONE
#define sLFGMgr
Definition LFGMgr.h:492
@ POINT_MOTION_TYPE
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
void CloseGossipMenuFor(Player *player)
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
@ TARGET_UNIT_DEST_AREA_ENTRY
@ EMOTE_STATE_USE_STANDING
@ FACTION_FRIENDLY
@ FACTION_MONSTER
@ SPELL_AURA_PERIODIC_DUMMY
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectPeriodicFn(F, I, N)
#define SpellCastFn(F)
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ QUEST_YOUVE_BEEN_SERVED
@ GOSSIP_OPTION_START
@ NPC_CROWN_APOTHECARY
@ NPC_APOTHECARY_BAXTER
@ NPC_APOTHECARY_FRYE
@ SPELL_COLOGNE_SPILL_DAMAGE
@ SPELL_COLOGNE_SPRAY
@ SPELL_PERFUME_SPRAY
@ SPELL_THROW_PERFUME
@ SPELL_VALIDATE_AREA
@ SPELL_ALLURING_PERFUME
@ SPELL_COLOGNE_SPILL
@ SPELL_PERFUME_SPILL_DAMAGE
@ SPELL_CHAIN_REACTION
@ SPELL_BUNNY_LOCKDOWN
@ SPELL_QUIET_SUICIDE
@ SPELL_THROW_COLOGNE
@ SPELL_PERMANENT_FEIGN_DEATH
@ SPELL_PERFUME_SPILL
@ EVENT_COLOGNE_SPRAY
@ EVENT_CHAIN_REACTION
@ EVENT_PERFUME_SPRAY
@ EVENT_CRAZED_APOTHECARY
@ EVENT_CALL_CRAZED_APOTHECARY
Position const FryeMovePos
Position const BaxterMovePos
void AddSC_boss_apothecary_hummel()
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetTarget() const
InstanceScript *const instance
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
Definition Group.h:165
virtual bool SetBossState(uint32 id, EncounterState state)
bool isEmpty() const
Definition LinkedList.h:108
iterator begin()
PlayerList const & GetPlayers() const
Definition Map.h:448
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
uint32 GetEntry() const
Definition Object.h:81
Group * GetGroup()
Definition Player.h:2171
uint32 GetQuestId() const
Definition QuestDef.h:229
FROM * GetSource() const
Definition Reference.h:96
HookList< CastHandler > AfterCast
Unit * GetCaster() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoZoneInCombat(uint32 entry=0)
void DoAction(int32 info, Predicate &&predicate, uint16 max=0)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void SetEmoteState(Emote emote)
Definition Unit.h:967
uint32 GetHealth() const
Definition Unit.h:913
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool IsInCombat() const
Definition Unit.h:1144
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Map * GetMap() const
Definition Object.h:449
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:3153
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
PrepareAuraScript(spell_apothecary_cologne_spill)
PrepareSpellScript(spell_apothecary_lingering_fumes)
PrepareAuraScript(spell_apothecary_perfume_spill)
PrepareSpellScript(spell_apothecary_throw_cologne)
PrepareSpellScript(spell_apothecary_throw_perfume)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_apothecary_validate_area)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
#define RegisterShadowfangKeepCreatureAI(ai_name)
@ DATA_APOTHECARY_HUMMEL
@ DATA_SPAWN_VALENTINE_ADDS
void GetPosition(float &x, float &y) const
Definition Position.h:84
void SummonedCreatureDies(Creature *summon, Unit *) override
void UpdateAI(uint32 diff) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_apothecary_hummel(Creature *creature)
void EnterEvadeMode(EvadeReason) override
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override
void DoAction(int32 action) override
void OnQuestReward(Player *, Quest const *quest, uint32) override
npc_apothecary_baxter(Creature *creature)
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
npc_apothecary_frye(Creature *creature)
void JustDied(Unit *) override
void DoAction(int32 action) override
void MovementInform(uint32 type, uint32 pointId) override
npc_apothecary_genericAI(Creature *creature, Position pos)