mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[8056] Move SMSG_CLEAR_COOLDOWN into function and use it. Other cleanups.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
d97f2bb92f
commit
9b9fe55981
6 changed files with 28 additions and 77 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -3256,12 +3256,7 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ )
|
|||
m_spellCooldowns.erase(spell_id);
|
||||
|
||||
if(update)
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spell_id);
|
||||
data << uint64(GetGUID());
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
SendClearCooldown(spell_id, this);
|
||||
}
|
||||
|
||||
void Player::RemoveArenaSpellCooldowns()
|
||||
|
|
@ -3279,13 +3274,8 @@ void Player::RemoveArenaSpellCooldowns()
|
|||
entry->RecoveryTime <= 15 * MINUTE * IN_MILISECONDS &&
|
||||
entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS )
|
||||
{
|
||||
// notify player
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(itr->first);
|
||||
data << uint64(GetGUID());
|
||||
GetSession()->SendPacket(&data);
|
||||
// remove cooldown
|
||||
m_spellCooldowns.erase(itr);
|
||||
// remove & notify
|
||||
RemoveSpellCooldown(itr->first, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3295,12 +3285,8 @@ void Player::RemoveAllSpellCooldown()
|
|||
if(!m_spellCooldowns.empty())
|
||||
{
|
||||
for(SpellCooldowns::const_iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end(); ++itr)
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(itr->first);
|
||||
data << uint64(GetGUID());
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
SendClearCooldown(itr->first, this);
|
||||
|
||||
m_spellCooldowns.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -6289,22 +6275,6 @@ void Player::DuelComplete(DuelCompleteType type)
|
|||
duel->opponent->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, 1);
|
||||
}
|
||||
|
||||
// cool-down duel spell
|
||||
/*data.Initialize(SMSG_SPELL_COOLDOWN, 17);
|
||||
|
||||
data<<GetGUID();
|
||||
data<<uint8(0x0);
|
||||
|
||||
data<<(uint32)7266;
|
||||
data<<uint32(0x0);
|
||||
GetSession()->SendPacket(&data);
|
||||
data.Initialize(SMSG_SPELL_COOLDOWN, 17);
|
||||
data<<duel->opponent->GetGUID();
|
||||
data<<uint8(0x0);
|
||||
data<<(uint32)7266;
|
||||
data<<uint32(0x0);
|
||||
duel->opponent->GetSession()->SendPacket(&data);*/
|
||||
|
||||
//Remove Duel Flag object
|
||||
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
|
||||
if(obj)
|
||||
|
|
@ -20300,3 +20270,11 @@ void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ )
|
|||
if(in_db_also)
|
||||
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(f), GetGUIDLow());
|
||||
}
|
||||
|
||||
void Player::SendClearCooldown( uint32 spell_id, Unit* target )
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spell_id);
|
||||
data << uint64(target->GetGUID());
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1442,6 +1442,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL);
|
||||
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
|
||||
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
|
||||
void SendClearCooldown( uint32 spell_id, Unit* target );
|
||||
|
||||
void RemoveArenaSpellCooldowns();
|
||||
void RemoveAllSpellCooldown();
|
||||
void _LoadSpellCooldowns(QueryResult *result);
|
||||
|
|
|
|||
|
|
@ -11017,33 +11017,6 @@ void Unit::SendPetTalk (uint32 pettalk)
|
|||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetSpellCooldown (uint32 spellid, time_t cooltime)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4);
|
||||
data << uint64(GetGUID());
|
||||
data << uint8(0x0); // flags (0x1, 0x2)
|
||||
data << uint32(spellid);
|
||||
data << uint32(cooltime);
|
||||
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetClearCooldown (uint32 spellid)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spellid);
|
||||
data << uint64(GetGUID());
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetAIReaction(uint64 guid)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
|
|
|
|||
|
|
@ -1495,8 +1495,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void SendPetCastFail(uint32 spellid, SpellCastResult msg);
|
||||
void SendPetActionFeedback (uint8 msg);
|
||||
void SendPetTalk (uint32 pettalk);
|
||||
void SendPetSpellCooldown (uint32 spellid, time_t cooltime);
|
||||
void SendPetClearCooldown (uint32 spellid);
|
||||
void SendPetAIReaction(uint64 guid);
|
||||
///----------End of Pet responses methods----------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8055"
|
||||
#define REVISION_NR "8056"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue