Core/Players: Properly mark all class/specialization/talent/pvp talent learned spells as dependent

Port From (https://github.com/TrinityCore/TrinityCore/commit/d7f5c19e1a1b969bf34fcf5cb38f54c1472583ea)
This commit is contained in:
hondacrx
2022-09-07 15:26:20 -04:00
parent 7357a98adc
commit 716cad0ec3
3 changed files with 25 additions and 15 deletions
+1 -1
View File
@@ -307,7 +307,7 @@ namespace Game.Entities
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue;
LearnSpell(specSpell.SpellID, false);
LearnSpell(specSpell.SpellID, true);
if (specSpell.OverridesSpellID != 0)
AddOverrideSpell(specSpell.OverridesSpellID, specSpell.SpellID);
}
+24 -12
View File
@@ -86,14 +86,18 @@ namespace Game.Entities
return false;
}
if (spec == GetActiveTalentGroup() && talent.OverridesSpellID != 0)
AddOverrideSpell(talent.OverridesSpellID, talent.SpellID);
if (GetTalentMap(spec).ContainsKey(talent.Id))
GetTalentMap(spec)[talent.Id] = PlayerSpellState.Unchanged;
else
GetTalentMap(spec)[talent.Id] = learning ? PlayerSpellState.New : PlayerSpellState.Unchanged;
if (spec == GetActiveTalentGroup())
{
LearnSpell(talent.SpellID, true);
if (talent.OverridesSpellID != 0)
AddOverrideSpell(talent.OverridesSpellID, talent.SpellID);
}
if (learning)
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.ChangeTalent);
@@ -211,8 +215,6 @@ namespace Game.Entities
if (!AddTalent(talentInfo, GetActiveTalentGroup(), true))
return TalentLearnResult.FailedUnknown;
LearnSpell(spellid, false);
Log.outDebug(LogFilter.Misc, "Player.LearnTalent: TalentID: {0} Spell: {1} Group: {2}", talentId, spellid, GetActiveTalentGroup());
return TalentLearnResult.LearnOk;
@@ -367,7 +369,7 @@ namespace Game.Entities
if (HasTalent(talentInfo.Id, GetActiveTalentGroup()))
{
LearnSpell(talentInfo.SpellID, false); // add the talent to the PlayerSpellMap
LearnSpell(talentInfo.SpellID, true); // add the talent to the PlayerSpellMap
if (talentInfo.OverridesSpellID != 0)
AddOverrideSpell(talentInfo.OverridesSpellID, talentInfo.SpellID);
}
@@ -393,7 +395,7 @@ namespace Game.Entities
{
uint mastery = spec.MasterySpellID[i];
if (mastery != 0)
LearnSpell(mastery, false);
LearnSpell(mastery, true);
}
}
@@ -733,12 +735,14 @@ namespace Game.Entities
return false;
}
if (HasPvpRulesEnabled())
LearnSpell(talent.SpellID, false);
if (activeTalentGroup == GetActiveTalentGroup() && HasAuraType(AuraType.PvpTalents))
{
LearnSpell(talent.SpellID, true);
// Move this to toggle ?
if (talent.OverridesSpellID != 0)
AddOverrideSpell(talent.OverridesSpellID, talent.SpellID);
// Move this to toggle ?
if (talent.OverridesSpellID != 0)
AddOverrideSpell(talent.OverridesSpellID, talent.SpellID);
}
GetPvpTalentMap(activeTalentGroup)[slot] = talent.Id;
@@ -775,9 +779,17 @@ namespace Game.Entities
if (pvpTalentInfo != null)
{
if (enable)
{
LearnSpell(pvpTalentInfo.SpellID, false);
if (pvpTalentInfo.OverridesSpellID != 0)
AddOverrideSpell(pvpTalentInfo.OverridesSpellID, pvpTalentInfo.SpellID);
}
else
{
if (pvpTalentInfo.OverridesSpellID != 0)
RemoveOverrideSpell(pvpTalentInfo.OverridesSpellID, pvpTalentInfo.SpellID);
RemoveSpell(pvpTalentInfo.SpellID, true);
}
}
}
}
-2
View File
@@ -4570,13 +4570,11 @@ namespace Game.Entities
if (enabled)
{
SetPlayerFlag(PlayerFlags.WarModeDesired);
TogglePvpTalents(true);
SetPvP(true);
}
else
{
RemovePlayerFlag(PlayerFlags.WarModeDesired);
TogglePvpTalents(false);
SetPvP(false);
}