fix(Core/Commands): Learn profession rank spells in .learn all recipes (#25114)
Co-authored-by: Ludwig <sudlud@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include "Tokenize.h"
|
||||
#include "World.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
bool IsPrimaryProfessionSkill(uint32 skill)
|
||||
{
|
||||
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
|
||||
@@ -687,6 +689,24 @@ SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<uint32> SpellMgr::GetSkillRankSpells(uint32 skillId) const
|
||||
{
|
||||
// Returns every spell that grants this skill via SPELL_EFFECT_SKILL,
|
||||
// i.e. the profession rank/proficiency spells (Apprentice -> Grand Master),
|
||||
// ordered by step. Not strictly limited to the six ranks: any skill-granting
|
||||
// spell for the line is included.
|
||||
std::vector<uint32> result;
|
||||
for (auto const& [spellId, node] : mSpellLearnSkills)
|
||||
if (node.skill == skillId)
|
||||
result.push_back(spellId);
|
||||
|
||||
std::ranges::sort(result, [this](uint32 a, uint32 b)
|
||||
{
|
||||
return mSpellLearnSkills.at(a).step < mSpellLearnSkills.at(b).step;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const
|
||||
{
|
||||
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(std::make_pair(spell_id, effIndex));
|
||||
|
||||
@@ -687,6 +687,7 @@ public:
|
||||
|
||||
// Spell learning
|
||||
[[nodiscard]] SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const;
|
||||
[[nodiscard]] std::vector<uint32> GetSkillRankSpells(uint32 skillId) const;
|
||||
|
||||
// Spell target coordinates
|
||||
[[nodiscard]] SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const;
|
||||
|
||||
Reference in New Issue
Block a user