Core/Packets: implemented and enabled CMSG_LEARN_PREVIEW_TALENTS

This commit is contained in:
Ovahlord
2023-11-22 14:30:15 +01:00
parent 8c1f1f82e5
commit 0a1200d156
6 changed files with 37 additions and 3 deletions

View File

@@ -26232,7 +26232,6 @@ bool Player::LearnTalent(uint32 talentId, uint8 requestedRank)
// update free talent points
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::CharacterPoints), static_cast<int32>(CalculateTalentsPoints() - GetSpentTalentPointsCount()));
SendTalentsInfoData();
return true;
}

View File

@@ -32,7 +32,16 @@ void WorldSession::HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents&
void WorldSession::HandleLearnTalentOpcode(WorldPackets::Talent::LearnTalent& packet)
{
_player->LearnTalent(packet.TalentID, packet.RequestedRank);
if (_player->LearnTalent(packet.TalentID, packet.RequestedRank))
_player->SendTalentsInfoData();
}
void WorldSession::HandleLearnPreviewTalentsOpcode(WorldPackets::Talent::LearnPreviewTalents& packet)
{
for (WorldPackets::Talent::TalentInfo const& talent : packet.Talents)
_player->LearnTalent(talent.TalentID, talent.Rank);
_player->SendTalentsInfoData();
}
void WorldSession::HandleLearnPvpTalentsOpcode(WorldPackets::Talent::LearnPvpTalents& /*packet*/)

View File

@@ -38,6 +38,13 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Talent::TalentInfo const&
return data;
}
ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Talent::TalentInfo& talentInfo)
{
data >> talentInfo.TalentID;
data >> talentInfo.Rank;
return data;
}
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Talent::TalentGroupInfo const& talentGroupInfo)
{
data << uint8(talentGroupInfo.Talents.size());
@@ -84,6 +91,13 @@ void WorldPackets::Talent::LearnTalent::Read()
_worldPacket >> RequestedRank;
}
void WorldPackets::Talent::LearnPreviewTalents::Read()
{
Talents.resize(_worldPacket.read<uint32>());
for (TalentInfo& talent : Talents)
_worldPacket >> talent;
}
WorldPacket const* WorldPackets::Talent::RespecWipeConfirm::Write()
{
_worldPacket << int8(RespecType);

View File

@@ -155,6 +155,16 @@ namespace WorldPackets
uint16 RequestedRank = 0;
};
class LearnPreviewTalents final : public ClientPacket
{
public:
LearnPreviewTalents(WorldPacket&& packet) : ClientPacket(CMSG_LEARN_PREVIEW_TALENTS, std::move(packet)) { }
void Read() override;
Array<TalentInfo, 60> Talents;
};
class RemoveGlyph final : public ClientPacket
{
public:

View File

@@ -555,7 +555,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_LATENCY_REPORT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_LEARN_PVP_TALENTS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleLearnPvpTalentsOpcode);
DEFINE_HANDLER(CMSG_LEARN_TALENTS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleLearnTalentsOpcode);
DEFINE_HANDLER(CMSG_LEARN_PREVIEW_TALENTS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_LEARN_PREVIEW_TALENTS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLearnPreviewTalentsOpcode);
DEFINE_HANDLER(CMSG_LEARN_PREVIEW_TALENTS_PET, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_LEARN_TALENT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLearnTalentOpcode);
DEFINE_HANDLER(CMSG_LEAVE_GROUP, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLeaveGroupOpcode);

View File

@@ -735,6 +735,7 @@ namespace WorldPackets
{
class LearnTalent;
class LearnTalents;
class LearnPreviewTalents;
class LearnPvpTalents;
class ConfirmRespecWipe;
class RemoveGlyph;
@@ -1517,6 +1518,7 @@ class TC_GAME_API WorldSession
void HandleLearnPvpTalentsOpcode(WorldPackets::Talent::LearnPvpTalents& packet);
void HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& packet);
void HandleLearnTalentOpcode(WorldPackets::Talent::LearnTalent& packet);
void HandleLearnPreviewTalentsOpcode(WorldPackets::Talent::LearnPreviewTalents& packet);
void HandleConfirmRespecWipeOpcode(WorldPackets::Talent::ConfirmRespecWipe& confirmRespecWipe);
void HandleUnlearnSkillOpcode(WorldPackets::Spells::UnlearnSkill& packet);
void HandleTradeSkillSetFavorite(WorldPackets::Spells::TradeSkillSetFavorite const& tradeSkillSetFavorite);