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
 
uint16 GetTotalAvailableHooks ()
 
- 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, uint16 totalAvailableHooks=0)
 
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
637: CreatureScript("npc_prof_blacksmith") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ HasWeaponSub()

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

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.

645 {
646 if (creature->IsQuestGiver())
647 player->PrepareQuestMenu(creature->GetGUID());
648
649 if (creature->IsVendor())
651
652 if (creature->IsTrainer())
653 {
655 }
656
657 uint32 creatureId = creature->GetEntry();
658 //WEAPONSMITH & ARMORSMITH
659 if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225)
660 {
661 if (player->GetQuestRewardStatus(5284) || player->GetQuestRewardStatus(5302) || player->GetQuestRewardStatus(5283) || player->GetQuestStatus(5301))
662 {
663 switch (creatureId)
664 {
665 case N_TRAINER_SMITHOMNI1: //Myolor Sunderfury
666 case N_TRAINER_SMITHOMNI2: //Krathok Moltenfist
667 if (!player->HasSpell(S_ARMOR) && !player->HasSpell(S_WEAPON))
669 if (!player->HasSpell(S_WEAPON) && !player->HasSpell(S_ARMOR))
671 break;
672 case N_TRAINER_WEAPON1: //Ironus Coldsteel
673 case N_TRAINER_WEAPON2: //Borgosh Corebender
674 if (player->HasSpell(S_WEAPON))
676 break;
677 case N_TRAINER_ARMOR1: //Grumnus Steelshaper
678 case N_TRAINER_ARMOR2: //Okothos Ironrager
679 if (player->HasSpell(S_ARMOR))
681 break;
682 }
683 }
684 }
685 //WEAPONSMITH SPEC
686 if (player->HasSpell(S_WEAPON) && player->GetLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250)
687 {
688 switch (creatureId)
689 {
690 case N_TRAINER_HAMMER: //Lilith the Lithe
691 if (!HasWeaponSub(player))
693 if (player->HasSpell(S_HAMMER))
695 break;
696 case N_TRAINER_AXE: //Kilram
697 if (!HasWeaponSub(player))
699 if (player->HasSpell(S_AXE))
701 break;
702 case N_TRAINER_SWORD: //Seril Scourgebane
703 if (!HasWeaponSub(player))
705 if (player->HasSpell(S_SWORD))
707 break;
708 }
709 }
710
711 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
712 return true;
713 }
std::uint32_t uint32
Definition: Define.h:107
@ S_WEAPON
Definition: npc_professions.cpp:112
@ S_ARMOR
Definition: npc_professions.cpp:113
#define GOSSIP_UNLEARN_HAMMER
Definition: npc_professions.cpp:82
#define GOSSIP_LEARN_HAMMER
Definition: npc_professions.cpp:81
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:56
#define GOSSIP_UNLEARN_AXE
Definition: npc_professions.cpp:84
#define GOSSIP_ARMOR_LEARN
Definition: npc_professions.cpp:75
#define GOSSIP_LEARN_AXE
Definition: npc_professions.cpp:83
#define GOSSIP_WEAPON_UNLEARN
Definition: npc_professions.cpp:74
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:57
#define GOSSIP_WEAPON_LEARN
Definition: npc_professions.cpp:73
@ N_TRAINER_SMITHOMNI1
Definition: npc_professions.cpp:195
@ N_TRAINER_SMITHOMNI2
Definition: npc_professions.cpp:196
@ N_TRAINER_AXE
Definition: npc_professions.cpp:202
@ N_TRAINER_ARMOR1
Definition: npc_professions.cpp:199
@ N_TRAINER_HAMMER
Definition: npc_professions.cpp:201
@ N_TRAINER_WEAPON1
Definition: npc_professions.cpp:197
@ N_TRAINER_ARMOR2
Definition: npc_professions.cpp:200
@ N_TRAINER_WEAPON2
Definition: npc_professions.cpp:198
@ N_TRAINER_SWORD
Definition: npc_professions.cpp:203
#define GOSSIP_ARMOR_UNLEARN
Definition: npc_professions.cpp:76
#define GOSSIP_UNLEARN_SWORD
Definition: npc_professions.cpp:86
#define GOSSIP_LEARN_SWORD
Definition: npc_professions.cpp:85
@ SKILL_BLACKSMITHING
Definition: SharedDefines.h:2909
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:61
@ GOSSIP_ICON_TRAINER
Definition: GossipDef.h:64
@ GOSSIP_ICON_VENDOR
Definition: GossipDef.h:62
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
bool GetQuestRewardStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1414
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5519
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1429
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsTrainer() const
Definition: Unit.h:761
bool IsQuestGiver() const
Definition: Unit.h:762
bool IsVendor() const
Definition: Unit.h:760
uint8 GetLevel() const
Definition: Unit.h:1024
bool HasWeaponSub(Player *player)
Definition: npc_professions.cpp:639

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.

