[7922] Implement param2 for ACTION_T_COMBAT_MOVEMENT for allow control start/stop melee combat state for creature at start/stop movement in combat.

Also small fix for avoid unexpected set pet speed to owner speed for non-player case. In player case this hack speed setting still required.
This commit is contained in:
VladimirMangos 2009-05-31 04:31:55 +04:00
parent c678263bb0
commit 79dab3dae5
6 changed files with 30 additions and 14 deletions

View file

@ -2317,7 +2317,7 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
return (100.0f - LvlPenalty) * LvlFactor / 100.0f;
}
void Unit::SendAttackStart(Unit* pVictim)
void Unit::SendMeleeAttackStart(Unit* pVictim)
{
WorldPacket data( SMSG_ATTACKSTART, 8 + 8 );
data << uint64(GetGUID());
@ -2327,7 +2327,7 @@ void Unit::SendAttackStart(Unit* pVictim)
DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" );
}
void Unit::SendAttackStop(Unit* victim)
void Unit::SendMeleeAttackStop(Unit* victim)
{
if(!victim)
return;
@ -7244,7 +7244,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) )
{
addUnitState(UNIT_STAT_MELEE_ATTACKING);
SendAttackStart(victim);
SendMeleeAttackStart(victim);
return true;
}
return false;
@ -7285,7 +7285,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
resetAttackTimer(OFF_ATTACK);
if(meleeAttack)
SendAttackStart(victim);
SendMeleeAttackStart(victim);
return true;
}
@ -7314,7 +7314,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/)
((Creature*)this)->SetNoSearchAssistance(false);
}
SendAttackStop(victim);
SendMeleeAttackStop(victim);
return true;
}
@ -7505,7 +7505,7 @@ void Unit::SetPet(Pet* pet)
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
// FIXME: hack, speed must be set only at follow
if(pet)
if(pet && GetTypeId()==TYPEID_PLAYER)
for(int i = 0; i < MAX_MOVE_TYPE; ++i)
pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
}