[8056] Move SMSG_CLEAR_COOLDOWN into function and use it. Other cleanups.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
XTZGZoReX 2009-06-21 03:06:08 +04:00 committed by VladimirMangos
parent d97f2bb92f
commit 9b9fe55981
6 changed files with 28 additions and 77 deletions

View file

@ -249,8 +249,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
else
pet->SendPetCastFail(spellid, result);
if(!((Creature*)pet)->HasSpellCooldown(spellid))
pet->SendPetClearCooldown(spellid);
if (!((Creature*)pet)->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, pet);
spell->finish(false);
delete spell;
@ -569,7 +569,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
sLog.outDebug("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);
if(!_player->GetPet() && !_player->GetCharm())
if (!_player->GetPet() && !_player->GetCharm())
return;
if (GUID_HIPART(guid) == HIGHGUID_PLAYER)
@ -577,7 +577,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
if(!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
{
sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
return;
@ -587,18 +587,18 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
if(!spellInfo)
if (!spellInfo)
{
sLog.outError("WORLD: unknown PET spell id %i", spellid);
return;
}
// do not cast not learned spells
if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
return;
SpellCastTargets targets;
if(!targets.read(&recvPacket,pet))
if (!targets.read(&recvPacket,pet))
return;
pet->clearUnitState(UNIT_STAT_FOLLOW);
@ -608,10 +608,10 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
spell->m_targets = targets;
SpellCastResult result = spell->CheckPetCast(NULL);
if(result == SPELL_CAST_OK)
if (result == SPELL_CAST_OK)
{
pet->AddCreatureSpellCooldown(spellid);
if(pet->isPet())
if (pet->isPet())
{
//10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
@ -626,8 +626,8 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
else
{
pet->SendPetCastFail(spellid, result);
if(!pet->HasSpellCooldown(spellid))
pet->SendPetClearCooldown(spellid);
if (!pet->HasSpellCooldown(spellid))
GetPlayer()->SendClearCooldown(spellid, pet);
spell->finish(false);
delete spell;