825 {
826 ClearGossipMenuFor(player);
827 switch (sender)
828 {
830 SendActionMenu(player, creature, action);
831 break;
832
834 SendConfirmLearn(player, creature, action);
835 break;
836
838 SendConfirmUnlearn(player, creature, action);
839 break;
840
842 SendActionMenu(player, creature, action);
843 break;
844 }
845 return true;
846 }
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:58
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:790
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:765
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:715

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
716 {
717 switch (action)
718 {
720 player->GetSession()->SendListInventory(creature->GetGUID());
721 break;
723 player->GetSession()->SendTrainerList(creature->GetGUID());
724 break;
725 //Learn Armor/Weapon
726 case GOSSIP_ACTION_INFO_DEF + 1:
727 ProcessCastaction(player, creature, S_ARMOR, S_LEARN_ARMOR, 0);
728 break;
729 case GOSSIP_ACTION_INFO_DEF + 2:
730 ProcessCastaction(player, creature, S_WEAPON, S_LEARN_WEAPON, 0);
731 break;
732 //Unlearn Armor/Weapon
733 case GOSSIP_ACTION_INFO_DEF + 3:
734 if (HasWeaponSub(player))
735 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
736 else
738 break;
739 case GOSSIP_ACTION_INFO_DEF + 4:
741 break;
742 //Learn Hammer/Axe/Sword
743 case GOSSIP_ACTION_INFO_DEF + 5:
744 ProcessCastaction(player, creature, S_HAMMER, S_LEARN_HAMMER, 0);
745 break;
746 case GOSSIP_ACTION_INFO_DEF + 6:
747 ProcessCastaction(player, creature, S_AXE, S_LEARN_AXE, 0);
748 break;
749 case GOSSIP_ACTION_INFO_DEF + 7:
750 ProcessCastaction(player, creature, S_SWORD, S_LEARN_SWORD, 0);
751 break;
752 //Unlearn Hammer/Axe/Sword
753 case GOSSIP_ACTION_INFO_DEF + 8:
754 ProcessUnlearnAction(player, creature, S_UNLEARN_HAMMER, 0, DoMedUnlearnCost(player));
755 break;
756 case GOSSIP_ACTION_INFO_DEF + 9:
757 ProcessUnlearnAction(player, creature, S_UNLEARN_AXE, 0, DoMedUnlearnCost(player));
758 break;
759 case GOSSIP_ACTION_INFO_DEF + 10:
760 ProcessUnlearnAction(player, creature, S_UNLEARN_SWORD, 0, DoMedUnlearnCost(player));
761 break;
762 }
763 }
@ S_LEARN_WEAPON
Definition: npc_professions.cpp:118
@ S_REP_WEAPON
Definition: npc_professions.cpp:131
@ S_UNLEARN_SWORD
Definition: npc_professions.cpp:128
@ S_UNLEARN_WEAPON
Definition: npc_professions.cpp:124
@ S_LEARN_ARMOR
Definition: npc_professions.cpp:119
@ S_UNLEARN_HAMMER
Definition: npc_professions.cpp:126
@ S_LEARN_HAMMER
Definition: npc_professions.cpp:120
@ S_LEARN_AXE
Definition: npc_professions.cpp:121
@ S_REP_ARMOR
Definition: npc_professions.cpp:130
@ S_LEARN_SWORD
Definition: npc_professions.cpp:122
@ S_UNLEARN_AXE
Definition: npc_professions.cpp:127
@ S_UNLEARN_ARMOR
Definition: npc_professions.cpp:125
int32 DoMedUnlearnCost(Player *player)
Definition: npc_professions.cpp:275
int32 DoLowUnlearnCost(Player *player)
Definition: npc_professions.cpp:286
void ProcessCastaction(Player *player, Creature *creature, uint32 spellId, uint32 triggeredSpellId, int32 cost)
Definition: npc_professions.cpp:427
void ProcessUnlearnAction(Player *player, Creature *creature, uint32 spellId, uint32 alternativeSpellId, int32 cost)
Definition: npc_professions.cpp:442
WorldSession * GetSession() const
Definition: Player.h:1998
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
766 {
767 if (action)
768 {
769 switch (creature->GetEntry())
770 {
771 case N_TRAINER_HAMMER:
773 //unknown textID (TALK_HAMMER_LEARN)
774 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
775 break;
776 case N_TRAINER_AXE:
778 //unknown textID (TALK_AXE_LEARN)
779 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
780 break;
781 case N_TRAINER_SWORD:
783 //unknown textID (TALK_SWORD_LEARN)
784 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
785 break;
786 }
787 }
788 }

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
791 {
792 if (action)
793 {
794 switch (creature->GetEntry())
795 {
796 case N_TRAINER_WEAPON1: //Ironus Coldsteel
797 case N_TRAINER_WEAPON2: //Borgosh Corebender
798 case N_TRAINER_ARMOR1: //Grumnus Steelshaper
799 case N_TRAINER_ARMOR2: //Okothos Ironrager
801 //unknown textID (TALK_UNLEARN_AXEORWEAPON)
802 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
803 break;
804
805 case N_TRAINER_HAMMER:
807 //unknown textID (TALK_HAMMER_UNLEARN)
808 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
809 break;
810 case N_TRAINER_AXE:
812 //unknown textID (TALK_AXE_UNLEARN)
813 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
814 break;
815 case N_TRAINER_SWORD:
817 //unknown textID (TALK_SWORD_UNLEARN)
818 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
819 break;
820 }
821 }
822 }
#define BOX_UNLEARN_ARMORORWEAPON
Definition: npc_professions.cpp:79
#define GOSSIP_UNLEARN_SMITH_SPEC
Definition: npc_professions.cpp:78
#define BOX_UNLEARN_WEAPON_SPEC
Definition: npc_professions.cpp:88

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().