diff options
| author | Rat <gmstreetrat@gmail.com> | 2014-11-29 14:52:53 +0100 |
|---|---|---|
| committer | Rat <gmstreetrat@gmail.com> | 2014-11-29 14:52:53 +0100 |
| commit | eda9094226983fc719378af5c1eca1a7ce93428e (patch) | |
| tree | 2461148a06096691d40255452538d52e4bc8698f /src/server/game/Handlers/SkillHandler.cpp | |
| parent | 8c4761e820d1185afb3d6384c47e0a53dce42fbc (diff) | |
| parent | 96f9451b850994fe2e92db43b4bc6327ae7e1734 (diff) | |
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into Spells
Diffstat (limited to 'src/server/game/Handlers/SkillHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/SkillHandler.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index ef1e9031cb9..f0c1b28117b 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -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); +} |
