mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7860] Implement creature event ai ACTION_T_CALL_FOR_HELP for explicit call for help in some script cases.
This commit is contained in:
parent
159258b668
commit
f332c000d1
8 changed files with 142 additions and 61 deletions
|
|
@ -85,8 +85,7 @@ VendorItem const* VendorItemData::FindItem(uint32 item_id) const
|
|||
|
||||
bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
Unit* victim = Unit::GetUnit(m_owner, m_victim);
|
||||
if (victim)
|
||||
if(Unit* victim = Unit::GetUnit(m_owner, m_victim))
|
||||
{
|
||||
while (!m_assistants.empty())
|
||||
{
|
||||
|
|
@ -1725,26 +1724,34 @@ void Creature::CallAssistance()
|
|||
}
|
||||
}
|
||||
|
||||
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy) const
|
||||
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const
|
||||
{
|
||||
// we don't need help from zombies :)
|
||||
if( !isAlive() )
|
||||
if (!isAlive())
|
||||
return false;
|
||||
|
||||
// skip fighting creature
|
||||
if( isInCombat() )
|
||||
return false;
|
||||
|
||||
// only from same creature faction
|
||||
if(getFaction() != u->getFaction() )
|
||||
if (isInCombat())
|
||||
return false;
|
||||
|
||||
// only free creature
|
||||
if( GetCharmerOrOwnerGUID() )
|
||||
if (GetCharmerOrOwnerGUID())
|
||||
return false;
|
||||
|
||||
// only from same creature faction
|
||||
if (checkfaction)
|
||||
{
|
||||
if (getFaction() != u->getFaction())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsFriendlyTo(u))
|
||||
return false;
|
||||
}
|
||||
|
||||
// skip non hostile to caster enemy creatures
|
||||
if( !IsHostileTo(enemy) )
|
||||
if (!IsHostileTo(enemy))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue