mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +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());
|
Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin());
|
||||||
m_assistants.pop_front();
|
m_assistants.pop_front();
|
||||||
|
|
||||||
if (assistant)
|
if (assistant && assistant->CanAssistTo(&m_owner, victim))
|
||||||
{
|
{
|
||||||
assistant->SetNoCallAssistence(true);
|
assistant->SetNoCallAssistance(true);
|
||||||
if(assistant->AI())
|
if(assistant->AI())
|
||||||
assistant->AI()->AttackStart(victim);
|
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_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_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false),
|
||||||
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
|
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_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
|
||||||
{
|
{
|
||||||
m_valuesCount = UNIT_END;
|
m_valuesCount = UNIT_END;
|
||||||
|
|
@ -1684,11 +1684,11 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const
|
||||||
return false;
|
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);
|
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
|
||||||
if(radius > 0)
|
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()
|
void Creature::SaveRespawnTime()
|
||||||
{
|
{
|
||||||
if(isPet() || !m_DBTableGuid)
|
if(isPet() || !m_DBTableGuid)
|
||||||
|
|
|
||||||
|
|
@ -547,8 +547,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
|
|
||||||
float GetAttackDistance(Unit const* pl) const;
|
float GetAttackDistance(Unit const* pl) const;
|
||||||
|
|
||||||
void CallAssistence();
|
void CallAssistance();
|
||||||
void SetNoCallAssistence(bool val) { m_AlreadyCallAssistence = val; }
|
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
|
||||||
|
bool CanAssistTo(const Unit* u, const Unit* enemy) const;
|
||||||
|
|
||||||
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
|
||||||
void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; }
|
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_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid
|
||||||
uint32 m_equipmentId;
|
uint32 m_equipmentId;
|
||||||
|
|
||||||
bool m_AlreadyCallAssistence;
|
bool m_AlreadyCallAssistance;
|
||||||
bool m_regenHealth;
|
bool m_regenHealth;
|
||||||
bool m_AI_locked;
|
bool m_AI_locked;
|
||||||
bool m_isDeadByDefault;
|
bool m_isDeadByDefault;
|
||||||
|
|
|
||||||
|
|
@ -721,32 +721,15 @@ namespace MaNGOS
|
||||||
if(u == i_funit)
|
if(u == i_funit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we don't need help from zombies :)
|
if ( !u->CanAssistTo(i_funit, i_enemy) )
|
||||||
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() )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// too far
|
// too far
|
||||||
if( !i_funit->IsWithinDistInMap(u, i_range) )
|
if( !i_funit->IsWithinDistInMap(u, i_range) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// skip non hostile to caster enemy creatures
|
|
||||||
if( !u->IsHostileTo(i_enemy) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// only if see assisted creature
|
// only if see assisted creature
|
||||||
if(!u->IsWithinLOSInMap(i_funit) )
|
if( !i_funit->IsWithinLOSInMap(u) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -6908,7 +6908,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||||
data << uint32(AI_REACTION_AGGRO); // Aggro sound
|
data << uint32(AI_REACTION_AGGRO); // Aggro sound
|
||||||
((WorldObject*)this)->SendMessageToSet(&data, true);
|
((WorldObject*)this)->SendMessageToSet(&data, true);
|
||||||
|
|
||||||
((Creature*)this)->CallAssistence();
|
((Creature*)this)->CallAssistance();
|
||||||
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6942,7 +6942,7 @@ bool Unit::AttackStop()
|
||||||
if( GetTypeId()==TYPEID_UNIT )
|
if( GetTypeId()==TYPEID_UNIT )
|
||||||
{
|
{
|
||||||
// reset call assistance
|
// reset call assistance
|
||||||
((Creature*)this)->SetNoCallAssistence(false);
|
((Creature*)this)->SetNoCallAssistance(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendAttackStop(victim);
|
SendAttackStop(victim);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6845"
|
#define REVISION_NR "6846"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue