Core/Talents: Fixes learning pvp talents

This commit is contained in:
hondacrx
2021-01-27 00:14:50 -05:00
parent 7d6be17c79
commit ae6affc44a
4 changed files with 19 additions and 11 deletions
+2 -2
View File
@@ -329,13 +329,13 @@ namespace Game.Entities
for (byte i = 0; i < PlayerConst.MaxSpecializations; ++i)
{
Talents[i] = new Dictionary<uint, PlayerSpellState>();
PvpTalents[i] = new Array<uint>(PlayerConst.MaxPvpTalentSlots, 0);
PvpTalents[i] = new uint[PlayerConst.MaxPvpTalentSlots];
Glyphs[i] = new List<uint>();
}
}
public Dictionary<uint, PlayerSpellState>[] Talents = new Dictionary<uint, PlayerSpellState>[PlayerConst.MaxSpecializations];
public Array<uint>[] PvpTalents = new Array<uint>[PlayerConst.MaxSpecializations];
public uint[][] PvpTalents = new uint[PlayerConst.MaxSpecializations][];
public List<uint>[] Glyphs = new List<uint>[PlayerConst.MaxSpecializations];
public uint ResetTalentsCost;
public long ResetTalentsTime;
+8 -3
View File
@@ -27,6 +27,7 @@ using Game.PvP;
using Game.Spells;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Game.Entities
{
@@ -416,9 +417,13 @@ namespace Game.Entities
if (talent.OverridesSpellID != 0)
RemoveOverrideSpell(talent.OverridesSpellID, talent.SpellID);
//todo check this
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
GetPvpTalentMap(GetActiveTalentGroup()).Remove(talent.Id);
var talents = GetPvpTalentMap(GetActiveTalentGroup());
for (var i = 0; i < PlayerConst.MaxPvpTalentSlots; ++i)
{
if (talents[i] == talent.Id)
talents[i] = 0;
}
}
public void TogglePvpTalents(bool enable)
@@ -520,7 +525,7 @@ namespace Game.Entities
return false;
}
public Array<uint> GetPvpTalentMap(byte spec) { return _specializationInfo.PvpTalents[spec]; }
public uint[] GetPvpTalentMap(byte spec) { return _specializationInfo.PvpTalents[spec]; }
//BGs
public Battleground GetBattleground()
@@ -603,13 +603,16 @@ namespace Game.Entities
continue;
}
groupInfoPkt.PvPTalentIDs.Add((ushort)pvpTalents[slot]);
PvPTalent pvpTalent = new PvPTalent();
pvpTalent.PvPTalentID = (ushort)pvpTalents[slot];
pvpTalent.Slot = slot;
groupInfoPkt.PvPTalents.Add(pvpTalent);
}
if (i == GetActiveTalentGroup())
packet.Info.ActiveGroup = (byte)packet.Info.TalentGroups.Count;
if (!groupInfoPkt.TalentIDs.Empty() || !groupInfoPkt.PvPTalentIDs.Empty() || i == GetActiveTalentGroup())
if (!groupInfoPkt.TalentIDs.Empty() || !groupInfoPkt.PvPTalents.Empty() || i == GetActiveTalentGroup())
packet.Info.TalentGroups.Add(groupInfoPkt);
}
@@ -35,13 +35,13 @@ namespace Game.Networking.Packets
{
_worldPacket.WriteUInt32(talentGroupInfo.SpecID);
_worldPacket.WriteInt32(talentGroupInfo.TalentIDs.Count);
_worldPacket.WriteInt32(talentGroupInfo.PvPTalentIDs.Count);
_worldPacket.WriteInt32(talentGroupInfo.PvPTalents.Count);
foreach (var talentID in talentGroupInfo.TalentIDs)
_worldPacket.WriteUInt16(talentID);
foreach (ushort talentID in talentGroupInfo.PvPTalentIDs)
_worldPacket.WriteUInt16(talentID);
foreach (PvPTalent talent in talentGroupInfo.PvPTalents)
talent.Write(_worldPacket);
}
}
@@ -51,7 +51,7 @@ namespace Game.Networking.Packets
{
public uint SpecID;
public List<ushort> TalentIDs = new List<ushort>();
public List<ushort> PvPTalentIDs = new List<ushort>();
public List<PvPTalent> PvPTalents = new List<PvPTalent>();
}
public class TalentInfoUpdate