Core/Chat: Implemented more chat link types

Closes #28946
This commit is contained in:
Shauren
2023-04-28 00:11:24 +02:00
parent 6d4a0ad8eb
commit d78f08aa9e
12 changed files with 286 additions and 4 deletions

View File

@@ -216,6 +216,23 @@ struct LinkValidator<LinkTags::battlepet>
}
};
template <>
struct LinkValidator<LinkTags::battlePetAbil>
{
static bool IsTextValid(BattlePetAbilLinkData const& data, std::string_view text)
{
for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1))
if (data.Ability->Name[i] == text)
return true;
return false;
}
static bool IsColorValid(BattlePetAbilLinkData const&, HyperlinkColor c)
{
return c == CHAT_LINK_COLOR_BATTLE_PET_ABIL;
}
};
template <>
struct LinkValidator<LinkTags::conduit>
{
@@ -496,15 +513,29 @@ struct LinkValidator<LinkTags::mawpower>
}
};
template <>
struct LinkValidator<LinkTags::mount>
{
static bool IsTextValid(MountLinkData const& data, std::string_view text)
{
return LinkValidator<LinkTags::spell>::IsTextValid(data.Spell, text);
}
static bool IsColorValid(MountLinkData const&, HyperlinkColor c)
{
return c == CHAT_LINK_COLOR_SPELL;
}
};
template <>
struct LinkValidator<LinkTags::outfit>
{
static bool IsTextValid(std::string const&, std::string_view)
static bool IsTextValid(std::string_view, std::string_view)
{
return true;
}
static bool IsColorValid(std::string const&, HyperlinkColor c)
static bool IsColorValid(std::string_view, HyperlinkColor c)
{
return c == CHAT_LINK_COLOR_TRANSMOG;
}
@@ -658,15 +689,20 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info)
{
using namespace LinkTags;
TryValidateAs(achievement);
TryValidateAs(api);
TryValidateAs(apower);
TryValidateAs(azessence);
TryValidateAs(area);
TryValidateAs(areatrigger);
TryValidateAs(battlepet);
TryValidateAs(battlePetAbil);
TryValidateAs(clubFinder);
TryValidateAs(clubTicket);
TryValidateAs(conduit);
TryValidateAs(creature);
TryValidateAs(creature_entry);
TryValidateAs(currency);
TryValidateAs(dungeonScore);
TryValidateAs(enchant);
TryValidateAs(gameevent);
TryValidateAs(gameobject);
@@ -680,6 +716,7 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info)
TryValidateAs(journal);
TryValidateAs(keystone);
TryValidateAs(mawpower);
TryValidateAs(mount);
TryValidateAs(outfit);
TryValidateAs(player);
TryValidateAs(pvptal);
@@ -687,6 +724,7 @@ static bool ValidateLinkInfo(HyperlinkInfo const& info)
TryValidateAs(skill);
TryValidateAs(spell);
TryValidateAs(talent);
TryValidateAs(talentbuild);
TryValidateAs(taxinode);
TryValidateAs(tele);
TryValidateAs(title);