Core/Spells: Fixed totem summoning behavior (summoning new totem while old is still active will not prevent new one from spawning) and fixed totem cooldowns

Closes #1609
Closes #1615
This commit is contained in:
Shauren
2011-05-21 10:58:32 +02:00
parent 463f831b29
commit c3778487f0
3 changed files with 18 additions and 17 deletions
+2 -1
View File
@@ -20574,9 +20574,10 @@ void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, time_t end_time)
m_spellCooldowns[spellid] = sc;
}
void Player::SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId, Spell* spell)
void Player::SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/)
{
// start cooldowns at server side, if any
if (setCooldown)
AddSpellAndCategoryCooldowns(spellInfo, itemId, spell);
// Send activate cooldown timer (possible 0) at client side
+1 -1
View File
@@ -1676,7 +1676,7 @@ class Player : public Unit, public GridObject<Player>
}
void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
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, bool setCooldown = true);
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
void RemoveSpellCategoryCooldown(uint32 cat, bool update = false);
+14 -14
View File
@@ -52,6 +52,19 @@ void Totem::Update(uint32 time)
void Totem::InitStats(uint32 duration)
{
// client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem
if (m_owner->GetTypeId() == TYPEID_PLAYER
&& m_Properties->Slot >= SUMMON_SLOT_TOTEM
&& m_Properties->Slot < MAX_TOTEM_SLOT)
{
WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
data << uint8(m_Properties->Slot - 1);
data << uint64(GetGUID());
data << uint32(duration);
data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL));
m_owner->ToPlayer()->SendDirectMessage(&data);
}
Minion::InitStats(duration);
// set display id depending on caster's race
@@ -69,19 +82,6 @@ void Totem::InitStats(uint32 duration)
m_duration = duration;
SetLevel(m_owner->getLevel());
// client requires SMSG_TOTEM_CREATED to be sent before adding to world
if (m_owner->GetTypeId() == TYPEID_PLAYER
&& m_Properties->Slot >= SUMMON_SLOT_TOTEM
&& m_Properties->Slot < MAX_TOTEM_SLOT)
{
WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
data << uint8(m_Properties->Slot - 1);
data << uint64(GetGUID());
data << uint32(duration);
data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL));
m_owner->ToPlayer()->SendDirectMessage(&data);
}
}
void Totem::InitSummon()
@@ -117,7 +117,7 @@ void Totem::UnSummon()
owner->SendAutoRepeatCancel(this);
if (SpellEntry const* spell = sSpellStore.LookupEntry(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
owner->SendCooldownEvent(spell);
owner->SendCooldownEvent(spell, 0, NULL, false);
if (Group* group = owner->GetGroup())
{