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

Public Member Functions

 npc_prof_blacksmith ()
 
bool HasWeaponSub (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_blacksmith::npc_prof_blacksmith ( )
inline
592 : CreatureScript("npc_prof_blacksmith") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

bool npc_prof_blacksmith::HasWeaponSub ( Player player)
inline
595  {
596  return (player->HasSpell(S_HAMMER) || player->HasSpell(S_AXE) || player->HasSpell(S_SWORD));
597  }
Definition: npc_professions.cpp:114
Definition: npc_professions.cpp:113
Definition: npc_professions.cpp:115

+ Here is the caller graph for this function:

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

Reimplemented from CreatureScript.

600  {
601  if (creature->IsQuestGiver())
602  player->PrepareQuestMenu(creature->GetGUID());
603 
604  if (creature->IsVendor())
606 
607  if (creature->IsTrainer())
609 
610  uint32 creatureId = creature->GetEntry();
611  //WEAPONSMITH & ARMORSMITH
612  if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225)
613  {
614  switch (creatureId)
615  {
618  if (!player->HasSpell(S_ARMOR) && !player->HasSpell(S_WEAPON) && player->GetReputationRank(REP_ARMOR) >= REP_FRIENDLY)
620  if (!player->HasSpell(S_WEAPON) && !player->HasSpell(S_ARMOR) && player->GetReputationRank(REP_WEAPON) >= REP_FRIENDLY)
622  break;
623  case N_TRAINER_WEAPON1:
624  case N_TRAINER_WEAPON2:
625  if (player->HasSpell(S_WEAPON))
627  break;
628  case N_TRAINER_ARMOR1:
629  case N_TRAINER_ARMOR2:
630  if (player->HasSpell(S_ARMOR))
632  break;
633  }
634  }
635  //WEAPONSMITH SPEC
636  if (player->HasSpell(S_WEAPON) && player->getLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250)
637  {
638  switch (creatureId)
639  {
640  case N_TRAINER_HAMMER:
641  if (!HasWeaponSub(player))
643  if (player->HasSpell(S_HAMMER))
645  break;
646  case N_TRAINER_AXE:
647  if (!HasWeaponSub(player))
649  if (player->HasSpell(S_AXE))
651  break;
652  case N_TRAINER_SWORD:
653  if (!HasWeaponSub(player))
655  if (player->HasSpell(S_SWORD))
657  break;
658  }
659  }
660 
661  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
662  return true;
663  }
bool IsVendor() const
Definition: Unit.h:1564
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:58
Definition: npc_professions.cpp:198
Definition: ScriptedGossip.h:71
Definition: GossipDef.h:62
#define GOSSIP_LEARN_SWORD
Definition: npc_professions.cpp:86
Definition: ScriptedGossip.h:59
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:57
#define GOSSIP_TEXT_BROWSE_GOODS
Definition: ScriptedGossip.h:26
Definition: npc_professions.cpp:199
Definition: npc_professions.cpp:194
Definition: npc_professions.cpp:195
Definition: npc_professions.cpp:197
#define GOSSIP_ARMOR_UNLEARN
Definition: npc_professions.cpp:77
bool HasWeaponSub(Player *player)
Definition: npc_professions.cpp:594
Definition: npc_professions.cpp:112
Definition: npc_professions.cpp:114
bool IsQuestGiver() const
Definition: Unit.h:1566
#define GOSSIP_UNLEARN_HAMMER
Definition: npc_professions.cpp:83
Definition: SharedDefines.h:217
#define GOSSIP_UNLEARN_SWORD
Definition: npc_professions.cpp:87
#define GOSSIP_WEAPON_UNLEARN
Definition: npc_professions.cpp:75
Definition: GossipDef.h:60
uint32_t uint32
Definition: Define.h:150
#define GOSSIP_LEARN_AXE
Definition: npc_professions.cpp:84
Definition: npc_professions.cpp:113
Definition: ScriptedGossip.h:60
Definition: npc_professions.cpp:115
Definition: ScriptedGossip.h:73
#define GOSSIP_WEAPON_LEARN
Definition: npc_professions.cpp:74
#define GOSSIP_TEXT_TRAIN
Definition: ScriptedGossip.h:27
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: npc_professions.cpp:132
Definition: npc_professions.cpp:193
Definition: GossipDef.h:59
Definition: SharedDefines.h:3928
#define GOSSIP_UNLEARN_AXE
Definition: npc_professions.cpp:85
uint32 GetEntry() const
Definition: Object.h:107
Definition: npc_professions.cpp:196
#define GOSSIP_ARMOR_LEARN
Definition: npc_professions.cpp:76
bool IsTrainer() const
Definition: Unit.h:1565
Definition: npc_professions.cpp:200
#define GOSSIP_LEARN_HAMMER
Definition: npc_professions.cpp:82
Definition: npc_professions.cpp:192
Definition: npc_professions.cpp:133
Definition: npc_professions.cpp:111

+ Here is the call graph for this function:

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

Reimplemented from CreatureScript.

791  {
792  player->PlayerTalkClass->ClearMenus();
793  switch (sender)
794  {
795  case GOSSIP_SENDER_MAIN:
796  SendActionMenu(player, creature, action);
797  break;
798 
799  case GOSSIP_SENDER_LEARN:
800  SendConfirmLearn(player, creature, action);
801  break;
802 
804  SendConfirmUnlearn(player, creature, action);
805  break;
806 
807  case GOSSIP_SENDER_CHECK:
808  SendActionMenu(player, creature, action);
809  break;
810  }
811  return true;
812  }
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:58
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:57
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:756
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:665
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:731
Definition: ScriptedGossip.h:73
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:59

+ Here is the call graph for this function:

void npc_prof_blacksmith::SendActionMenu ( Player player,
Creature creature,
uint32  action 
)
inline
666  {
667  switch (action)
668  {
669  case GOSSIP_ACTION_TRADE:
670  player->GetSession()->SendListInventory(creature->GetGUID());
671  break;
672  case GOSSIP_ACTION_TRAIN:
673  player->GetSession()->SendTrainerList(creature->GetGUID());
674  break;
675  //Learn Armor/Weapon
676  case GOSSIP_ACTION_INFO_DEF + 1:
677  if (!player->HasSpell(S_ARMOR))
678  {
679  player->CastSpell(player, S_LEARN_ARMOR, true);
680  //_Creature->CastSpell(player, S_REP_ARMOR, true);
681  }
682  player->CLOSE_GOSSIP_MENU();
683  break;
684  case GOSSIP_ACTION_INFO_DEF + 2:
685  if (!player->HasSpell(S_WEAPON))
686  {
687  player->CastSpell(player, S_LEARN_WEAPON, true);
688  //_Creature->CastSpell(player, S_REP_WEAPON, true);
689  }
690  player->CLOSE_GOSSIP_MENU();
691  break;
692  //Unlearn Armor/Weapon
693  case GOSSIP_ACTION_INFO_DEF + 3:
694  if (HasWeaponSub(player))
695  {
696  //unknown textID (TALK_MUST_UNLEARN_WEAPON)
697  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
698  }
699  else
701  break;
702  case GOSSIP_ACTION_INFO_DEF + 4:
704  break;
705  //Learn Hammer/Axe/Sword
706  case GOSSIP_ACTION_INFO_DEF + 5:
707  player->CastSpell(player, S_LEARN_HAMMER, true);
708  player->CLOSE_GOSSIP_MENU();
709  break;
710  case GOSSIP_ACTION_INFO_DEF + 6:
711  player->CastSpell(player, S_LEARN_AXE, true);
712  player->CLOSE_GOSSIP_MENU();
713  break;
714  case GOSSIP_ACTION_INFO_DEF + 7:
715  player->CastSpell(player, S_LEARN_SWORD, true);
716  player->CLOSE_GOSSIP_MENU();
717  break;
718  //Unlearn Hammer/Axe/Sword
719  case GOSSIP_ACTION_INFO_DEF + 8:
720  ProcessUnlearnAction(player, creature, S_UNLEARN_HAMMER, 0, DoMedUnlearnCost(player));
721  break;
722  case GOSSIP_ACTION_INFO_DEF + 9:
723  ProcessUnlearnAction(player, creature, S_UNLEARN_AXE, 0, DoMedUnlearnCost(player));
724  break;
725  case GOSSIP_ACTION_INFO_DEF + 10:
726  ProcessUnlearnAction(player, creature, S_UNLEARN_SWORD, 0, DoMedUnlearnCost(player));
727  break;
728  }
729  }
Definition: npc_professions.cpp:124
Definition: ScriptedGossip.h:71
Definition: npc_professions.cpp:119
Definition: npc_professions.cpp:117
Definition: ScriptedGossip.h:59
int32 DoMedUnlearnCost(Player *player)
Definition: npc_professions.cpp:241
Definition: npc_professions.cpp:123
Definition: npc_professions.cpp:126
bool HasWeaponSub(Player *player)
Definition: npc_professions.cpp:594
Definition: npc_professions.cpp:129
Definition: npc_professions.cpp:112
Definition: npc_professions.cpp:130
int32 DoLowUnlearnCost(Player *player)
Definition: npc_professions.cpp:252
void ProcessUnlearnAction(Player *player, Creature *creature, uint32 spellId, uint32 alternativeSpellId, int32 cost)
Definition: npc_professions.cpp:400
Definition: npc_professions.cpp:127
Definition: npc_professions.cpp:121
Definition: ScriptedGossip.h:60
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: npc_professions.cpp:120
Definition: npc_professions.cpp:125
Definition: npc_professions.cpp:118
Definition: npc_professions.cpp:111

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_prof_blacksmith::SendConfirmLearn ( Player player,
Creature creature,
uint32  action 
)
inline
732  {
733  if (action)
734  {
735  switch (creature->GetEntry())
736  {
737  case N_TRAINER_HAMMER:
738  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, action);
739  //unknown textID (TALK_HAMMER_LEARN)
740  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
741  break;
742  case N_TRAINER_AXE:
743  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, action);
744  //unknown textID (TALK_AXE_LEARN)
745  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
746  break;
747  case N_TRAINER_SWORD:
748  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, action);
749  //unknown textID (TALK_SWORD_LEARN)
750  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
751  break;
752  }
753  }
754  }
Definition: npc_professions.cpp:198
#define GOSSIP_LEARN_SWORD
Definition: npc_professions.cpp:86
Definition: npc_professions.cpp:199
#define GOSSIP_LEARN_AXE
Definition: npc_professions.cpp:84
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
Definition: npc_professions.cpp:200
#define GOSSIP_LEARN_HAMMER
Definition: npc_professions.cpp:82

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void npc_prof_blacksmith::SendConfirmUnlearn ( Player player,
Creature creature,
uint32  action 
)
inline
757  {
758  if (action)
759  {
760  switch (creature->GetEntry())
761  {
762  case N_TRAINER_WEAPON1:
763  case N_TRAINER_WEAPON2:
764  case N_TRAINER_ARMOR1:
765  case N_TRAINER_ARMOR2:
766  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(player), false);
767  //unknown textID (TALK_UNLEARN_AXEORWEAPON)
768  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
769  break;
770 
771  case N_TRAINER_HAMMER:
772  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false);
773  //unknown textID (TALK_HAMMER_UNLEARN)
774  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
775  break;
776  case N_TRAINER_AXE:
777  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false);
778  //unknown textID (TALK_AXE_UNLEARN)
779  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
780  break;
781  case N_TRAINER_SWORD:
782  player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, action, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(player), false);
783  //unknown textID (TALK_SWORD_UNLEARN)
784  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
785  break;
786  }
787  }
788  }
Definition: npc_professions.cpp:198
#define GOSSIP_UNLEARN_SMITH_SPEC
Definition: npc_professions.cpp:79
int32 DoMedUnlearnCost(Player *player)
Definition: npc_professions.cpp:241
Definition: npc_professions.cpp:199
Definition: npc_professions.cpp:194
Definition: npc_professions.cpp:195
Definition: npc_professions.cpp:197
int32 DoLowUnlearnCost(Player *player)
Definition: npc_professions.cpp:252
#define BOX_UNLEARN_WEAPON_SPEC
Definition: npc_professions.cpp:89
#define GOSSIP_UNLEARN_HAMMER
Definition: npc_professions.cpp:83
#define GOSSIP_UNLEARN_SWORD
Definition: npc_professions.cpp:87
#define BOX_UNLEARN_ARMORORWEAPON
Definition: npc_professions.cpp:80
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define GOSSIP_UNLEARN_AXE
Definition: npc_professions.cpp:85
uint32 GetEntry() const
Definition: Object.h:107
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:59
Definition: npc_professions.cpp:196
Definition: npc_professions.cpp:200

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