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. More...
 
void SpellHit (Unit *caster, SpellInfo const *spellInfo) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
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) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
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. More...
 
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. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
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 ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
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 ()
 
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 AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
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: More...
 
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. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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)
 
virtual void MoveInLineOfSight (Unit *)
 
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
303: ScriptedAI(creature), summons(me) { }
Definition: ScriptedCreature.h:190
Creature * me
Definition: ScriptedCreature.h:280
SummonList summons
Definition: brewfest.cpp:306

Member Function Documentation

◆ AllowStart()

bool npc_dark_iron_attack_generator::AllowStart ( )
inline
532 {
533 auto minutes = Acore::Time::GetMinutes();
534
535 if (!minutes || minutes == 30)
536 return true;
537
538 return false;
539 }
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
452 {
453 if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f))
454 {
455 char amount[500];
456 snprintf(amount, sizeof(amount), "RETREAT!! We've already lost %u and we can't afford to lose any more!!", guzzlerCounter);
457 herald->Yell(amount, LANG_UNIVERSAL);
458 }
459
461 Reset();
462 }
@ SPELL_SUMMON_PLANS_A
Definition: brewfest.cpp:291
@ SPELL_SUMMON_PLANS_H
Definition: brewfest.cpp:292
@ NPC_DARK_IRON_HERALD
Definition: brewfest.cpp:272
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
Definition: Creature.h:43
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2457
uint32 GetMapId() const
Definition: Position.h:275
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:1167
uint32 guzzlerCounter
Definition: brewfest.cpp:307
void Reset() override
Definition: brewfest.cpp:311

References Unit::CastSpell(), WorldObject::FindNearestCreature(), WorldLocation::GetMapId(), guzzlerCounter, LANG_UNIVERSAL, 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
439 {
440 if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f))
441 {
442 char amount[500];
443 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);
444 herald->Yell(amount, LANG_UNIVERSAL);
445 }
446
447 Reset();
448 events.RescheduleEvent(EVENT_CHECK_HOUR, 1min);
449 }
events
Definition: boss_sartura.cpp:43
@ EVENT_CHECK_HOUR
Definition: brewfest.cpp:276

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
542 {
543 uint32 entry = 0;
544 switch (urand(0, 2))
545 {
546 case 0:
548 break;
549 case 1:
551 break;
552 case 2:
553 entry = NPC_NORMAL_GORDOK;
554 break;
555 }
556
557 return me->FindNearestCreature(entry, 100.0f);
558 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
std::uint32_t uint32
Definition: Define.h:107
@ NPC_NORMAL_THUNDERBREW
Definition: brewfest.cpp:268
@ NPC_NORMAL_VOODOO
Definition: brewfest.cpp:266
@ NPC_NORMAL_BARLEYBREW
Definition: brewfest.cpp:267
@ NPC_NORMAL_GORDOK
Definition: brewfest.cpp:269
@ NPC_NORMAL_DROHN
Definition: brewfest.cpp:265

References WorldObject::FindNearestCreature(), WorldLocation::GetMapId(), 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 ScriptedAI.

341{}

◆ MoveInLineOfSight()

void npc_dark_iron_attack_generator::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

340{}

◆ PrepareEvent()

void npc_dark_iron_attack_generator::PrepareEvent ( )
inline
465 {
466 std::list<Creature*> revelers;
468 for (Creature* reveler : revelers)
469 {
470 revelerGUIDs.push_back(reveler->GetGUID());
471 reveler->SetRespawnDelay(MONTH);
472 reveler->AI()->SetData(0, me->GetMapId());
473 }
474
475 Creature* cr;
476 if (me->GetMapId() == 1) // Kalimdor
477 {
478 if ((cr = me->SummonCreature(NPC_DROHN_KEG, 1183.69f, -4315.15f, 21.1875f, 0.750492f)))
479 {
481 summons.Summon(cr);
482 revelerGUIDs.push_back(cr->GetGUID());
483 }
484 if ((cr = me->SummonCreature(NPC_VOODOO_KEG, 1182.42f, -4272.45f, 21.1182f, -1.02974f)))
485 {
487 summons.Summon(cr);
488 revelerGUIDs.push_back(cr->GetGUID());
489 }
490 if ((cr = me->SummonCreature(NPC_GORDOK_KEG, 1223.78f, -4296.48f, 21.1707f, -2.86234f)))
491 {
493 summons.Summon(cr);
494 revelerGUIDs.push_back(cr->GetGUID());
495 }
496 }
497 else if (me->GetMapId() == 0) // Eastern Kingdom
498 {
499 if ((cr = me->SummonCreature(NPC_BARLEYBREW_KEG, -5187.23f, -599.779f, 397.176f, 0.017453f)))
500 {
502 summons.Summon(cr);
503 revelerGUIDs.push_back(cr->GetGUID());
504 }
505 if ((cr = me->SummonCreature(NPC_THUNDERBREW_KEG, -5160.05f, -632.632f, 397.178f, 1.39626f)))
506 {
508 summons.Summon(cr);
509 revelerGUIDs.push_back(cr->GetGUID());
510 }
511 if ((cr = me->SummonCreature(NPC_GORDOK_KEG, -5145.75f, -575.667f, 397.176f, -2.28638f)))
512 {
514 summons.Summon(cr);
515 revelerGUIDs.push_back(cr->GetGUID());
516 }
517 }
518
520 summons.Summon(cr);
521
522 kegCounter = 0;
523 guzzlerCounter = 0;
524 thrown = 0;
525
526 events.ScheduleEvent(EVENT_SPAWN_MOLE_MACHINE, 1500ms);
527 events.ScheduleEvent(EVENT_PRE_FINISH_ATTACK, 280s);
528 events.ScheduleEvent(EVENT_BARTENDER_SAY, 5s);
529 }
constexpr auto MONTH
Definition: Common.h:51
@ NPC_DROHN_KEG
Definition: brewfest.cpp:262
@ EVENT_BARTENDER_SAY
Definition: brewfest.cpp:280
@ EVENT_PRE_FINISH_ATTACK
Definition: brewfest.cpp:278
@ NPC_GORDOK_KEG
Definition: brewfest.cpp:260
@ NPC_BREWFEST_REVELER
Definition: brewfest.cpp:273
@ EVENT_SPAWN_MOLE_MACHINE
Definition: brewfest.cpp:277
@ NPC_VOODOO_KEG
Definition: brewfest.cpp:261
@ NPC_THUNDERBREW_KEG
Definition: brewfest.cpp:259
@ NPC_BARLEYBREW_KEG
Definition: brewfest.cpp:258
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:860
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:48
@ REACT_PASSIVE
Definition: Unit.h:548
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:88
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
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:2366
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
uint32 kegCounter
Definition: brewfest.cpp:307
GuidVector revelerGUIDs
Definition: brewfest.cpp:309
uint8 thrown
Definition: brewfest.cpp:308

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, 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 ScriptedAI.

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

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 ScriptedAI.

344 {
345 if (spellInfo->Id == SPELL_REPORT_DEATH)
346 {
347 if (caster->GetEntry() == NPC_DARK_IRON_GUZZLER)
349 else
350 {
351 kegCounter++;
352 if (kegCounter == 3)
354 }
355 }
356 }
@ NPC_DARK_IRON_GUZZLER
Definition: brewfest.cpp:264
@ SPELL_REPORT_DEATH
Definition: brewfest.cpp:288
uint32 GetEntry() const
Definition: Object.h:115
void FinishEventDueToLoss()
Definition: brewfest.cpp:438

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()

Reimplemented from ScriptedAI.

359 {
360 events.Update(diff);
361 switch (events.ExecuteEvent())
362 {
363 case EVENT_CHECK_HOUR:
364 {
365 // determine hour
366 if (AllowStart())
367 {
368 PrepareEvent();
369 events.RepeatEvent(300000);
370 return;
371 }
372 events.RepeatEvent(2000);
373 break;
374 }
376 {
377 if (me->GetMapId() == 1) // Kalimdor
378 {
379 float rand = 8 + rand_norm() * 12;
380 float angle = rand_norm() * 2 * M_PI;
381 float x = 1201.8f + rand * cos(angle);
382 float y = -4299.6f + rand * std::sin(angle);
383 if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f))
384 cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
385 }
386 else if (me->GetMapId() == 0) // EK
387 {
388 float rand = rand_norm() * 20;
389 float angle = rand_norm() * 2 * M_PI;
390 float x = -5157.1f + rand * cos(angle);
391 float y = -598.98f + rand * std::sin(angle);
392 if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f))
393 cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true);
394 }
395 events.RepeatEvent(3000);
396 break;
397 }
399 {
400 events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE);
401 events.ScheduleEvent(EVENT_FINISH_ATTACK, 20s);
402 break;
403 }
405 {
407 events.RescheduleEvent(EVENT_CHECK_HOUR, 1min);
408 break;
409 }
411 {
412 events.RepeatEvent(12000);
413 Creature* sayer = GetRandomBartender();
414 if (!sayer)
415 return;
416
417 thrown++;
418 if (thrown == 3)
419 {
420 thrown = 0;
421 sayer->Say("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL);
422 //sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true);
423 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);
424 }
425 else
426 {
427 if (urand(0, 1))
428 sayer->Say("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL);
429 else
430 sayer->Say("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL);
431 }
432
433 break;
434 }
435 }
436 }
double rand_norm()
Definition: Random.cpp:77
@ NPC_MOLE_MACHINE_TRIGGER
Definition: brewfest.cpp:263
@ SPELL_SPAWN_MOLE_MACHINE
Definition: brewfest.cpp:285
@ EVENT_FINISH_ATTACK
Definition: brewfest.cpp:279
@ NPC_SUPER_BREW_TRIGGER
Definition: brewfest.cpp:271
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: Object.h:47
float GetOrientation() const
Definition: Position.h:119
virtual void Say(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:21139
void PrepareEvent()
Definition: brewfest.cpp:464
bool AllowStart()
Definition: brewfest.cpp:531
void FinishAttackDueToWin()
Definition: brewfest.cpp:451
Creature * GetRandomBartender()
Definition: brewfest.cpp:541

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, 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().