AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_dark_iron_attack_generator Struct Reference
Inheritance diagram for npc_dark_iron_attack_generator:
ScriptedAI CreatureAI UnitAI

Public Member Functions

 npc_dark_iron_attack_generator (Creature *creature)
 
void Reset () override
 
void MoveInLineOfSight (Unit *) override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void SpellHit (Unit *caster, SpellInfo const *spellInfo) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void FinishEventDueToLoss ()
 
void FinishAttackDueToWin ()
 
void PrepareEvent ()
 
bool AllowStart ()
 
CreatureGetRandomBartender ()
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

EventMap events
 
SummonList summons
 
uint32 kegCounter
 
uint32 guzzlerCounter
 
uint8 thrown
 
GuidVector revelerGUIDs
 
- Public Attributes inherited from ScriptedAI
Creatureme
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_dark_iron_attack_generator()

npc_dark_iron_attack_generator::npc_dark_iron_attack_generator ( Creature creature)
inline
304: ScriptedAI(creature), summons(me) { }
Definition ScriptedCreature.h:190
Creature * me
Definition ScriptedCreature.h:280
SummonList summons
Definition brewfest.cpp:307

Member Function Documentation

◆ AllowStart()

bool npc_dark_iron_attack_generator::AllowStart ( )
inline
533 {
534 auto minutes = Acore::Time::GetMinutes();
535
536 if (!minutes || minutes == 30)
537 return true;
538
539 return false;
540 }
AC_COMMON_API uint32 GetMinutes(Seconds time=0s)
Definition Timer.cpp:374

References Acore::Time::GetMinutes().

Referenced by UpdateAI().

◆ FinishAttackDueToWin()

void npc_dark_iron_attack_generator::FinishAttackDueToWin ( )
inline
453 {
454 if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f))
455 {
456 char amount[500];
457 snprintf(amount, sizeof(amount), "RETREAT!! We've already lost %u and we can't afford to lose any more!!", guzzlerCounter);
458 herald->Yell(amount, LANG_UNIVERSAL);
459 }
460
462 Reset();
463 }
@ MAP_KALIMDOR
Definition AreaDefines.h:185
@ LANG_UNIVERSAL
Definition SharedDefines.h:735
@ SPELL_SUMMON_PLANS_A
Definition brewfest.cpp:292
@ SPELL_SUMMON_PLANS_H
Definition brewfest.cpp:293
@ NPC_DARK_IRON_HERALD
Definition brewfest.cpp:273
Definition Creature.h:43
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1179
uint32 GetMapId() const
Definition Position.h:280
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2459
uint32 guzzlerCounter
Definition brewfest.cpp:308
void Reset() override
Definition brewfest.cpp:312

References Unit::CastSpell(), WorldObject::FindNearestCreature(), WorldLocation::GetMapId(), guzzlerCounter, LANG_UNIVERSAL, MAP_KALIMDOR, ScriptedAI::me, NPC_DARK_IRON_HERALD, Reset(), SPELL_SUMMON_PLANS_A, and SPELL_SUMMON_PLANS_H.

Referenced by UpdateAI().

◆ FinishEventDueToLoss()

void npc_dark_iron_attack_generator::FinishEventDueToLoss ( )
inline
440 {
441 if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f))
442 {
443 char amount[500];
444 snprintf(amount, sizeof(amount), "We did it boys! Now back to the Grim Guzzler and we'll drink to the %u that were injured!", guzzlerCounter);
445 herald->Yell(amount, LANG_UNIVERSAL);
446 }
447
448 Reset();
449 events.RescheduleEvent(EVENT_CHECK_HOUR, 1min);
450 }
events
Definition boss_sartura.cpp:43
@ EVENT_CHECK_HOUR
Definition brewfest.cpp:277

References EVENT_CHECK_HOUR, WorldObject::FindNearestCreature(), guzzlerCounter, LANG_UNIVERSAL, ScriptedAI::me, NPC_DARK_IRON_HERALD, and Reset().

Referenced by SpellHit().

◆ GetRandomBartender()

