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

[8060] Store spell_pet_auras for auraeffects instead of by whole aura Author:hunuza.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-06-23 14:05:37 +02:00
parent 64786941dd
commit f2ec641e42
12 changed files with 100 additions and 143 deletions
+16 -37
View File
@@ -3223,8 +3223,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
RemoveAurasDueToSpell(spell_id);
// remove pet auras
if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id))
RemovePetAura(petSpell);
for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id, i))
RemovePetAura(petSpell);
// free talent points
uint32 talentCosts = GetTalentSpellCost(spell_id);
@@ -3374,12 +3375,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::RemoveCategoryCooldown( uint32 cat )
@@ -3405,13 +3401,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);
}
}
}
@@ -3421,12 +3412,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();
}
}
@@ -6453,22 +6440,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)
@@ -21132,3 +21103,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);
}