mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[6846] Fixed some more typos. Added post check for assistance conditions into event execute.
Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
359d4d7dd3
commit
64fd2dc881
5 changed files with 40 additions and 31 deletions
|
|
@ -101,9 +101,9 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin());
|
||||
m_assistants.pop_front();
|
||||
|
||||
if (assistant)
|
||||
if (assistant && assistant->CanAssistTo(&m_owner, victim))
|
||||
{
|
||||
assistant->SetNoCallAssistence(true);
|
||||
assistant->SetNoCallAssistance(true);
|
||||
if(assistant->AI())
|
||||
assistant->AI()->AttackStart(victim);
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ m_lootMoney(0), m_lootRecipient(0),
|
|||
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
|
||||
m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false),
|
||||
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
|
||||
m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
|
||||
m_AlreadyCallAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
|
||||
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
|
||||
{
|
||||
m_valuesCount = UNIT_END;
|
||||
|
|
@ -1684,11 +1684,11 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Creature::CallAssistence()
|
||||
void Creature::CallAssistance()
|
||||
{
|
||||
if( !m_AlreadyCallAssistence && getVictim() && !isPet() && !isCharmed())
|
||||
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
|
||||
{
|
||||
SetNoCallAssistence(true);
|
||||
SetNoCallAssistance(true);
|
||||
|
||||
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
|
||||
if(radius > 0)
|
||||
|
|
@ -1725,6 +1725,31 @@ void Creature::CallAssistence()
|
|||
}
|
||||
}
|
||||
|
||||
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy) const
|
||||
{
|
||||
// we don't need help from zombies :)
|
||||
if( !isAlive() )
|
||||
return false;
|
||||
|
||||
// skip fighting creature
|
||||
if( isInCombat() )
|
||||
return false;
|
||||
|
||||
// only from same creature faction
|
||||
if(getFaction() != u->getFaction() )
|
||||
return false;
|
||||
|
||||
// only free creature
|
||||
if( GetCharmerOrOwnerGUID() )
|
||||
return false;
|
||||
|
||||
// skip non hostile to caster enemy creatures
|
||||
if( !IsHostileTo(enemy) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Creature::SaveRespawnTime()
|
||||
{
|
||||
if(isPet() || !m_DBTableGuid)
|
||||
|
|
|
|||
|
|
@ -547,8 +547,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
|
||||
float GetAttackDistance(Unit const* pl) const;
|
||||
|
||||
void CallAssistence();
|
||||
void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
|
||||
void CallAssistance();
|
||||
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
|
||||
bool CanAssistTo(const Unit* u, const Unit* enemy) const;
|
||||
|
||||
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
||||
|
|
@ -633,7 +634,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
|
||||
uint32 m_equipmentId;
|
||||
|
||||
bool m_AlreadyCallAssistence;
|
||||
bool m_AlreadyCallAssistance;
|
||||
bool m_regenHealth;
|
||||
bool m_AI_locked;
|
||||
bool m_isDeadByDefault;
|
||||
|
|
|
|||
|
|
@ -721,32 +721,15 @@ namespace MaNGOS
|
|||
if(u == i_funit)
|
||||
return false;
|
||||
|
||||
// we don't need help from zombies :)
|
||||
if( !u->isAlive() )
|
||||
return false;
|
||||
|
||||
// skip fighting creature
|
||||
if( u->isInCombat() )
|
||||
return false;
|
||||
|
||||
// only from same creature faction
|
||||
if(u->getFaction() != i_funit->getFaction() )
|
||||
return false;
|
||||
|
||||
// only free creature
|
||||
if( u->GetCharmerOrOwnerGUID() )
|
||||
if ( !u->CanAssistTo(i_funit, i_enemy) )
|
||||
return false;
|
||||
|
||||
// too far
|
||||
if( !i_funit->IsWithinDistInMap(u, i_range) )
|
||||
return false;
|
||||
|
||||
// skip non hostile to caster enemy creatures
|
||||
if( !u->IsHostileTo(i_enemy) )
|
||||
return false;
|
||||
|
||||
// only if see assisted creature
|
||||
if(!u->IsWithinLOSInMap(i_funit) )
|
||||
if( !i_funit->IsWithinLOSInMap(u) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -6908,7 +6908,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
|||
data << uint32(AI_REACTION_AGGRO); // Aggro sound
|
||||
((WorldObject*)this)->SendMessageToSet(&data, true);
|
||||
|
||||
((Creature*)this)->CallAssistence();
|
||||
((Creature*)this)->CallAssistance();
|
||||
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
}
|
||||
|
||||
|
|
@ -6942,7 +6942,7 @@ bool Unit::AttackStop()
|
|||
if( GetTypeId()==TYPEID_UNIT )
|
||||
{
|
||||
// reset call assistance
|
||||
((Creature*)this)->SetNoCallAssistence(false);
|
||||
((Creature*)this)->SetNoCallAssistance(false);
|
||||
}
|
||||
|
||||
SendAttackStop(victim);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "6845"
|
||||
#define REVISION_NR "6846"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue