AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_prof_blacksmith Class Reference
Inheritance diagram for npc_prof_blacksmith:
CreatureScript ScriptObject UpdatableScript< Creature >

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
bool IsDatabaseBound () const override
 
virtual bool OnGossipHello (Player *, Creature *)
 
virtual bool OnGossipSelect (Player *, Creature *, uint32, uint32)
 
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 OnQuestComplete (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
virtual void OnFfaPvpStateUpdate (Creature *, bool)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
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 ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()=default
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_prof_blacksmith()

npc_prof_blacksmith::npc_prof_blacksmith ( )
inline
636: CreatureScript("npc_prof_blacksmith") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ HasWeaponSub()

bool npc_prof_blacksmith::HasWeaponSub ( Player player)
inline
639 {
640 return (player->HasSpell(S_HAMMER) || player->HasSpell(S_AXE) || player->HasSpell(S_SWORD));
641 }
@ S_AXE
Definition: npc_professions.cpp:114
@ S_SWORD
Definition: npc_professions.cpp:115
@ S_HAMMER
Definition: npc_professions.cpp:113
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3831

References Player::HasSpell(), S_AXE, S_HAMMER, and S_SWORD.

Referenced by OnGossipHello(), and SendActionMenu().

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

644 {
645 if (creature->IsQuestGiver())
646 player->PrepareQuestMenu(creature->GetGUID());
647
648 if (creature->IsVendor())
650
651 if (creature->IsTrainer())
652 {
654 }
655
656 uint32 creatureId = creature->GetEntry();
657 //WEAPONSMITH & ARMORSMITH
658 if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225)
659 {
660 if (player->GetQuestRewardStatus(5284) || player->GetQuestRewardStatus(5302) || player->GetQuestRewardStatus(5283) || player->GetQuestStatus(5301))
661 {
662 switch (creatureId)
663 {
664 case N_TRAINER_SMITHOMNI1: //Myolor Sunderfury
665 case N_TRAINER_SMITHOMNI2: //Krathok Moltenfist
666 if (!player->HasSpell(S_ARMOR) && !player->HasSpell(S_WEAPON))
668 if (!player->HasSpell(S_WEAPON) && !player->HasSpell(S_ARMOR))
670 break;
671 case N_TRAINER_WEAPON1: //Ironus Coldsteel
672 case N_TRAINER_WEAPON2: //Borgosh Corebender
673 if (player->HasSpell(S_WEAPON))
675 break;
676 case N_TRAINER_ARMOR1: //Grumnus Steelshaper
677 case N_TRAINER_ARMOR2: //Okothos Ironrager
678 if (player->HasSpell(S_ARMOR))
680 break;
681 }
682 }
683 }
684 //WEAPONSMITH SPEC
685 if (player->HasSpell(S_WEAPON) && player->GetLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250)
686 {
687 switch (creatureId)
688 {
689 case N_TRAINER_HAMMER: //Lilith the Lithe
690 if (!HasWeaponSub(player))
692 if (player->HasSpell(S_HAMMER))
694 break;
695 case N_TRAINER_AXE: //Kilram
696 if (!HasWeaponSub(player))
698 if (player->HasSpell(S_AXE))
700 break;
701 case N_TRAINER_SWORD: //Seril Scourgebane
702 if (!HasWeaponSub(player))
704 if (player->HasSpell(S_SWORD))
706 break;
707 }
708 }
709
710 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
711 return true;
712 }
std::uint32_t uint32
Definition: Define.h:108
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const guid)
Definition: ScriptedGossip.cpp:45
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition: ScriptedGossip.cpp:28
#define GOSSIP_TEXT_TRAIN
Definition: ScriptedGossip.h:26
#define GOSSIP_TEXT_BROWSE_GOODS
Definition: ScriptedGossip.h:25
@ GOSSIP_SENDER_MAIN
Definition: ScriptedGossip.h:70
@ GOSSIP_ACTION_TRADE
Definition: ScriptedGossip.h:56
@ GOSSIP_ACTION_TRAIN
Definition: ScriptedGossip.h:57
@ GOSSIP_ACTION_INFO_DEF
Definition: ScriptedGossip.h:68
@ GOSSIP_ICON_CHAT
Definition: GossipDef.h:60
@ GOSSIP_ICON_TRAINER
Definition: GossipDef.h:63
@ GOSSIP_ICON_VENDOR
Definition: GossipDef.h:61
@ S_WEAPON
Definition: npc_professions.cpp:111
@ S_ARMOR
Definition: npc_professions.cpp:112
#define GOSSIP_UNLEARN_HAMMER
Definition: npc_professions.cpp:81
#define GOSSIP_LEARN_HAMMER
Definition: npc_professions.cpp:80
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:55
#define GOSSIP_UNLEARN_AXE
Definition: npc_professions.cpp:83
#define GOSSIP_ARMOR_LEARN
Definition: npc_professions.cpp:74
#define GOSSIP_LEARN_AXE
Definition: npc_professions.cpp:82
#define GOSSIP_WEAPON_UNLEARN
Definition: npc_professions.cpp:73
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:56
#define GOSSIP_WEAPON_LEARN
Definition: npc_professions.cpp:72
@ N_TRAINER_SMITHOMNI1
Definition: npc_professions.cpp:194
@ N_TRAINER_SMITHOMNI2
Definition: npc_professions.cpp:195
@ N_TRAINER_AXE
Definition: npc_professions.cpp:201
@ N_TRAINER_ARMOR1
Definition: npc_professions.cpp:198
@ N_TRAINER_HAMMER
Definition: npc_professions.cpp:200
@ N_TRAINER_WEAPON1
Definition: npc_professions.cpp:196
@ N_TRAINER_ARMOR2
Definition: npc_professions.cpp:199
@ N_TRAINER_WEAPON2
Definition: npc_professions.cpp:197
@ N_TRAINER_SWORD
Definition: npc_professions.cpp:202
#define GOSSIP_ARMOR_UNLEARN
Definition: npc_professions.cpp:75
#define GOSSIP_UNLEARN_SWORD
Definition: npc_professions.cpp:85
#define GOSSIP_LEARN_SWORD
Definition: npc_professions.cpp:84
@ SKILL_BLACKSMITHING
Definition: SharedDefines.h:2909
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1401
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5418
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1416
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:403
bool IsTrainer() const
Definition: Unit.h:1666
bool IsQuestGiver() const
Definition: Unit.h:1667
bool IsVendor() const
Definition: Unit.h:1665
uint8 GetLevel() const
Definition: Unit.h:1432
bool HasWeaponSub(Player *player)
Definition: npc_professions.cpp:638

References AddGossipItemFor(), Player::GetBaseSkillValue(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), Unit::GetLevel(), Player::GetQuestRewardStatus(), Player::GetQuestStatus(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ACTION_TRADE, GOSSIP_ACTION_TRAIN, GOSSIP_ARMOR_LEARN, GOSSIP_ARMOR_UNLEARN, GOSSIP_ICON_CHAT, GOSSIP_ICON_TRAINER, GOSSIP_ICON_VENDOR, GOSSIP_LEARN_AXE, GOSSIP_LEARN_HAMMER, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_UNLEARN, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_TEXT_TRAIN, GOSSIP_UNLEARN_AXE, GOSSIP_UNLEARN_HAMMER, GOSSIP_UNLEARN_SWORD, GOSSIP_WEAPON_LEARN, GOSSIP_WEAPON_UNLEARN, Player::HasSpell(), HasWeaponSub(), Unit::IsQuestGiver(), Unit::IsTrainer(), Unit::IsVendor(), N_TRAINER_ARMOR1, N_TRAINER_ARMOR2, N_TRAINER_AXE, N_TRAINER_HAMMER, N_TRAINER_SMITHOMNI1, N_TRAINER_SMITHOMNI2, N_TRAINER_SWORD, N_TRAINER_WEAPON1, N_TRAINER_WEAPON2, Player::PrepareQuestMenu(), S_ARMOR, S_AXE, S_HAMMER, S_SWORD, S_WEAPON, SendGossipMenuFor(), and SKILL_BLACKSMITHING.

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

824 {
825 ClearGossipMenuFor(player);
826 switch (sender)
827 {
829 SendActionMenu(player, creature, action);
830 break;
831
833 SendConfirmLearn(player, creature, action);
834 break;
835
837 SendConfirmUnlearn(player, creature, action);
838 break;
839
841 SendActionMenu(player, creature, action);
842 break;
843 }
844 return true;
845 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:57
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:789
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:764
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:714

References ClearGossipMenuFor(), GOSSIP_SENDER_CHECK, GOSSIP_SENDER_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_UNLEARN, SendActionMenu(), SendConfirmLearn(), and SendConfirmUnlearn().

◆ SendActionMenu()

void npc_prof_blacksmith::SendActionMenu ( Player player,
Creature creature,
uint32  action 
)
inline
715 {
716 switch (action)
717 {
719 player->GetSession()->SendListInventory(creature->GetGUID());
720 break;
722 player->GetSession()->SendTrainerList(creature->GetGUID());
723 break;
724 //Learn Armor/Weapon
725 case GOSSIP_ACTION_INFO_DEF + 1:
726 ProcessCastaction(player, creature, S_ARMOR, S_LEARN_ARMOR, 0);
727 break;
728 case GOSSIP_ACTION_INFO_DEF + 2:
729 ProcessCastaction(player, creature, S_WEAPON, S_LEARN_WEAPON, 0);
730 break;
731 //Unlearn Armor/Weapon
732 case GOSSIP_ACTION_INFO_DEF + 3:
733 if (HasWeaponSub(player))
734 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
735 else
737 break;
738 case GOSSIP_ACTION_INFO_DEF + 4:
740 break;
741 //Learn Hammer/Axe/Sword
742 case GOSSIP_ACTION_INFO_DEF + 5:
743 ProcessCastaction(player, creature, S_HAMMER, S_LEARN_HAMMER, 0);
744 break;
745 case GOSSIP_ACTION_INFO_DEF + 6:
746 ProcessCastaction(player, creature, S_AXE, S_LEARN_AXE, 0);
747 break;
748 case GOSSIP_ACTION_INFO_DEF + 7:
749 ProcessCastaction(player, creature, S_SWORD, S_LEARN_SWORD, 0);
750 break;
751 //Unlearn Hammer/Axe/Sword
752 case GOSSIP_ACTION_INFO_DEF + 8:
753 ProcessUnlearnAction(player, creature, S_UNLEARN_HAMMER, 0, DoMedUnlearnCost(player));
754 break;
755 case GOSSIP_ACTION_INFO_DEF + 9:
756 ProcessUnlearnAction(player, creature, S_UNLEARN_AXE, 0, DoMedUnlearnCost(player));
757 break;
758 case GOSSIP_ACTION_INFO_DEF + 10:
759 ProcessUnlearnAction(player, creature, S_UNLEARN_SWORD, 0, DoMedUnlearnCost(player));
760 break;
761 }
762 }
@ S_LEARN_WEAPON
Definition: npc_professions.cpp:117
@ S_REP_WEAPON
Definition: npc_professions.cpp:130
@ S_UNLEARN_SWORD
Definition: npc_professions.cpp:127
@ S_UNLEARN_WEAPON
Definition: npc_professions.cpp:123
@ S_LEARN_ARMOR
Definition: npc_professions.cpp:118
@ S_UNLEARN_HAMMER
Definition: npc_professions.cpp:125
@ S_LEARN_HAMMER
Definition: npc_professions.cpp:119
@ S_LEARN_AXE
Definition: npc_professions.cpp:120
@ S_REP_ARMOR
Definition: npc_professions.cpp:129
@ S_LEARN_SWORD
Definition: npc_professions.cpp:121
@ S_UNLEARN_AXE
Definition: npc_professions.cpp:126
@ S_UNLEARN_ARMOR
Definition: npc_professions.cpp:124
int32 DoMedUnlearnCost(Player *player)
Definition: npc_professions.cpp:274
int32 DoLowUnlearnCost(Player *player)
Definition: npc_professions.cpp:285
void ProcessCastaction(Player *player, Creature *creature, uint32 spellId, uint32 triggeredSpellId, int32 cost)
Definition: npc_professions.cpp:426
void ProcessUnlearnAction(Player *player, Creature *creature, uint32 spellId, uint32 alternativeSpellId, int32 cost)
Definition: npc_professions.cpp:441
WorldSession * GetSession() const
Definition: Player.h:1961
void SendListInventory(ObjectGuid guid, uint32 vendorEntry=0)
Definition: ItemHandler.cpp:1035
void SendTrainerList(ObjectGuid guid)
Definition: NPCHandler.cpp:87

References DoLowUnlearnCost(), DoMedUnlearnCost(), Player::GetGossipTextId(), Object::GetGUID(), Player::GetSession(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ACTION_TRADE, GOSSIP_ACTION_TRAIN, HasWeaponSub(), ProcessCastaction(), ProcessUnlearnAction(), S_ARMOR, S_AXE, S_HAMMER, S_LEARN_ARMOR, S_LEARN_AXE, S_LEARN_HAMMER, S_LEARN_SWORD, S_LEARN_WEAPON, S_REP_ARMOR, S_REP_WEAPON, S_SWORD, S_UNLEARN_ARMOR, S_UNLEARN_AXE, S_UNLEARN_HAMMER, S_UNLEARN_SWORD, S_UNLEARN_WEAPON, S_WEAPON, SendGossipMenuFor(), WorldSession::SendListInventory(), and WorldSession::SendTrainerList().

Referenced by OnGossipSelect().

◆ SendConfirmLearn()

void npc_prof_blacksmith::SendConfirmLearn ( Player player,
Creature creature,
uint32  action 
)
inline
765 {
766 if (action)
767 {
768 switch (creature->GetEntry())
769 {
770 case N_TRAINER_HAMMER:
772 //unknown textID (TALK_HAMMER_LEARN)
773 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
774 break;
775 case N_TRAINER_AXE:
777 //unknown textID (TALK_AXE_LEARN)
778 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
779 break;
780 case N_TRAINER_SWORD:
782 //unknown textID (TALK_SWORD_LEARN)
783 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
784 break;
785 }
786 }
787 }

References AddGossipItemFor(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_LEARN_HAMMER, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, N_TRAINER_AXE, N_TRAINER_HAMMER, N_TRAINER_SWORD, and SendGossipMenuFor().

Referenced by OnGossipSelect().

◆ SendConfirmUnlearn()

void npc_prof_blacksmith::SendConfirmUnlearn ( Player player,
Creature creature,
uint32  action 
)
inline
790 {
791 if (action)
792 {
793 switch (creature->GetEntry())
794 {
795 case N_TRAINER_WEAPON1: //Ironus Coldsteel
796 case N_TRAINER_WEAPON2: //Borgosh Corebender
797 case N_TRAINER_ARMOR1: //Grumnus Steelshaper
798 case N_TRAINER_ARMOR2: //Okothos Ironrager
800 //unknown textID (TALK_UNLEARN_AXEORWEAPON)
801 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
802 break;
803
804 case N_TRAINER_HAMMER:
806 //unknown textID (TALK_HAMMER_UNLEARN)
807 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
808 break;
809 case N_TRAINER_AXE:
811 //unknown textID (TALK_AXE_UNLEARN)
812 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
813 break;
814 case N_TRAINER_SWORD:
816 //unknown textID (TALK_SWORD_UNLEARN)
817 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
818 break;
819 }
820 }
821 }
#define BOX_UNLEARN_ARMORORWEAPON
Definition: npc_professions.cpp:78
#define GOSSIP_UNLEARN_SMITH_SPEC
Definition: npc_professions.cpp:77
#define BOX_UNLEARN_WEAPON_SPEC
Definition: npc_professions.cpp:87

References AddGossipItemFor(), BOX_UNLEARN_ARMORORWEAPON, BOX_UNLEARN_WEAPON_SPEC, DoLowUnlearnCost(), DoMedUnlearnCost(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_SENDER_CHECK, GOSSIP_UNLEARN_AXE, GOSSIP_UNLEARN_HAMMER, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_UNLEARN_SWORD, N_TRAINER_ARMOR1, N_TRAINER_ARMOR2, N_TRAINER_AXE, N_TRAINER_HAMMER, N_TRAINER_SWORD, N_TRAINER_WEAPON1, N_TRAINER_WEAPON2, and SendGossipMenuFor().

Referenced by OnGossipSelect().