Creature * npc_dark_iron_attack_generator::GetRandomBartender ( )
inline
543 {
544 uint32 entry = 0;
545 switch (urand(0, 2))
546 {
547 case 0:
549 break;
550 case 1:
552 break;
553 case 2:
554 entry = NPC_NORMAL_GORDOK;
555 break;
556 }
557
558 return me->FindNearestCreature(entry, 100.0f);
559 }
std::uint32_t uint32
Definition Define.h:107
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ NPC_NORMAL_THUNDERBREW
Definition brewfest.cpp:269
@ NPC_NORMAL_VOODOO
Definition brewfest.cpp:267
@ NPC_NORMAL_BARLEYBREW
Definition brewfest.cpp:268
@ NPC_NORMAL_GORDOK
Definition brewfest.cpp:270
@ NPC_NORMAL_DROHN
Definition brewfest.cpp:266

References WorldObject::FindNearestCreature(), WorldLocation::GetMapId(), MAP_KALIMDOR, ScriptedAI::me, NPC_NORMAL_BARLEYBREW, NPC_NORMAL_DROHN, NPC_NORMAL_GORDOK, NPC_NORMAL_THUNDERBREW, NPC_NORMAL_VOODOO, and urand().

Referenced by UpdateAI().

◆ JustEngagedWith()

void npc_dark_iron_attack_generator::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from CreatureAI.

342{}

◆ MoveInLineOfSight()

void npc_dark_iron_attack_generator::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

341{}

◆ PrepareEvent()

void npc_dark_iron_attack_generator::PrepareEvent ( )
inline
466 {
467 std::list<Creature*> revelers;
469 for (Creature* reveler : revelers)
470 {
471 revelerGUIDs.push_back(reveler->GetGUID());
472 reveler->SetRespawnDelay(MONTH);
473 reveler->AI()->SetData(0, me->GetMapId());
474 }
475
476 Creature* cr;
477 if (me->GetMapId() == MAP_KALIMDOR)
478 {
479 if ((cr = me->SummonCreature(NPC_DROHN_KEG, 1183.69f, -4315.15f, 21.1875f, 0.750492f)))
480 {
482 summons.Summon(cr);
483 revelerGUIDs.push_back(cr->GetGUID());
484 }
485 if ((cr = me->SummonCreature(NPC_VOODOO_KEG, 1182.42f, -4272.45f, 21.1182f, -1.02974f)))
486 {
488 summons.Summon(cr);
489 revelerGUIDs.push_back(cr->GetGUID());
490 }
491 if ((cr = me->SummonCreature(NPC_GORDOK_KEG, 1223.78f, -4296.48f, 21.1707f, -2.86234f)))
492 {
494 summons.Summon(cr);
495 revelerGUIDs.push_back(cr->GetGUID());
496 }
497 }
498 else if (me->GetMapId() == MAP_EASTERN_KINGDOMS)
499 {
500 if ((cr = me->SummonCreature(NPC_BARLEYBREW_KEG, -5187.23f, -599.779f, 397.176f, 0.017453f)))
501 {
503 summons.Summon(cr);
504 revelerGUIDs.push_back(cr->GetGUID());
505 }
506 if ((cr = me->SummonCreature(NPC_THUNDERBREW_KEG, -5160.05f, -632.632f, 397.178f, 1.39626f)))
507 {
509 summons.Summon(cr);
510 revelerGUIDs.push_back(cr->GetGUID());
511 }
512 if ((cr = me->SummonCreature(NPC_GORDOK_KEG, -5145.75f, -575.667f, 397.176f, -2.28638f)))
513 {
515 summons.Summon(cr);
516 revelerGUIDs.push_back(cr->GetGUID());
517 }
518 }
519
521 summons.Summon(cr);
522
523 kegCounter = 0;
524 guzzlerCounter = 0;
525 thrown = 0;
526
527 events.ScheduleEvent(EVENT_SPAWN_MOLE_MACHINE, 1500ms);
528 events.ScheduleEvent(EVENT_PRE_FINISH_ATTACK, 280s);
529 events.ScheduleEvent(EVENT_BARTENDER_SAY, 5s);
530 }
@ MAP_EASTERN_KINGDOMS
Definition AreaDefines.h:184
constexpr auto MONTH
Definition Common.h:51
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:49
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition ScriptedCreature.cpp:875
@ REACT_PASSIVE
Definition Unit.h:549
@ NPC_DROHN_KEG
Definition brewfest.cpp:263
@ EVENT_BARTENDER_SAY
Definition brewfest.cpp:281
@ EVENT_PRE_FINISH_ATTACK
Definition brewfest.cpp:279
@ NPC_GORDOK_KEG
Definition brewfest.cpp:261
@ NPC_BREWFEST_REVELER
Definition brewfest.cpp:274
@ EVENT_SPAWN_MOLE_MACHINE
Definition brewfest.cpp:278
@ NPC_VOODOO_KEG
Definition brewfest.cpp:262
@ NPC_THUNDERBREW_KEG
Definition brewfest.cpp:260
@ NPC_BARLEYBREW_KEG
Definition brewfest.cpp:259
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
void Summon(Creature const *summon)
Definition ScriptedCreature.h:88
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2368
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
uint32 kegCounter
Definition brewfest.cpp:308
GuidVector revelerGUIDs
Definition brewfest.cpp:310
uint8 thrown
Definition brewfest.cpp:309

