void ASkill::InterruptSkill(ESkillInterruptReason interruptReason, FVector mousePos, AGameCharacter* targetUnit) { if (skillState != ESkillState::Performing) return; if (bAutoCooldownOnInterrupt) StartCooldown(); OnCanInterruptSkill(interruptReason, mousePos, targetUnit); }
void SpellHistory::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= nullptr*/, bool startCooldown /*= true*/) { // Send activate cooldown timer (possible 0) at client side if (Player* player = GetPlayerOwner()) { uint32 category = spellInfo->GetCategory(); GetCooldownDurations(spellInfo, itemId, nullptr, &category, nullptr); auto categoryItr = _categoryCooldowns.find(category); if (categoryItr != _categoryCooldowns.end() && categoryItr->second->SpellId != spellInfo->Id) { player->SendDirectMessage(WorldPackets::Spells::CooldownEvent(player != _owner, categoryItr->second->SpellId).Write()); if (startCooldown) StartCooldown(sSpellMgr->AssertSpellInfo(categoryItr->second->SpellId), itemId, spell); } player->SendDirectMessage(WorldPackets::Spells::CooldownEvent(player != _owner, spellInfo->Id).Write()); } // start cooldowns at server side, if any if (startCooldown) StartCooldown(spellInfo, itemId, spell); }
void SpellHistory::HandleCooldowns(SpellInfo const* spellInfo, Item const* item, Spell* spell /*= nullptr*/) { if (Player* player = _owner->ToPlayer()) { // potions start cooldown until exiting combat if (item && (item->IsPotion() || spellInfo->IsCooldownStartedOnEvent())) { player->SetLastPotionId(item->GetEntry()); return; } } if (spellInfo->IsCooldownStartedOnEvent() || spellInfo->IsPassive() || (spell && spell->IsIgnoringCooldowns())) return; StartCooldown(spellInfo, item ? item->GetEntry() : 0, spell); }
void SpellHistory::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= nullptr*/, bool startCooldown /*= true*/) { // start cooldowns at server side, if any if (startCooldown) StartCooldown(spellInfo, itemId, spell); if (Player* player = GetPlayerOwner()) { // Send activate cooldown timer (possible 0) at client side WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8); data << uint32(spellInfo->Id); data << uint64(_owner->GetGUID()); player->SendDirectMessage(&data); uint32 category = spellInfo->GetCategory(); if (category && spellInfo->CategoryRecoveryTime) { SpellCategoryStore::const_iterator ct = sSpellsByCategoryStore.find(category); if (ct != sSpellsByCategoryStore.end()) { for (auto const& cooldownPair : _spellCooldowns) { uint32 categorySpell = cooldownPair.first; if (!ct->second.count(categorySpell)) continue; if (categorySpell == spellInfo->Id) // skip main spell, already handled above continue; SpellInfo const* spellInfo2 = sSpellMgr->EnsureSpellInfo(categorySpell); if (!spellInfo2->IsCooldownStartedOnEvent()) continue; data.Initialize(SMSG_COOLDOWN_EVENT, 4 + 8); data << uint32(categorySpell); data << uint64(_owner->GetGUID()); player->SendDirectMessage(&data); } } } } }
void SpellHistory::HandleCooldowns(SpellInfo const* spellInfo, uint32 itemID, Spell* spell /*= nullptr*/) { if (ConsumeCharge(spellInfo->ChargeCategoryId)) return; if (Player* player = _owner->ToPlayer()) { // potions start cooldown until exiting combat if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemID)) { if (itemTemplate->IsPotion() || spellInfo->IsCooldownStartedOnEvent()) { player->SetLastPotionId(itemID); return; } } } if (spellInfo->IsCooldownStartedOnEvent() || spellInfo->IsPassive() || (spell && spell->IsIgnoringCooldowns())) return; StartCooldown(spellInfo, itemID, spell); }
void SpellHistory::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= nullptr*/, bool startCooldown /*= true*/) { // start cooldowns at server side, if any if (startCooldown) StartCooldown(spellInfo, itemId, spell); if (Player* player = GetPlayerOwner()) { // Send activate cooldown timer (possible 0) at client side player->SendDirectMessage(WorldPackets::Spells::CooldownEvent(player != _owner, spellInfo->Id).Write()); uint32 category = spellInfo->GetCategory(); if (category && spellInfo->CategoryRecoveryTime) { SpellCategoryStore::const_iterator ct = sSpellsByCategoryStore.find(category); if (ct != sSpellsByCategoryStore.end()) { for (auto const& cooldownPair : _spellCooldowns) { uint32 categorySpell = cooldownPair.first; if (!ct->second.count(categorySpell)) continue; if (categorySpell == spellInfo->Id) // skip main spell, already handled above continue; SpellInfo const* spellInfo2 = sSpellMgr->AssertSpellInfo(categorySpell); if (!spellInfo2->IsCooldownStartedOnEvent()) continue; player->SendDirectMessage(WorldPackets::Spells::CooldownEvent(player != _owner, categorySpell).Write()); } } } } }
void ASkill::SkillFinished(float manualCooldown) { StartCooldown(manualCooldown); }