TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
learn_commandscript Class Reference

Public Member Functions

 learn_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleLearnCommand (ChatHandler *handler, char const *args)
 
static bool HandleLearnAllGMCommand (ChatHandler *handler, char const *)
 
static bool HandleLearnAllMyClassCommand (ChatHandler *handler, char const *)
 
static bool HandleLearnAllMySpellsCommand (ChatHandler *handler, char const *)
 
static bool HandleLearnAllMyTalentsCommand (ChatHandler *handler, char const *)
 
static bool HandleLearnAllMyPetTalentsCommand (ChatHandler *, char const *)
 
static bool HandleLearnAllLangCommand (ChatHandler *handler, char const *)
 
static bool HandleLearnAllDefaultCommand (ChatHandler *handler, char const *args)
 
static bool HandleLearnAllCraftsCommand (ChatHandler *handler, char const *args)
 
static bool HandleLearnAllRecipesCommand (ChatHandler *handler, char const *args)
 
static void HandleLearnSkillRecipesHelper (Player *player, uint32 skillId)
 
static bool HandleUnLearnCommand (ChatHandler *handler, char const *args)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

learn_commandscript::learn_commandscript ( )
inline
37 : CommandScript("learn_commandscript") { }
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> learn_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

40  {
41  static std::vector<ChatCommand> learnAllMyCommandTable =
42  {
47  };
48 
49  static std::vector<ChatCommand> learnAllCommandTable =
50  {
51  { "my", rbac::RBAC_PERM_COMMAND_LEARN_ALL_MY, false, NULL, "", learnAllMyCommandTable },
57  };
58 
59  static std::vector<ChatCommand> learnCommandTable =
60  {
61  { "all", rbac::RBAC_PERM_COMMAND_LEARN_ALL, false, NULL, "", learnAllCommandTable },
63  };
64 
65  static std::vector<ChatCommand> commandTable =
66  {
67  { "learn", rbac::RBAC_PERM_COMMAND_LEARN, false, NULL, "", learnCommandTable },
68  { "unlearn", rbac::RBAC_PERM_COMMAND_UNLEARN, false, &HandleUnLearnCommand, "" },
69  };
70  return commandTable;
71  }
static bool HandleLearnAllMyPetTalentsCommand(ChatHandler *, char const *)
Definition: cs_learn.cpp:210
static bool HandleLearnAllCraftsCommand(ChatHandler *handler, char const *args)
Definition: cs_learn.cpp:313
static bool HandleLearnAllDefaultCommand(ChatHandler *handler, char const *args)
Definition: cs_learn.cpp:299
Definition: RBAC.h:325
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleUnLearnCommand(ChatHandler *handler, char const *args)
Definition: cs_learn.cpp:428
static bool HandleLearnAllLangCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:289
static bool HandleLearnAllMySpellsCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:143
Definition: RBAC.h:336
static bool HandleLearnCommand(ChatHandler *handler, char const *args)
Definition: cs_learn.cpp:73
static bool HandleLearnAllMyTalentsCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:183
Definition: RBAC.h:324
static bool HandleLearnAllGMCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:118
static bool HandleLearnAllRecipesCommand(ChatHandler *handler, char const *args)
Definition: cs_learn.cpp:336
static bool HandleLearnAllMyClassCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:136

+ Here is the call graph for this function:

