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

Public Member Functions

 npc_prof_alchemy ()
 
bool HasAlchemySpell (Player *player)
 
bool OnGossipHello (Player *player, Creature *creature) override
 
void SendActionMenu (Player *player, Creature *creature, uint32 action)
 
void SendConfirmLearn (Player *player, Creature *creature, uint32 action)
 
void SendConfirmUnlearn (Player *player, Creature *creature, uint32 action)
 
bool OnGossipSelect (Player *player, Creature *creature, uint32 sender, uint32 action) override
 
- Public Member Functions inherited from CreatureScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Creature *)
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, Creature *, Quest const *)
 
virtual bool OnQuestSelect (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

- Protected Member Functions inherited from CreatureScript
 CreatureScript (const char *name)
 
- Protected Member Functions inherited from UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

npc_prof_alchemy::npc_prof_alchemy ( )
inline
427 : CreatureScript("npc_prof_alchemy") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

bool npc_prof_alchemy::HasAlchemySpell ( Player player)
inline
430  {
431  return (player->HasSpell(S_TRANSMUTE) || player->HasSpell(S_ELIXIR) || player->HasSpell(S_POTION));
432  }
Definition: npc_professions.cpp:169
Definition: npc_professions.cpp:168
Definition: npc_professions.cpp:170

+ Here is the caller graph for this function:

bool npc_prof_alchemy::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

435  {
436  if (creature->IsQuestGiver())
437  player->PrepareQuestMenu(creature->GetGUID());
438 
439  if (creature->IsVendor())
441 
442  if (creature->IsTrainer())
444 
445  if (player->HasSkill(SKILL_ALCHEMY) && player->GetBaseSkillValue(SKILL_ALCHEMY) >= 350 && player->getLevel() > 67)
446  {
447  if (player->GetQuestRewardStatus(Q_MASTER_TRANSMUTE) || player->GetQuestRewardStatus(Q_MASTER_ELIXIR) || player->GetQuestRewardStatus(Q_MASTER_POTION))
448  {
449  switch (creature->GetEntry())
450  {
451  case N_TRAINER_TRANSMUTE: //Zarevhi
452  if (!HasAlchemySpell(player))
454  if (player->HasSpell(S_TRANSMUTE))
456  break;
457  case N_TRAINER_ELIXIR: //Lorokeem
458  if (!HasAlchemySpell(player))
460  if (player->HasSpell(S_ELIXIR))
462  break;
463  case N_TRAINER_POTION: //Lauranna Thar'well
464  if (!HasAlchemySpell(player))
466  if (player->HasSpell(S_POTION))
468  break;
469  }
470  }
471  }
472 
473  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
474  return true;
475  }
bool IsVendor() const
Definition: Unit.h:1564
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:58
Definition: npc_professions.cpp:187
Definition: ScriptedGossip.h:71
#define GOSSIP_LEARN_ELIXIR
Definition: npc_professions.cpp:69
Definition: GossipDef.h:62
Definition: npc_professions.cpp:169
Definition: ScriptedGossip.h:59
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:57
Definition: npc_professions.cpp:223
#define GOSSIP_TEXT_BROWSE_GOODS
Definition: ScriptedGossip.h:26
#define GOSSIP_LEARN_POTION
Definition: npc_professions.cpp:65
bool IsQuestGiver() const
Definition: Unit.h:1566
Definition: GossipDef.h:60
#define GOSSIP_UNLEARN_POTION
Definition: npc_professions.cpp:66
#define GOSSIP_UNLEARN_TRANSMUTE
Definition: npc_professions.cpp:68
Definition: npc_professions.cpp:224
#define GOSSIP_UNLEARN_ELIXIR
Definition: npc_professions.cpp:70
Definition: ScriptedGossip.h:60
Definition: ScriptedGossip.h:73
Definition: npc_professions.cpp:189
#define GOSSIP_TEXT_TRAIN
Definition: ScriptedGossip.h:27
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: GossipDef.h:59
uint32 GetEntry() const
Definition: Object.h:107
Definition: npc_professions.cpp:168
Definition: SharedDefines.h:3930
bool IsTrainer() const
Definition: Unit.h:1565
Definition: npc_professions.cpp:170
#define GOSSIP_LEARN_TRANSMUTE
Definition: npc_professions.cpp:67
Definition: npc_professions.cpp:188
Definition: npc_professions.cpp:222
bool HasAlchemySpell(Player *player)
Definition: npc_professions.cpp:429

+ Here is the call graph for this function:

bool npc_prof_alchemy::OnGossipSelect ( Player player,
Creature creature,
uint32  sender,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

561  {
562  player->PlayerTalkClass->ClearMenus();
563  switch (sender)
564  {
565  case GOSSIP_SENDER_MAIN:
566  SendActionMenu(player, creature, action);
567  break;
568 
569  case GOSSIP_SENDER_LEARN:
570  SendConfirmLearn(player, creature, action);
571  break;
572 
574  SendConfirmUnlearn(player, creature, action);
575  break;
576 
577  case GOSSIP_SENDER_CHECK:
578  SendActionMenu(player, creature, action);
579  break;
580  }
581  return true;
582  }
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:510
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:58
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:57
Definition: ScriptedGossip.h:73
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:59
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:535
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:477

+ Here is the call graph for this function:

void npc_prof_alchemy::SendActionMenu ( Player player,
Creature creature,
uint32  action 
)
inline
478  {
479  switch (action)
480  {
481  case GOSSIP_ACTION_TRADE:
482  player->GetSession()->SendListInventory(creature->GetGUID());
483  break;
484  case GOSSIP_ACTION_TRAIN:
485  player->GetSession()->SendTrainerList(creature->GetGUID());
486  break;
487  //Learn Alchemy
488  case GOSSIP_ACTION_INFO_DEF + 1:
489  ProcessCastaction(player, creature, S_TRANSMUTE, S_LEARN_TRANSMUTE, DoLearnCost(player));
490  break;
491  case GOSSIP_ACTION_INFO_DEF + 2:
492  ProcessCastaction(player, creature, S_ELIXIR, S_LEARN_ELIXIR, DoLearnCost(player));
493  break;
494  case GOSSIP_ACTION_INFO_DEF + 3:
495  ProcessCastaction(player, creature, S_POTION, S_LEARN_POTION, DoLearnCost(player));
496  break;
497  //Unlearn Alchemy
498  case GOSSIP_ACTION_INFO_DEF + 4:
499  ProcessCastaction(player, creature, 0, S_UNLEARN_TRANSMUTE, DoHighUnlearnCost(player));
500  break;
501  case GOSSIP_ACTION_INFO_DEF + 5:
502  ProcessCastaction(player, creature, 0, S_UNLEARN_ELIXIR, DoHighUnlearnCost(player));
503  break;
504  case GOSSIP_ACTION_INFO_DEF + 6:
505  ProcessCastaction(player, creature, 0, S_UNLEARN_POTION, DoHighUnlearnCost(player));
506  break;
507  }
508  }
Definition: ScriptedGossip.h:71
void ProcessCastaction(Player *player, Creature *creature, uint32 spellId, uint32 triggeredSpellId, int32 cost)
Definition: npc_professions.cpp:261
Definition: npc_professions.cpp:169
Definition: ScriptedGossip.h:59
Definition: npc_professions.cpp:178
Definition: npc_professions.cpp:176
Definition: npc_professions.cpp:177
int32 DoLearnCost(Player *)
Definition: npc_professions.cpp:231
Definition: npc_professions.cpp:172
int32 DoHighUnlearnCost(Player *)
Definition: npc_professions.cpp:236
Definition: ScriptedGossip.h:60
Definition: npc_professions.cpp:173
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: npc_professions.cpp:168
Definition: npc_professions.cpp:174
Definition: npc_professions.cpp:170

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_prof_alchemy::SendConfirmLearn ( Player player,
Creature creature,
uint32  action 
)
inline
511  {
512  if (action)
513  {
514  switch (creature->GetEntry())
515  {
516  case N_TRAINER_TRANSMUTE:
517  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, action);
518  //unknown textID ()
519  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
520  break;
521  case N_TRAINER_ELIXIR:
522  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, action);
523  //unknown textID ()
524  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
525  break;
526  case N_TRAINER_POTION:
527  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, action);
528  //unknown textID ()
529  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
530  break;
531  }
532  }
533  }
Definition: npc_professions.cpp:187
#define GOSSIP_LEARN_ELIXIR
Definition: npc_professions.cpp:69
#define GOSSIP_LEARN_POTION
Definition: npc_professions.cpp:65
Definition: npc_professions.cpp:189
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: GossipDef.h:59
uint32 GetEntry() const
Definition: Object.h:107
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:59
#define GOSSIP_LEARN_TRANSMUTE
Definition: npc_professions.cpp:67
Definition: npc_professions.cpp:188

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_prof_alchemy::SendConfirmUnlearn ( Player player,
Creature creature,
uint32  action 
)
inline
536  {
537  if (action)
538  {
539  switch (creature->GetEntry())
540  {
541  case N_TRAINER_TRANSMUTE:
542  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false);
543  //unknown textID ()
544  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
545  break;
546  case N_TRAINER_ELIXIR:
547  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false);
548  //unknown textID ()
549  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
550  break;
551  case N_TRAINER_POTION:
552  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(player), false);
553  //unknown textID ()
554  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
555  break;
556  }
557  }
558  }
Definition: npc_professions.cpp:187
#define BOX_UNLEARN_ALCHEMY_SPEC
Definition: npc_professions.cpp:72
int32 DoHighUnlearnCost(Player *)
Definition: npc_professions.cpp:236
#define GOSSIP_UNLEARN_POTION
Definition: npc_professions.cpp:66
#define GOSSIP_UNLEARN_TRANSMUTE
Definition: npc_professions.cpp:68
#define GOSSIP_UNLEARN_ELIXIR
Definition: npc_professions.cpp:70
Definition: npc_professions.cpp:189
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 GetEntry() const
Definition: Object.h:107
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:59
Definition: npc_professions.cpp:188

+ 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: