aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-27 18:28:26 -0500
committermegamage <none@none>2009-06-27 18:28:26 -0500
commitfc0e8a251b31f0bf54432c08d37b0bf55467a880 (patch)
tree161281376e117cca6581e3881c1efaac351309de /src
parent02a83001a4856e825c24b0a0a6d26d06e1ede288 (diff)
[8084] Correctly show spell icon disabled state at relogin for spells with cooldown delayed until expire. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp27
-rw-r--r--src/game/Player.h2
2 files changed, 17 insertions, 12 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 634c30b805a..5f376b19a91 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -2618,7 +2618,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
void Player::SendInitialSpells()
{
time_t curTime = time(NULL);
- time_t infTime = curTime + MONTH/2;
+ time_t infTime = curTime + infinityCooldownDelayCheck;
uint16 spellCount = 0;
@@ -2652,18 +2652,21 @@ void Player::SendInitialSpells()
if(!sEntry)
continue;
- // not send infinity cooldown
- if(itr->second.end > infTime)
- continue;
-
data << uint32(itr->first);
- time_t cooldown = 0;
- if(itr->second.end > curTime)
- cooldown = (itr->second.end-curTime)*IN_MILISECONDS;
-
data << uint16(itr->second.itemid); // cast item id
data << uint16(sEntry->Category); // spell category
+
+ // send infinity cooldown in special format
+ if(itr->second.end >= infTime)
+ {
+ data << uint32(1); // cooldown
+ data << uint32(0x80000000); // category cooldown
+ continue;
+ }
+
+ time_t cooldown = itr->second.end > curTime ? (itr->second.end-curTime)*IN_MILISECONDS : 0;
+
if(sEntry->Category) // may be wrong, but anyway better than nothing...
{
data << uint32(0); // cooldown
@@ -3476,7 +3479,7 @@ void Player::_SaveSpellCooldowns()
CharacterDatabase.PExecute("DELETE FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow());
time_t curTime = time(NULL);
- time_t infTime = curTime + MONTH/2;
+ time_t infTime = curTime + infinityCooldownDelayCheck;
// remove outdated and save active
for(SpellCooldowns::iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end();)
@@ -18124,8 +18127,8 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
{
// use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped)
// but not allow ignore until reset or re-login
- catrecTime = catrec > 0 ? curTime+MONTH : 0;
- recTime = rec > 0 ? curTime+MONTH : catrecTime;
+ catrecTime = catrec > 0 ? curTime+infinityCooldownDelay : 0;
+ recTime = rec > 0 ? curTime+infinityCooldownDelay : catrecTime;
}
else
{
diff --git a/src/game/Player.h b/src/game/Player.h
index 216994f7e7c..12f1ec66722 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1409,6 +1409,8 @@ class TRINITY_DLL_SPEC Player : public Unit
void DropModCharge(SpellModifier * mod, Spell * spell);
void SetSpellModTakingSpell(Spell* spell, bool apply);
+ static uint32 const infinityCooldownDelay = MONTH; // used for set "infinity cooldowns" for spells and check
+ static uint32 const infinityCooldownDelayCheck = MONTH/2;
bool HasSpellCooldown(uint32 spell_id) const
{
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);