diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-06-30 00:06:33 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-06-30 00:06:33 +0200 |
commit | ad0cb188c91501887f4117157dcb450429652b7c (patch) | |
tree | 71446dc6d375f447558b0be567cf83ab08e71bf3 /src | |
parent | 29eac37a16df2ec14cba89f4d6e28f54ca1a4e25 (diff) |
Core/Players: Fixed spell overrides not being removed when unlearning talents
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 5 | ||||
-rw-r--r-- | src/server/game/Spells/TraitMgr.cpp | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index da2539e8aaa..f6a68f82d42 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3293,6 +3293,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled /*= false*/, bool learn_ bool cur_active = itr->second.active; bool cur_dependent = itr->second.dependent; + Optional<int32> traitDefinitionId = itr->second.TraitDefinitionId; if (disabled) { @@ -3405,6 +3406,10 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled /*= false*/, bool learn_ } } + if (traitDefinitionId) + if (TraitDefinitionEntry const* traitDefinition = sTraitDefinitionStore.LookupEntry(*traitDefinitionId)) + RemoveOverrideSpell(traitDefinition->OverridesSpellID, spell_id); + m_overrideSpells.erase(spell_id); if (m_canTitanGrip) diff --git a/src/server/game/Spells/TraitMgr.cpp b/src/server/game/Spells/TraitMgr.cpp index 4586dd865f7..35beedd24c1 100644 --- a/src/server/game/Spells/TraitMgr.cpp +++ b/src/server/game/Spells/TraitMgr.cpp @@ -392,7 +392,7 @@ void FillOwnedCurrenciesMap(WorldPackets::Traits::TraitConfig const& traitConfig currencies[currency->ID] += player.GetCurrencyQuantity(currency->CurrencyTypesID); break; case TraitCurrencyType::TraitSourced: - if (std::vector<TraitCurrencySourceEntry const*>* currencySources = Trinity::Containers::MapGetValuePtr(_traitCurrencySourcesByCurrency, currency->ID)) + if (std::vector<TraitCurrencySourceEntry const*> const* currencySources = Trinity::Containers::MapGetValuePtr(_traitCurrencySourcesByCurrency, currency->ID)) { for (TraitCurrencySourceEntry const* currencySource : *currencySources) { @@ -667,7 +667,6 @@ LearnResult ValidateConfig(WorldPackets::Traits::TraitConfig const& traitConfig, int32* grantedCount = Trinity::Containers::MapGetValuePtr(grantedCurrencies, traitCurrencyId); if (!grantedCount || *grantedCount < spentAmount) return LearnResult::NotEnoughTalentsInPrimaryTree; - } if (requireSpendingAllCurrencies && traitConfig.Type == TraitConfigType::Combat) |