Core/Packets: added opcode handlers and packet structures for CMSG_LEARN_TALENT and CMSG_SET_PRIMARY_TALENT_TREE

This commit is contained in:
Ovahlord
2024-07-24 22:10:54 +02:00
parent ddbcf5f60b
commit 09885238ac
5 changed files with 34 additions and 31 deletions

View File

@@ -26,34 +26,18 @@
#include "SpellPackets.h"
#include "TalentPackets.h"
void WorldSession::HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& packet)
void WorldSession::HandleLearnTalentOpcode(WorldPackets::Talent::LearnTalent& /*packet*/)
{
WorldPackets::Talent::LearnTalentFailed learnTalentFailed;
bool anythingLearned = false;
for (uint32 talentId : packet.Talents)
{
if (TalentLearnResult result = _player->LearnTalent(talentId, &learnTalentFailed.SpellID))
{
if (!learnTalentFailed.Reason)
learnTalentFailed.Reason = result;
learnTalentFailed.Talents.push_back(talentId);
}
else
anythingLearned = true;
}
if (learnTalentFailed.Reason)
SendPacket(learnTalentFailed.Write());
if (anythingLearned)
_player->SendTalentsInfoData();
}
void WorldSession::HandleLearnPreviewTalentsOpcode(WorldPackets::Talent::LearnPreviewTalents& /*packet*/)
{
}
void WorldSession::HandleSetPrimaryTalentTreeOpcode(WorldPackets::Talent::SetPrimaryTalentTree& /*packet*/)
{
}
void WorldSession::HandleConfirmRespecWipeOpcode(WorldPackets::Talent::ConfirmRespecWipe& confirmRespecWipe)
{
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(confirmRespecWipe.RespecMaster, UNIT_NPC_FLAG_TRAINER, UNIT_NPC_FLAG_2_NONE);