feat(Core/Chat): new argument parsing and unify chat hyperlink parsing (#6243)

This commit is contained in:
Kargatum
2021-10-23 15:15:42 +07:00
committed by GitHub
parent 1101f9dd2a
commit bc9473482e
90 changed files with 4280 additions and 2508 deletions

View File

@@ -466,13 +466,13 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
{
for (uint8 k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; k++)
{
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]);
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->Enchantment[k]);
if (pEnchant)
{
for (uint8 t = 0; t < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; t++)
if (pEnchant->spellid[t] == m_spellInfo->Id)
{
amount = uint32((item_rand_suffix->prefix[k] * castItem->GetItemSuffixFactor()) / 10000);
amount = uint32((item_rand_suffix->AllocationPct[k] * castItem->GetItemSuffixFactor()) / 10000);
break;
}
}

View File

@@ -936,13 +936,18 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
{
// targets for effect already selected
if (effectMask & processedEffectMask)
{
return;
}
auto const& effects = GetSpellInfo()->Effects;
// choose which targets we can select at once
for (uint32 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j)
{
SpellEffectInfo const* effects = GetSpellInfo()->Effects;
if (effects[j].IsEffect() &&
effects[effIndex].TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
effects[effIndex].TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
@@ -955,6 +960,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
}
processedEffectMask |= effectMask;
break;
}
default:
break;
}

View File

@@ -207,8 +207,8 @@ uint32 SpellImplicitTargetInfo::GetExplicitTargetMask(bool& srcSet, bool& dstSet
return targetMask;
}
SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_TARGETS] =
{
std::array<SpellImplicitTargetInfo::StaticData, TOTAL_SPELL_TARGETS> SpellImplicitTargetInfo::_data =
{ {
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, //
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 1 TARGET_UNIT_CASTER
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 2 TARGET_UNIT_NEARBY_ENEMY
@@ -320,7 +320,7 @@ SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_
{TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 108 TARGET_GAMEOBJECT_CONE
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 109
{TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 110 TARGET_DEST_UNK_110
};
} };
SpellEffectInfo::SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex)
{
@@ -598,8 +598,8 @@ SpellTargetObjectTypes SpellEffectInfo::GetUsedTargetObjectType() const
return _data[Effect].UsedTargetObjectType;
}
SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] =
{
std::array<SpellEffectInfo::StaticData, TOTAL_SPELL_EFFECTS> SpellEffectInfo::_data =
{ {
// implicit target type used target object type
{EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 0
{EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 1 SPELL_EFFECT_INSTAKILL
@@ -766,7 +766,7 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] =
{EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 162 SPELL_EFFECT_TALENT_SPEC_SELECT
{EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 163 SPELL_EFFECT_163
{EFFECT_IMPLICIT_TARGET_EXPLICIT, TARGET_OBJECT_TYPE_UNIT}, // 164 SPELL_EFFECT_REMOVE_AURA
};
} };
SpellInfo::SpellInfo(SpellEntry const* spellEntry)
{
@@ -822,25 +822,18 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry)
RangeEntry = spellEntry->RangeIndex ? sSpellRangeStore.LookupEntry(spellEntry->RangeIndex) : nullptr;
Speed = spellEntry->Speed;
StackAmount = spellEntry->StackAmount;
for (uint8 i = 0; i < 2; ++i)
Totem[i] = spellEntry->Totem[i];
for (uint8 i = 0; i < MAX_SPELL_REAGENTS; ++i)
Reagent[i] = spellEntry->Reagent[i];
for (uint8 i = 0; i < MAX_SPELL_REAGENTS; ++i)
ReagentCount[i] = spellEntry->ReagentCount[i];
Totem = spellEntry->Totem;
Reagent = spellEntry->Reagent;
ReagentCount = spellEntry->ReagentCount;
EquippedItemClass = spellEntry->EquippedItemClass;
EquippedItemSubClassMask = spellEntry->EquippedItemSubClassMask;
EquippedItemInventoryTypeMask = spellEntry->EquippedItemInventoryTypeMask;
for (uint8 i = 0; i < 2; ++i)
TotemCategory[i] = spellEntry->TotemCategory[i];
for (uint8 i = 0; i < 2; ++i)
SpellVisual[i] = spellEntry->SpellVisual[i];
TotemCategory = spellEntry->TotemCategory;
SpellVisual = spellEntry->SpellVisual;
SpellIconID = spellEntry->SpellIconID;
ActiveIconID = spellEntry->ActiveIconID;
for (uint8 i = 0; i < 16; ++i)
SpellName[i] = spellEntry->SpellName[i];
for (uint8 i = 0; i < 16; ++i)
Rank[i] = spellEntry->Rank[i];
SpellName = spellEntry->SpellName;
Rank = spellEntry->Rank;
MaxTargetLevel = spellEntry->MaxTargetLevel;
MaxAffectedTargets = spellEntry->MaxAffectedTargets;
SpellFamilyName = spellEntry->SpellFamilyName;

View File

@@ -236,7 +236,8 @@ private:
SpellTargetCheckTypes SelectionCheckType; // defines selection criteria
SpellTargetDirectionTypes DirectionType; // direction for cone and dest targets
};
static StaticData _data[TOTAL_SPELL_TARGETS];
static std::array<StaticData, TOTAL_SPELL_TARGETS> _data;
};
class SpellEffectInfo
@@ -302,7 +303,8 @@ private:
SpellEffectImplicitTargetTypes ImplicitTargetType; // defines what target can be added to effect target list if there's no valid target type provided for effect
SpellTargetObjectTypes UsedTargetObjectType; // defines valid target object type for spell effect
};
static StaticData _data[TOTAL_SPELL_EFFECTS];
static std::array<StaticData, TOTAL_SPELL_EFFECTS> _data;
};
class SpellInfo
@@ -360,18 +362,18 @@ public:
SpellRangeEntry const* RangeEntry;
float Speed;
uint32 StackAmount;
uint32 Totem[2];
int32 Reagent[MAX_SPELL_REAGENTS];
uint32 ReagentCount[MAX_SPELL_REAGENTS];
std::array<uint32, 2> Totem;
std::array<int32, MAX_SPELL_REAGENTS> Reagent;
std::array<uint32, MAX_SPELL_REAGENTS> ReagentCount;
int32 EquippedItemClass;
int32 EquippedItemSubClassMask;
int32 EquippedItemInventoryTypeMask;
uint32 TotemCategory[2];
uint32 SpellVisual[2];
std::array<uint32, 2> TotemCategory;
std::array<uint32, 2> SpellVisual;
uint32 SpellIconID;
uint32 ActiveIconID;
char* SpellName[16];
char* Rank[16];
std::array<char const*, 16> SpellName;
std::array<char const*, 16> Rank;
uint32 MaxTargetLevel;
uint32 MaxAffectedTargets;
uint32 SpellFamilyName;
@@ -380,7 +382,7 @@ public:
uint32 PreventionType;
int32 AreaGroupId;
uint32 SchoolMask;
SpellEffectInfo Effects[MAX_SPELL_EFFECTS];
std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> Effects;
uint32 ExplicitTargetMask;
SpellChainNode const* ChainEntry;