mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[7809] Replace repeating "remove cooldown and send update to client" code by function call.
This commit is contained in:
parent
09046df744
commit
f117ce3420
6 changed files with 22 additions and 48 deletions
|
|
@ -1064,11 +1064,7 @@ bool ChatHandler::HandleCooldownCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPacket data( SMSG_CLEAR_COOLDOWN, (4+8) );
|
target->RemoveSpellCooldown(spell_id,true);
|
||||||
data << uint32(spell_id);
|
|
||||||
data << uint64(target->GetGUID());
|
|
||||||
target->GetSession()->SendPacket(&data);
|
|
||||||
target->RemoveSpellCooldown(spell_id);
|
|
||||||
PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target==m_session->GetPlayer() ? GetMangosString(LANG_YOU) : tNameLink.c_str());
|
PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target==m_session->GetPlayer() ? GetMangosString(LANG_YOU) : tNameLink.c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -3214,6 +3214,20 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Player::RemoveArenaSpellCooldowns()
|
void Player::RemoveArenaSpellCooldowns()
|
||||||
{
|
{
|
||||||
// remove cooldowns on spells that has < 15 min CD
|
// remove cooldowns on spells that has < 15 min CD
|
||||||
|
|
|
||||||
|
|
@ -1404,7 +1404,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
|
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
|
||||||
void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL);
|
void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL);
|
||||||
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
|
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
|
||||||
void RemoveSpellCooldown(uint32 spell_id) { m_spellCooldowns.erase(spell_id); }
|
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
|
||||||
void RemoveArenaSpellCooldowns();
|
void RemoveArenaSpellCooldowns();
|
||||||
void RemoveAllSpellCooldown();
|
void RemoveAllSpellCooldown();
|
||||||
void _LoadSpellCooldowns(QueryResult *result);
|
void _LoadSpellCooldowns(QueryResult *result);
|
||||||
|
|
|
||||||
|
|
@ -588,15 +588,7 @@ void Spell::FillTargetMap()
|
||||||
{
|
{
|
||||||
// clear cooldown at fail
|
// clear cooldown at fail
|
||||||
if(m_caster->GetTypeId()==TYPEID_PLAYER)
|
if(m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id);
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
|
||||||
data << uint32(m_spellInfo->Id);
|
|
||||||
data << uint64(m_caster->GetGUID());
|
|
||||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
|
||||||
}
|
|
||||||
|
|
||||||
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
|
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
|
||||||
finish(false);
|
finish(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1196,12 +1196,7 @@ void Spell::EffectDummy(uint32 i)
|
||||||
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
|
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
|
||||||
spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )
|
spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )
|
||||||
{
|
{
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(classspell);
|
((Player*)m_caster)->RemoveSpellCooldown(classspell,true);
|
||||||
|
|
||||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
|
||||||
data << uint32(classspell);
|
|
||||||
data << uint64(m_caster->GetGUID());
|
|
||||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1444,14 +1439,7 @@ void Spell::EffectDummy(uint32 i)
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell);
|
SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell);
|
||||||
|
|
||||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & 0x0000024000000860LL))
|
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & 0x0000024000000860LL))
|
||||||
{
|
((Player*)m_caster)->RemoveSpellCooldown(classspell,true);
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(classspell);
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
|
||||||
data << uint32(classspell);
|
|
||||||
data << uint64(m_caster->GetGUID());
|
|
||||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1502,14 +1490,7 @@ void Spell::EffectDummy(uint32 i)
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell);
|
SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell);
|
||||||
|
|
||||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0 )
|
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0 )
|
||||||
{
|
((Player*)m_caster)->RemoveSpellCooldown(classspell,true);
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(classspell);
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
|
||||||
data << uint32(classspell);
|
|
||||||
data << uint64(m_caster->GetGUID());
|
|
||||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1608,17 +1589,8 @@ void Spell::EffectDummy(uint32 i)
|
||||||
// non-standard cast requirement check
|
// non-standard cast requirement check
|
||||||
if (!unitTarget || unitTarget->getAttackers().empty())
|
if (!unitTarget || unitTarget->getAttackers().empty())
|
||||||
{
|
{
|
||||||
// clear cooldown at fail
|
|
||||||
if(m_caster->GetTypeId()==TYPEID_PLAYER)
|
if(m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id);
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8));
|
|
||||||
data << uint32(m_spellInfo->Id);
|
|
||||||
data << uint64(m_caster->GetGUID());
|
|
||||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
|
||||||
}
|
|
||||||
|
|
||||||
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7808"
|
#define REVISION_NR "7809"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue