Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
SkillHandler.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
Common.h
"
7
#include "
DatabaseEnv.h
"
8
#include "
Log.h
"
9
#include "
ObjectAccessor.h
"
10
#include "
Opcodes.h
"
11
#include "
Pet.h
"
12
#include "
Player.h
"
13
#include "
UpdateMask.h
"
14
#include "
WorldPacket.h
"
15
#include "
WorldSession.h
"
16
17
void
WorldSession::HandeSetTalentSpecialization
(
WorldPacket
& recvData)
18
{
19
uint32
specializationTabId;
20
recvData >> specializationTabId;
21
22
if
(specializationTabId >
MAX_TALENT_TABS
)
23
return
;
24
25
if
(
_player
->GetTalentSpecialization(
_player
->GetActiveSpec()))
26
return
;
27
28
uint32
specializationId =
GetClassSpecializations
(
_player
->getClass())[specializationTabId];
29
30
_player
->SetTalentSpecialization(
_player
->GetActiveSpec(), specializationId);
31
_player
->SetUInt32Value(
PLAYER_FIELD_CURRENT_SPEC_ID
, specializationId);
32
_player
->UpdateTalentSpecializationManaBonus();
33
_player
->SendTalentsInfoData();
34
35
std::list<uint32> learnList =
GetSpellsForLevels
(0,
_player
->getRaceMask(),
_player
->GetTalentSpecialization(
_player
->GetActiveSpec()), 0,
_player
->getLevel());
36
for
(std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); ++iter)
37
{
38
if
(!
_player
->HasSpell(*iter))
39
_player
->learnSpell(*iter,
true
);
40
}
41
42
_player
->SaveToDB();
43
}
44
45
void
WorldSession::HandleLearnTalentOpcode
(
WorldPacket
& recvData)
46
{
47
uint32
talentCount = recvData.
ReadBits
(23);
48
uint16
talentId;
49
bool
anythingLearned =
false
;
50
51
for
(
uint32
i = 0; i != talentCount; i++)
52
{
53
recvData >> talentId;
54
if
(
_player
->LearnTalent(talentId))
55
anythingLearned =
true
;
56
}
57
58
if
(anythingLearned)
59
_player
->SendTalentsInfoData();
60
}
61
62
void
WorldSession::HandleLearnPreviewTalents
(
WorldPacket
& recvPacket)
63
{
64
SF_LOG_DEBUG
(
"network"
,
"CMSG_LEARN_PREVIEW_TALENTS"
);
65
}
66
67
void
WorldSession::HandleRespecWipeConfirmOpcode
(
WorldPacket
& recvPacket)
68
{
69
SF_LOG_DEBUG
(
"network"
,
"CMSG_CONFIRM_RESPEC_WIPE"
);
70
ObjectGuid
guid;
71
uint8
RespecType = 0;
72
uint32
Cost = 0;
73
74
recvPacket >> RespecType;
75
recvPacket.
ReadGuidMask
(guid, 7, 2, 6, 1, 4, 0, 3, 5);
76
recvPacket.
ReadGuidBytes
(guid, 2, 4, 1, 3, 0, 5, 7, 6);
77
78
// remove fake death
79
if
(
GetPlayer
()->HasUnitState(
UNIT_STATE_DIED
))
80
GetPlayer
()->
RemoveAurasByType
(
SPELL_AURA_FEIGN_DEATH
);
81
82
if
(!RespecType)
83
{
84
if
(!
_player
->ResetTalents(Cost,
true
,
false
))
85
{
86
GetPlayer
()->
SendTalentWipeConfirm
(guid,
false
);
87
return
;
88
}
89
}
90
else
91
{
92
_player
->ResetTalents(Cost,
false
,
true
);
93
}
94
95
_player
->SendTalentsInfoData();
96
97
if
(
Unit
* unit =
_player
->GetSelectedUnit())
98
unit->CastSpell(
_player
, 14867,
true
);
//spell: "Untalent Visual Effect"
99
}
100
101
void
WorldSession::HandleUnlearnSkillOpcode
(
WorldPacket
& recvData)
102
{
103
uint32
skillId;
104
recvData >> skillId;
105
106
if
(!
IsPrimaryProfessionSkill
(skillId))
107
return
;
108
109
GetPlayer
()->
SetSkill
(skillId, 0, 0, 0);
110
}
111
112
void
WorldSession::HandleRequestResearchHistory
(
WorldPacket
&
/*recvPacket*/
)
113
{
114
if
(!
_player
)
115
return
;
116
117
_player
->SendResearchHistory();
118
}
Common.h
GetClassSpecializations
uint32 const * GetClassSpecializations(uint8 classId)
Definition
DBCStores.cpp:1329
GetSpellsForLevels
std::list< uint32 > GetSpellsForLevels(uint32 classId, uint32 raceMask, uint32 specializationId, uint32 minLevel, uint32 maxLevel)
Definition
DBCStores.cpp:1155
MAX_TALENT_TABS
#define MAX_TALENT_TABS
Definition
DBCStructure.h:2718
DatabaseEnv.h
uint8
std::uint8_t uint8
Definition
Define.h:79
uint32
std::uint32_t uint32
Definition
Define.h:77
uint16
std::uint16_t uint16
Definition
Define.h:78
Log.h
SF_LOG_DEBUG
#define SF_LOG_DEBUG(filterType__,...)
Definition
Log.h:134
ObjectAccessor.h
Opcodes.h
Pet.h
Player.h
SPELL_AURA_FEIGN_DEATH
@ SPELL_AURA_FEIGN_DEATH
Definition
SpellAuraDefines.h:113
IsPrimaryProfessionSkill
bool IsPrimaryProfessionSkill(uint32 skill)
Definition
SpellMgr.cpp:23
UNIT_STATE_DIED
@ UNIT_STATE_DIED
Definition
Unit.h:512
PLAYER_FIELD_CURRENT_SPEC_ID
@ PLAYER_FIELD_CURRENT_SPEC_ID
Definition
UpdateFields.h:157
UpdateMask.h
WorldPacket.h
WorldSession.h
ByteBuffer::ReadBits
uint32 ReadBits(size_t bits)
Definition
ByteBuffer.h:198
ByteBuffer::ReadGuidBytes
void ReadGuidBytes(ObjectGuid &guid, Offsets... offsets)
Definition
ByteBuffer.h:256
ByteBuffer::ReadGuidMask
void ReadGuidMask(ObjectGuid &guid, Offsets... offsets)
Definition
ByteBuffer.h:240
Player::SendTalentWipeConfirm
void SendTalentWipeConfirm(ObjectGuid guid, bool resetType)
Definition
Player.cpp:10409
Player::SetSkill
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
Definition
Player.cpp:6377
Unit
Definition
Unit.h:1367
Unit::RemoveAurasByType
void RemoveAurasByType(AuraType auraType, uint64 casterGUID=0, Aura *except=NULL, bool negative=true, bool positive=true)
Definition
UnitAuraState.cpp:683
WorldPacket
Definition
WorldPacket.h:16
WorldSession::HandleRespecWipeConfirmOpcode
void HandleRespecWipeConfirmOpcode(WorldPacket &recvPacket)
Definition
SkillHandler.cpp:67
WorldSession::GetPlayer
Player * GetPlayer() const
Definition
WorldSession.h:295
WorldSession::HandleLearnPreviewTalents
void HandleLearnPreviewTalents(WorldPacket &recvPacket)
Definition
SkillHandler.cpp:62
WorldSession::_player
Player * _player
Definition
WorldSession.h:1188
WorldSession::HandleUnlearnSkillOpcode
void HandleUnlearnSkillOpcode(WorldPacket &recvPacket)
Definition
SkillHandler.cpp:101
WorldSession::HandleLearnTalentOpcode
void HandleLearnTalentOpcode(WorldPacket &recvPacket)
Definition
SkillHandler.cpp:45
WorldSession::HandleRequestResearchHistory
void HandleRequestResearchHistory(WorldPacket &recvPacket)
Definition
SkillHandler.cpp:112
WorldSession::HandeSetTalentSpecialization
void HandeSetTalentSpecialization(WorldPacket &recvData)
Definition
SkillHandler.cpp:17
ObjectGuid
Definition
ByteBuffer.h:66
src
server
game
Handlers
SkillHandler.cpp
Generated on
for Project SkyFire Core by
1.17.0