diff options
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index f817e8a57c9..7f249b36fbd 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2039,6 +2039,25 @@ void Creature::CallAssistance() } } +void Creature::CallForHelp(float fRadius) +{ + if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed()) + return; + + CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius); + MaNGOS::CreatureWorker<MaNGOS::CallOfHelpCreatureInRangeDo> worker(this, u_do); + + TypeContainerVisitor<MaNGOS::CreatureWorker<MaNGOS::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker); + + CellLock<GridReadGuard> cell_lock(cell, p); + cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap()); +} + bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const { // is it true? |