AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
NPCStaveQuestAI Struct Reference

#include "npc_stave_of_ancients.h"

Inheritance diagram for NPCStaveQuestAI:
ScriptedAI CreatureAI UnitAI npc_artorius::npc_artoriusAI npc_franklin::npc_franklinAI npc_nelson::npc_nelsonAI npc_precious::npc_preciousAI npc_simone::npc_simoneAI

Public Member Functions

 NPCStaveQuestAI (Creature *creature)
 
uint32 GetFormEntry (std::string)
 
bool InNormalForm ()
 
void RevealForm ()
 
void StorePlayerGUID ()
 
PlayerGetGossipPlayer ()
 
bool IsAllowedEntry (uint32)
 
bool UnitIsUnfair (Unit *unit)
 
bool IsFairFight ()
 
bool ValidThreatlist ()
 
void SetHomePosition ()
 
void PrepareForEncounter ()
 
void ClearLootIfUnfair (Unit *killer)
 
bool PlayerEligibleForReward (Unit *killer)
 
void StoreAttackerGuidValue (Unit *attacker)
 
bool QuestIncomplete (Unit *unit, uint32 questItem)
 
void ResetState (uint32)
 
void EvadeOnFeignDeath ()
 
virtual void AttackStart (Unit *)
 
virtual void AttackedBy (Unit *)
 
virtual void JustDied (Unit *)
 
- 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
 
- 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)
 
 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

ObjectGuid gossipPlayerGUID
 
ObjectGuid playerGUID
 
bool encounterStarted
 
ThreatContainer::StorageType const & threatList = me->GetThreatMgr().GetThreatList()
 
std::map< int, int > entryKeys
 
std::map< int, std::map< std::string, int > > entryList
 
std::vector< uint64attackerGuids
 
- 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

◆ NPCStaveQuestAI()

NPCStaveQuestAI::NPCStaveQuestAI ( Creature creature)
inline
135: ScriptedAI(creature) { }
Definition: ScriptedCreature.h:190

Member Function Documentation

◆ AttackedBy()

void NPCStaveQuestAI::AttackedBy ( Unit attacker)
virtual

Reimplemented from CreatureAI.

262{
263 StoreAttackerGuidValue(attacker);
264}
void StoreAttackerGuidValue(Unit *attacker)
Definition: npc_stave_of_ancients.cpp:192

References StoreAttackerGuidValue().

◆ AttackStart()

void NPCStaveQuestAI::AttackStart ( Unit target)
virtual

Reimplemented from ScriptedAI.

252{
253 if (playerGUID.IsEmpty() && !InNormalForm())
254 {
256 }
257
259}
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:208
bool IsEmpty() const
Definition: ObjectGuid.h:161
bool InNormalForm()
Definition: npc_stave_of_ancients.cpp:34
ObjectGuid playerGUID
Definition: npc_stave_of_ancients.h:138
void StorePlayerGUID()
Definition: npc_stave_of_ancients.cpp:49

References ScriptedAI::AttackStart(), InNormalForm(), ObjectGuid::IsEmpty(), playerGUID, and StorePlayerGUID().

◆ ClearLootIfUnfair()

void NPCStaveQuestAI::ClearLootIfUnfair ( Unit killer)
164{
165 // Remove loot if there is more than 1 attacker or Player doesn't have the quest
166 // this should prevent party kills and looting the quest item without putting any effort
167 if (attackerGuids.size() > 1 || !PlayerEligibleForReward(killer))
168 {
169 me->loot.clear();
170 return;
171 }
172}
Creature * me
Definition: ScriptedCreature.h:280
Loot loot
Definition: Creature.h:227
void clear()
Definition: LootMgr.h:343
std::vector< uint64 > attackerGuids
Definition: npc_stave_of_ancients.h:186
bool PlayerEligibleForReward(Unit *killer)
Definition: npc_stave_of_ancients.cpp:174

References attackerGuids, Loot::clear(), Creature::loot, ScriptedAI::me, and PlayerEligibleForReward().

Referenced by JustDied().

◆ EvadeOnFeignDeath()

