[8483] Implement glyph 43361.
[getmangos.git] / src / game / PetHandler.cpp
blobc40cea1d884ada694c7097564ef228f2831c8dd1
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 "WorldPacket.h"
21 #include "WorldSession.h"
22 #include "ObjectMgr.h"
23 #include "SpellMgr.h"
24 #include "Log.h"
25 #include "Opcodes.h"
26 #include "Spell.h"
27 #include "ObjectAccessor.h"
28 #include "CreatureAI.h"
29 #include "Util.h"
30 #include "Pet.h"
32 void WorldSession::HandlePetAction( WorldPacket & recv_data )
34 uint64 guid1;
35 uint32 data;
36 uint64 guid2;
37 recv_data >> guid1; //pet guid
38 recv_data >> data;
39 recv_data >> guid2; //tag guid
41 uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
42 uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
44 // used also for charmed creature
45 Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
46 sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
47 if(!pet)
49 sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
50 return;
53 if(pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
55 sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() );
56 return;
59 if(!pet->isAlive())
60 return;
62 if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
63 return;
65 CharmInfo *charmInfo = pet->GetCharmInfo();
66 if(!charmInfo)
68 sLog.outError("WorldSession::HandlePetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
69 return;
72 switch(flag)
74 case ACT_COMMAND: //0x07
75 switch(spellid)
77 case COMMAND_STAY: //flat=1792 //STAY
78 pet->StopMoving();
79 pet->GetMotionMaster()->Clear();
80 pet->GetMotionMaster()->MoveIdle();
81 charmInfo->SetCommandState( COMMAND_STAY );
82 break;
83 case COMMAND_FOLLOW: //spellid=1792 //FOLLOW
84 pet->AttackStop();
85 pet->GetMotionMaster()->MoveFollow(_player,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
86 charmInfo->SetCommandState( COMMAND_FOLLOW );
87 break;
88 case COMMAND_ATTACK: //spellid=1792 //ATTACK
90 const uint64& selguid = _player->GetSelection();
91 Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, selguid);
92 if(!TargetUnit)
93 return;
95 // not let attack friendly units.
96 if(GetPlayer()->IsFriendlyTo(TargetUnit))
97 return;
98 // Not let attack through obstructions
99 if(!pet->IsWithinLOSInMap(TargetUnit))
100 return;
102 // This is true if pet has no target or has target but targets differs.
103 if(pet->getVictim() != TargetUnit)
105 if (pet->getVictim())
106 pet->AttackStop();
108 if(pet->GetTypeId() != TYPEID_PLAYER)
110 pet->GetMotionMaster()->Clear();
111 if (((Creature*)pet)->AI())
112 ((Creature*)pet)->AI()->AttackStart(TargetUnit);
114 //10% chance to play special pet attack talk, else growl
115 if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
116 pet->SendPetTalk((uint32)PET_TALK_ATTACK);
117 else
119 // 90% chance for pet and 100% chance for charmed creature
120 pet->SendPetAIReaction(guid1);
123 else // charmed player
125 pet->Attack(TargetUnit,true);
126 pet->SendPetAIReaction(guid1);
129 break;
131 case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
132 if(((Creature*)pet)->isPet())
134 Pet* p = (Pet*)pet;
135 if(p->getPetType() == HUNTER_PET)
136 _player->RemovePet(p,PET_SAVE_AS_DELETED);
137 else
138 //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
139 p->setDeathState(CORPSE);
141 else // charmed
142 _player->Uncharm();
143 break;
144 default:
145 sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
147 break;
148 case ACT_REACTION: // 0x6
149 switch(spellid)
151 case REACT_PASSIVE: //passive
152 case REACT_DEFENSIVE: //recovery
153 case REACT_AGGRESSIVE: //activete
154 charmInfo->SetReactState( ReactStates(spellid) );
155 break;
157 break;
158 case ACT_DISABLED: // 0x81 spell (disabled), ignore
159 case ACT_PASSIVE: // 0x01
160 case ACT_ENABLED: // 0xC1 spell
162 Unit* unit_target = NULL;
163 if (((Creature*)pet)->GetGlobalCooldown() > 0)
164 return;
166 if(guid2)
167 unit_target = ObjectAccessor::GetUnit(*_player,guid2);
169 // do not cast unknown spells
170 SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
171 if(!spellInfo)
173 sLog.outError("WORLD: unknown PET spell id %i", spellid);
174 return;
177 for(uint32 i = 0; i < 3;++i)
179 if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)
180 return;
183 // do not cast not learned spells
184 if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
185 return;
187 pet->clearUnitState(UNIT_STAT_FOLLOW);
189 Spell *spell = new Spell(pet, spellInfo, false);
191 SpellCastResult result = spell->CheckPetCast(unit_target);
193 //auto turn to target unless possessed
194 if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
196 if(unit_target)
198 pet->SetInFront(unit_target);
199 if (unit_target->GetTypeId() == TYPEID_PLAYER)
200 pet->SendUpdateToPlayer( (Player*)unit_target );
202 else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())
204 pet->SetInFront(unit_target2);
205 if (unit_target2->GetTypeId() == TYPEID_PLAYER)
206 pet->SendUpdateToPlayer( (Player*)unit_target2 );
208 if (Unit* powner = pet->GetCharmerOrOwner())
209 if(powner->GetTypeId() == TYPEID_PLAYER)
210 pet->SendUpdateToPlayer((Player*)powner);
211 result = SPELL_CAST_OK;
214 if(result == SPELL_CAST_OK)
216 ((Creature*)pet)->AddCreatureSpellCooldown(spellid);
218 unit_target = spell->m_targets.getUnitTarget();
220 //10% chance to play special pet attack talk, else growl
221 //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
222 if(((Creature*)pet)->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
223 pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
224 else
226 pet->SendPetAIReaction(guid1);
229 if( unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
231 // This is true if pet has no target or has target but targets differs.
232 if (pet->getVictim() != unit_target)
234 if (pet->getVictim())
235 pet->AttackStop();
236 pet->GetMotionMaster()->Clear();
237 if (((Creature*)pet)->AI())
238 ((Creature*)pet)->AI()->AttackStart(unit_target);
242 spell->prepare(&(spell->m_targets));
244 else
246 if(pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
247 Spell::SendCastResult(GetPlayer(),spellInfo,0,result);
248 else
249 pet->SendPetCastFail(spellid, result);
251 if (!((Creature*)pet)->HasSpellCooldown(spellid))
252 GetPlayer()->SendClearCooldown(spellid, pet);
254 spell->finish(false);
255 delete spell;
257 break;
259 default:
260 sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
264 void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
266 sLog.outDetail( "HandlePetNameQuery. CMSG_PET_NAME_QUERY" );
268 uint32 petnumber;
269 uint64 petguid;
271 recv_data >> petnumber;
272 recv_data >> petguid;
274 SendPetNameQuery(petguid,petnumber);
277 void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
279 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
280 if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
281 return;
283 std::string name = pet->GetName();
285 WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
286 data << uint32(petnumber);
287 data << name.c_str();
288 data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
290 if( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
292 data << uint8(1);
293 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
294 data << ((Pet*)pet)->GetDeclinedNames()->name[i];
296 else
297 data << uint8(0);
299 _player->GetSession()->SendPacket(&data);
302 void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
304 sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" );
306 uint64 petguid;
307 uint8 count;
309 recv_data >> petguid;
311 // FIXME: charmed case
312 //Pet* pet = ObjectAccessor::Instance().GetPet(petguid);
313 if(ObjectAccessor::FindPlayer(petguid))
314 return;
316 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
318 if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
320 sLog.outError( "HandlePetSetAction: Unknown pet or pet owner." );
321 return;
324 CharmInfo *charmInfo = pet->GetCharmInfo();
325 if(!charmInfo)
327 sLog.outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
328 return;
331 count = (recv_data.size() == 24) ? 2 : 1;
332 for(uint8 i = 0; i < count; ++i)
334 uint32 position;
335 uint32 data;
337 recv_data >> position;
338 recv_data >> data;
340 uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data);
341 uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data);
343 sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, uint32(act_state));
345 //ignore invalid position
346 if(position >= MAX_UNIT_ACTION_BAR_INDEX)
347 return;
349 //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
350 if(!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
352 //sign for autocast
353 if(act_state == ACT_ENABLED && spell_id)
355 if(pet->isCharmed())
356 charmInfo->ToggleCreatureAutocast(spell_id, true);
357 else
358 ((Pet*)pet)->ToggleAutocast(spell_id, true);
360 //sign for no/turn off autocast
361 else if(act_state == ACT_DISABLED && spell_id)
363 if(pet->isCharmed())
364 charmInfo->ToggleCreatureAutocast(spell_id, false);
365 else
366 ((Pet*)pet)->ToggleAutocast(spell_id, false);
369 charmInfo->SetActionBar(position,spell_id,ActiveStates(act_state));
374 void WorldSession::HandlePetRename( WorldPacket & recv_data )
376 sLog.outDetail( "HandlePetRename. CMSG_PET_RENAME" );
378 uint64 petguid;
379 uint8 isdeclined;
381 std::string name;
382 DeclinedName declinedname;
384 recv_data >> petguid;
385 recv_data >> name;
386 recv_data >> isdeclined;
388 Pet* pet = ObjectAccessor::GetPet(petguid);
389 // check it!
390 if( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET ||
391 pet->GetByteValue(UNIT_FIELD_BYTES_2, 2) != UNIT_RENAME_ALLOWED ||
392 pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() )
393 return;
395 PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
396 if(res != PET_NAME_SUCCESS)
398 SendPetNameInvalid(res, name, NULL);
399 return;
402 if(objmgr.IsReservedName(name))
404 SendPetNameInvalid(PET_NAME_RESERVED, name, NULL);
405 return;
408 pet->SetName(name);
410 Unit *owner = pet->GetOwner();
411 if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
412 ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
414 pet->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_NOT_ALLOWED);
416 if(isdeclined)
418 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
420 recv_data >> declinedname.name[i];
423 std::wstring wname;
424 Utf8toWStr(name, wname);
425 if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname))
427 SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname);
428 return;
432 CharacterDatabase.BeginTransaction();
433 if(isdeclined)
435 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
436 CharacterDatabase.escape_string(declinedname.name[i]);
437 CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
438 CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
439 pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
442 CharacterDatabase.escape_string(name);
443 CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
444 CharacterDatabase.CommitTransaction();
446 pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
449 void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
451 uint64 guid;
452 recv_data >> guid; //pet guid
453 sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
455 if(!_player->IsInWorld())
456 return;
458 // pet/charmed
459 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
460 if(pet)
462 if(pet->isPet())
464 if(pet->GetGUID() == _player->GetPetGUID())
466 uint32 feelty = pet->GetPower(POWER_HAPPINESS);
467 pet->SetPower(POWER_HAPPINESS ,(feelty-50000) > 0 ?(feelty-50000) : 0);
470 _player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
472 else if(pet->GetGUID() == _player->GetCharmGUID())
474 _player->Uncharm();
479 void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
481 sLog.outDetail("CMSG_PET_UNLEARN");
482 uint64 guid;
483 recvPacket >> guid; // Pet guid
485 Pet* pet = _player->GetPet();
487 if(!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
488 return;
490 if(guid != pet->GetGUID())
492 sLog.outError( "HandlePetUnlearnOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
493 return;
496 CharmInfo *charmInfo = pet->GetCharmInfo();
497 if(!charmInfo)
499 sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
500 return;
502 pet->resetTalents();
503 _player->SendTalentsInfoData(true);
506 void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
508 sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
509 uint64 guid;
510 uint32 spellid;
511 uint8 state; //1 for on, 0 for off
512 recvPacket >> guid >> spellid >> state;
514 if(!_player->GetPet() && !_player->GetCharm())
515 return;
517 if(ObjectAccessor::FindPlayer(guid))
518 return;
520 Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
522 if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
524 sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
525 return;
528 // do not add not learned spells/ passive spells
529 if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
530 return;
532 CharmInfo *charmInfo = pet->GetCharmInfo();
533 if(!charmInfo)
535 sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
536 return;
539 if(pet->isCharmed())
540 //state can be used as boolean
541 pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
542 else
543 ((Pet*)pet)->ToggleAutocast(spellid, state);
545 charmInfo->SetSpellAutocast(spellid,state);
548 void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
550 sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL");
552 uint64 guid;
553 uint32 spellid;
554 uint8 cast_count;
555 uint8 unk_flags; // flags (if 0x02 - some additional data are received)
557 recvPacket >> guid >> cast_count >> spellid >> unk_flags;
559 sLog.outDebug("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);
561 if (!_player->GetPet() && !_player->GetCharm())
562 return;
564 if (GUID_HIPART(guid) == HIGHGUID_PLAYER)
565 return;
567 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
569 if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
571 sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
572 return;
575 if (pet->GetGlobalCooldown() > 0)
576 return;
578 SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
579 if (!spellInfo)
581 sLog.outError("WORLD: unknown PET spell id %i", spellid);
582 return;
585 // do not cast not learned spells
586 if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
587 return;
589 SpellCastTargets targets;
590 if (!targets.read(&recvPacket,pet))
591 return;
593 pet->clearUnitState(UNIT_STAT_FOLLOW);
595 Spell *spell = new Spell(pet, spellInfo, false);
596 spell->m_cast_count = cast_count; // probably pending spell cast
597 spell->m_targets = targets;
599 SpellCastResult result = spell->CheckPetCast(NULL);
600 if (result == SPELL_CAST_OK)
602 pet->AddCreatureSpellCooldown(spellid);
603 if (pet->isPet())
605 //10% chance to play special pet attack talk, else growl
606 //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
607 if(((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
608 pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
609 else
610 pet->SendPetAIReaction(guid);
613 spell->prepare(&(spell->m_targets));
615 else
617 pet->SendPetCastFail(spellid, result);
618 if (!pet->HasSpellCooldown(spellid))
619 GetPlayer()->SendClearCooldown(spellid, pet);
621 spell->finish(false);
622 delete spell;
626 void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
628 WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
629 data << uint32(error);
630 data << name;
631 if(declinedName)
633 data << uint8(1);
634 for(uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
635 data << declinedName->name[i];
637 else
638 data << uint8(0);
639 SendPacket(&data);
642 void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data )
644 sLog.outDebug("WORLD: CMSG_PET_LEARN_TALENT");
646 uint64 guid;
647 uint32 talent_id, requested_rank;
648 recv_data >> guid >> talent_id >> requested_rank;
650 _player->LearnPetTalent(guid, talent_id, requested_rank);
651 _player->SendTalentsInfoData(true);
654 void WorldSession::HandleLearnPreviewTalentsPet( WorldPacket & recv_data )
656 sLog.outDebug("CMSG_LEARN_PREVIEW_TALENTS_PET");
658 uint64 guid;
659 recv_data >> guid;
661 uint32 talentsCount;
662 recv_data >> talentsCount;
664 uint32 talentId, talentRank;
666 for(uint32 i = 0; i < talentsCount; ++i)
668 recv_data >> talentId >> talentRank;
670 _player->LearnPetTalent(guid, talentId, talentRank);
673 _player->SendTalentsInfoData(true);