static bool learn_commandscript::HandleLearnAllCraftsCommand ( ChatHandler handler,
char const args 
)
inlinestatic
314  {
315  Player* target;
316  if (!handler->extractPlayerTarget((char*)args, &target))
317  return false;
318 
319  for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i)
320  {
321  SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i);
322  if (!skillInfo)
323  continue;
324 
325  if ((skillInfo->CategoryID == SKILL_CATEGORY_PROFESSION || skillInfo->CategoryID == SKILL_CATEGORY_SECONDARY) &&
326  skillInfo->CanLink) // only prof. with recipes have
327  {
328  HandleLearnSkillRecipesHelper(target, skillInfo->ID);
329  }
330  }
331 
333  return true;
334  }
Definition: DBCStructure.h:952
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
uint32 CanLink
Definition: DBCStructure.h:960
static void HandleLearnSkillRecipesHelper(Player *player, uint32 skillId)
Definition: cs_learn.cpp:394
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:4151
int32 CategoryID
Definition: DBCStructure.h:955
Definition: SharedDefines.h:4149
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:435
uint32 ID
Definition: DBCStructure.h:954

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllDefaultCommand ( ChatHandler handler,
char const args 
)
inlinestatic
300  {
301  Player* target;
302  if (!handler->extractPlayerTarget((char*)args, &target))
303  return false;
304 
305  target->LearnDefaultSkills();
306  target->LearnCustomSpells();
307  target->LearnQuestRewardedSpells();
308 
309  handler->PSendSysMessage(LANG_COMMAND_LEARN_ALL_DEFAULT_AND_QUEST, handler->GetNameLink(target).c_str());
310  return true;
311  }
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
virtual std::string GetNameLink() const
Definition: Chat.h:101
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllGMCommand ( ChatHandler handler,
char const  
)
inlinestatic
119  {
120  for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
121  {
122  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
123  if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
124  continue;
125 
126  if (!spellInfo->IsAbilityOfSkillType(SKILL_INTERNAL))
127  continue;
128 
129  handler->GetSession()->GetPlayer()->LearnSpell(i, false);
130  }
131 
133  return true;
134  }
Definition: SpellInfo.h:326
Definition: SharedDefines.h:4017
Player * GetPlayer() const
Definition: WorldSession.h:927
Definition: Language.h:496
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
WorldSession * GetSession()
Definition: Chat.h:59
bool IsAbilityOfSkillType(uint32 skillType) const
Definition: SpellInfo.cpp:1324
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllLangCommand ( ChatHandler handler,
char const  
)
inlinestatic
290  {
291  // skipping UNIVERSAL language (0)
292  for (uint8 i = 1; i < LANGUAGES_COUNT; ++i)
293  handler->GetSession()->GetPlayer()->LearnSpell(lang_description[i].spell_id, false);
294 
296  return true;
297  }
Definition: Language.h:434
Player * GetPlayer() const
Definition: WorldSession.h:927
#define LANGUAGES_COUNT
Definition: SharedDefines.h:988
WorldSession * GetSession()
Definition: Chat.h:59
uint8_t uint8
Definition: Define.h:152
LanguageDesc lang_description[LANGUAGES_COUNT]
Definition: ObjectMgr.cpp:164
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllMyClassCommand ( ChatHandler handler,
char const  
)
inlinestatic
137  {
138  HandleLearnAllMySpellsCommand(handler, "");
139  HandleLearnAllMyTalentsCommand(handler, "");
140  return true;
141  }
static bool HandleLearnAllMySpellsCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:143
static bool HandleLearnAllMyTalentsCommand(ChatHandler *handler, char const *)
Definition: cs_learn.cpp:183

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllMyPetTalentsCommand ( ChatHandler ,
char const  
)
inlinestatic
211  {
212  /* TODO: 6.x remove pet talents
213  Player* player = handler->GetSession()->GetPlayer();
214 
215  Pet* pet = player->GetPet();
216  if (!pet)
217  {
218  handler->SendSysMessage(LANG_NO_PET_FOUND);
219  handler->SetSentErrorMessage(true);
220  return false;
221  }
222 
223  CreatureTemplate const* creatureInfo = pet->GetCreatureTemplate();
224  if (!creatureInfo)
225  {
226  handler->SendSysMessage(LANG_WRONG_PET_TYPE);
227  handler->SetSentErrorMessage(true);
228  return false;
229  }
230 
231  CreatureFamilyEntry const* petFamily = sCreatureFamilyStore.LookupEntry(creatureInfo->family);
232  if (!petFamily)
233  {
234  handler->SendSysMessage(LANG_WRONG_PET_TYPE);
235  handler->SetSentErrorMessage(true);
236  return false;
237  }
238 
239  if (petFamily->PetTalentType < 0) // not hunter pet
240  {
241  handler->SendSysMessage(LANG_WRONG_PET_TYPE);
242  handler->SetSentErrorMessage(true);
243  return false;
244  }
245 
246  for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
247  {
248  TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
249  if (!talentInfo)
250  continue;
251 
252  TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
253  if (!talentTabInfo)
254  continue;
255 
256  // prevent learn talent for different family (cheating)
257  if (((1 << petFamily->PetTalentType) & talentTabInfo->petTalentMask) == 0)
258  continue;
259 
260  // search highest talent rank
261  uint32 spellId = 0;
262 
263  for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
264  {
265  if (talentInfo->RankID[rank] != 0)
266  {
267  spellId = talentInfo->RankID[rank];
268  break;
269  }
270  }
271 
272  if (!spellId) // ??? none spells in talent
273  continue;
274 
275  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
276  if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
277  continue;
278 
279  // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
280  pet->learnSpellHighRank(spellId);
281  }
282 
283  pet->SetFreeTalentPoints(0);
284 
285  handler->SendSysMessage(LANG_COMMAND_LEARN_PET_TALENTS);*/
286  return true;
287  }

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllMySpellsCommand ( ChatHandler handler,
char const  
)
inlinestatic
144  {
145  ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(handler->GetSession()->GetPlayer()->getClass());
146  if (!classEntry)
147  return true;
148  uint32 family = classEntry->SpellClassSet;
149 
150  for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
151  {
152  SkillLineAbilityEntry const* entry = sSkillLineAbilityStore.LookupEntry(i);
153  if (!entry)
154  continue;
155 
156  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->SpellID);
157  if (!spellInfo)
158  continue;
159 
160  // skip server-side/triggered spells
161  if (spellInfo->SpellLevel == 0)
162  continue;
163 
164  // skip wrong class/race skills
165  if (!handler->GetSession()->GetPlayer()->IsSpellFitByClassAndRace(spellInfo->Id))
166  continue;
167 
168  // skip other spell families
169  if (spellInfo->SpellFamilyName != family)
170  continue;
171 
172  // skip broken spells
173  if (!SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
174  continue;
175 
176  handler->GetSession()->GetPlayer()->LearnSpell(spellInfo->Id, false);
177  }
178 
180  return true;
181  }
Definition: Language.h:432
uint32 Id
Definition: SpellInfo.h:329
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesfmt)
uint32 SpellLevel
Definition: SpellInfo.h:375
Definition: SpellInfo.h:326
Player * GetPlayer() const
Definition: WorldSession.h:927
uint32 SpellID
Definition: DBCStructure.h:969
Definition: DBCStructure.h:181
uint32 SpellFamilyName
Definition: SpellInfo.h:396
uint32 SpellClassSet
Definition: DBCStructure.h:190
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
Definition: DBCStructure.h:965
WorldSession * GetSession()
Definition: Chat.h:59
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllMyTalentsCommand ( ChatHandler handler,
char const  
)
inlinestatic
184  {
185  Player* player = handler->GetSession()->GetPlayer();
186  uint32 playerClass = player->getClass();
187 
188  for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
189  {
190  TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
191  if (!talentInfo)
192  continue;
193 
194  if (playerClass != talentInfo->ClassID)
195  continue;
196 
197  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(talentInfo->SpellID);
198  if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
199  continue;
200 
201  // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
202  player->LearnSpellHighestRank(talentInfo->SpellID);
203  player->AddTalent(talentInfo, player->GetActiveTalentGroup(), true);
204  }
205 
207  return true;
208  }
Definition: SpellInfo.h:326
uint32 ClassID
Definition: DBCStructure.h:1264
Player * GetPlayer() const
Definition: WorldSession.h:927
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
DBCStorage< TalentEntry > sTalentStore(Talentfmt)
WorldSession * GetSession()
Definition: Chat.h:59
Definition: Language.h:433
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: DBCStructure.h:1255
uint32 SpellID
Definition: DBCStructure.h:1261

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnAllRecipesCommand ( ChatHandler handler,
char const args 
)
inlinestatic
337  {
338  // Learns all recipes of specified profession and sets skill to max
339  // Example: .learn all_recipes enchanting
340 
341  Player* target = handler->getSelectedPlayer();
342  if (!target)
343  {
345  return false;
346  }
347 
348  if (!*args)
349  return false;
350 
351  std::wstring namePart;
352 
353  if (!Utf8toWStr(args, namePart))
354  return false;
355 
356  // converting string that we try to find to lower case
357  wstrToLower(namePart);
358 
359  std::string name;
360 
361  SkillLineEntry const* targetSkillInfo = NULL;
362  for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i)
363  {
364  SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i);
365  if (!skillInfo)
366  continue;
367 
368  if ((skillInfo->CategoryID != SKILL_CATEGORY_PROFESSION &&
369  skillInfo->CategoryID != SKILL_CATEGORY_SECONDARY) ||
370  !skillInfo->CanLink) // only prof with recipes have set
371  continue;
372 
373  name = skillInfo->DisplayName_lang;
374  if (name.empty())
375  continue;
376 
377  if (!Utf8FitTo(name, namePart))
378  continue;
379 
380  targetSkillInfo = skillInfo;
381  }
382 
383  if (!targetSkillInfo)
384  return false;
385 
386  HandleLearnSkillRecipesHelper(target, targetSkillInfo->ID);
387 
388  uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->ID);
389  target->SetSkill(targetSkillInfo->ID, target->GetSkillStep(targetSkillInfo->ID), maxLevel, maxLevel);
390  handler->PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str());
391  return true;
392  }
Definition: DBCStructure.h:952
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
arena_t NULL
Definition: jemalloc_internal.h:624
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Definition: Util.cpp:281
void wstrToLower(std::wstring &str)
Definition: Util.h:306
Definition: Language.h:621
bool Utf8FitTo(const std::string &str, std::wstring const &search)
Definition: Util.cpp:453
uint32 CanLink
Definition: DBCStructure.h:960
static void HandleLearnSkillRecipesHelper(Player *player, uint32 skillId)
Definition: cs_learn.cpp:394
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:4151
uint16_t uint16
Definition: Define.h:151
char * DisplayName_lang
Definition: DBCStructure.h:956
Player * getSelectedPlayer()
Definition: Chat.cpp:579
int32 CategoryID
Definition: DBCStructure.h:955
Definition: SharedDefines.h:4149
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509
uint32 ID
Definition: DBCStructure.h:954

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleLearnCommand ( ChatHandler handler,
char const args 
)
inlinestatic
74  {
75  Player* targetPlayer = handler->getSelectedPlayerOrSelf();
76 
77  if (!targetPlayer)
78  {
80  handler->SetSentErrorMessage(true);
81  return false;
82  }
83 
84  // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
85  uint32 spell = handler->extractSpellIdFromLink((char*)args);
86  if (!spell || !sSpellMgr->GetSpellInfo(spell))
87  return false;
88 
89  char const* all = strtok(NULL, " ");
90  bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false;
91 
92  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
93  if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
94  {
96  handler->SetSentErrorMessage(true);
97  return false;
98  }
99 
100  if (!allRanks && targetPlayer->HasSpell(spell))
101  {
102  if (targetPlayer == handler->GetSession()->GetPlayer())
104  else
105  handler->PSendSysMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
106  handler->SetSentErrorMessage(true);
107  return false;
108  }
109 
110  if (allRanks)
111  targetPlayer->LearnSpellHighestRank(spell);
112  else
113  targetPlayer->LearnSpell(spell, false);
114 
115  return true;
116  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:498
Definition: Language.h:490
Definition: SpellInfo.h:326
arena_t NULL
Definition: jemalloc_internal.h:624
Player * getSelectedPlayerOrSelf()
Definition: Chat.cpp:623
Player * GetPlayer() const
Definition: WorldSession.h:927
bool all(float x)
Definition: g3dmath.h:431
Definition: Language.h:497
virtual std::string GetNameLink() const
Definition: Chat.h:101
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
uint32 extractSpellIdFromLink(char *text)
Definition: Chat.cpp:806
WorldSession * GetSession()
Definition: Chat.h:59
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152
Definition: Language.h:509

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void learn_commandscript::HandleLearnSkillRecipesHelper ( Player player,
uint32  skillId 
)
inlinestatic
395  {
396  uint32 classmask = player->getClassMask();
397 
398  for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
399  {
400  SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
401  if (!skillLine)
402  continue;
403 
404  // wrong skill
405  if (skillLine->SkillLine != skillId)
406  continue;
407 
408  // not high rank
409  if (skillLine->SupercedesSpell)
410  continue;
411 
412  // skip racial skills
413  if (skillLine->RaceMask != 0)
414  continue;
415 
416  // skip wrong class skills
417  if (skillLine->ClassMask && (skillLine->ClassMask & classmask) == 0)
418  continue;
419 
420  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(skillLine->SpellID);
421  if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false))
422  continue;
423 
424  player->LearnSpell(skillLine->SpellID, false);
425  }
426  }
Definition: SpellInfo.h:326
uint32 SupercedesSpell
Definition: DBCStructure.h:973
uint32 ClassMask
Definition: DBCStructure.h:971
uint32 SkillLine
Definition: DBCStructure.h:968
uint32 SpellID
Definition: DBCStructure.h:969
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
static bool IsSpellValid(SpellInfo const *spellInfo, Player *player=NULL, bool msg=true)
Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book...
Definition: SpellMgr.cpp:482
Definition: DBCStructure.h:965
uint32 RaceMask
Definition: DBCStructure.h:970
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool learn_commandscript::HandleUnLearnCommand ( ChatHandler handler,
char const args 
)
inlinestatic
429  {
430  if (!*args)
431  return false;
432 
433  // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
434  uint32 spellId = handler->extractSpellIdFromLink((char*)args);
435  if (!spellId)
436  return false;
437 
438  char const* allStr = strtok(NULL, " ");
439  bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
440 
441  Player* target = handler->getSelectedPlayer();
442  if (!target)
443  {
445  handler->SetSentErrorMessage(true);
446  return false;
447  }
448 
449  if (allRanks)
450  spellId = sSpellMgr->GetFirstSpellInChain(spellId);
451 
452  if (target->HasSpell(spellId))
453  target->RemoveSpell(spellId, false, !allRanks);
454  else
456 
457  return true;
458  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Language.h:140
Definition: Language.h:500
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
uint32 extractSpellIdFromLink(char *text)
Definition: Chat.cpp:806
Player * getSelectedPlayer()
Definition: Chat.cpp:579
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: