mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
feat(Core/Spell): AssertSpellInfo (#6115)
* feat(Core/Spell): AssertSpellInfo (cherry picked from commite52878b6b5) (cherry picked from commit8c44259fae) Co-Authored-By: Shauren <shauren.trinity@gmail.com> Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com> * Update SpellMgr.h
This commit is contained in:
@@ -5256,7 +5256,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
uint32 spellId = 24659;
|
||||
if (apply && caster)
|
||||
{
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId);
|
||||
SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
|
||||
|
||||
for (uint32 i = 0; i < spell->StackAmount; ++i)
|
||||
caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
|
||||
@@ -5271,7 +5271,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
|
||||
uint32 spellId = 24662;
|
||||
if (apply && caster)
|
||||
{
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellId);
|
||||
SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
|
||||
for (uint32 i = 0; i < spell->StackAmount; ++i)
|
||||
caster->CastSpell(target, spell->Id, true, nullptr, nullptr, GetCasterGUID());
|
||||
break;
|
||||
|
||||
@@ -1997,7 +1997,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
|
||||
sSpellMgr->GetSetOfSpellsInSpellGroupWithFlag(1, SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE, availableElixirs);
|
||||
for (std::set<uint32>::iterator itr = availableElixirs.begin(); itr != availableElixirs.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(*itr);
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*itr);
|
||||
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
|
||||
availableElixirs.erase(itr++);
|
||||
else
|
||||
|
||||
@@ -684,6 +684,14 @@ public:
|
||||
|
||||
// SpellInfo object management
|
||||
[[nodiscard]] SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : nullptr; }
|
||||
// Use this only with 100% valid spellIds
|
||||
SpellInfo const* AssertSpellInfo(uint32 spellId) const
|
||||
{
|
||||
ASSERT(spellId < GetSpellInfoStoreSize());
|
||||
SpellInfo const* spellInfo = mSpellInfoMap[spellId];
|
||||
ASSERT(spellInfo);
|
||||
return spellInfo;
|
||||
}
|
||||
[[nodiscard]] uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); }
|
||||
|
||||
// Talent Additional Set
|
||||
|
||||
Reference in New Issue
Block a user