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

Public Member Functions

 npc_cameron (Creature *creature)
 
void MoveTheChildren ()
 
void PathEndReached (uint32 pathId) override
 
void sOnGameEvent (bool start, uint16 eventId) override
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 
void UpdateAI (uint32 diff) override
 
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 EnterCombat (Unit *) override
 
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 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 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)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
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)
 
 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 EnterCombat (Unit *)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
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
 
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 *)
 
- 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
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
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)
 
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)
 
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)
 
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
 

Static Public Member Functions

static uint32 SoundPicker ()
 
- 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 ()
 

Private Attributes

EventMap _events
 
bool _started
 
GuidVector _childrenGUIDs
 

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
}
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 
- 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
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_cameron()

npc_cameron::npc_cameron ( Creature creature)
inline
72 : ScriptedAI(creature)
73 {
74 _started = false;
75 }
Definition: ScriptedCreature.h:177
bool _started
Definition: zone_elwynn_forest.cpp:253

References _started.

Member Function Documentation

◆ MoveTheChildren()

void npc_cameron::MoveTheChildren ( )
inline
90 {
91 std::vector<Position> MovePosPositions =
92 {
93 { -9373.521f, -67.71767f, 69.201965f, 1.117011f },
94 { -9374.94f, -62.51654f, 69.201965f, 5.201081f },
95 { -9371.013f, -71.20811f, 69.201965f, 1.937315f },
96 { -9368.419f, -66.47543f, 69.201965f, 3.141593f },
97 { -9372.376f, -65.49946f, 69.201965f, 4.206244f },
98 { -9377.477f, -67.8297f, 69.201965f, 0.296706f }
99 };
100
101 Acore::Containers::RandomShuffle(MovePosPositions);
102
103 // first we break formation because children will need to move on their own now
104 for (auto guid : _childrenGUIDs)
105 if (Creature* child = ObjectAccessor::GetCreature(*me, guid))
106 if (child->GetFormation())
107 child->GetFormation()->RemoveMember(child);
108
109 // Move each child to an random position
110 for (uint32 i = 0; i < _childrenGUIDs.size(); ++i)
111 {
113 {
114 children->SetWalk(true);
115 children->GetMotionMaster()->MovePoint(0, MovePosPositions[i], true, MovePosPositions[i].GetOrientation());
116 }
117 }
118 me->SetWalk(true);
119 me->GetMotionMaster()->MovePoint(0, MovePosPositions.back(), true, MovePosPositions.back().GetOrientation());
120 }
std::uint32_t uint32
Definition: Define.h:108
void RandomShuffle(C &container)
Definition: Containers.h:207
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215
Creature * me
Definition: ScriptedCreature.h:267
Definition: Creature.h:46
bool SetWalk(bool enable) override
Definition: Creature.cpp:3053
MotionMaster * GetMotionMaster()
Definition: Unit.h:2258
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210
GuidVector _childrenGUIDs
Definition: zone_elwynn_forest.cpp:254

References _childrenGUIDs, ObjectAccessor::GetCreature(), Unit::GetMotionMaster(), ScriptedAI::me, MotionMaster::MovePoint(), Acore::Containers::RandomShuffle(), and Creature::SetWalk().

Referenced by PathEndReached().

◆ PathEndReached()

void npc_cameron::PathEndReached ( uint32  pathId)
inlineoverridevirtual

Reimplemented from CreatureAI.

123 {
124 switch (pathId)
125 {
126 case STORMWIND_PATH:
127 {
129 _events.ScheduleEvent(EVENT_WP_START_GOLDSHIRE, 660000); // 11 minutes
130 break;
131 }
132 case GOLDSHIRE_PATH:
133 {
135 _events.ScheduleEvent(EVENT_WP_START_WOODS, 900000); // 15 minutes
136 break;
137 }
138 case WOODS_PATH:
139 {
141 _events.ScheduleEvent(EVENT_WP_START_HOUSE, 360000); // 6 minutes
143 break;
144 }
145 case HOUSE_PATH:
146 {
147 // Move childeren at last point
149 // After 30 seconds a random sound should play
151 break;
152 }
153 }
154 }
@ WOODS_PATH
Definition: zone_elwynn_forest.cpp:29
@ HOUSE_PATH
Definition: zone_elwynn_forest.cpp:30
@ STORMWIND_PATH
Definition: zone_elwynn_forest.cpp:27
@ GOLDSHIRE_PATH
Definition: zone_elwynn_forest.cpp:28
@ EVENT_WP_START_WOODS
Definition: zone_elwynn_forest.cpp:57
@ EVENT_WP_START_GOLDSHIRE
Definition: zone_elwynn_forest.cpp:56
@ EVENT_PLAY_SOUNDS
Definition: zone_elwynn_forest.cpp:60
@ EVENT_RANDOM_MOVEMENT
Definition: zone_elwynn_forest.cpp:62
@ EVENT_WP_START_LISA
Definition: zone_elwynn_forest.cpp:59
@ EVENT_WP_START_HOUSE
Definition: zone_elwynn_forest.cpp:58
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
void MoveTheChildren()
Definition: zone_elwynn_forest.cpp:89
EventMap _events
Definition: zone_elwynn_forest.cpp:252

References _events, EVENT_PLAY_SOUNDS, EVENT_RANDOM_MOVEMENT, EVENT_WP_START_GOLDSHIRE, EVENT_WP_START_HOUSE, EVENT_WP_START_LISA, EVENT_WP_START_WOODS, GOLDSHIRE_PATH, HOUSE_PATH, MoveTheChildren(), EventMap::ScheduleEvent(), STORMWIND_PATH, and WOODS_PATH.

◆ sOnGameEvent()

void npc_cameron::sOnGameEvent ( bool  start,
uint16  eventId 
)
inlineoverridevirtual

Reimplemented from UnitAI.

157 {
158 if (start && eventId == GAME_EVENT_CHILDREN_OF_GOLDSHIRE)
159 {
160 // Start event at 7 am
161 // Begin pathing
163 _started = true;
164 }
165 else if (!start && eventId == GAME_EVENT_CHILDREN_OF_GOLDSHIRE)
166 {
167 // Reset event at 8 am
168 _started = false;
169 _events.Reset();
170 }
171 }
@ GAME_EVENT_CHILDREN_OF_GOLDSHIRE
Definition: zone_elwynn_forest.cpp:67
@ EVENT_BEGIN_EVENT
Definition: zone_elwynn_forest.cpp:61
void Reset()
Definition: EventMap.cpp:21

References _events, _started, EVENT_BEGIN_EVENT, GAME_EVENT_CHILDREN_OF_GOLDSHIRE, EventMap::Reset(), and EventMap::ScheduleEvent().

◆ SoundPicker()

static uint32 npc_cameron::SoundPicker ( )
inlinestatic
78 {
79 return RAND(
86 );
87 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:30
@ HUMAN_FEMALE_EMOTE_CRY
Definition: zone_elwynn_forest.cpp:40
@ GHOSTDEATH
Definition: zone_elwynn_forest.cpp:41
@ CTHUN_DEATH_IS_CLOSE
Definition: zone_elwynn_forest.cpp:39
@ BANSHEE_DEATH
Definition: zone_elwynn_forest.cpp:36
@ CTHUN_YOU_WILL_DIE
Definition: zone_elwynn_forest.cpp:38
@ BANSHEEPREAGGRO
Definition: zone_elwynn_forest.cpp:37

References BANSHEE_DEATH, BANSHEEPREAGGRO, CTHUN_DEATH_IS_CLOSE, CTHUN_YOU_WILL_DIE, GHOSTDEATH, HUMAN_FEMALE_EMOTE_CRY, and RAND().

Referenced by UpdateAI().

◆ UpdateAI()

void npc_cameron::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

174 {
175 if (!_started)
176 return;
177
178 _events.Update(diff);
179
180 while (uint32 eventId = _events.ExecuteEvent())
181 {
182 switch (eventId)
183 {
186 break;
189 break;
192 break;
194 for (uint32 i = 0; i < _childrenGUIDs.size(); ++i)
195 {
197 {
198 if (lisa->GetEntry() == NPC_LISA)
199 {
200 lisa->GetMotionMaster()->MovePath(LISA_PATH, false);
201 break;
202 }
203 }
204 }
205 break;
208 break;
210 {
211 _childrenGUIDs.clear();
212
213 // Get all childeren's guid's.
214 if (Creature* dana = me->FindNearestCreature(NPC_DANA, 25.0f))
215 _childrenGUIDs.push_back(dana->GetGUID());
216
217 if (Creature* john = me->FindNearestCreature(NPC_JOHN, 25.0f))
218 _childrenGUIDs.push_back(john->GetGUID());
219
220 if (Creature* lisa = me->FindNearestCreature(NPC_LISA, 25.0f))
221 _childrenGUIDs.push_back(lisa->GetGUID());
222
223 if (Creature* aaron = me->FindNearestCreature(NPC_AARON, 25.0f))
224 _childrenGUIDs.push_back(aaron->GetGUID());
225
226 if (Creature* jose = me->FindNearestCreature(NPC_JOSE, 25.0f))
227 _childrenGUIDs.push_back(jose->GetGUID());
228
229 // If Formation was disbanded, remake.
230 if (!me->GetFormation()->IsFormed())
231 for (auto guid : _childrenGUIDs)
232 if (Creature* child = ObjectAccessor::GetCreature(*me, guid))
233 child->SearchFormation();
234
235 // Start movement
237
238 break;
239 }
241 {
242 me->GetMotionMaster()->MoveRandom(10.0f);
243 break;
244 }
245 default:
246 break;
247 }
248 }
249 }
@ LISA_PATH
Definition: zone_elwynn_forest.cpp:31
@ NPC_AARON
Definition: zone_elwynn_forest.cpp:50
@ NPC_LISA
Definition: zone_elwynn_forest.cpp:49
@ NPC_JOHN
Definition: zone_elwynn_forest.cpp:48
@ NPC_DANA
Definition: zone_elwynn_forest.cpp:46
@ NPC_JOSE
Definition: zone_elwynn_forest.cpp:51
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
CreatureGroup const * GetFormation() const
Definition: Creature.h:337
bool IsFormed() const
Definition: CreatureGroups.h:101
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2395
void PlayDistanceSound(uint32 sound_id, Player *target=nullptr)
Definition: Object.cpp:2831
void MovePath(uint32 path_id, bool repeatable)
Definition: MotionMaster.cpp:758
void MoveRandom(float wanderDistance=0.0f)
Definition: MotionMaster.cpp:238
static uint32 SoundPicker()
Definition: zone_elwynn_forest.cpp:77

References _childrenGUIDs, _events, _started, EVENT_BEGIN_EVENT, EVENT_PLAY_SOUNDS, EVENT_RANDOM_MOVEMENT, EVENT_WP_START_GOLDSHIRE, EVENT_WP_START_HOUSE, EVENT_WP_START_LISA, EVENT_WP_START_WOODS, EventMap::ExecuteEvent(), WorldObject::FindNearestCreature(), ObjectAccessor::GetCreature(), Creature::GetFormation(), Unit::GetMotionMaster(), GOLDSHIRE_PATH, HOUSE_PATH, CreatureGroup::IsFormed(), LISA_PATH, ScriptedAI::me, MotionMaster::MovePath(), MotionMaster::MoveRandom(), NPC_AARON, NPC_DANA, NPC_JOHN, NPC_JOSE, NPC_LISA, WorldObject::PlayDistanceSound(), SoundPicker(), STORMWIND_PATH, EventMap::Update(), and WOODS_PATH.

Member Data Documentation

◆ _childrenGUIDs

GuidVector npc_cameron::_childrenGUIDs
private

Referenced by MoveTheChildren(), and UpdateAI().

◆ _events

EventMap npc_cameron::_events
private

◆ _started

bool npc_cameron::_started
private

Referenced by npc_cameron(), sOnGameEvent(), and UpdateAI().