TrinityCore
Loading...
Searching...
No Matches
NPCHandler.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "WorldSession.h"
19#include "Battleground.h"
20#include "BattlegroundMgr.h"
21#include "Common.h"
22#include "Creature.h"
23#include "CreatureAI.h"
24#include "DatabaseEnv.h"
25#include "DBCStores.h"
26#include "GossipDef.h"
27#include "Item.h"
28#include "Log.h"
29#include "MailPackets.h"
30#include "Map.h"
31#include "NPCPackets.h"
32#include "Opcodes.h"
33#include "ObjectMgr.h"
34#include "Pet.h"
35#include "Player.h"
36#include "QueryCallback.h"
37#include "ReputationMgr.h"
38#include "ScriptMgr.h"
39#include "SpellInfo.h"
40#include "SpellMgr.h"
41#include "Trainer.h"
42#include "World.h"
43#include "WorldPacket.h"
44
46{
47 STABLE_ERR_MONEY = 0x01, // "you don't have enough money"
48 STABLE_ERR_INVALID_SLOT = 0x03, // "That slot is locked"
49 STABLE_ERR_STABLE = 0x06, // currently used in most fail cases
50 STABLE_SUCCESS_STABLE = 0x08, // stable success
51 STABLE_SUCCESS_UNSTABLE = 0x09, // unstable/swap success
52 STABLE_SUCCESS_BUY_SLOT = 0x0A, // buy slot success
53 STABLE_ERR_EXOTIC = 0x0C // "you are unable to control exotic creatures"
54};
55
57{
58 ObjectGuid guid;
59 recvData >> guid;
60
62 if (!unit)
63 {
64 TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - {} not found or you can not interact with him.", guid.ToString());
65 return;
66 }
67
68 // remove fake death
69 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
71
73}
74
76{
78 data << guid;
79 SendPacket(&data);
80}
81
83{
85 packet.PostmasterGUID = guid;
86 SendPacket(packet.Write());
87}
88
90{
92 if (!npc)
93 {
94 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - {} not found or you can not interact with him.", packet.Unit.ToString());
95 return;
96 }
97
98 SendTrainerList(npc);
99}
100
102{
103 // remove fake death
104 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
106
107 Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(npc->GetEntry());
108 if (!trainer)
109 {
110 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - trainer spells not found for {}", npc->GetGUID().ToString());
111 return;
112 }
113
114 if (!trainer->IsTrainerValidForPlayer(_player))
115 {
116 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - trainer {} not valid for player {}", npc->GetGUID().ToString(), GetPlayerInfo());
117 return;
118 }
119
121}
122
124{
125 TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL {}, learn spell id is: {}", packet.TrainerGUID.ToString(), packet.SpellID);
126
128 if (!npc)
129 {
130 TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - {} not found or you can not interact with him.", packet.TrainerGUID.ToString());
131 return;
132 }
133
134 // remove fake death
135 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
137
138 Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(npc->GetEntry());
139 if (!trainer)
140 return;
141
142 trainer->TeachSpell(npc, _player, packet.SpellID);
143}
144
146{
147 TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
148
149 ObjectGuid guid;
150 recvData >> guid;
151
153 if (!unit)
154 {
155 TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - {} not found or you can not interact with him.", guid.ToString());
156 return;
157 }
158
159 // set faction visible if needed
160 if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->GetFaction()))
161 _player->GetReputationMgr().SetVisible(factionTemplateEntry);
162
164 // remove fake death
165 //if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
166 // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
167
168 // Stop the npc if moving
170 unit->PauseMovement(pause);
171 unit->SetHomePosition(unit->GetPosition());
172
173 // If spiritguide, no need for gossip menu, just put player into resurrect queue
174 if (unit->IsSpiritGuide())
175 {
177 if (bg)
178 {
180 sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
181 return;
182 }
183 }
184
186 if (!unit->AI()->OnGossipHello(_player))
187 {
188// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
191 }
192}
193
195{
196 TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
197
198 ObjectGuid guid;
199 recvData >> guid;
200
202 if (!unit)
203 {
204 TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - {} not found or you can not interact with him.", guid.ToString());
205 return;
206 }
207
208 // remove fake death
209 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
211
213}
214
216{
217 _player->ResurrectPlayer(0.5f, true);
218 _player->DurabilityLossAll(0.25f, true);
219
220 // get corpse nearest graveyard
221 WorldSafeLocsEntry const* corpseGrave = nullptr;
222 if (_player->HasCorpse())
223 {
224 WorldLocation const& corpseLocation = _player->GetCorpseLocation();
225 corpseGrave = sObjectMgr->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
226 corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam(), _player);
227 }
228
229 // now can spawn bones
231
232 // teleport to nearest from corpse graveyard, if different from nearest to player ghost
233 if (corpseGrave)
234 {
235 WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveyard(
237
238 if (corpseGrave != ghostGrave)
239 _player->TeleportTo(corpseGrave->Continent, corpseGrave->Loc.X, corpseGrave->Loc.Y, corpseGrave->Loc.Z, _player->GetOrientation());
240 }
241}
242
244{
245 ObjectGuid npcGUID;
246 recvData >> npcGUID;
247
248 if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
249 return;
250
252 if (!unit)
253 {
254 TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - {} not found or you can not interact with him.", npcGUID.ToString());
255 return;
256 }
257
258 // remove fake death
259 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
261
262 SendBindPoint(unit);
263}
264
266{
267 // prevent set homebind to instances in any case
268 if (GetPlayer()->GetMap()->Instanceable())
269 return;
270
271 uint32 bindspell = 3286;
272
273 // send spell for homebinding (3286)
274 npc->CastSpell(_player, bindspell, true);
275
277 data << npc->GetGUID();
278 data << uint32(bindspell);
279 SendPacket(&data);
280
282}
283
285{
286 TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
287 ObjectGuid npcGUID;
288
289 recvData >> npcGUID;
290
291 if (!CheckStableMaster(npcGUID))
292 return;
293
294 // remove fake death
295 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
297
298 // remove mounts this fix bug where getting pet from stable while mounted deletes pet.
299 if (GetPlayer()->IsMounted())
301
302 SendStablePet(npcGUID);
303}
304
306{
307 TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send.");
308
309 WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
310
311 data << guid;
312
313 size_t wpos = data.wpos();
314 data << uint8(0); // place holder for slot show number
315
316 PetStable* petStable = GetPlayer()->GetPetStable();
317 if (!petStable)
318 {
319 data << uint8(0); // stable slots
320 SendPacket(&data);
321 return;
322 }
323
324 data << uint8(petStable->MaxStabledPets);
325
326 uint8 num = 0; // counter for place holder
327
328 if (petStable->CurrentPet)
329 {
330 PetStable::PetInfo const& pet = *petStable->CurrentPet;
331 data << uint32(pet.PetNumber);
332 data << uint32(pet.CreatureId);
333 data << uint32(pet.Level);
334 data << pet.Name; // petname
335 data << uint8(1); // flags: 1 active, 2 inactive
336 ++num;
337 }
338 else
339 {
340 if (PetStable::PetInfo const* pet = petStable->GetUnslottedHunterPet())
341 {
342 data << uint32(pet->PetNumber);
343 data << uint32(pet->CreatureId);
344 data << uint32(pet->Level);
345 data << pet->Name; // petname
346 data << uint8(1); // flags: 1 active, 2 inactive
347 ++num;
348 }
349 }
350
351 for (Optional<PetStable::PetInfo> const& stabledSlot : petStable->StabledPets)
352 {
353 if (stabledSlot)
354 {
355 PetStable::PetInfo const& pet = *stabledSlot;
356 data << uint32(pet.PetNumber);
357 data << uint32(pet.CreatureId);
358 data << uint32(pet.Level);
359 data << pet.Name; // petname
360 data << uint8(2); // flags: 1 active, 2 inactive
361 ++num;
362 }
363 }
364
365 data.put<uint8>(wpos, num); // set real data to placeholder
366 SendPacket(&data);
367}
368
370{
372 data << uint8(res);
373 SendPacket(&data);
374}
375
377{
378 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
379 ObjectGuid npcGUID;
380
381 recvData >> npcGUID;
382
383 if (!GetPlayer()->IsAlive())
384 {
386 return;
387 }
388
389 if (!CheckStableMaster(npcGUID))
390 {
392 return;
393 }
394
395 // remove fake death
396 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
398
399 PetStable* petStable = GetPlayer()->GetPetStable();
400 if (!petStable)
401 return;
402
403 Pet* pet = _player->GetPet();
404
405 // can't place in stable dead pet
406 if ((pet && (!pet->IsAlive() || pet->getPetType() != HUNTER_PET))
407 || (!pet && (petStable->UnslottedPets.size() != 1 || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)))
408 {
410 return;
411 }
412
413 for (uint32 freeSlot = 0; freeSlot < petStable->MaxStabledPets; ++freeSlot)
414 {
415 if (!petStable->StabledPets[freeSlot])
416 {
417 if (pet)
418 {
419 // stable summoned pet
421 std::swap(petStable->StabledPets[freeSlot], petStable->CurrentPet);
423 return;
424 }
425
427 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + freeSlot));
428 stmt->setUInt32(1, _player->GetGUID().GetCounter());
429 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
430 CharacterDatabase.Execute(stmt);
431
432 // stable unsummoned pet
433 petStable->StabledPets[freeSlot] = std::move(petStable->UnslottedPets.back());
434 petStable->UnslottedPets.pop_back();
436 return;
437 }
438 }
439
440 // not free stable slot
442}
443
445{
446 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
447 ObjectGuid npcGUID;
448 uint32 petnumber;
449
450 recvData >> npcGUID >> petnumber;
451
452 if (!CheckStableMaster(npcGUID))
453 {
455 return;
456 }
457
458 // remove fake death
459 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
461
462 PetStable* petStable = GetPlayer()->GetPetStable();
463 if (!petStable)
464 {
466 return;
467 }
468
469 auto stabledPet = std::find_if(petStable->StabledPets.begin(), petStable->StabledPets.end(), [petnumber](Optional<PetStable::PetInfo> const& pet)
470 {
471 return pet && pet->PetNumber == petnumber;
472 });
473
474 if (stabledPet == petStable->StabledPets.end())
475 {
477 return;
478 }
479
480 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate((*stabledPet)->CreatureId);
481 if (!creatureInfo || !creatureInfo->IsTameable(_player->CanTameExoticPets()))
482 {
483 // if problem in exotic pet
484 if (creatureInfo && creatureInfo->IsTameable(true))
486 else
488 return;
489 }
490
491 Pet* oldPet = _player->GetPet();
492 if (oldPet)
493 {
494 // try performing a swap, client sends this packet instead of swap when starting from stabled slot
495 if (!oldPet->IsAlive() || !oldPet->IsHunterPet())
496 {
498 return;
499 }
500
501 _player->RemovePet(oldPet, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
502 }
503 else if (petStable->UnslottedPets.size() == 1)
504 {
505 if (petStable->CurrentPet || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)
506 {
508 return;
509 }
510
512 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
513 stmt->setUInt32(1, _player->GetGUID().GetCounter());
514 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
515 CharacterDatabase.Execute(stmt);
516
517 // move unsummoned pet into CurrentPet slot so that it gets moved into stable slot later
518 petStable->CurrentPet = std::move(petStable->UnslottedPets.back());
519 petStable->UnslottedPets.pop_back();
520 }
521 else if (petStable->CurrentPet || !petStable->UnslottedPets.empty())
522 {
524 return;
525 }
526
527 Pet* newPet = new Pet(_player, HUNTER_PET);
528 if (!newPet->LoadPetFromDB(_player, 0, petnumber, false))
529 {
530 delete newPet;
531
532 petStable->UnslottedPets.push_back(std::move(*petStable->CurrentPet));
533 petStable->CurrentPet.reset();
534
535 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
538 stmt->setUInt32(1, _player->GetGUID().GetCounter());
539 stmt->setUInt32(2, petnumber);
540 CharacterDatabase.Execute(stmt);
541
543 }
544 else
545 {
546 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
549 stmt->setUInt32(1, _player->GetGUID().GetCounter());
550 stmt->setUInt32(2, petnumber);
551 CharacterDatabase.Execute(stmt);
552
554 }
555}
556
558{
559 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
560 ObjectGuid npcGUID;
561
562 recvData >> npcGUID;
563
564 if (!CheckStableMaster(npcGUID))
565 {
567 return;
568 }
569
570 // remove fake death
571 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
573
574 PetStable& petStable = GetPlayer()->GetOrInitPetStable();
575 if (petStable.MaxStabledPets < MAX_PET_STABLES)
576 {
577 StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(petStable.MaxStabledPets + 1);
578 if (_player->HasEnoughMoney(SlotPrice->Cost))
579 {
580 ++petStable.MaxStabledPets;
581 _player->ModifyMoney(-int32(SlotPrice->Cost));
583 }
584 else
586 }
587 else
589}
590
592{
593 TC_LOG_DEBUG("network", "HandleStableRevivePet: Not implemented");
594}
595
597{
598 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
599 ObjectGuid npcGUID;
600 uint32 petId;
601
602 recvData >> npcGUID >> petId;
603
604 if (!CheckStableMaster(npcGUID))
605 {
607 return;
608 }
609
610 // remove fake death
611 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
613
614 PetStable* petStable = GetPlayer()->GetPetStable();
615 if (!petStable)
616 {
618 return;
619 }
620
621 // Find swapped pet slot in stable
622 auto stabledPet = std::find_if(petStable->StabledPets.begin(), petStable->StabledPets.end(), [petId](Optional<PetStable::PetInfo> const& pet)
623 {
624 return pet && pet->PetNumber == petId;
625 });
626
627 if (stabledPet == petStable->StabledPets.end())
628 {
630 return;
631 }
632
633 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate((*stabledPet)->CreatureId);
634 if (!creatureInfo || !creatureInfo->IsTameable(_player->CanTameExoticPets()))
635 {
636 // if problem in exotic pet
637 if (creatureInfo && creatureInfo->IsTameable(true))
639 else
641 return;
642 }
643
644 Pet* oldPet = _player->GetPet();
645 if (oldPet)
646 {
647 if (!oldPet->IsAlive() || !oldPet->IsHunterPet())
648 {
650 return;
651 }
652
653 _player->RemovePet(oldPet, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
654 }
655 else if (petStable->UnslottedPets.size() == 1)
656 {
657 if (petStable->CurrentPet || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)
658 {
660 return;
661 }
662
664 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
665 stmt->setUInt32(1, _player->GetGUID().GetCounter());
666 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
667 CharacterDatabase.Execute(stmt);
668
669 // move unsummoned pet into CurrentPet slot so that it gets moved into stable slot later
670 petStable->CurrentPet = std::move(petStable->UnslottedPets.back());
671 petStable->UnslottedPets.pop_back();
672 }
673 else if (petStable->CurrentPet || !petStable->UnslottedPets.empty())
674 {
676 return;
677 }
678
679 // summon unstabled pet
680 Pet* newPet = new Pet(_player, HUNTER_PET);
681 if (!newPet->LoadPetFromDB(_player, 0, petId, false))
682 {
683 delete newPet;
685
686 petStable->UnslottedPets.push_back(std::move(*petStable->CurrentPet));
687 petStable->CurrentPet.reset();
688
689 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
692 stmt->setUInt32(1, _player->GetGUID().GetCounter());
693 stmt->setUInt32(2, petId);
694 CharacterDatabase.Execute(stmt);
695 }
696 else
697 {
698 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
701 stmt->setUInt32(1, _player->GetGUID().GetCounter());
702 stmt->setUInt32(2, petId);
703 CharacterDatabase.Execute(stmt);
704
706 }
707}
708
710{
711 TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
712
713 ObjectGuid npcGUID, itemGUID;
714 uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
715
716 recvData >> npcGUID >> itemGUID >> guildBank;
717
719 if (!unit)
720 {
721 TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - {} not found or you can not interact with him.", npcGUID.ToString());
722 return;
723 }
724
725 // remove fake death
726 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
728
729 // reputation discount
730 float discountMod = _player->GetReputationPriceDiscount(unit);
731
732 if (!itemGUID.IsEmpty())
733 {
734 TC_LOG_DEBUG("network", "ITEM: Repair {}, at {}", itemGUID.ToString(), npcGUID.ToString());
735
736 Item* item = _player->GetItemByGuid(itemGUID);
737 if (item)
738 _player->DurabilityRepair(item->GetPos(), true, discountMod);
739 }
740 else
741 {
742 TC_LOG_DEBUG("network", "ITEM: Repair all items at {}", npcGUID.ToString());
743 _player->DurabilityRepairAll(true, discountMod, guildBank != 0);
744 }
745}
#define sBattlegroundMgr
@ CHAR_UPD_CHAR_PET_SLOT_BY_ID
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< StableSlotPricesEntry > sStableSlotPricesStore(StableSlotPricesfmt)
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define TC_LOG_DEBUG(filterType__,...)
Definition Log.h:156
StableResultCode
@ STABLE_ERR_INVALID_SLOT
@ STABLE_ERR_MONEY
@ STABLE_SUCCESS_STABLE
@ STABLE_SUCCESS_BUY_SLOT
@ STABLE_ERR_EXOTIC
@ STABLE_ERR_STABLE
@ STABLE_SUCCESS_UNSTABLE
#define sObjectMgr
Definition ObjectMgr.h:1721
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
#define MAX_PET_STABLES
Definition PetDefines.h:36
PetSaveMode
Definition PetDefines.h:40
@ PET_SAVE_FIRST_STABLE_SLOT
Definition PetDefines.h:43
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:42
@ HUNTER_PET
Definition PetDefines.h:32
@ SPELL_AURA_MOUNTED
@ SPELL_AURA_FEIGN_DEATH
@ AURA_INTERRUPT_FLAG_TALK
@ UNIT_NPC_FLAG_TABARDDESIGNER
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_NPC_FLAG_INNKEEPER
@ UNIT_NPC_FLAG_REPAIR
@ UNIT_NPC_FLAG_TRAINER
@ UNIT_NPC_FLAG_SPIRITHEALER
@ UNIT_STATE_DIED
Definition Unit.h:220
void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
size_t wpos() const
Definition ByteBuffer.h:321
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
virtual bool OnGossipHello(Player *)
Definition CreatureAI.h:216
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:293
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:186
CreatureMovementData const & GetMovementTemplate() const
CreatureAI * AI() const
Definition Creature.h:154
Definition Item.h:62
uint16 GetPos() const
Definition Item.h:130
LowType GetCounter() const
Definition ObjectGuid.h:156
bool IsEmpty() const
Definition ObjectGuid.h:172
std::string ToString() const
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 MaxStabledPets
Definition PetDefines.h:114
PetInfo const * GetUnslottedHunterPet() const
Definition PetDefines.h:117
std::array< Optional< PetInfo >, MAX_PET_STABLES > StabledPets
Definition PetDefines.h:113
Optional< PetInfo > CurrentPet
Definition PetDefines.h:112
std::vector< PetInfo > UnslottedPets
Definition PetDefines.h:115
Definition Pet.h:40
PetType getPetType() const
Definition Pet.h:51
bool LoadPetFromDB(Player *owner, uint32 petEntry, uint32 petnumber, bool current)
Definition Pet.cpp:185
void SendCloseGossip()
void ClearMenus()
uint32 GetTeam() const
Definition Player.h:1832
WorldLocation const & GetCorpseLocation() const
Definition Player.h:1758
PetStable & GetOrInitPetStable()
Definition Player.cpp:25983
bool CanTameExoticPets() const
Definition Player.h:1902
void DurabilityLossAll(double percent, bool inventory)
Definition Player.cpp:4554
void DurabilityRepair(uint16 pos, bool takeCost, float discountMod)
Definition Player.cpp:4743
bool ModifyMoney(int32 amount, bool sendError=true)
Definition Player.cpp:22339
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4536
void SendPreparedGossip(WorldObject *source)
Definition Player.cpp:14052
float GetReputationPriceDiscount(Creature const *creature) const
Definition Player.cpp:23175
PetStable * GetPetStable()
Definition Player.h:1067
bool HasCorpse() const
Definition Player.h:1757
void DurabilityRepairAll(bool takeCost, float discountMod, bool guildBank)
Definition Player.cpp:4660
Pet * GetPet() const
Definition Player.cpp:20286
bool HasEnoughMoney(uint32 amount) const
Definition Player.h:1410
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
Definition Player.cpp:2094
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:20310
Battleground * GetBattleground() const
Definition Player.cpp:23049
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:1524
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9518
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition Player.cpp:13886
ReputationMgr & GetReputationMgr()
Definition Player.h:1848
PlayerMenu * PlayerTalkClass
Definition Player.h:1969
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4346
void setUInt32(uint8 index, uint32 value)
void setUInt8(uint8 index, uint8 value)
void SetVisible(FactionTemplateEntry const *factionTemplateEntry)
bool IsTrainerValidForPlayer(Player const *player) const
Definition Trainer.cpp:209
void SendSpells(Creature const *npc, Player const *player, LocaleConstant locale) const
Definition Trainer.cpp:37
void TeachSpell(Creature const *npc, Player *player, uint32 spellId) const
Definition Trainer.cpp:80
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3765
bool IsHunterPet() const
Definition Unit.h:885
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition Unit.cpp:4022
void PauseMovement(uint32 timer=0, uint8 slot=0, bool forced=true)
Definition Unit.cpp:10327
bool IsAlive() const
Definition Unit.h:1234
uint32 GetFaction() const override
Definition Unit.h:973
bool IsSpiritGuide() const
Definition Unit.h:1111
uint32 GetMapId() const
Definition Position.h:193
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
WorldPacket const * Write() override
bool CheckStableMaster(ObjectGuid guid)
void HandleUnstablePet(WorldPacket &recvPacket)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
LocaleConstant GetSessionDbLocaleIndex() const
void HandleStableRevivePet(WorldPacket &recvPacket)
void HandleTrainerListOpcode(WorldPackets::NPC::Hello &packet)
void HandleTrainerBuySpellOpcode(WorldPackets::NPC::TrainerBuySpell &packet)
void HandleBinderActivateOpcode(WorldPacket &recvPacket)
void HandleStablePet(WorldPacket &recvPacket)
std::string GetPlayerInfo() const
Player * GetPlayer() const
void SendBindPoint(Creature *npc)
void SendSpiritResurrect()
void HandleBuyStableSlot(WorldPacket &recvPacket)
void HandleRequestStabledPets(WorldPacket &recvPacket)
void HandleTabardVendorActivateOpcode(WorldPacket &recvPacket)
void HandleGossipHelloOpcode(WorldPacket &recvPacket)
void SendPetStableResult(uint8 guid)
void HandleRepairItemOpcode(WorldPacket &recvPacket)
void SendShowMailBox(ObjectGuid guid)
Player * _player
void HandleSpiritHealerActivateOpcode(WorldPacket &recvPacket)
void SendTrainerList(Creature *npc)
void SendStablePet(ObjectGuid guid)
void HandleStableSwapPet(WorldPacket &recvPacket)
void SendTabardVendorActivate(ObjectGuid guid)
@ SMSG_TRAINER_BUY_SUCCEEDED
Definition Opcodes.h:464
@ MSG_LIST_STABLED_PETS
Definition Opcodes.h:652
@ SMSG_STABLE_RESULT
Definition Opcodes.h:656
@ MSG_TABARDVENDOR_ACTIVATE
Definition Opcodes.h:527
uint32 GetInteractionPauseTimer() const
bool IsTameable(bool canTameExotic) const
std::string Name
Definition PetDefines.h:95
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
void GetPosition(float &x, float &y) const
Definition Position.h:84
float GetPositionY() const
Definition Position.h:80
DBCPosition3D Loc