mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Packets: Added SMSG_SET_SPECIALIZATION
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "UpdateMask.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "TalentPackets.h"
|
||||
|
||||
void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData)
|
||||
{
|
||||
@@ -126,3 +127,36 @@ void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recvData)
|
||||
|
||||
GetPlayer()->SetSkill(skillId, 0, 0, 0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetSpecializationOpcode(WorldPackets::Talent::SetSpecialization& packet)
|
||||
{
|
||||
Player* player = GetPlayer();
|
||||
|
||||
if (packet.SpecGroupIndex >= MAX_SPECIALIZATIONS)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSetSpecializationOpcode - specialization index %u out of range", packet.SpecGroupIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
ChrSpecializationEntry const* chrSpec = sChrSpecializationByIndexStore[player->getClass()][packet.SpecGroupIndex];
|
||||
|
||||
if (!chrSpec)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSetSpecializationOpcode - specialization index %u not found", packet.SpecGroupIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
if (chrSpec->ClassID != player->getClass())
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSetSpecializationOpcode - specialization %u does not belong to class %u", chrSpec->ID, player->getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->getLevel() < MIN_SPECIALIZATION_LEVEL)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleSetSpecializationOpcode - player level too low for specializations");
|
||||
return;
|
||||
}
|
||||
|
||||
player->LearnTalentSpecialization(chrSpec->ID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user