diff options
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b045b6473fd..2cd10e0b4e8 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5582,6 +5582,11 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 if (m_spellInfo->ExcludeCasterAuraSpell && unitCaster->HasAura(m_spellInfo->ExcludeCasterAuraSpell)) return SPELL_FAILED_CASTER_AURASTATE; + if (m_spellInfo->CasterAuraType && !unitCaster->HasAuraType(m_spellInfo->CasterAuraType)) + return SPELL_FAILED_CASTER_AURASTATE; + if (m_spellInfo->ExcludeCasterAuraType && unitCaster->HasAuraType(m_spellInfo->ExcludeCasterAuraType)) + return SPELL_FAILED_CASTER_AURASTATE; + if (reqCombat && unitCaster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat()) return SPELL_FAILED_AFFECTING_COMBAT; } @@ -6390,19 +6395,15 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32 if (spellEffectInfo.Effect == SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY) { - BattlePets::BattlePetBreedQuality quality = BattlePets::BattlePetBreedQuality::Poor; - switch (spellEffectInfo.BasePoints) + auto qualityItr = std::lower_bound(sBattlePetBreedQualityStore.begin(), sBattlePetBreedQualityStore.end(), spellEffectInfo.BasePoints, [](BattlePetBreedQualityEntry const* a1, int32 selector) { - case 85: - quality = BattlePets::BattlePetBreedQuality::Rare; - break; - case 75: - quality = BattlePets::BattlePetBreedQuality::Uncommon; - break; - default: - // Ignore Epic Battle-Stones - break; - } + return a1->MaxQualityRoll < selector; + }); + + BattlePets::BattlePetBreedQuality quality = BattlePets::BattlePetBreedQuality::Poor; + if (qualityItr != sBattlePetBreedQualityStore.end()) + quality = BattlePets::BattlePetBreedQuality(qualityItr->QualityEnum); + if (battlePet->PacketInfo.Quality >= AsUnderlyingType(quality)) return SPELL_FAILED_CANT_UPGRADE_BATTLE_PET; } @@ -6668,7 +6669,7 @@ SpellCastResult Spell::CheckCasterAuras(int32* param1) const Unit::AuraEffectList const& auras = unitCaster->GetAuraEffectsByType(type); for (AuraEffect const* aurEff : auras) { - uint32 const mechanicMask = aurEff->GetSpellInfo()->GetAllEffectsMechanicMask(); + uint64 const mechanicMask = aurEff->GetSpellInfo()->GetAllEffectsMechanicMask(); if (mechanicMask && !(mechanicMask & GetSpellInfo()->GetAllowedMechanicMask())) { foundNotMechanic = true; @@ -7467,21 +7468,21 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*= { Item const* item = m_targets.GetItemTarget(); if (!item) - return SPELL_FAILED_CANT_BE_DISENCHANTED; + return SPELL_FAILED_CANT_BE_SALVAGED; // prevent disenchanting in trade slot if (item->GetOwnerGUID() != player->GetGUID()) - return SPELL_FAILED_CANT_BE_DISENCHANTED; + return SPELL_FAILED_CANT_BE_SALVAGED; ItemTemplate const* itemProto = item->GetTemplate(); if (!itemProto) - return SPELL_FAILED_CANT_BE_DISENCHANTED; + return SPELL_FAILED_CANT_BE_SALVAGED; ItemDisenchantLootEntry const* itemDisenchantLoot = item->GetDisenchantLoot(m_caster->ToPlayer()); if (!itemDisenchantLoot) - return SPELL_FAILED_CANT_BE_DISENCHANTED; + return SPELL_FAILED_CANT_BE_SALVAGED; if (itemDisenchantLoot->SkillRequired > player->GetSkillValue(SKILL_ENCHANTING)) - return SPELL_FAILED_LOW_CASTLEVEL; + return SPELL_FAILED_CANT_BE_SALVAGED_SKILL; break; } case SPELL_EFFECT_PROSPECTING: |