References EVENT_BARTENDER_SAY, EVENT_PRE_FINISH_ATTACK, EVENT_SPAWN_MOLE_MACHINE, GetCreatureListWithEntryInGrid(), Object::GetGUID(), WorldLocation::GetMapId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), guzzlerCounter, kegCounter, MAP_EASTERN_KINGDOMS, MAP_KALIMDOR, ScriptedAI::me, MONTH, NPC_BARLEYBREW_KEG, NPC_BREWFEST_REVELER, NPC_DARK_IRON_HERALD, NPC_DROHN_KEG, NPC_GORDOK_KEG, NPC_THUNDERBREW_KEG, NPC_VOODOO_KEG, REACT_PASSIVE, revelerGUIDs, Creature::SetReactState(), SummonList::Summon(), WorldObject::SummonCreature(), summons, TEMPSUMMON_TIMED_DESPAWN, and thrown.

Referenced by UpdateAI().

◆ Reset()

void npc_dark_iron_attack_generator::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

313 {
314 for (ObjectGuid const& guid : revelerGUIDs)
315 {
316 if (Creature* reveler = ObjectAccessor::GetCreature(*me, guid))
317 {
318 reveler->SetRespawnDelay(5 * MINUTE);
319 reveler->Respawn();
320
321 // It's here because SmartAI::JustRespawned restores original faction
322 // So we need to delay a little bit reloading auras from creature_template_addon
323 reveler->m_Events.AddEventAtOffset([reveler]()
324 {
325 reveler->RemoveAllAuras();
326 reveler->LoadCreaturesAddon(true);
327 }, 100ms);
328 }
329 }
330 revelerGUIDs.clear();
331
333 events.Reset();
334 events.ScheduleEvent(EVENT_CHECK_HOUR, 2s);
335 kegCounter = 0;
336 guzzlerCounter = 0;
337 thrown = 0;
338 }
constexpr auto MINUTE
Definition Common.h:47
Definition ObjectGuid.h:118
void DespawnAll(uint32 delay=0)
Definition ScriptedCreature.cpp:71
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:210

References SummonList::DespawnAll(), EVENT_CHECK_HOUR, ObjectAccessor::GetCreature(), guzzlerCounter, kegCounter, ScriptedAI::me, MINUTE, revelerGUIDs, summons, and thrown.

Referenced by FinishAttackDueToWin(), and FinishEventDueToLoss().

◆ SpellHit()

void npc_dark_iron_attack_generator::SpellHit ( Unit caster,
SpellInfo const *  spellInfo 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

345 {
346 if (spellInfo->Id == SPELL_REPORT_DEATH)
347 {
348 if (caster->GetEntry() == NPC_DARK_IRON_GUZZLER)
350 else
351 {
352 kegCounter++;
353 if (kegCounter == 3)
355 }
356 }
357 }
@ NPC_DARK_IRON_GUZZLER
Definition brewfest.cpp:265
@ SPELL_REPORT_DEATH
Definition brewfest.cpp:289
uint32 GetEntry() const
Definition Object.h:116
void FinishEventDueToLoss()
Definition brewfest.cpp:439

References FinishEventDueToLoss(), Object::GetEntry(), guzzlerCounter, SpellInfo::Id, kegCounter, NPC_DARK_IRON_GUZZLER, and SPELL_REPORT_DEATH.

◆ UpdateAI()

void npc_dark_iron_attack_generator::UpdateAI ( uint32  )
inlineoverridevirtual

Use to start attacking a target. Called just before JustEngagedWith()

Implements UnitAI.

360 {
361 events.Update(diff);
362 switch (events.ExecuteEvent())
363 {
364 case EVENT_CHECK_HOUR:
365 {
366 // determine hour
367 if (AllowStart())
368 {
369 PrepareEvent();
370 events.RepeatEvent(300000);
371 return;
372 }
373 events.RepeatEvent(2000);
374 break;
375 }
377 {
378 if (me->GetMapId() == MAP_KALIMDOR)
379 {
380 float rand = 8 + rand_norm() * 12;
381 float angle = rand_norm() * 2 * M_PI;
382 float x = 1201.8f + rand * cos(angle);
383 float y = -4299.6f + rand * std::sin(angle);
384 if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f))
385 cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
386 }
387 else if (me->GetMapId() == MAP_EASTERN_KINGDOMS)
388 {
389 float rand = rand_norm() * 20;
390 float angle = rand_norm() * 2 * M_PI;
391 float x = -5157.1f + rand * cos(angle);
392 float y = -598.98f + rand * std::sin(angle);
393 if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f))
394 cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
395 }
396 events.RepeatEvent(3000);
397 break;
398 }
400 {
401 events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE);
402 events.ScheduleEvent(EVENT_FINISH_ATTACK, 20s);
403 break;
404 }
406 {
408 events.RescheduleEvent(EVENT_CHECK_HOUR, 1min);
409 break;
410 }
412 {
413 events.RepeatEvent(12000);
414 Creature* sayer = GetRandomBartender();
415 if (!sayer)
416 return;
417
418 thrown++;
419 if (thrown == 3)
420 {
421 thrown = 0;
422 sayer->Say("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL);
423 //sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true);
424 sayer->SummonCreature(NPC_SUPER_BREW_TRIGGER, sayer->GetPositionX() + 15 * cos(sayer->GetOrientation()), sayer->GetPositionY() + 15 * std::sin(sayer->GetOrientation()), sayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
425 }
426 else
427 {
428 if (urand(0, 1))
429 sayer->Say("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL);
430 else
431 sayer->Say("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL);
432 }
433
434 break;
435 }
436 }
437 }
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:48
double rand_norm()
Definition Random.cpp:85
@ NPC_MOLE_MACHINE_TRIGGER
Definition brewfest.cpp:264
@ SPELL_SPAWN_MOLE_MACHINE
Definition brewfest.cpp:286
@ EVENT_FINISH_ATTACK
Definition brewfest.cpp:280
@ NPC_SUPER_BREW_TRIGGER
Definition brewfest.cpp:272
virtual void Say(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition Unit.cpp:20953
float GetOrientation() const
Definition Position.h:124
void PrepareEvent()
Definition brewfest.cpp:465
bool AllowStart()
Definition brewfest.cpp:532
void FinishAttackDueToWin()
Definition brewfest.cpp:452
Creature * GetRandomBartender()
Definition brewfest.cpp:542

References AllowStart(), EVENT_BARTENDER_SAY, EVENT_CHECK_HOUR, EVENT_FINISH_ATTACK, EVENT_PRE_FINISH_ATTACK, EVENT_SPAWN_MOLE_MACHINE, FinishAttackDueToWin(), WorldLocation::GetMapId(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetRandomBartender(), LANG_UNIVERSAL, MAP_EASTERN_KINGDOMS, MAP_KALIMDOR, ScriptedAI::me, NPC_MOLE_MACHINE_TRIGGER, NPC_SUPER_BREW_TRIGGER, PrepareEvent(), rand_norm(), Unit::Say(), SPELL_SPAWN_MOLE_MACHINE, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, thrown, and urand().

Member Data Documentation

◆ events

EventMap npc_dark_iron_attack_generator::events

◆ guzzlerCounter

uint32 npc_dark_iron_attack_generator::guzzlerCounter

◆ kegCounter

uint32 npc_dark_iron_attack_generator::kegCounter

Referenced by PrepareEvent(), Reset(), and SpellHit().

◆ revelerGUIDs

GuidVector npc_dark_iron_attack_generator::revelerGUIDs

Referenced by PrepareEvent(), and Reset().

◆ summons

SummonList npc_dark_iron_attack_generator::summons

Referenced by PrepareEvent(), and Reset().

◆ thrown

uint8 npc_dark_iron_attack_generator::thrown

Referenced by PrepareEvent(), Reset(), and UpdateAI().


The documentation for this struct was generated from the following file: