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

Public Member Functions

 npc_pet_gen_argent_pony_bridle (Creature *c)
 
void EnterEvadeMode (EvadeReason) override
 
void Reset () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
uint32 GetData (uint32 param) const override
 
void DoAction (int32 param) override
 
bool OnGossipHello (Player *player, Creature *creature)
 
bool OnGossipSelect (Player *player, Creature *creature, uint32, uint32 action)
 
- 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 (Position const *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
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=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, 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 >
T const & DUNGEON_MODE (T const &normal5, T const &heroic10) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25, T const &heroic10, T const &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=0ms)
 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
 
bool IsEngaged () const
 Check if creature is currently engaged in combat.
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual bool IsEscortNPC (bool=true) const
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void OnSpellCast (SpellInfo const *)
 
virtual void OnSpellFailed (SpellInfo const *)
 
virtual void OnChannelFinished (SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, 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 *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void OnOwnerCombatInteraction (Unit *target)
 
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)
 
virtual void DistancingStarted ()
 
virtual void DistancingEnded ()
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, 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 EvadeTimerExpired ()
 Called when evade timer expires (target unreachable for too long)
 
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, int32 aura=0)
 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
 

Private Attributes

bool _init
 
uint8 _state
 
int32 _mountTimer
 
std::unordered_map< uint8, bool > _banners
 
uint32 _lastAura
 

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 ()
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
- 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
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_pet_gen_argent_pony_bridle()

npc_pet_gen_argent_pony_bridle::npc_pet_gen_argent_pony_bridle ( Creature c)
inline
153 : ScriptedAI(c)
154 {
156 _init = false;
157 _mountTimer = 4000;
158 _lastAura = 0;
159 }
@ ARGENT_PONY_STATE_NONE
Definition pet_generic.cpp:99
Definition ScriptedCreature.h:191
int32 _mountTimer
Definition pet_generic.cpp:346
uint32 _lastAura
Definition pet_generic.cpp:348
bool _init
Definition pet_generic.cpp:344
uint8 _state
Definition pet_generic.cpp:345

References _init, _lastAura, _mountTimer, _state, and ARGENT_PONY_STATE_NONE.

Member Function Documentation

◆ DoAction()

void npc_pet_gen_argent_pony_bridle::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

260 {
261 if (param > 60000)
262 {
263 if (_lastAura)
265 _lastAura = param;
266 return;
267 }
268
269 _state = param;
270 }
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5189
Creature * me
Definition ScriptedCreature.h:281

References _lastAura, _state, ScriptedAI::me, and Unit::RemoveAurasDueToSpell().

◆ EnterEvadeMode()

void npc_pet_gen_argent_pony_bridle::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

162 {
163 if (Unit* owner = me->GetCharmerOrOwner())
164 {
165 me->GetMotionMaster()->Clear(false);
167 }
168 }
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:65
constexpr float MINI_PET_FOLLOW_ANGLE
Definition PetDefines.h:209
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:448
void Clear(bool reset=true)
Definition MotionMaster.h:193
Definition Unit.h:665
MotionMaster * GetMotionMaster()
Definition Unit.h:1758
Unit * GetCharmerOrOwner() const
Definition Unit.h:1287

References MotionMaster::Clear(), Unit::GetCharmerOrOwner(), Unit::GetMotionMaster(), ScriptedAI::me, MINI_PET_FOLLOW_ANGLE, MOTION_SLOT_ACTIVE, MotionMaster::MoveFollow(), and PET_FOLLOW_DIST.

◆ GetData()

uint32 npc_pet_gen_argent_pony_bridle::GetData ( uint32  param) const
inlineoverridevirtual

Reimplemented from UnitAI.

251 {
252 if (param == 0)
253 return _state;
254
255 auto itr = _banners.find(param);
256 return (itr != _banners.end() && itr->second) ? 1 : 0;
257 }
std::unordered_map< uint8, bool > _banners
Definition pet_generic.cpp:347

References _banners, and _state.

◆ OnGossipHello()

bool npc_pet_gen_argent_pony_bridle::OnGossipHello ( Player player,
Creature creature 
)
inline
273 {
274 if (player->GetGUID() != creature->GetOwnerGUID())
275 return true;
276
277 if (!creature->HasAura(player->GetTeamId(true) ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S))
278 {
279 uint8 _state = creature->AI()->GetData(0 /*GET_DATA_STATE*/);
286 }
287
288 for (auto const& [raceId, banner] : argentBanners)
289 {
290 if (creature->AI()->GetData(raceId) == uint32(true))
291 AddGossipItemFor(player, GOSSIP_ICON_CHAT, banner.text, GOSSIP_SENDER_MAIN, banner.spell);
292 }
293
294 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
295 return true;
296 }
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:61
@ GOSSIP_ICON_INTERACT_1
Definition GossipDef.h:65
@ GOSSIP_ICON_VENDOR
Definition GossipDef.h:62
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition ScriptedGossip.cpp:28
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
Definition ScriptedGossip.cpp:45
@ GOSSIP_SENDER_MAIN
Definition ScriptedGossip.h:70
@ GOSSIP_ACTION_BANK
Definition ScriptedGossip.h:61
@ GOSSIP_ACTION_TRADE
Definition ScriptedGossip.h:56
CreatureAI * AI() const
Definition Creature.h:144
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
TeamId GetTeamId(bool original=false) const
Definition Player.h:2138
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition PlayerGossip.cpp:409
virtual uint32 GetData(uint32) const
Definition UnitAI.h:218
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:6017
ObjectGuid GetOwnerGUID() const
Definition Unit.h:714
static std::unordered_map< uint8, argentPonyBanner > argentBanners
Definition pet_generic.cpp:138
@ ARGENT_PONY_STATE_MAILBOX
Definition pet_generic.cpp:103
@ ARGENT_PONY_STATE_BANK
Definition pet_generic.cpp:102
@ ARGENT_PONY_STATE_VENDOR
Definition pet_generic.cpp:101
@ SPELL_AURA_TIRED_G
Definition pet_generic.cpp:115
@ ARGENT_PONY_STATE_ENCH
Definition pet_generic.cpp:100
@ SPELL_AURA_TIRED_S
Definition pet_generic.cpp:110
@ GOSSIP_ACTION_MAILBOX
Definition pet_generic.cpp:119

References _state, AddGossipItemFor(), Creature::AI(), ARGENT_PONY_STATE_BANK, ARGENT_PONY_STATE_ENCH, ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR, argentBanners, UnitAI::GetData(), Player::GetGossipTextId(), Object::GetGUID(), Unit::GetOwnerGUID(), Player::GetTeamId(), GOSSIP_ACTION_BANK, GOSSIP_ACTION_MAILBOX, GOSSIP_ACTION_TRADE, GOSSIP_ICON_CHAT, GOSSIP_ICON_INTERACT_1, GOSSIP_ICON_VENDOR, GOSSIP_SENDER_MAIN, Unit::HasAura(), SendGossipMenuFor(), SPELL_AURA_TIRED_G, and SPELL_AURA_TIRED_S.

◆ OnGossipSelect()

bool npc_pet_gen_argent_pony_bridle::OnGossipSelect ( Player player,
Creature creature,
uint32  ,
uint32  action 
)
inline
299 {
300 CloseGossipMenuFor(player);
301 uint32 spellId = 0;
302 switch (action)
303 {
306 player->GetSession()->SendListInventory(creature->GetGUID());
307 spellId = player->GetTeamId(true) ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S;
309 break;
312 player->GetSession()->SendShowBank(player->GetGUID());
313 spellId = player->GetTeamId(true) ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S;
314 creature->AI()->DoAction(ARGENT_PONY_STATE_BANK);
315 break;
317 {
319 player->GetSession()->SendShowMailBox(creature->GetGUID());
320 spellId = player->GetTeamId(true) ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S;
322 break;
323 }
324 default:
325 if (action > 60000)
326 {
327 creature->AI()->DoAction(action);
328 creature->CastSpell(creature, action, true);
329 }
330 return true;
331 }
332
333 if (spellId && !creature->HasAura(spellId))
334 {
335 creature->CastSpell(creature, spellId, true);
336 player->AddSpellCooldown(spellId, 0, 3 * MINUTE * IN_MILLISECONDS);
338 creature->DespawnOrUnsummon(180s);
339 }
340 return true;
341 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto HOUR
Definition Common.h:48
constexpr auto MINUTE
Definition Common.h:47
void CloseGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:56
@ UNIT_NPC_FLAG_BANKER
Definition UnitDefines.h:339
@ UNIT_NPC_FLAG_VENDOR
Definition UnitDefines.h:329
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:322
@ UNIT_NPC_FLAG_MAILBOX
Definition UnitDefines.h:348
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2199
WorldSession * GetSession() const
Definition Player.h:2030
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11258
virtual void DoAction(int32)
Definition UnitAI.h:217
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:1361
void ReplaceAllNpcFlags(NPCFlags flags)
Definition Unit.h:767
void SendListInventory(ObjectGuid guid, uint32 vendorEntry=0)
Definition ItemHandler.cpp:854
void SendShowMailBox(ObjectGuid guid)
Definition NPCHandler.cpp:74
void SendShowBank(ObjectGuid guid)
Definition BankHandler.cpp:186
@ SPELL_AURA_BANK_G
Definition pet_generic.cpp:112
@ SPELL_AURA_POSTMAN_S
Definition pet_generic.cpp:107
@ SPELL_AURA_SHOP_S
Definition pet_generic.cpp:108
@ SPELL_AURA_BANK_S
Definition pet_generic.cpp:109
@ SPELL_AURA_SHOP_G
Definition pet_generic.cpp:114
@ SPELL_AURA_POSTMAN_G
Definition pet_generic.cpp:113

References Player::AddSpellCooldown(), Creature::AI(), ARGENT_PONY_STATE_BANK, ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR, Unit::CastSpell(), CloseGossipMenuFor(), Creature::DespawnOrUnsummon(), UnitAI::DoAction(), Object::GetGUID(), Player::GetSession(), Player::GetTeamId(), GOSSIP_ACTION_BANK, GOSSIP_ACTION_MAILBOX, GOSSIP_ACTION_TRADE, Unit::HasAura(), HOUR, IN_MILLISECONDS, MINUTE, Unit::ReplaceAllNpcFlags(), WorldSession::SendListInventory(), WorldSession::SendShowBank(), WorldSession::SendShowMailBox(), SPELL_AURA_BANK_G, SPELL_AURA_BANK_S, SPELL_AURA_POSTMAN_G, SPELL_AURA_POSTMAN_S, SPELL_AURA_SHOP_G, SPELL_AURA_SHOP_S, SPELL_AURA_TIRED_G, SPELL_AURA_TIRED_S, UNIT_NPC_FLAG_BANKER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAG_MAILBOX, and UNIT_NPC_FLAG_VENDOR.

◆ Reset()

void npc_pet_gen_argent_pony_bridle::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

171 {
172 if (_init)
173 return;
174
175 _init = true;
176 uint32 duration = 0;
177 uint32 aura = 0;
179
180 if (Unit* owner = me->GetCharmerOrOwner())
181 if (Player* player = owner->ToPlayer())
182 if (player->HasAchieved(ACHIEVEMENT_PONY_UP))
183 {
185
186 aura = (player->GetTeamId(true) == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G);
187 duration = player->GetSpellCooldownDelay(aura);
189
190 for (uint8 i = 0; i < 3; ++i)
191 {
192 if (player->GetTeamId(true) == TEAM_ALLIANCE)
193 {
194 if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S + i))
195 {
196 duration = cooldown;
197 aura = SPELL_AURA_POSTMAN_S + i;
199 me->ToTempSummon()->UnSummon(Milliseconds(duration));
200 break;
201 }
202 }
203 else
204 {
205 if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_BANK_G + i))
206 {
207 duration = cooldown * IN_MILLISECONDS;
208 aura = SPELL_AURA_BANK_G + i;
210 me->ToTempSummon()->UnSummon(Milliseconds(duration));
211 break;
212 }
213 }
214 }
215
216 // Generate Banners
217 uint32 mask = player->GetTeamId(true) ? sRaceMgr->GetHordeRaceMask() : sRaceMgr->GetAllianceRaceMask();
218 for (auto const& [raceId, banner] : argentBanners)
219 {
220 if ((mask & (1 << (raceId - 1))) && player->HasAchieved(banner.achievement))
221 _banners[raceId] = true;
222 }
223 }
224
225 if (duration && aura)
226 {
227 if (Aura* aur = me->AddAura(aura, me))
228 aur->SetDuration(duration);
229 }
230 }
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:27
#define sRaceMgr
Definition RaceMgr.h:52
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
@ UNIT_NPC_FLAG_NONE
Definition UnitDefines.h:321
Definition SpellAuras.h:87
Player * ToPlayer()
Definition Object.h:202
Definition Player.h:1086
virtual void UnSummon(Milliseconds msTime=0ms)
Definition TemporarySummon.cpp:292
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:15137
TempSummon * ToTempSummon()
Definition Unit.h:732
static uint32 argentPonyService[2][3]
Definition pet_generic.cpp:125
@ ACHIEVEMENT_PONY_UP
Definition pet_generic.cpp:117

References _banners, _init, _state, ACHIEVEMENT_PONY_UP, Unit::AddAura(), ARGENT_PONY_STATE_ENCH, argentBanners, argentPonyService, Unit::GetCharmerOrOwner(), IN_MILLISECONDS, ScriptedAI::me, Unit::ReplaceAllNpcFlags(), SPELL_AURA_BANK_G, SPELL_AURA_POSTMAN_S, SPELL_AURA_TIRED_G, SPELL_AURA_TIRED_S, sRaceMgr, TEAM_ALLIANCE, TEAM_HORDE, Object::ToPlayer(), Unit::ToTempSummon(), UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAG_NONE, and TempSummon::UnSummon().

◆ UpdateAI()

void npc_pet_gen_argent_pony_bridle::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

233 {
234 _mountTimer += diff;
235 if (_mountTimer > 5000)
236 {
237 _mountTimer = 0;
240 else if (Unit* owner = me->GetCharmerOrOwner())
241 {
242 if (owner->IsMounted() && !me->IsMounted())
244 else if (!owner->IsMounted() && me->IsMounted())
246 }
247 }
248 }
bool IsMounted() const
Definition Unit.h:1886
@ SPELL_PONY_MOUNT
Definition pet_generic.cpp:105

References _mountTimer, _state, ARGENT_PONY_STATE_NONE, Unit::CastSpell(), Unit::GetCharmerOrOwner(), Unit::IsMounted(), ScriptedAI::me, Unit::RemoveAurasDueToSpell(), Unit::ReplaceAllNpcFlags(), SPELL_PONY_MOUNT, and UNIT_NPC_FLAG_NONE.

Member Data Documentation

◆ _banners

std::unordered_map<uint8, bool> npc_pet_gen_argent_pony_bridle::_banners
private

Referenced by GetData(), and Reset().

◆ _init

bool npc_pet_gen_argent_pony_bridle::_init
private

◆ _lastAura

uint32 npc_pet_gen_argent_pony_bridle::_lastAura
private

◆ _mountTimer

int32 npc_pet_gen_argent_pony_bridle::_mountTimer
private

◆ _state

uint8 npc_pet_gen_argent_pony_bridle::_state
private

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