[7918] Improve portability in work with uint64 string format specifiers and in code...
[getmangos.git] / src / game / PetHandler.cpp
blob3080f6f139ad26e3899ccc09862126a757e6151f
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 CHECK_PACKET_SIZE(recv_data, 8+2+2+8);
36 uint64 guid1;
37 uint16 spellid;
38 uint16 flag;
39 uint64 guid2;
40 recv_data >> guid1; //pet guid
41 recv_data >> spellid;
42 recv_data >> flag; //delete = 0x0700 CastSpell = C100
43 recv_data >> guid2; //tag guid
45 // used also for charmed creature
46 Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
47 sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) );
48 if(!pet)
50 sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
51 return;
54 if(pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
56 sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() );
57 return;
60 if(!pet->isAlive())
61 return;
63 if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK))
64 return;
66 CharmInfo *charmInfo = pet->GetCharmInfo();
67 if(!charmInfo)
69 sLog.outError("WorldSession::HandlePetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
70 return;
73 switch(flag)
75 case ACT_COMMAND: //0x0700
76 switch(spellid)
78 case COMMAND_STAY: //flat=1792 //STAY
79 pet->StopMoving();
80 pet->GetMotionMaster()->Clear();
81 pet->GetMotionMaster()->MoveIdle();
82 charmInfo->SetCommandState( COMMAND_STAY );
83 break;
84 case COMMAND_FOLLOW: //spellid=1792 //FOLLOW
85 pet->AttackStop();
86 pet->GetMotionMaster()->MoveFollow(_player,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE);
87 charmInfo->SetCommandState( COMMAND_FOLLOW );
88 break;
89 case COMMAND_ATTACK: //spellid=1792 //ATTACK
91 const uint64& selguid = _player->GetSelection();
92 Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, selguid);
93 if(!TargetUnit)
94 return;
96 // not let attack friendly units.
97 if(GetPlayer()->IsFriendlyTo(TargetUnit))
98 return;
99 // Not let attack through obstructions
100 if(!pet->IsWithinLOSInMap(TargetUnit))
101 return;
103 // This is true if pet has no target or has target but targets differs.
104 if(pet->getVictim() != TargetUnit)
106 if (pet->getVictim())
107 pet->AttackStop();
109 if(pet->GetTypeId() != TYPEID_PLAYER)
111 pet->GetMotionMaster()->Clear();
112 if (((Creature*)pet)->AI())
113 ((Creature*)pet)->AI()->AttackStart(TargetUnit);
115 //10% chance to play special pet attack talk, else growl
116 if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
117 pet->SendPetTalk((uint32)PET_TALK_ATTACK);
118 else
120 // 90% chance for pet and 100% chance for charmed creature
121 pet->SendPetAIReaction(guid1);
124 else // charmed player
126 pet->Attack(TargetUnit,true);
127 pet->SendPetAIReaction(guid1);
130 break;
132 case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
133 if(((Creature*)pet)->isPet())
135 Pet* p = (Pet*)pet;
136 if(p->getPetType() == HUNTER_PET)
137 _player->RemovePet(p,PET_SAVE_AS_DELETED);
138 else
139 //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
140 p->setDeathState(CORPSE);
142 else // charmed
143 _player->Uncharm();
144 break;
145 default:
146 sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
148 break;
149 case ACT_REACTION: // 0x600
150 switch(spellid)
152 case REACT_PASSIVE: //passive
153 case REACT_DEFENSIVE: //recovery
154 case REACT_AGGRESSIVE: //activete
155 charmInfo->SetReactState( ReactStates(spellid) );
156 break;
158 break;
159 case ACT_DISABLED: // 0x8100 spell (disabled), ignore
160 case ACT_PASSIVE: // 0x0100
161 case ACT_ENABLED: // 0xC100 spell
163 Unit* unit_target = NULL;
164 if (((Creature*)pet)->GetGlobalCooldown() > 0)
165 return;
167 if(guid2)
168 unit_target = ObjectAccessor::GetUnit(*_player,guid2);
170 // do not cast unknown spells
171 SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );
172 if(!spellInfo)
174 sLog.outError("WORLD: unknown PET spell id %i", spellid);
175 return;
178 for(uint32 i = 0; i < 3;++i)
180 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)
181 return;
184 // do not cast not learned spells
185 if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
186 return;
188 pet->clearUnitState(UNIT_STAT_FOLLOW);
190 Spell *spell = new Spell(pet, spellInfo, false);
192 SpellCastResult result = spell->CheckPetCast(unit_target);
194 //auto turn to target unless possessed
195 if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
197 if(unit_target)
199 pet->SetInFront(unit_target);
200 if (unit_target->GetTypeId() == TYPEID_PLAYER)
201 pet->SendUpdateToPlayer( (Player*)unit_target );
203 else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())
205 pet->SetInFront(unit_target2);
206 if (unit_target2->GetTypeId() == TYPEID_PLAYER)
207 pet->SendUpdateToPlayer( (Player*)unit_target2 );
209 if (Unit* powner = pet->GetCharmerOrOwner())
210 if(powner->GetTypeId() == TYPEID_PLAYER)
211 pet->SendUpdateToPlayer((Player*)powner);
212 result = SPELL_CAST_OK;
215 if(result == SPELL_CAST_OK)
217 ((Creature*)pet)->AddCreatureSpellCooldown(spellid);
219 unit_target = spell->m_targets.getUnitTarget();
221 //10% chance to play special pet attack talk, else growl
222 //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
223 if(((Creature*)pet)->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
224 pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
225 else
227 pet->SendPetAIReaction(guid1);
230 if( unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
232 // This is true if pet has no target or has target but targets differs.
233 if (pet->getVictim() != unit_target)
235 if (pet->getVictim())
236 pet->AttackStop();
237 pet->GetMotionMaster()->Clear();
238 if (((Creature*)pet)->AI())
239 ((Creature*)pet)->AI()->AttackStart(unit_target);
243 spell->prepare(&(spell->m_targets));
245 else
247 if(pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
249 WorldPacket data(SMSG_CAST_FAILED, (4+1+1));
250 data << uint8(0) << uint32(spellid) << uint8(result);
251 switch (result)
253 case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
254 data << uint32(spellInfo->RequiresSpellFocus);
255 break;
256 default:
257 break;
259 SendPacket(&data);
261 else
262 pet->SendPetCastFail(spellid, result);
264 if(!((Creature*)pet)->HasSpellCooldown(spellid))
265 pet->SendPetClearCooldown(spellid);
267 spell->finish(false);
268 delete spell;
270 break;
272 default:
273 sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
277 void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
279 CHECK_PACKET_SIZE(recv_data,4+8);
281 sLog.outDetail( "HandlePetNameQuery. CMSG_PET_NAME_QUERY" );
283 uint32 petnumber;
284 uint64 petguid;
286 recv_data >> petnumber;
287 recv_data >> petguid;
289 SendPetNameQuery(petguid,petnumber);
292 void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
294 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
295 if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
296 return;
298 std::string name = pet->GetName();
300 WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
301 data << uint32(petnumber);
302 data << name.c_str();
303 data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
305 if( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
307 data << uint8(1);
308 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
309 data << ((Pet*)pet)->GetDeclinedNames()->name[i];
311 else
312 data << uint8(0);
314 _player->GetSession()->SendPacket(&data);
317 void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
319 CHECK_PACKET_SIZE(recv_data, 8+4+2+2);
321 sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" );
323 uint64 petguid;
324 uint32 position;
325 uint16 spell_id;
326 uint16 act_state;
327 uint8 count;
329 recv_data >> petguid;
331 // FIXME: charmed case
332 //Pet* pet = ObjectAccessor::Instance().GetPet(petguid);
333 if(ObjectAccessor::FindPlayer(petguid))
334 return;
336 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
338 if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
340 sLog.outError( "HandlePetSetAction: Unknown pet or pet owner." );
341 return;
344 CharmInfo *charmInfo = pet->GetCharmInfo();
345 if(!charmInfo)
347 sLog.outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
348 return;
351 count = (recv_data.size() == 24) ? 2 : 1;
352 for(uint8 i = 0; i < count; ++i)
354 recv_data >> position;
355 recv_data >> spell_id;
356 recv_data >> act_state;
358 sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, act_state);
360 //ignore invalid position
361 if(position >= MAX_UNIT_ACTION_BAR_INDEX)
362 return;
364 //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
365 if(!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
367 //sign for autocast
368 if(act_state == ACT_ENABLED && spell_id)
370 if(pet->isCharmed())
371 charmInfo->ToggleCreatureAutocast(spell_id, true);
372 else
373 ((Pet*)pet)->ToggleAutocast(spell_id, true);
375 //sign for no/turn off autocast
376 else if(act_state == ACT_DISABLED && spell_id)
378 if(pet->isCharmed())
379 charmInfo->ToggleCreatureAutocast(spell_id, false);
380 else
381 ((Pet*)pet)->ToggleAutocast(spell_id, false);
384 charmInfo->SetActionBar(position,spell_id,ActiveStates(act_state));
389 void WorldSession::HandlePetRename( WorldPacket & recv_data )
391 CHECK_PACKET_SIZE(recv_data, 8+1);
393 sLog.outDetail( "HandlePetRename. CMSG_PET_RENAME" );
395 uint64 petguid;
396 uint8 isdeclined;
398 std::string name;
399 DeclinedName declinedname;
401 recv_data >> petguid;
402 recv_data >> name;
403 CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1);
404 recv_data >> isdeclined;
406 Pet* pet = ObjectAccessor::GetPet(petguid);
407 // check it!
408 if( !pet || !pet->isPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET ||
409 pet->GetByteValue(UNIT_FIELD_BYTES_2, 2) != UNIT_RENAME_ALLOWED ||
410 pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo() )
411 return;
413 if(!ObjectMgr::IsValidPetName(name))
415 SendPetNameInvalid(PET_NAME_INVALID, name, NULL);
416 return;
419 if(objmgr.IsReservedName(name))
421 SendPetNameInvalid(PET_NAME_RESERVED, name, NULL);
422 return;
425 pet->SetName(name);
427 Unit *owner = pet->GetOwner();
428 if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
429 ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
431 pet->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_NOT_ALLOWED);
433 if(isdeclined)
435 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
437 CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1);
438 recv_data >> declinedname.name[i];
441 std::wstring wname;
442 Utf8toWStr(name, wname);
443 if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname))
445 SendPetNameInvalid(PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME, name, &declinedname);
446 return;
450 CharacterDatabase.BeginTransaction();
451 if(isdeclined)
453 for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
454 CharacterDatabase.escape_string(declinedname.name[i]);
455 CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
456 CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
457 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());
460 CharacterDatabase.escape_string(name);
461 CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
462 CharacterDatabase.CommitTransaction();
464 pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
467 void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
469 CHECK_PACKET_SIZE(recv_data, 8);
471 uint64 guid;
472 recv_data >> guid; //pet guid
473 sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
475 // pet/charmed
476 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
477 if(pet)
479 if(pet->isPet())
481 if(pet->GetGUID() == _player->GetPetGUID())
483 uint32 feelty = pet->GetPower(POWER_HAPPINESS);
484 pet->SetPower(POWER_HAPPINESS ,(feelty-50000) > 0 ?(feelty-50000) : 0);
487 _player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
489 else if(pet->GetGUID() == _player->GetCharmGUID())
491 _player->Uncharm();
496 void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
498 CHECK_PACKET_SIZE(recvPacket,8);
500 sLog.outDetail("CMSG_PET_UNLEARN");
501 uint64 guid;
502 recvPacket >> guid; // Pet guid
504 Pet* pet = _player->GetPet();
506 if(!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
507 return;
509 if(guid != pet->GetGUID())
511 sLog.outError( "HandlePetUnlearnOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
512 return;
515 CharmInfo *charmInfo = pet->GetCharmInfo();
516 if(!charmInfo)
518 sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
519 return;
521 pet->resetTalents();
524 void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
526 CHECK_PACKET_SIZE(recvPacket,8+2+2+1);
528 sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
529 uint64 guid;
530 uint16 spellid;
531 uint16 spellid2; //maybe second spell, automatically toggled off when first toggled on?
532 uint8 state; //1 for on, 0 for off
533 recvPacket >> guid >> spellid >> spellid2 >> state;
535 if(!_player->GetPet() && !_player->GetCharm())
536 return;
538 if(ObjectAccessor::FindPlayer(guid))
539 return;
541 Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
543 if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
545 sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
546 return;
549 // do not add not learned spells/ passive spells
550 if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
551 return;
553 CharmInfo *charmInfo = pet->GetCharmInfo();
554 if(!charmInfo)
556 sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
557 return;
560 if(pet->isCharmed())
561 //state can be used as boolean
562 pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
563 else
564 ((Pet*)pet)->ToggleAutocast(spellid, state);
566 charmInfo->SetSpellAutocast(spellid,state);
569 void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
571 sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL");
573 CHECK_PACKET_SIZE(recvPacket,8+1+4+1);
574 uint64 guid;
575 uint32 spellid;
576 uint8 cast_count;
577 uint8 unk_flags; // flags (if 0x02 - some additional data are received)
579 recvPacket >> guid >> cast_count >> spellid >> unk_flags;
581 sLog.outDebug("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);
583 if(!_player->GetPet() && !_player->GetCharm())
584 return;
586 if (GUID_HIPART(guid) == HIGHGUID_PLAYER)
587 return;
589 Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
591 if(!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
593 sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
594 return;
597 if (pet->GetGlobalCooldown() > 0)
598 return;
600 SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
601 if(!spellInfo)
603 sLog.outError("WORLD: unknown PET spell id %i", spellid);
604 return;
607 // do not cast not learned spells
608 if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
609 return;
611 SpellCastTargets targets;
612 if(!targets.read(&recvPacket,pet))
613 return;
615 pet->clearUnitState(UNIT_STAT_FOLLOW);
617 Spell *spell = new Spell(pet, spellInfo, false);
618 spell->m_cast_count = cast_count; // probably pending spell cast
619 spell->m_targets = targets;
621 SpellCastResult result = spell->CheckPetCast(NULL);
622 if(result == SPELL_CAST_OK)
624 pet->AddCreatureSpellCooldown(spellid);
625 if(pet->isPet())
627 //10% chance to play special pet attack talk, else growl
628 //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
629 if(((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
630 pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
631 else
632 pet->SendPetAIReaction(guid);
635 spell->prepare(&(spell->m_targets));
637 else
639 pet->SendPetCastFail(spellid, result);
640 if(!pet->HasSpellCooldown(spellid))
641 pet->SendPetClearCooldown(spellid);
643 spell->finish(false);
644 delete spell;
648 void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
650 WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
651 data << uint32(error);
652 data << name;
653 if(declinedName)
655 data << uint8(1);
656 for(uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
657 data << declinedName->name[i];
659 else
660 data << uint8(0);
661 SendPacket(&data);
664 void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data )
666 sLog.outDebug("WORLD: CMSG_PET_LEARN_TALENT");
668 CHECK_PACKET_SIZE(recv_data, 8+4+4);
670 uint64 guid;
671 uint32 talent_id, requested_rank;
672 recv_data >> guid >> talent_id >> requested_rank;
674 _player->LearnPetTalent(guid, talent_id, requested_rank);