void NPCStaveQuestAI::EvadeOnFeignDeath ( )
243{
245 if (player && player->HasAura(SPELL_FEIGN_DEATH))
246 {
248 }
249}
@ SPELL_FEIGN_DEATH
Definition: npc_stave_of_ancients.h:39
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
Definition: Player.h:1064
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5669

References CreatureAI::EnterEvadeMode(), ObjectAccessor::GetPlayer(), Unit::HasAura(), ScriptedAI::me, playerGUID, and SPELL_FEIGN_DEATH.

Referenced by npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_precious::npc_preciousAI::UpdateAI().

◆ GetFormEntry()

uint32 NPCStaveQuestAI::GetFormEntry ( std::string  type)
28{
29 uint32 currentEntry = me->GetEntry();
30 uint32 entryKey = entryKeys[currentEntry];
31 return entryList[entryKey][type];
32}
std::uint32_t uint32
Definition: Define.h:107
uint32 GetEntry() const
Definition: Object.h:112
std::map< int, int > entryKeys
Definition: npc_stave_of_ancients.h:142
std::map< int, std::map< std::string, int > > entryList
Definition: npc_stave_of_ancients.h:154

References entryKeys, entryList, Object::GetEntry(), and ScriptedAI::me.

Referenced by InNormalForm(), and RevealForm().

◆ GetGossipPlayer()

Player * NPCStaveQuestAI::GetGossipPlayer ( )

◆ InNormalForm()

◆ IsAllowedEntry()

bool NPCStaveQuestAI::IsAllowedEntry ( uint32  entry)
71{
72 uint32 allowedEntries[4] = { 0, 12999, 19833, 19921 }; //player, World Invisible Trigger(traps) and snake trap snakes
73 bool isAllowed = std::find(std::begin(allowedEntries), std::end(allowedEntries), entry) != std::end(allowedEntries);
74 return isAllowed;
75}

Referenced by StoreAttackerGuidValue(), and UnitIsUnfair().

◆ IsFairFight()

bool NPCStaveQuestAI::IsFairFight ( )
109{
110 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
111 {
112 Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
113
114 if (!(*itr)->GetThreat())
115 {
116 // if target threat is 0 its fair, this prevents despawn in the case when
117 // there is a bystander since UpdateVictim adds nearby enemies to the threatlist
118 continue;
119 }
120
121 if (UnitIsUnfair(unit))
122 {
123 return false;
124 }
125 }
126
127 return true;
128}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Definition: Unit.h:630
ThreatContainer::StorageType const & threatList
Definition: npc_stave_of_ancients.h:140
bool UnitIsUnfair(Unit *unit)
Definition: npc_stave_of_ancients.cpp:77

References ObjectAccessor::GetUnit(), ScriptedAI::me, threatList, and UnitIsUnfair().

Referenced by ValidThreatlist().

◆ JustDied()

void NPCStaveQuestAI::JustDied ( Unit killer)
virtual

Reimplemented from ScriptedAI.

Reimplemented in npc_simone::npc_simoneAI.

267{
268 // Prevent looting if killer doesn't have the quest
269 ClearLootIfUnfair(killer);
270}
void ClearLootIfUnfair(Unit *killer)
Definition: npc_stave_of_ancients.cpp:163

References ClearLootIfUnfair().

Referenced by npc_simone::npc_simoneAI::JustDied().

◆ PlayerEligibleForReward()

bool NPCStaveQuestAI::PlayerEligibleForReward ( Unit killer)
175{
176 if (!killer)
177 {
178 return true;
179 }
180
181 if (Player* player = killer->ToPlayer())
182 {
183 if (player->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) != QUEST_STATUS_INCOMPLETE)
184 {
185 return false;
186 }
187 }
188
189 return true;
190}
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ QUEST_STAVE_OF_THE_ANCIENTS
Definition: npc_stave_of_ancients.h:35
Player * ToPlayer()
Definition: Object.h:198

References QUEST_STATUS_INCOMPLETE, QUEST_STAVE_OF_THE_ANCIENTS, and Object::ToPlayer().

Referenced by ClearLootIfUnfair().

◆ PrepareForEncounter()

