mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[10390] Add several new script calls for InstanceData
OnCreature Evade/Death/EnterCombat and in addition OnPlayerLeave The functions are intended to help doing instance related tasks (in other words, not for the general AI of creatures). Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
1fd4ff3155
commit
9c02f476ec
4 changed files with 33 additions and 1 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "Util.h"
|
||||
#include "Totem.h"
|
||||
#include "BattleGround.h"
|
||||
#include "InstanceData.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "CellImpl.h"
|
||||
|
|
@ -814,6 +815,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
((Creature*)pOwner)->AI()->SummonedCreatureJustDied(cVictim);
|
||||
}
|
||||
|
||||
if (InstanceData* mapInstance = cVictim->GetInstanceData())
|
||||
mapInstance->OnCreatureDeath(cVictim);
|
||||
|
||||
// Dungeon specific stuff, only applies to players killing creatures
|
||||
if(cVictim->GetInstanceId())
|
||||
{
|
||||
|
|
@ -7470,6 +7474,9 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
|
||||
if (((Creature*)this)->AI())
|
||||
((Creature*)this)->AI()->EnterCombat(enemy);
|
||||
|
||||
if (InstanceData* mapInstance = this->GetInstanceData())
|
||||
mapInstance->OnCreatureEnterCombat((Creature*)this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8329,6 +8336,10 @@ void Unit::TauntFadeOut(Unit *taunter)
|
|||
{
|
||||
if(((Creature*)this)->AI())
|
||||
((Creature*)this)->AI()->EnterEvadeMode();
|
||||
|
||||
if (InstanceData* mapInstance = this->GetInstanceData())
|
||||
mapInstance->OnCreatureEvade((Creature*)this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -8424,6 +8435,9 @@ bool Unit::SelectHostileTarget()
|
|||
// enter in evade mode in other case
|
||||
((Creature*)this)->AI()->EnterEvadeMode();
|
||||
|
||||
if (InstanceData* mapInstance = this->GetInstanceData())
|
||||
mapInstance->OnCreatureEvade((Creature*)this);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue