[10561] Avoid ask AI for direct controlled creature at attack.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also fix warrning double->float in recent commited code.
This commit is contained in:
zergtmn 2010-09-30 17:51:51 +04:00 committed by VladimirMangos
parent 02b51fb976
commit ab3de84cca
3 changed files with 11 additions and 10 deletions

View file

@ -115,14 +115,20 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
if (pet->getVictim()) if (pet->getVictim())
pet->AttackStop(); pet->AttackStop();
if(pet->GetTypeId() != TYPEID_PLAYER) if (pet->hasUnitState(UNIT_STAT_CONTROLLED))
{
pet->Attack(TargetUnit, true);
pet->SendPetAIReaction(guid1);
}
else
{ {
pet->GetMotionMaster()->Clear(); pet->GetMotionMaster()->Clear();
if (((Creature*)pet)->AI()) if (((Creature*)pet)->AI())
((Creature*)pet)->AI()->AttackStart(TargetUnit); ((Creature*)pet)->AI()->AttackStart(TargetUnit);
// 10% chance to play special pet attack talk, else growl // 10% chance to play special pet attack talk, else growl
if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10) if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10))
pet->SendPetTalk((uint32)PET_TALK_ATTACK); pet->SendPetTalk((uint32)PET_TALK_ATTACK);
else else
{ {
@ -130,11 +136,6 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
pet->SendPetAIReaction(guid1); pet->SendPetAIReaction(guid1);
} }
} }
else // charmed player
{
pet->Attack(TargetUnit,true);
pet->SendPetAIReaction(guid1);
}
} }
break; break;
} }

View file

@ -1776,7 +1776,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
} }
case 64385: // Spinning (from Unusual Compass) case 64385: // Spinning (from Unusual Compass)
{ {
m_caster->SetFacingTo(frand(0, M_PI*2), true); m_caster->SetFacingTo(frand(0, M_PI_F*2), true);
return; return;
} }
case 67019: // Flask of the North case 67019: // Flask of the North

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10560" #define REVISION_NR "10561"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__