void NPCStaveQuestAI::PrepareForEncounter ( )
153{
154 encounterStarted = true;
158
161}
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:696
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:683
void MoveIdle()
Definition: MotionMaster.cpp:232
void Clear(bool reset=true)
Definition: MotionMaster.h:165
bool encounterStarted
Definition: npc_stave_of_ancients.h:139
void SetHomePosition()
Definition: npc_stave_of_ancients.cpp:142

References MotionMaster::Clear(), encounterStarted, Unit::GetMotionMaster(), ScriptedAI::me, MotionMaster::MoveIdle(), Unit::RemoveNpcFlag(), SetHomePosition(), Unit::SetUnitFlag(), UNIT_FLAG_NON_ATTACKABLE, and UNIT_NPC_FLAG_GOSSIP.

Referenced by npc_artorius::npc_artoriusAI::DoAction(), npc_nelson::npc_nelsonAI::DoAction(), npc_simone::npc_simoneAI::ScheduleEncounterStart(), and npc_franklin::npc_franklinAI::ScheduleEncounterStart().

◆ QuestIncomplete()

bool NPCStaveQuestAI::QuestIncomplete ( Unit unit,
uint32  questItem 
)
214{
215 if (!unit || !unit->IsPlayer())
216 {
217 return true;
218 }
219
221 bool hasQuestItem = unit->ToPlayer()->HasItemCount(questItem, 1, true);
222 bool isIncomplete = questStatus == QUEST_STATUS_INCOMPLETE && !hasQuestItem;
223
224 return isIncomplete;
225}
QuestStatus
Definition: QuestDef.h:99
bool IsPlayer() const
Definition: Object.h:197
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition: PlayerStorage.cpp:661
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1424

References Player::GetQuestStatus(), Player::HasItemCount(), Object::IsPlayer(), QUEST_STATUS_INCOMPLETE, QUEST_STAVE_OF_THE_ANCIENTS, and Object::ToPlayer().

Referenced by npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ ResetState()

void NPCStaveQuestAI::ResetState ( uint32  aura = 0)
228{
229 encounterStarted = false;
231 attackerGuids.clear();
232
233 if (InNormalForm())
234 {
237 }
238
239 me->RemoveAura(aura);
240}
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void Clear()
Definition: ObjectGuid.h:138
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4758
EventProcessor m_Events
Definition: Unit.h:1792
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:695

References attackerGuids, ObjectGuid::Clear(), encounterStarted, InNormalForm(), EventProcessor::KillAllEvents(), Unit::m_Events, ScriptedAI::me, playerGUID, Unit::RemoveAura(), Unit::SetNpcFlag(), and UNIT_NPC_FLAG_GOSSIP.

Referenced by npc_artorius::npc_artoriusAI::Reset(), npc_precious::npc_preciousAI::Reset(), npc_simone::npc_simoneAI::Reset(), npc_nelson::npc_nelsonAI::Reset(), and npc_franklin::npc_franklinAI::Reset().

◆ RevealForm()

void NPCStaveQuestAI::RevealForm ( )

◆ SetHomePosition()

void NPCStaveQuestAI::SetHomePosition ( )
143{
144 Position homePosition = me->GetPosition();
145
146 if (homePosition.IsPositionValid())
147 {
148 me->SetHomePosition(homePosition);
149 }
150}
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:337
Definition: Position.h:28
bool IsPositionValid() const
Definition: Position.cpp:175
void GetPosition(float &x, float &y) const
Definition: Position.h:122

References Position::GetPosition(), Position::IsPositionValid(), ScriptedAI::me, and Creature::SetHomePosition().

