mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7951] Mope call for help code to function form Event AI code to allow use it from C++ scripts also.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
0b3a4bf5a5
commit
48fee42129
5 changed files with 55 additions and 51 deletions
|
|
@ -1777,6 +1777,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
|
||||
{
|
||||
// we don't need help from zombies :)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue