aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-11-02 20:05:29 +0100
committerShauren <shauren.trinity@gmail.com>2023-11-02 20:05:29 +0100
commit31da896eb2ea9a18dae7c2fa45c188ebadfc9e3e (patch)
treee836e7d0eb25a9656cb3b64ee8e094e3bb21f551 /src
parent20b0ad736c3ab81b28a84fb1fb8ae7c99a794749 (diff)
Core/Spells: Prevent duplicating trait configs for Generic type
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 7cb4fc675d8..350f20e239d 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -6040,7 +6040,14 @@ void Spell::EffectCreateTraitTreeConfig()
return;
newConfig.TraitSystemID = sTraitTreeStore.AssertEntry(effectInfo->MiscValue)->TraitSystemID;
- target->CreateTraitConfig(newConfig);
+ int32 existingConfigForSystem = target->m_activePlayerData->TraitConfigs.FindIndexIf([&](UF::TraitConfig const& config)
+ {
+ return static_cast<TraitConfigType>(*config.Type) == TraitConfigType::Generic
+ && config.TraitSystemID == newConfig.TraitSystemID;
+ });
+
+ if (existingConfigForSystem < 0)
+ target->CreateTraitConfig(newConfig);
}
void Spell::EffectChangeActiveCombatTraitConfig()