27 && (!entry || summon->
GetEntry() == entry))
41 else if (summon->
GetEntry() == entry)
75 for (StorageType::const_iterator i =
storage_.begin(); i !=
storage_.end(); ++i)
78 if (summon && summon->
GetEntry() == entry)
114 if (
me->Attack(who,
true))
138 me->GetMotionMaster()->MoveChase(victim, distance, angle);
146 me->GetMotionMaster()->MoveIdle();
157 if (!target ||
me->IsNonMeleeSpellCasted(
false))
180 return me->SummonCreature(entry,
me->GetPositionX() + offsetX,
me->GetPositionY() + offsetY,
me->GetPositionZ() + offsetZ, angle, type, despawntime);
204 tempSpell =
sSpellMgr->GetSpellInfo(
me->m_spells[i]);
212 if (targets && !(
SpellSummary[
me->m_spells[i]].Targets & (1 << (targets - 1))))
216 if (effects && !(
SpellSummary[
me->m_spells[i]].Effects & (1 << (effects - 1))))
220 if (school && (tempSpell->
SchoolMask & school) == 0)
224 if (mechanic && tempSpell->
Mechanic != mechanic)
239 if (rangeMin &&
me->GetSpellMinRangeForTarget(target, tempSpell) < rangeMin)
241 if (rangeMax &&
me->GetSpellMaxRangeForTarget(target, tempSpell) > rangeMax)
245 if (
me->IsWithinDistInMap(target,
float(
me->GetSpellMinRangeForTarget(target, tempSpell))) || !
me->IsWithinDistInMap(target,
float(
me->GetSpellMaxRangeForTarget(target, tempSpell))))
249 apSpell[spellCount] = tempSpell;
257 return apSpell[std::rand() % spellCount];
262 if (!
me->CanHaveThreatList() ||
me->getThreatManager().isThreatListEmpty())
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());
270 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
282 return me->getThreatManager().getThreat(unit);
289 me->getThreatManager().modifyThreatPercent(unit, pct);
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);
301 me->NearTeleportTo(position[0], position[1], position[2], position[3]);
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.",
318 Map* map =
me->GetMap();
324 if (
Player* player = itr->GetSource())
325 if (player->IsAlive())
334 me->VisitNearbyObject(range, searcher);
341 std::list<Creature*> list;
344 me->VisitNearbyObject(range, searcher);
351 std::list<Creature*> list;
354 me->VisitNearbyObject(range, searcher);
371 cell.
Visit(pair, visitor, *
me->GetMap(), *
me, minimumRange);
380 me->LoadEquipment(
me->GetOriginalEquipmentId(),
true);
419 if (
me->IsInEvadeMode() || !
me->GetVictim())
422 float x =
me->GetPositionX();
423 float y =
me->GetPositionY();
424 float z =
me->GetPositionZ();
426 switch (
me->GetEntry())
433 if (
me->GetDistance2d(432.59f, 371.93f) < 105.0f)
441 if (x > 3218.86f && x < 3275.69f && y < 572.40f && y > 484.68f)
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)
457instance(creature->GetInstanceScript()),
504 me->GetPosition(x, y, z);
507 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
508 if (
Unit* target = (*itr)->getTarget())
510 target->NearTeleportTo(x, y, z, 0);
565 if (
me->IsInCombat())
592 uint32 corpseDelay =
me->GetCorpseDelay();
593 uint32 respawnDelay =
me->GetRespawnDelay();
595 me->SetCorpseDelay(1);
596 me->SetRespawnDelay(29);
598 me->DespawnOrUnsummon();
600 me->SetCorpseDelay(corpseDelay);
601 me->SetRespawnDelay(respawnDelay);
694 float randOrientation =
frand(0, 2 *
M_PI);
695 x = centerX + (dist * cos(randOrientation));
696 y = centerY + (dist * sin(randOrientation));
@ DIFFICULTY_25MAN_NORMAL
@ DIFFICULTY_25MAN_HEROIC
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
#define SF_LOG_ERROR(filterType__,...)
#define SF_LOG_INFO(filterType__,...)
@ TELE_TO_NOT_LEAVE_COMBAT
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)
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)
@ TRIGGERED_FULL_MASK
Will ignore most target checks (mostly DBC target checks).
#define CREATURE_MAX_SPELLS
@ UNIT_FIELD_VIRTUAL_ITEM_ID
float frand(float min, float max)
InstanceScript *const instance
BossBoundaryMap const * GetBoundary() const
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
BossBoundaryMap const *const _boundary
void ExecuteEvent(uint32) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
BossAI(Creature *creature, uint32 bossId)
bool CheckBoundary(Unit *who)
CreatureAI(Creature *creature)
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
virtual void EnterEvadeMode()
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
PlayerList const & GetPlayers() const
LinkedListHead::Iterator< MapReference const > const_iterator
uint32 GetGUIDLow() const
bool HasEntry(uint32 entry) const
void DespawnEntry(uint32 entry)
void DoZoneInCombat(uint32 entry=0)
std::list< HostileReference * > StorageType
void DoMeleeAttackIfReady()
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
virtual void AttackStart(Unit *)
static Creature * GetCreature(WorldObject &object, uint64 guid)
static Unit * GetUnit(WorldObject &object, uint64 guid)
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
void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
GameObject * FindNearestGameObject(uint32 entry, float range) const
void GetPlayerListInGrid(std::list< Player * > &lList, float fMaxSearchRange) const
void GetCreatureListWithEntryInGrid(std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
void PlayDirectSound(uint32 sound_id, Player *target=NULL)
CellCoord ComputeCellCoord(float x, float y)
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
float GetPositionX() const
float GetPositionY() 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
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)
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)
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)