[8483] Implement glyph 43361.
[getmangos.git] / src / game / SkillHandler.cpp
blob970406f79d157d4680d799c26862ff35f428a76b
1 /*
2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Common.h"
20 #include "Database/DatabaseEnv.h"
21 #include "Opcodes.h"
22 #include "Log.h"
23 #include "Player.h"
24 #include "WorldPacket.h"
25 #include "WorldSession.h"
26 #include "ObjectAccessor.h"
27 #include "UpdateMask.h"
29 void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data )
31 uint32 talent_id, requested_rank;
32 recv_data >> talent_id >> requested_rank;
34 _player->LearnTalent(talent_id, requested_rank);
35 _player->SendTalentsInfoData(false);
38 void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
40 sLog.outDebug("CMSG_LEARN_PREVIEW_TALENTS");
42 uint32 talentsCount;
43 recvPacket >> talentsCount;
45 uint32 talentId, talentRank;
47 for(uint32 i = 0; i < talentsCount; ++i)
49 recvPacket >> talentId >> talentRank;
51 _player->LearnTalent(talentId, talentRank);
54 _player->SendTalentsInfoData(false);
57 void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data )
59 sLog.outDetail("MSG_TALENT_WIPE_CONFIRM");
60 uint64 guid;
61 recv_data >> guid;
63 Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER);
64 if (!unit)
66 sLog.outDebug( "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
67 return;
70 // remove fake death
71 if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
72 GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
74 if(!(_player->resetTalents()))
76 WorldPacket data( MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent
77 data << uint64(0);
78 data << uint32(0);
79 SendPacket( &data );
80 return;
83 _player->SendTalentsInfoData(false);
84 unit->CastSpell(_player, 14867, true); //spell: "Untalent Visual Effect"
87 void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
89 uint32 skill_id;
90 recv_data >> skill_id;
91 GetPlayer()->SetSkill(skill_id, 0, 0);