Core/ChatCommands: Parse SpellInfo also from enchant, glyph, talent and trade links (PR #25270)

(cherry picked from commit 9df61fd111)
This commit is contained in:
Peter Keresztes Schmidt
2020-08-17 18:26:41 +02:00
committed by Shauren
parent c8b0d4e6d8
commit 1c246cc980
2 changed files with 18 additions and 9 deletions

View File

@@ -68,12 +68,21 @@ char const* Trinity::ChatCommands::ArgInfo<GameTele const*>::TryConsume(GameTele
struct SpellInfoVisitor
{
using value_type = SpellInfo const*;
value_type operator()(Hyperlink<apower> artifactPower) const { return operator()(artifactPower->ArtifactPower->SpellID); }
value_type operator()(Hyperlink<conduit> soulbindConduit) const { return operator()((*soulbindConduit)->SpellID); }
value_type operator()(Hyperlink<enchant> enchant) const { return enchant; }
value_type operator()(Hyperlink<mawpower> mawPower) const { return operator()((*mawPower)->SpellID); }
value_type operator()(Hyperlink<pvptal> pvpTalent) const { return operator()((*pvpTalent)->SpellID); }
value_type operator()(Hyperlink<spell> spell) const { return spell->Spell; }
value_type operator()(Hyperlink<talent> talent) const { return operator()((*talent)->SpellID); }
value_type operator()(Hyperlink<trade> trade) const { return trade->Spell; }
value_type operator()(uint32 spellId) const { return sSpellMgr->GetSpellInfo(spellId, DIFFICULTY_NONE); }
};
char const* Trinity::ChatCommands::ArgInfo<SpellInfo const*>::TryConsume(SpellInfo const*& data, char const* args)
{
Variant<Hyperlink<spell>, uint32> val;
Variant<Hyperlink<apower>, Hyperlink<conduit>, Hyperlink<enchant>, Hyperlink<mawpower>, Hyperlink<pvptal>, Hyperlink<spell>, Hyperlink<talent>, Hyperlink<trade>, uint32> val;
if ((args = CommandArgsConsumerSingle<decltype(val)>::TryConsumeTo(val, args)))
data = val.visit(SpellInfoVisitor());
return args;

View File

@@ -293,7 +293,7 @@ namespace Trinity::Hyperlinks
struct TC_GAME_API conduit
{
using value_type = SoulbindConduitRankEntry const*&;
using value_type = SoulbindConduitRankEntry const*;
static constexpr char const* tag() { return "conduit"; }
static bool StoreTo(SoulbindConduitRankEntry const*& val, char const* pos, size_t len);
};
@@ -321,7 +321,7 @@ namespace Trinity::Hyperlinks
struct TC_GAME_API garrfollowerability
{
using value_type = GarrAbilityEntry const*&;
using value_type = GarrAbilityEntry const*;
static constexpr char const* tag() { return "garrfollowerability"; }
static bool StoreTo(GarrAbilityEntry const*& val, char const* pos, size_t len);
};
@@ -363,14 +363,14 @@ namespace Trinity::Hyperlinks
struct TC_GAME_API mawpower
{
using value_type = MawPowerEntry const*&;
using value_type = MawPowerEntry const*;
static constexpr char const* tag() { return "mawpower"; }
static bool StoreTo(MawPowerEntry const*& val, char const* pos, size_t len);
};
struct TC_GAME_API pvptal
{
using value_type = PvpTalentEntry const*&;
using value_type = PvpTalentEntry const*;
static constexpr char const* tag() { return "pvptal"; }
static bool StoreTo(PvpTalentEntry const*& val, char const* pos, size_t len);
};
@@ -391,7 +391,7 @@ namespace Trinity::Hyperlinks
struct TC_GAME_API talent
{
using value_type = TalentEntry const*&;
using value_type = TalentEntry const*;
static constexpr char const* tag() { return "talent"; }
static bool StoreTo(TalentEntry const*& val, char const* pos, size_t len);
};
@@ -405,21 +405,21 @@ namespace Trinity::Hyperlinks
struct TC_GAME_API transmogappearance
{
using value_type = ItemModifiedAppearanceEntry const*&;
using value_type = ItemModifiedAppearanceEntry const*;
static constexpr char const* tag() { return "transmogappearance"; }
static bool StoreTo(ItemModifiedAppearanceEntry const*& val, char const* pos, size_t len);
};
struct TC_GAME_API transmogillusion
{
using value_type = SpellItemEnchantmentEntry const*&;
using value_type = SpellItemEnchantmentEntry const*;
static constexpr char const* tag() { return "transmogillusion"; }
static bool StoreTo(SpellItemEnchantmentEntry const*& val, char const* pos, size_t len);
};
struct TC_GAME_API transmogset
{
using value_type = TransmogSetEntry const*&;
using value_type = TransmogSetEntry const*;
static constexpr char const* tag() { return "transmogset"; }
static bool StoreTo(TransmogSetEntry const*& val, char const* pos, size_t len);
};