mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-14 22:19:25 +01:00
Core/Chat: Some fixes to talent hyperlink verification. Closes #22685.
This commit is contained in:
@@ -122,11 +122,15 @@ bool Trinity::Hyperlinks::LinkTags::talent::StoreTo(TalentLinkData& val, char co
|
||||
{
|
||||
HyperlinkDataTokenizer t(pos, len);
|
||||
uint32 talentId;
|
||||
if (!(t.TryConsumeTo(talentId) && t.TryConsumeTo(val.Rank) && t.IsEmpty()))
|
||||
int8 rank; // talent links contain <learned rank>-1, we store <learned rank>
|
||||
if (!(t.TryConsumeTo(talentId) && t.TryConsumeTo(rank) && t.IsEmpty()))
|
||||
return false;
|
||||
if (rank < -1 || rank > 4)
|
||||
return false;
|
||||
val.Rank = rank+1;
|
||||
if (!(val.Talent = sTalentStore.LookupEntry(talentId)))
|
||||
return false;
|
||||
if (!val.Talent->RankID[val.Rank-1])
|
||||
if (val.Rank > 0 && !val.Talent->RankID[val.Rank - 1])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ struct LinkValidator<LinkTags::talent>
|
||||
{
|
||||
static bool IsTextValid(TalentLinkData const& data, char const* pos, size_t len)
|
||||
{
|
||||
if (SpellInfo const* info = sSpellMgr->GetSpellInfo(data.Talent->RankID[data.Rank-1]))
|
||||
if (SpellInfo const* info = sSpellMgr->GetSpellInfo(data.Talent->RankID[0]))
|
||||
return LinkValidator<LinkTags::spell>::IsTextValid(info, pos, len);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user