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 "ItemPackets.h"
29#include "Log.h"
30#include "MailPackets.h"
31#include "Map.h"
32#include "NPCPackets.h"
33#include "Opcodes.h"
34#include "ObjectMgr.h"
35#include "Pet.h"
36#include "Player.h"
37#include "QueryCallback.h"
38#include "ReputationMgr.h"
39#include "ScriptMgr.h"
40#include "SpellInfo.h"
41#include "SpellMgr.h"
42#include "Trainer.h"
43#include "World.h"
44#include "WorldPacket.h"
45
47{
48 STABLE_ERR_MONEY = 0x01, // "you don't have enough money"
49 STABLE_ERR_INVALID_SLOT = 0x03, // "That slot is locked"
50 STABLE_ERR_STABLE = 0x06, // currently used in most fail cases
51 STABLE_SUCCESS_STABLE = 0x08, // stable success
52 STABLE_SUCCESS_UNSTABLE = 0x09, // unstable/swap success
53 STABLE_SUCCESS_BUY_SLOT = 0x0A, // buy slot success
54 STABLE_ERR_EXOTIC = 0x0C // "you are unable to control exotic creatures"
55};
56
58{
59 ObjectGuid guid;
60 recvData >> guid;
61
63 if (!unit)
64 {
65 TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - {} not found or you can not interact with him.", guid.ToString());
66 return;
67 }
68
69 // remove fake death
70 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
72
74}
75
77{
79 data << guid;
80 SendPacket(&data);
81}
82
84{
86 packet.PostmasterGUID = guid;
87 SendPacket(packet.Write());
88}
89
91{
93 if (!npc)
94 {
95 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - {} not found or you can not interact with him.", packet.Unit.ToString());
96 return;
97 }
98
99 SendTrainerList(npc);
100}
101
103{
104 // remove fake death
105 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
107
108 Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(npc->GetEntry());
109 if (!trainer)
110 {
111 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - trainer spells not found for {}", npc->GetGUID().ToString());
112 return;
113 }
114
115 if (!trainer->IsTrainerValidForPlayer(_player))
116 {
117 TC_LOG_DEBUG("network", "WorldSession: SendTrainerList - trainer {} not valid for player {}", npc->GetGUID().ToString(), GetPlayerInfo());
118 return;
119 }
120
122}
123
125{
126 TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL {}, learn spell id is: {}", packet.TrainerGUID.ToString(), packet.SpellID);
127
129 if (!npc)
130 {
131 TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - {} not found or you can not interact with him.", packet.TrainerGUID.ToString());
132 return;
133 }
134
135 // remove fake death
136 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
138
139 Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(npc->GetEntry());
140 if (!trainer)
141 return;
142
143 trainer->TeachSpell(npc, _player, packet.SpellID);
144}
145
147{
148 TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
149
151 if (!unit)
152 {
153 TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - {} not found or you can not interact with him.", packet.Unit.ToString());
154 return;
155 }
156
157 // set faction visible if needed
158 if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->GetFaction()))
159 _player->GetReputationMgr().SetVisible(factionTemplateEntry);
160
162 // remove fake death
163 //if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
164 // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
165
166 // Stop the npc if moving
168 unit->PauseMovement(pause);
169 unit->SetHomePosition(unit->GetPosition());
170
171 // If spiritguide, no need for gossip menu, just put player into resurrect queue
172 if (unit->IsSpiritGuide())
173 {
175 if (bg)
176 {
178 sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
179 return;
180 }
181 }
182
184 if (!unit->AI()->OnGossipHello(_player))
185 {
186// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
189 }
190}
191
193{
194 TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
195
196 ObjectGuid guid;
197 recvData >> guid;
198
200 if (!unit)
201 {
202 TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - {} not found or you can not interact with him.", guid.ToString());
203 return;
204 }
205
206 // remove fake death
207 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
209
211}
212
214{
215 _player->ResurrectPlayer(0.5f, true);
216 _player->DurabilityLossAll(0.25f, true);
217
218 // get corpse nearest graveyard
219 WorldSafeLocsEntry const* corpseGrave = nullptr;
220 if (_player->HasCorpse())
221 {
222 WorldLocation const& corpseLocation = _player->GetCorpseLocation();
223 corpseGrave = sObjectMgr->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
224 corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam(), _player);
225 }
226
227 // now can spawn bones
229
230 // teleport to nearest from corpse graveyard, if different from nearest to player ghost
231 if (corpseGrave)
232 {
233 WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveyard(
235
236 if (corpseGrave != ghostGrave)
237 _player->TeleportTo(corpseGrave->Continent, corpseGrave->Loc.X, corpseGrave->Loc.Y, corpseGrave->Loc.Z, _player->GetOrientation());
238 }
239}
240
242{
243 if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
244 return;
245
247 if (!unit)
248 {
249 TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - {} not found or you can not interact with him.", packet.Unit.ToString());
250 return;
251 }
252
253 // remove fake death
254 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
256
257 SendBindPoint(unit);
258}
259
261{
262 // prevent set homebind to instances in any case
263 if (GetPlayer()->GetMap()->Instanceable())
264 return;
265
266 uint32 bindspell = 3286;
267
268 // send spell for homebinding (3286)
269 npc->CastSpell(_player, bindspell, true);
270
272 data << npc->GetGUID();
273 data << uint32(bindspell);
274 SendPacket(&data);
275
277}
278
280{
281 TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
282 ObjectGuid npcGUID;
283
284 recvData >> npcGUID;
285
286 if (!CheckStableMaster(npcGUID))
287 return;
288
289 // remove fake death
290 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
292
293 // remove mounts this fix bug where getting pet from stable while mounted deletes pet.
294 if (GetPlayer()->IsMounted())
296
297 SendStablePet(npcGUID);
298}
299
301{
302 TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send.");
303
304 WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
305
306 data << guid;
307
308 size_t wpos = data.wpos();
309 data << uint8(0); // place holder for slot show number
310
311 PetStable* petStable = GetPlayer()->GetPetStable();
312 if (!petStable)
313 {
314 data << uint8(0); // stable slots
315 SendPacket(&data);
316 return;
317 }
318
319 data << uint8(petStable->MaxStabledPets);
320
321 uint8 num = 0; // counter for place holder
322
323 if (petStable->CurrentPet)
324 {
325 PetStable::PetInfo const& pet = *petStable->CurrentPet;
326 data << uint32(pet.PetNumber);
327 data << uint32(pet.CreatureId);
328 data << uint32(pet.Level);
329 data << pet.Name; // petname
330 data << uint8(1); // flags: 1 active, 2 inactive
331 ++num;
332 }
333 else
334 {
335 if (PetStable::PetInfo const* pet = petStable->GetUnslottedHunterPet())
336 {
337 data << uint32(pet->PetNumber);
338 data << uint32(pet->CreatureId);
339 data << uint32(pet->Level);
340 data << pet->Name; // petname
341 data << uint8(1); // flags: 1 active, 2 inactive
342 ++num;
343 }
344 }
345
346 for (Optional<PetStable::PetInfo> const& stabledSlot : petStable->StabledPets)
347 {
348 if (stabledSlot)
349 {
350 PetStable::PetInfo const& pet = *stabledSlot;
351 data << uint32(pet.PetNumber);
352 data << uint32(pet.CreatureId);
353 data << uint32(pet.Level);
354 data << pet.Name; // petname
355 data << uint8(2); // flags: 1 active, 2 inactive
356 ++num;
357 }
358 }
359
360 data.put<uint8>(wpos, num); // set real data to placeholder
361 SendPacket(&data);
362}
363
365{
367 data << uint8(res);
368 SendPacket(&data);
369}
370
372{
373 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
374 ObjectGuid npcGUID;
375
376 recvData >> npcGUID;
377
378 if (!GetPlayer()->IsAlive())
379 {
381 return;
382 }
383
384 if (!CheckStableMaster(npcGUID))
385 {
387 return;
388 }
389
390 // remove fake death
391 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
393
394 PetStable* petStable = GetPlayer()->GetPetStable();
395 if (!petStable)
396 return;
397
398 Pet* pet = _player->GetPet();
399
400 // can't place in stable dead pet
401 if ((pet && (!pet->IsAlive() || pet->getPetType() != HUNTER_PET))
402 || (!pet && (petStable->UnslottedPets.size() != 1 || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)))
403 {
405 return;
406 }
407
408 for (uint32 freeSlot = 0; freeSlot < petStable->MaxStabledPets; ++freeSlot)
409 {
410 if (!petStable->StabledPets[freeSlot])
411 {
412 if (pet)
413 {
414 // stable summoned pet
416 std::swap(petStable->StabledPets[freeSlot], petStable->CurrentPet);
418 return;
419 }
420
422 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + freeSlot));
423 stmt->setUInt32(1, _player->GetGUID().GetCounter());
424 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
425 CharacterDatabase.Execute(stmt);
426
427 // stable unsummoned pet
428 petStable->StabledPets[freeSlot] = std::move(petStable->UnslottedPets.back());
429 petStable->UnslottedPets.pop_back();
431 return;
432 }
433 }
434
435 // not free stable slot
437}
438
440{
441 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
442 ObjectGuid npcGUID;
443 uint32 petnumber;
444
445 recvData >> npcGUID >> petnumber;
446
447 if (!CheckStableMaster(npcGUID))
448 {
450 return;
451 }
452
453 // remove fake death
454 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
456
457 PetStable* petStable = GetPlayer()->GetPetStable();
458 if (!petStable)
459 {
461 return;
462 }
463
464 auto stabledPet = std::find_if(petStable->StabledPets.begin(), petStable->StabledPets.end(), [petnumber](Optional<PetStable::PetInfo> const& pet)
465 {
466 return pet && pet->PetNumber == petnumber;
467 });
468
469 if (stabledPet == petStable->StabledPets.end())
470 {
472 return;
473 }
474
475 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate((*stabledPet)->CreatureId);
476 if (!creatureInfo || !creatureInfo->IsTameable(_player->CanTameExoticPets()))
477 {
478 // if problem in exotic pet
479 if (creatureInfo && creatureInfo->IsTameable(true))
481 else
483 return;
484 }
485
486 Pet* oldPet = _player->GetPet();
487 if (oldPet)
488 {
489 // try performing a swap, client sends this packet instead of swap when starting from stabled slot
490 if (!oldPet->IsAlive() || !oldPet->IsHunterPet())
491 {
493 return;
494 }
495
496 _player->RemovePet(oldPet, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
497 }
498 else if (petStable->UnslottedPets.size() == 1)
499 {
500 if (petStable->CurrentPet || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)
501 {
503 return;
504 }
505
507 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
508 stmt->setUInt32(1, _player->GetGUID().GetCounter());
509 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
510 CharacterDatabase.Execute(stmt);
511
512 // move unsummoned pet into CurrentPet slot so that it gets moved into stable slot later
513 petStable->CurrentPet = std::move(petStable->UnslottedPets.back());
514 petStable->UnslottedPets.pop_back();
515 }
516 else if (petStable->CurrentPet || !petStable->UnslottedPets.empty())
517 {
519 return;
520 }
521
522 Pet* newPet = new Pet(_player, HUNTER_PET);
523 if (!newPet->LoadPetFromDB(_player, 0, petnumber, false))
524 {
525 delete newPet;
526
527 petStable->UnslottedPets.push_back(std::move(*petStable->CurrentPet));
528 petStable->CurrentPet.reset();
529
530 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
533 stmt->setUInt32(1, _player->GetGUID().GetCounter());
534 stmt->setUInt32(2, petnumber);
535 CharacterDatabase.Execute(stmt);
536
538 }
539 else
540 {
541 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
544 stmt->setUInt32(1, _player->GetGUID().GetCounter());
545 stmt->setUInt32(2, petnumber);
546 CharacterDatabase.Execute(stmt);
547
549 }
550}
551
553{
554 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
555 ObjectGuid npcGUID;
556
557 recvData >> npcGUID;
558
559 if (!CheckStableMaster(npcGUID))
560 {
562 return;
563 }
564
565 // remove fake death
566 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
568
569 PetStable& petStable = GetPlayer()->GetOrInitPetStable();
570 if (petStable.MaxStabledPets < MAX_PET_STABLES)
571 {
572 StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(petStable.MaxStabledPets + 1);
573 if (_player->HasEnoughMoney(SlotPrice->Cost))
574 {
575 ++petStable.MaxStabledPets;
576 _player->ModifyMoney(-int32(SlotPrice->Cost));
578 }
579 else
581 }
582 else
584}
585
587{
588 TC_LOG_DEBUG("network", "HandleStableRevivePet: Not implemented");
589}
590
592{
593 TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
594 ObjectGuid npcGUID;
595 uint32 petId;
596
597 recvData >> npcGUID >> petId;
598
599 if (!CheckStableMaster(npcGUID))
600 {
602 return;
603 }
604
605 // remove fake death
606 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
608
609 PetStable* petStable = GetPlayer()->GetPetStable();
610 if (!petStable)
611 {
613 return;
614 }
615
616 // Find swapped pet slot in stable
617 auto stabledPet = std::find_if(petStable->StabledPets.begin(), petStable->StabledPets.end(), [petId](Optional<PetStable::PetInfo> const& pet)
618 {
619 return pet && pet->PetNumber == petId;
620 });
621
622 if (stabledPet == petStable->StabledPets.end())
623 {
625 return;
626 }
627
628 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate((*stabledPet)->CreatureId);
629 if (!creatureInfo || !creatureInfo->IsTameable(_player->CanTameExoticPets()))
630 {
631 // if problem in exotic pet
632 if (creatureInfo && creatureInfo->IsTameable(true))
634 else
636 return;
637 }
638
639 Pet* oldPet = _player->GetPet();
640 if (oldPet)
641 {
642 if (!oldPet->IsAlive() || !oldPet->IsHunterPet())
643 {
645 return;
646 }
647
648 _player->RemovePet(oldPet, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
649 }
650 else if (petStable->UnslottedPets.size() == 1)
651 {
652 if (petStable->CurrentPet || !petStable->UnslottedPets[0].Health || petStable->UnslottedPets[0].Type != HUNTER_PET)
653 {
655 return;
656 }
657
659 stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet)));
660 stmt->setUInt32(1, _player->GetGUID().GetCounter());
661 stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber);
662 CharacterDatabase.Execute(stmt);
663
664 // move unsummoned pet into CurrentPet slot so that it gets moved into stable slot later
665 petStable->CurrentPet = std::move(petStable->UnslottedPets.back());
666 petStable->UnslottedPets.pop_back();
667 }
668 else if (petStable->CurrentPet || !petStable->UnslottedPets.empty())
669 {
671 return;
672 }
673
674 // summon unstabled pet
675 Pet* newPet = new Pet(_player, HUNTER_PET);
676 if (!newPet->LoadPetFromDB(_player, 0, petId, false))
677 {
678 delete newPet;
680
681 petStable->UnslottedPets.push_back(std::move(*petStable->CurrentPet));
682 petStable->CurrentPet.reset();
683
684 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
687 stmt->setUInt32(1, _player->GetGUID().GetCounter());
688 stmt->setUInt32(2, petId);
689 CharacterDatabase.Execute(stmt);
690 }
691 else
692 {
693 // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved
696 stmt->setUInt32(1, _player->GetGUID().GetCounter());
697 stmt->setUInt32(2, petId);
698 CharacterDatabase.Execute(stmt);
699
701 }
702}
703
705{
706 TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM: Npc {}, Item {}, UseGuildBank: {}",
707 packet.NpcGUID.ToString(), packet.ItemGUID.ToString(), packet.UseGuildBank);
708
710 if (!unit)
711 {
712 TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - {} not found or you can not interact with him.", packet.NpcGUID.ToString());
713 return;
714 }
715
716 // remove fake death
717 if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
719
720 // reputation discount
721 float discountMod = _player->GetReputationPriceDiscount(unit);
722
723 if (!packet.ItemGUID.IsEmpty())
724 {
725 TC_LOG_DEBUG("network", "ITEM: Repair {}, at {}", packet.ItemGUID.ToString(), packet.NpcGUID.ToString());
726
727 Item* item = _player->GetItemByGuid(packet.ItemGUID);
728 if (item)
729 _player->DurabilityRepair(item->GetPos(), true, discountMod);
730 }
731 else
732 {
733 TC_LOG_DEBUG("network", "ITEM: Repair all items at {}", packet.NpcGUID.ToString());
734 _player->DurabilityRepairAll(true, discountMod, packet.UseGuildBank);
735 }
736}
#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:234
void AddPlayerToResurrectQueue(ObjectGuid npc_guid, ObjectGuid player_guid)
size_t wpos() const
Definition ByteBuffer.h:325
void put(std::size_t pos, T value)
Definition ByteBuffer.h:141
virtual bool OnGossipHello(Player *)
Definition CreatureAI.h:216
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:302
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:195
CreatureMovementData const & GetMovementTemplate() const
CreatureAI * AI() const
Definition Creature.h:163
Definition Item.h:62
uint16 GetPos() const
Definition Item.h:147
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:1818
WorldLocation const & GetCorpseLocation() const
Definition Player.h:1744
PetStable & GetOrInitPetStable()
Definition Player.cpp:25938
bool CanTameExoticPets() const
Definition Player.h:1889
void DurabilityLossAll(double percent, bool inventory)
Definition Player.cpp:4573
void DurabilityRepair(uint16 pos, bool takeCost, float discountMod)
Definition Player.cpp:4762
bool ModifyMoney(int32 amount, bool sendError=true)
Definition Player.cpp:22336
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4555
void SendPreparedGossip(WorldObject *source)
Definition Player.cpp:14053
float GetReputationPriceDiscount(Creature const *creature) const
Definition Player.cpp:23150
PetStable * GetPetStable()
Definition Player.h:1045
bool HasCorpse() const
Definition Player.h:1743
void DurabilityRepairAll(bool takeCost, float discountMod, bool guildBank)
Definition Player.cpp:4679
Pet * GetPet() const
Definition Player.cpp:20284
bool HasEnoughMoney(uint32 amount) const
Definition Player.h:1394
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
Definition Player.cpp:2126
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:20308
Battleground * GetBattleground() const
Definition Player.cpp:23024
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:1539
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9516
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition Player.cpp:13887
ReputationMgr & GetReputationMgr()
Definition Player.h:1834
PlayerMenu * PlayerTalkClass
Definition Player.h:1956
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4374
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:3788
bool IsHunterPet() const
Definition Unit.h:899
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition Unit.cpp:4045
void PauseMovement(uint32 timer=0, uint8 slot=0, bool forced=true)
Definition Unit.cpp:10304
bool IsAlive() const
Definition Unit.h:1247
uint32 GetFaction() const override
Definition Unit.h:987
bool IsSpiritGuide() const
Definition Unit.h:1125
uint32 GetMapId() const
Definition Position.h:193
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
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 HandleStablePet(WorldPacket &recvPacket)
void HandleGossipHelloOpcode(WorldPackets::NPC::Hello &packet)
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 HandleRepairItemOpcode(WorldPackets::Item::RepairItem &packet)
void SendPetStableResult(uint8 guid)
void SendShowMailBox(ObjectGuid guid)
Player * _player
void HandleSpiritHealerActivateOpcode(WorldPacket &recvPacket)
void HandleBinderActivateOpcode(WorldPackets::NPC::Hello &packet)
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