aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SkillHandler.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-07-19 19:31:54 +0200
committerShauren <shauren.trinity@gmail.com>2016-07-19 19:31:54 +0200
commit836221aaf5420afe8ff4719780426251c222b87d (patch)
tree12a66ff491e38f75bb922c21616b93fd24b85ddf /src/server/game/Handlers/SkillHandler.cpp
parentcc07a491f64fa958c8a27079bd2def84c577f816 (diff)
parentd463273ab1c8efb9dd6000ee5cb8f780574cdd1e (diff)
Merge branch 'legion' into 6.x
Diffstat (limited to 'src/server/game/Handlers/SkillHandler.cpp')
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp50
1 files changed, 15 insertions, 35 deletions
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 2060468a41a..e9fafac5d1d 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -28,10 +28,23 @@
void WorldSession::HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& packet)
{
+ WorldPackets::Talent::LearnTalentsFailed learnTalentsFailed;
bool anythingLearned = false;
for (uint32 talentId : packet.Talents)
- if (_player->LearnTalent(talentId))
+ {
+ if (TalentLearnResult result = _player->LearnTalent(talentId, &learnTalentsFailed.SpellID))
+ {
+ if (!learnTalentsFailed.Reason)
+ learnTalentsFailed.Reason = result;
+
+ learnTalentsFailed.Talents.push_back(talentId);
+ }
+ else
anythingLearned = true;
+ }
+
+ if (learnTalentsFailed.Reason)
+ SendPacket(learnTalentsFailed.Write());
if (anythingLearned)
_player->SendTalentsInfoData();
@@ -71,42 +84,9 @@ void WorldSession::HandleConfirmRespecWipeOpcode(WorldPackets::Talent::ConfirmRe
void WorldSession::HandleUnlearnSkillOpcode(WorldPackets::Spells::UnlearnSkill& packet)
{
- SkillRaceClassInfoEntry const* rcEntry = GetSkillRaceClassInfo(packet.SkillLine, GetPlayer()->getRace(), GetPlayer()->getClass());
+ SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(packet.SkillLine, GetPlayer()->getRace(), GetPlayer()->getClass());
if (!rcEntry || !(rcEntry->Flags & SKILL_FLAG_UNLEARNABLE))
return;
GetPlayer()->SetSkill(packet.SkillLine, 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);
-}