◆ pet_commandscript()
pet_commandscript::pet_commandscript |
( |
| ) |
|
|
inline |
Definition CommandScript.h:25
◆ GetCommands()
Implements CommandScript.
36 {
38 {
42 };
43
45 {
46 { "pet", petCommandTable }
47 };
48
49 return commandTable;
50 }
@ SEC_GAMEMASTER
Definition Common.h:59
static bool HandlePetLearnCommand(ChatHandler *handler, SpellInfo const *spell)
Definition cs_pet.cpp:86
static bool HandlePetCreateCommand(ChatHandler *handler)
Definition cs_pet.cpp:52
static bool HandlePetUnlearnCommand(ChatHandler *handler, SpellInfo const *spell)
Definition cs_pet.cpp:128
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46
References HandlePetCreateCommand(), HandlePetLearnCommand(), HandlePetUnlearnCommand(), and SEC_GAMEMASTER.
◆ HandlePetCreateCommand()
static bool pet_commandscript::HandlePetCreateCommand |
( |
ChatHandler * |
handler | ) |
|
|
inlinestatic |
53 {
56
57 if (!creatureTarget || creatureTarget->
IsPet() || creatureTarget->
IsPlayer())
58 {
60 return false;
61 }
62
64
65 if (!creatrueTemplate->
family)
66 {
68 return false;
69 }
70
72 {
74 return false;
75 }
76
78 {
80 return false;
81 }
82
83 return true;
84 }
@ LANG_SELECT_CREATURE
Definition Language.h:32
@ LANG_CREATURE_NON_TAMEABLE
Definition Language.h:385
@ LANG_YOU_ALREADY_HAVE_PET
Definition Language.h:386
#define sObjectMgr
Definition ObjectMgr.h:1636
WorldSession * GetSession()
Definition Chat.h:242
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
Creature * getSelectedCreature() const
Definition Chat.cpp:410
bool IsPlayer() const
Definition Object.h:200
uint32 GetEntry() const
Definition Object.h:115
bool IsExistPet()
Definition Player.cpp:9256
Pet * CreatePet(Creature *creatureTarget, uint32 spellID=0)
Definition Player.cpp:9262
bool IsPet() const
Definition Unit.h:763
Player * GetPlayer() const
Definition WorldSession.h:376
Definition CreatureData.h:186
uint32 Entry
Definition CreatureData.h:187
uint32 family
Definition CreatureData.h:217
References Player::CreatePet(), CreatureTemplate::Entry, CreatureTemplate::family, Object::GetEntry(), WorldSession::GetPlayer(), ChatHandler::getSelectedCreature(), ChatHandler::GetSession(), Player::IsExistPet(), Unit::IsPet(), Object::IsPlayer(), LANG_CREATURE_NON_TAMEABLE, LANG_SELECT_CREATURE, LANG_YOU_ALREADY_HAVE_PET, ChatHandler::SendErrorMessage(), and sObjectMgr.
Referenced by GetCommands().
◆ HandlePetLearnCommand()
static bool pet_commandscript::HandlePetLearnCommand |
( |
ChatHandler * |
handler, |
|
|
SpellInfo const * |
spell |
|
) |
| |
|
inlinestatic |
87 {
88 if (!spell)
89 {
91 return false;
92 }
93
95 {
97 return false;
98 }
99
101 if (!pet)
102 {
104 return false;
105 }
106
109 if (bounds.first != bounds.second || spellDifficultyId)
110 {
111 handler->
SendErrorMessage(
"Spell {} cannot be learnt using a command!", spell->Id);
112 return false;
113 }
114
115
117 {
119 return false;
120 }
121
124
125 return true;
126 }
std::uint32_t uint32
Definition Define.h:107
@ LANG_COMMAND_NOSPELLFOUND
Definition Language.h:478
@ LANG_COMMAND_SPELL_BROKEN
Definition Language.h:521
std::pair< SpellScriptsContainer::iterator, SpellScriptsContainer::iterator > SpellScriptsBounds
Definition ObjectMgr.h:388
#define sSpellMgr
Definition SpellMgr.h:825
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211
bool HasSpell(uint32 spell) const override
Definition Pet.cpp:2336
bool learnSpell(uint32 spell_id)
Definition Pet.cpp:1908
Pet * GetPet() const
Definition Player.cpp:8968
static bool IsSpellValid(SpellInfo const *spellInfo)
Definition SpellMgr.cpp:441
References Player::GetPet(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Pet::HasSpell(), SpellInfo::Id, SpellMgr::IsSpellValid(), LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_SPELL_BROKEN, Pet::learnSpell(), ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), sObjectMgr, and sSpellMgr.
Referenced by GetCommands().
◆ HandlePetUnlearnCommand()
static bool pet_commandscript::HandlePetUnlearnCommand |
( |
ChatHandler * |
handler, |
|
|
SpellInfo const * |
spell |
|
) |
| |
|
inlinestatic |
129 {
130 if (!spell)
131 {
133 return false;
134 }
135
137 {
139 return false;
140 }
141
143 if (!pet)
144 {
146 return false;
147 }
148
150 {
152 }
153 else
154 {
156 }
157
158 return true;
159 }
bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab=true)
Definition Pet.cpp:1981
References Player::GetPet(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Pet::HasSpell(), SpellInfo::Id, SpellMgr::IsSpellValid(), LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_SPELL_BROKEN, ChatHandler::PSendSysMessage(), Pet::removeSpell(), and ChatHandler::SendErrorMessage().
Referenced by GetCommands().
The documentation for this class was generated from the following file:
- azerothcore-wotlk/src/server/scripts/Commands/cs_pet.cpp