Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
ScriptedCreature.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Cell.h"
7#include "CellImpl.h"
8#include "GridNotifiers.h"
9#include "GridNotifiersImpl.h"
10#include "Item.h"
11#include "ObjectMgr.h"
12#include "ScriptedCreature.h"
13#include "ScriptMgr.h"
14#include "Spell.h"
15#include "TemporarySummon.h"
16
17// Spell summary for ScriptedAI::SelectSpell
18extern struct TSpellSummary* SpellSummary;
19
21{
22 for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
23 {
24 Creature* summon = Unit::GetCreature(*me, *i);
25 ++i;
26 if (summon && summon->IsAIEnabled
27 && (!entry || summon->GetEntry() == entry))
28 {
29 summon->AI()->DoZoneInCombat();
30 }
31 }
32}
33
35{
36 for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
37 {
38 Creature* summon = Unit::GetCreature(*me, *i);
39 if (!summon)
40 i = storage_.erase(i);
41 else if (summon->GetEntry() == entry)
42 {
43 i = storage_.erase(i);
44 summon->DespawnOrUnsummon();
45 }
46 else
47 ++i;
48 }
49}
50
52{
53 while (!storage_.empty())
54 {
55 Creature* summon = Unit::GetCreature(*me, storage_.front());
56 storage_.pop_front();
57 if (summon)
58 summon->DespawnOrUnsummon();
59 }
60}
61
63{
64 for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
65 {
66 if (Unit::GetCreature(*me, *i))
67 ++i;
68 else
69 i = storage_.erase(i);
70 }
71}
72
74{
75 for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i)
76 {
77 Creature* summon = Unit::GetCreature(*me, *i);
78 if (summon && summon->GetEntry() == entry)
79 return true;
80 }
81
82 return false;
83}
84
86me(creature),
87IsFleeing(false),
90{
91 _isHeroic = me->GetMap()->IsHeroic();
92 _difficulty = DifficultyID(me->GetMap()->GetSpawnMode());
93}
94
96{
97 switch (_difficulty)
98 {
102 return true;
103 default:
104 break;
105 }
106 return false;
107}
108
110{
111 if (!who)
112 return;
113
114 if (me->Attack(who, true))
116}
117
119{
122 else
124}
125
127{
128 //Check if we have a current target
129 if (!UpdateVictim())
130 return;
131
133}
134
135void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle)
136{
137 if (victim)
138 me->GetMotionMaster()->MoveChase(victim, distance, angle);
139}
140
142{
143 if (!victim)
144 return;
145
146 me->GetMotionMaster()->MoveIdle();
147}
148
150{
151 if (me->GetVictim())
152 me->AttackStop();
153}
154
155void ScriptedAI::DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool triggered)
156{
157 if (!target || me->IsNonMeleeSpellCasted(false))
158 return;
159
160 me->StopMoving();
161 me->CastSpell(target, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
162}
163
165{
166 if (!source)
167 return;
168
169 if (!sSoundEntriesStore.LookupEntry(soundId))
170 {
171 SF_LOG_ERROR("scripts", "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, uint8(source->GetTypeId()), source->GetGUIDLow());
172 return;
173 }
174
175 source->PlayDirectSound(soundId);
176}
177
178Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
179{
180 return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, type, despawntime);
181}
182
183SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects)
184{
185 //No target so we can't cast
186 if (!target)
187 return NULL;
188
189 //Silenced so we can't cast
191 return NULL;
192
193 //Using the extended script system we first create a list of viable spells
194 SpellInfo const* apSpell[CREATURE_MAX_SPELLS];
195 memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellInfo*));
196
197 uint32 spellCount = 0;
198
199 SpellInfo const* tempSpell = NULL;
200
201 //Check if each spell is viable(set it to null if not)
202 for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
203 {
204 tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
205
206 //This spell doesn't exist
207 if (!tempSpell)
208 continue;
209
210 // Targets and Effects checked first as most used restrictions
211 //Check the spell targets if specified
212 if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets - 1))))
213 continue;
214
215 //Check the type of spell if we are looking for a specific spell type
216 if (effects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effects - 1))))
217 continue;
218
219 //Check for school if specified
220 if (school && (tempSpell->SchoolMask & school) == 0)
221 continue;
222
223 //Check for spell mechanic if specified
224 if (mechanic && tempSpell->Mechanic != mechanic)
225 continue;
226
227 //Make sure that the spell uses the requested amount of power
228 //if (powerCostMin && tempSpell->ManaCost < powerCostMin)
229 // continue;
230
231 //if (powerCostMax && tempSpell->ManaCost > powerCostMax)
232 // continue;
233
234 //Continue if we don't have the mana to actually cast this spell
235 //if (tempSpell->ManaCost > (uint32)me->GetPower(Powers(tempSpell->PowerType)))
236 // continue;
237
238 //Check if the spell meets our range requirements
239 if (rangeMin && me->GetSpellMinRangeForTarget(target, tempSpell) < rangeMin)
240 continue;
241 if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempSpell) > rangeMax)
242 continue;
243
244 //Check if our target is in range
245 if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempSpell))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempSpell))))
246 continue;
247
248 //All good so lets add it to the spell list
249 apSpell[spellCount] = tempSpell;
250 ++spellCount;
251 }
252
253 //We got our usable spells so now lets randomly pick one
254 if (!spellCount)
255 return NULL;
256
257 return apSpell[std::rand() % spellCount];
258}
259
261{
262 if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
263 {
264 SF_LOG_ERROR("scripts", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
265 return;
266 }
267
268 ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
269
270 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
271 {
272 Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
273 if (unit && DoGetThreat(unit))
274 DoModifyThreatPercent(unit, -100);
275 }
276}
277
279{
280 if (!unit)
281 return 0.0f;
282 return me->getThreatManager().getThreat(unit);
283}
284
286{
287 if (!unit)
288 return;
289 me->getThreatManager().modifyThreatPercent(unit, pct);
290}
291
292void ScriptedAI::DoTeleportTo(float x, float y, float z, uint32 time)
293{
294 me->Relocate(x, y, z);
295 float speed = me->GetDistance(x, y, z) / ((float)time * 0.001f);
296 me->MonsterMoveWithSpeed(x, y, z, speed);
297}
298
299void ScriptedAI::DoTeleportTo(const float position[4])
300{
301 me->NearTeleportTo(position[0], position[1], position[2], position[3]);
302}
303
304void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
305{
306 if (!unit)
307 return;
308
309 if (Player* player = unit->ToPlayer())
310 player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
311 else
312 SF_LOG_ERROR("scripts", "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
313 me->GetGUID(), me->GetEntry(), uint8(unit->GetTypeId()), unit->GetGUID(), x, y, z, o);
314}
315
316void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
317{
318 Map* map = me->GetMap();
319 if (!map->IsInstance())
320 return;
321
322 Map::PlayerList const& PlayerList = map->GetPlayers();
323 for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
324 if (Player* player = itr->GetSource())
325 if (player->IsAlive())
326 player->TeleportTo(me->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
327}
328
330{
331 Unit* unit = NULL;
332 Skyfire::MostHPMissingInRange u_check(me, range, minHPDiff);
334 me->VisitNearbyObject(range, searcher);
335
336 return unit;
337}
338
339std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
340{
341 std::list<Creature*> list;
342 Skyfire::FriendlyCCedInRange u_check(me, range);
344 me->VisitNearbyObject(range, searcher);
345
346 return list;
347}
348
349std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 uiSpellid)
350{
351 std::list<Creature*> list;
352 Skyfire::FriendlyMissingBuffInRange u_check(me, range, uiSpellid);
354 me->VisitNearbyObject(range, searcher);
355
356 return list;
357}
358
360{
361 Player* player = NULL;
362
363 CellCoord pair(Skyfire::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
364 Cell cell(pair);
365 cell.SetNoCreate();
366
367 Skyfire::PlayerAtMinimumRangeAway check(me, minimumRange);
370
371 cell.Visit(pair, visitor, *me->GetMap(), *me, minimumRange);
372
373 return player;
374}
375
376void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO_CHANGE*/, int32 offHand /*= EQUIP_NO_CHANGE*/, int32 ranged /*= EQUIP_NO_CHANGE*/)
377{
378 if (loadDefault)
379 {
380 me->LoadEquipment(me->GetOriginalEquipmentId(), true);
381 return;
382 }
383
384 if (mainHand >= 0)
385 me->SetUInt32Value(UNIT_FIELD_VIRTUAL_ITEM_ID + 0, uint32(mainHand));
386
387 if (offHand >= 0)
388 me->SetUInt32Value(UNIT_FIELD_VIRTUAL_ITEM_ID + 1, uint32(offHand));
389
390 if (ranged >= 0)
391 me->SetUInt32Value(UNIT_FIELD_VIRTUAL_ITEM_ID + 2, uint32(ranged));
392}
393
394void ScriptedAI::SetCombatMovement(bool allowMovement)
395{
396 _isCombatMovementAllowed = allowMovement;
397}
398
400{
405};
406
407// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area.
408// It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it.
410{
411 if (_evadeCheckCooldown <= diff)
412 _evadeCheckCooldown = 2500;
413 else
414 {
415 _evadeCheckCooldown -= diff;
416 return false;
417 }
418
419 if (me->IsInEvadeMode() || !me->GetVictim())
420 return false;
421
422 float x = me->GetPositionX();
423 float y = me->GetPositionY();
424 float z = me->GetPositionZ();
425
426 switch (me->GetEntry())
427 {
428 case NPC_BROODLORD: // broodlord (not move down stairs)
429 if (z > 448.60f)
430 return false;
431 break;
432 case NPC_VOID_REAVER: // void reaver (calculate from center of room)
433 if (me->GetDistance2d(432.59f, 371.93f) < 105.0f)
434 return false;
435 break;
436 case NPC_JAN_ALAI: // jan'alai (calculate by Z)
437 if (z > 12.0f)
438 return false;
439 break;
440 case NPC_SARTHARION: // sartharion (calculate box)
441 if (x > 3218.86f && x < 3275.69f && y < 572.40f && y > 484.68f)
442 return false;
443 break;
444 default: // For most of creatures that certain area is their home area.
445 SF_LOG_INFO("misc", "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
446 uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
447 if (me->GetAreaId() == homeAreaId)
448 return false;
449 }
450
452 return true;
453}
454
455// BossAI - for instanced bosses
456BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
457instance(creature->GetInstanceScript()),
458summons(creature),
459_boundary(instance ? instance->GetBossBoundary(bossId) : NULL),
460_bossId(bossId) { }
461
463{
464 if (!me->IsAlive())
465 return;
466
467 me->ResetLootMode();
468 events.Reset();
469 summons.DespawnAll();
470 if (instance)
471 instance->SetBossState(_bossId, NOT_STARTED);
472}
473
475{
476 events.Reset();
477 summons.DespawnAll();
478 if (instance)
479 {
480 instance->SetBossState(_bossId, DONE);
481 instance->SaveToDB();
482 }
483}
484
486{
487 me->setActive(true);
489 if (instance)
490 {
491 // bosses do not respawn, check only on enter combat
492 if (!instance->CheckRequiredBosses(_bossId))
493 {
495 return;
496 }
497 instance->SetBossState(_bossId, IN_PROGRESS);
498 }
499}
500
502{
503 float x, y, z;
504 me->GetPosition(x, y, z);
505
506 ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
507 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
508 if (Unit* target = (*itr)->getTarget())
509 if (target->GetTypeId() == TypeID::TYPEID_PLAYER && !CheckBoundary(target))
510 target->NearTeleportTo(x, y, z, 0);
511}
512
514{
515 if (!GetBoundary() || !who)
516 return true;
517
518 for (BossBoundaryMap::const_iterator itr = GetBoundary()->begin(); itr != GetBoundary()->end(); ++itr)
519 {
520 switch (itr->first)
521 {
522 case BOUNDARY_N:
523 if (who->GetPositionX() > itr->second)
524 return false;
525 break;
526 case BOUNDARY_S:
527 if (who->GetPositionX() < itr->second)
528 return false;
529 break;
530 case BOUNDARY_E:
531 if (who->GetPositionY() < itr->second)
532 return false;
533 break;
534 case BOUNDARY_W:
535 if (who->GetPositionY() > itr->second)
536 return false;
537 break;
538 case BOUNDARY_NW:
539 if (who->GetPositionX() + who->GetPositionY() > itr->second)
540 return false;
541 break;
542 case BOUNDARY_SE:
543 if (who->GetPositionX() + who->GetPositionY() < itr->second)
544 return false;
545 break;
546 case BOUNDARY_NE:
547 if (who->GetPositionX() - who->GetPositionY() > itr->second)
548 return false;
549 break;
550 case BOUNDARY_SW:
551 if (who->GetPositionX() - who->GetPositionY() < itr->second)
552 return false;
553 break;
554 default:
555 break;
556 }
557 }
558
559 return true;
560}
561
563{
564 summons.Summon(summon);
565 if (me->IsInCombat())
566 DoZoneInCombat(summon);
567}
568
570{
571 summons.Despawn(summon);
572}
573
575{
576 if (!UpdateVictim())
577 return;
578
579 events.Update(diff);
580
581 if (me->HasUnitState(UNIT_STATE_CASTING))
582 return;
583
584 while (uint32 eventId = events.ExecuteEvent())
585 ExecuteEvent(eventId);
586
588}
589
591{
592 uint32 corpseDelay = me->GetCorpseDelay();
593 uint32 respawnDelay = me->GetRespawnDelay();
594
595 me->SetCorpseDelay(1);
596 me->SetRespawnDelay(29);
597
598 me->DespawnOrUnsummon();
599
600 me->SetCorpseDelay(corpseDelay);
601 me->SetRespawnDelay(respawnDelay);
602}
603
604// WorldBossAI - for non-instanced bosses
605
607 ScriptedAI(creature),
608 summons(creature) { }
609
611{
612 if (!me->IsAlive())
613 return;
614
615 events.Reset();
616 summons.DespawnAll();
617}
618
620{
621 events.Reset();
622 summons.DespawnAll();
623}
624
626{
627 Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
628 if (target)
629 AttackStart(target);
630}
631
633{
634 summons.Summon(summon);
635 Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
636 if (target)
637 summon->AI()->AttackStart(target);
638}
639
641{
642 summons.Despawn(summon);
643}
644
646{
647 if (!UpdateVictim())
648 return;
649
650 events.Update(diff);
651
652 if (me->HasUnitState(UNIT_STATE_CASTING))
653 return;
654
655 while (uint32 eventId = events.ExecuteEvent())
656 ExecuteEvent(eventId);
657
659}
660
661// SD2 grid searchers.
662Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive /*= true*/)
663{
664 return source->FindNearestCreature(entry, maxSearchRange, alive);
665}
666
667GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange)
668{
669 return source->FindNearestGameObject(entry, maxSearchRange);
670}
671
672void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange)
673{
674 source->GetCreatureListWithEntryInGrid(list, entry, maxSearchRange);
675}
676
677void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange)
678{
679 source->GetGameObjectListWithEntryInGrid(list, entry, maxSearchRange);
680}
681
682void GetPlayerListInGrid(std::list<Player*>& list, WorldObject* source, float maxSearchRange)
683{
684 source->GetPlayerListInGrid(list, maxSearchRange);
685}
686
687void GetPositionWithDistInOrientation(Unit* pUnit, float dist, float orientation, float& x, float& y)
688{
689 x = pUnit->GetPositionX() + (dist * cos(orientation));
690 y = pUnit->GetPositionY() + (dist * sin(orientation));
691}
692void GetRandPosFromCenterInDist(float centerX, float centerY, float dist, float& x, float& y)
693{
694 float randOrientation = frand(0, 2 * M_PI);
695 x = centerX + (dist * cos(randOrientation));
696 y = centerY + (dist * sin(randOrientation));
697}
#define M_PI
Definition Common.h:192
SelectTargetType
Definition CreatureAI.h:24
SelectEffect
Definition CreatureAI.h:40
DifficultyID
Definition DBCEnums.h:330
@ DIFFICULTY_25MAN_NORMAL
Definition DBCEnums.h:335
@ DIFFICULTY_25MAN_LFR
Definition DBCEnums.h:338
@ DIFFICULTY_25MAN_HEROIC
Definition DBCEnums.h:337
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
std::int32_t int32
Definition Define.h:73
#define UI64FMTD
Definition Define.h:64
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
Definition GridDefines.h:71
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ BOUNDARY_SE
@ BOUNDARY_SW
@ BOUNDARY_NE
@ BOUNDARY_W
@ BOUNDARY_NW
@ BOUNDARY_S
@ BOUNDARY_N
@ BOUNDARY_E
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define SF_LOG_INFO(filterType__,...)
Definition Log.h:137
@ TYPEID_PLAYER
Definition Object.h:55
TempSummonType
Definition Object.h:67
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:831
void GetPlayerListInGrid(std::list< Player * > &list, WorldObject *source, float maxSearchRange)
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange)
@ NPC_BROODLORD
@ NPC_JAN_ALAI
@ NPC_VOID_REAVER
@ NPC_SARTHARION
void GetPositionWithDistInOrientation(Unit *pUnit, float dist, float orientation, float &x, float &y)
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
void GetRandPosFromCenterInDist(float centerX, float centerY, float dist, float &x, float &y)
struct TSpellSummary * SpellSummary
void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
#define sSpellMgr
Definition SpellMgr.h:744
@ TRIGGERED_FULL_MASK
Will ignore most target checks (mostly DBC target checks).
Definition Unit.h:435
@ TRIGGERED_NONE
Definition Unit.h:416
#define CREATURE_MAX_SPELLS
Definition Unit.h:272
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ UNIT_FLAG_SILENCED
Definition Unit.h:638
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_VIRTUAL_ITEM_ID
@ UNIT_FIELD_FLAGS
float frand(float min, float max)
Definition Util.cpp:39
InstanceScript *const instance
BossBoundaryMap const * GetBoundary() const
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
BossBoundaryMap const *const _boundary
void TeleportCheaters()
void ExecuteEvent(uint32) OVERRIDE
void _DespawnAtEvade()
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
uint32 const _bossId
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
bool CheckBoundary(Unit *who)
CreatureAI(Creature *creature)
Definition CreatureAI.h:69
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
bool UpdateVictim()
virtual void EnterEvadeMode()
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
CreatureAI * AI() const
Definition Creature.h:483
Definition Map.h:238
MapRefManager PlayerList
Definition Map.h:406
PlayerList const & GetPlayers() const
Definition Map.h:407
bool IsInstance() const
Definition Map.h:368
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
uint32 GetGUIDLow() const
Definition Object.h:120
TypeID GetTypeId() const
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:125
uint32 Mechanic
Definition SpellInfo.h:163
uint32 SchoolMask
Definition SpellInfo.h:231
Creature * me
bool HasEntry(uint32 entry) const
void DespawnEntry(uint32 entry)
void RemoveNotExisting()
StorageType storage_
void DoZoneInCombat(uint32 entry=0)
std::list< HostileReference * > StorageType
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:16
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool IsAIEnabled
Definition Unit.h:2735
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
WorldBossAI(Creature *creature)
void ExecuteEvent(uint32) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
SummonList summons
uint32 GetMapId() const
Definition Object.h:546
void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Definition Object.cpp:2828
GameObject * FindNearestGameObject(uint32 entry, float range) const
Definition Object.cpp:2810
void GetPlayerListInGrid(std::list< Player * > &lList, float fMaxSearchRange) const
Definition Object.cpp:2854
void GetCreatureListWithEntryInGrid(std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Definition Object.cpp:2841
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2801
void PlayDirectSound(uint32 sound_id, Player *target=NULL)
Definition Object.cpp:3442
CellCoord ComputeCellCoord(float x, float y)
Definition Cell.h:37
void SetNoCreate()
Definition Cell.h:66
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
Definition CellImpl.h:109
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
bool IsHeroic() const
void DoStartNoMovement(Unit *target)
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void SetCombatMovement(bool allowMovement)
uint32 _evadeCheckCooldown
Creature * me
bool IsCombatMovementAllowed() const
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
float DoGetThreat(Unit *unit)
void DoTeleportTo(float x, float y, float z, uint32 time=0)
Player * GetPlayerAtMinimumRange(float minRange)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
bool _isCombatMovementAllowed
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
void DoTeleportAll(float x, float y, float z, float o)
SpellInfo const * SelectSpell(Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
bool EnterEvadeIfOutOfCombatArea(uint32 const diff)
void DoCastSpell(Unit *target, SpellInfo const *spellInfo, bool triggered=false)
void AttackStartNoMove(Unit *target)
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
DifficultyID _difficulty
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
std::list< Creature * > DoFindFriendlyCC(float range)
ScriptedAI(Creature *creature)
bool Is25ManRaid() const
void DoModifyThreatPercent(Unit *unit, int32 pct)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void AttackStart(Unit *) OVERRIDE
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)