mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Chat: Fix validation of tradeskill recipes that belong to multiple skill lines
This commit is contained in:
@@ -219,22 +219,27 @@ struct LinkValidator<LinkTags::enchant>
|
||||
{
|
||||
static bool IsTextValid(SpellInfo const* info, char const* pos, size_t len)
|
||||
{
|
||||
if (LinkValidator<LinkTags::spell>::IsTextValid(info, pos, len))
|
||||
return true;
|
||||
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(info->Id);
|
||||
if (bounds.first == bounds.second)
|
||||
return LinkValidator<LinkTags::spell>::IsTextValid(info, pos, len);
|
||||
|
||||
SkillLineEntry const* skill = sSkillLineStore.LookupEntry(bounds.first->second->skillId);
|
||||
if (!skill)
|
||||
return false;
|
||||
|
||||
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
|
||||
for (auto pair = bounds.first; pair != bounds.second; ++pair)
|
||||
{
|
||||
char const* skillName = skill->name[i];
|
||||
size_t skillLen = strlen(skillName);
|
||||
if (len > skillLen + 2 && // or of form [Skill Name: Spell Name]
|
||||
!strncmp(pos, skillName, skillLen) && !strncmp(pos + skillLen, ": ", 2) &&
|
||||
equal_with_len(info->SpellName[i], pos + (skillLen + 2), len - (skillLen + 2)))
|
||||
return true;
|
||||
SkillLineEntry const* skill = sSkillLineStore.LookupEntry(pair->second->skillId);
|
||||
if (!skill)
|
||||
return false;
|
||||
|
||||
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
|
||||
{
|
||||
char const* skillName = skill->name[i];
|
||||
size_t skillLen = strlen(skillName);
|
||||
if (len > skillLen + 2 && // or of form [Skill Name: Spell Name]
|
||||
!strncmp(pos, skillName, skillLen) && !strncmp(pos + skillLen, ": ", 2) &&
|
||||
equal_with_len(info->SpellName[i], pos + (skillLen + 2), len - (skillLen + 2)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user