diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-05-21 10:58:32 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-05-21 10:58:32 +0200 |
commit | c3778487f07752c425cef98fa496cda450d46f9b (patch) | |
tree | d87bb8aba354f6d2606ae303b063b29e5381fc3f /src | |
parent | 463f831b29c392fc98ea778f7781d41df7a87349 (diff) |
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
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 5 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.h | 2 | ||||
-rwxr-xr-x | src/server/game/Entities/Totem/Totem.cpp | 28 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 25d808c7501..ab5b5935a5c 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -20574,10 +20574,11 @@ 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 - AddSpellAndCategoryCooldowns(spellInfo, itemId, spell); + if (setCooldown) + AddSpellAndCategoryCooldowns(spellInfo, itemId, spell); // Send activate cooldown timer (possible 0) at client side WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 4c0c6401049..5c3db626433 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -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); diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index cc2b272625b..86c15eeb243 100755 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -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()) { |