Referenced by PrepareForEncounter(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ StoreAttackerGuidValue()

void NPCStaveQuestAI::StoreAttackerGuidValue ( Unit attacker)
193{
194 if (!attacker)
195 {
196 return;
197 }
198
199 uint64 guidValue = attacker->GetGUID().GetRawValue();
200 bool isGUIDPresent = std::find(attackerGuids.begin(), attackerGuids.end(), guidValue) != attackerGuids.end();
201
202 // don't store snaketrap's snakes and trap triggers
203 if (isGUIDPresent || (IsAllowedEntry(attacker->GetEntry()) && !attacker->IsPlayer()))
204 {
205 return;
206 }
207 else
208 {
209 attackerGuids.push_back(guidValue);
210 }
211}
std::uint64_t uint64
Definition: Define.h:106
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
uint64 GetRawValue() const
Definition: ObjectGuid.h:142
bool IsAllowedEntry(uint32)
Definition: npc_stave_of_ancients.cpp:70

References attackerGuids, Object::GetEntry(), Object::GetGUID(), ObjectGuid::GetRawValue(), IsAllowedEntry(), and Object::IsPlayer().

Referenced by AttackedBy().

◆ StorePlayerGUID()

void NPCStaveQuestAI::StorePlayerGUID ( )
50{
51 if (!playerGUID.IsEmpty())
52 {
53 return;
54 }
55
56 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
57 {
58 if ((*itr)->getTarget()->IsPlayer())
59 {
60 playerGUID = (*itr)->getUnitGuid();
61 }
62 }
63}

References ObjectGuid::IsEmpty(), playerGUID, and threatList.

Referenced by AttackStart().

◆ UnitIsUnfair()

bool NPCStaveQuestAI::UnitIsUnfair ( Unit unit)
78{
79 if (!unit || playerGUID.IsEmpty())
80 {
81 return false;
82 }
83
84 if (unit->IsPlayer())
85 {
86 if (playerGUID != unit->GetGUID())
87 {
88 return true;
89 }
90 }
91 else
92 {
93 if (unit->GetOwnerGUID() != playerGUID)
94 {
95 // if a creature attacking isn't owned by the player its unfair
96 return true;
97 }
98 else if (!IsAllowedEntry(unit->GetEntry()))
99 {
100 // if not in the whitelist its unfair
101 return true;
102 }
103 }
104
105 return false;
106}
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1210

References Object::GetEntry(), Object::GetGUID(), Unit::GetOwnerGUID(), IsAllowedEntry(), ObjectGuid::IsEmpty(), Object::IsPlayer(), and playerGUID.

Referenced by IsFairFight(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::SummonedCreatureDies(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ ValidThreatlist()

bool NPCStaveQuestAI::ValidThreatlist ( )
131{
132 if (threatList.size() == 1)
133 {
134 return true;
135 }
136
137 bool isFair = IsFairFight();
138
139 return isFair;
140}
bool IsFairFight()
Definition: npc_stave_of_ancients.cpp:108

References IsFairFight(), and threatList.

Referenced by npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

Member Data Documentation

◆ attackerGuids

std::vector<uint64> NPCStaveQuestAI::attackerGuids

◆ encounterStarted

bool NPCStaveQuestAI::encounterStarted

◆ entryKeys

std::map<int, int> NPCStaveQuestAI::entryKeys
Initial value:
= {
}
@ FRANKLIN_EVIL_ENTRY
Definition: npc_stave_of_ancients.h:124
@ FRANKLIN_NORMAL_ENTRY
Definition: npc_stave_of_ancients.h:123
@ PRECIOUS_NORMAL_ENTRY
Definition: npc_stave_of_ancients.h:87
@ PRECIOUS_EVIL_ENTRY
Definition: npc_stave_of_ancients.h:88
@ ARTORIUS_EVIL_ENTRY
Definition: npc_stave_of_ancients.h:54
@ ARTORIUS_NORMAL_ENTRY
Definition: npc_stave_of_ancients.h:53
@ SIMONE_EVIL_ENTRY
Definition: npc_stave_of_ancients.h:74
@ SIMONE_NORMAL_ENTRY
Definition: npc_stave_of_ancients.h:73
@ NELSON_NORMAL_ENTRY
Definition: npc_stave_of_ancients.h:100
@ NELSON_EVIL_ENTRY
Definition: npc_stave_of_ancients.h:101

Referenced by GetFormEntry().

◆ entryList

std::map<int, std::map<std::string, int> > NPCStaveQuestAI::entryList

Referenced by GetFormEntry().

◆ gossipPlayerGUID

◆ playerGUID

◆ threatList

ThreatContainer::StorageType const& NPCStaveQuestAI::threatList = me->GetThreatMgr().GetThreatList()