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

Public Member Functions

 npc_prof_tailor ()
 
bool HasTailorSpell (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_tailor()

npc_prof_tailor::npc_prof_tailor ( )
inline
1070: CreatureScript("npc_prof_tailor") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ HasTailorSpell()

bool npc_prof_tailor::HasTailorSpell ( Player player)
inline
1073 {
1074 return (player->HasSpell(S_MOONCLOTH) || player->HasSpell(S_SHADOWEAVE) || player->HasSpell(S_SPELLFIRE));
1075 }
@ S_MOONCLOTH
Definition: npc_professions.cpp:158
@ S_SPELLFIRE
Definition: npc_professions.cpp:157
@ S_SHADOWEAVE
Definition: npc_professions.cpp:159
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3892

References Player::HasSpell(), S_MOONCLOTH, S_SHADOWEAVE, and S_SPELLFIRE.

Referenced by OnGossipHello().

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

1078 {
1079 if (creature->IsQuestGiver())
1080 player->PrepareQuestMenu(creature->GetGUID());
1081
1082 if (creature->IsVendor())
1084
1085 if (creature->IsTrainer())
1086 {
1088 }
1089
1090 //TAILORING SPEC
1091 if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 350 && player->GetLevel() > 59)
1092 {
1093 if (player->GetQuestRewardStatus(10831) || player->GetQuestRewardStatus(10832) || player->GetQuestRewardStatus(10833))
1094 {
1095 switch (creature->GetEntry())
1096 {
1097 case N_TRAINER_SPELLFIRE: //Gidge Spellweaver
1098 if (!HasTailorSpell(player))
1100 if (player->HasSpell(S_SPELLFIRE))
1101 {
1103 }
1104 break;
1105 case N_TRAINER_MOONCLOTH: //Nasmara Moonsong
1106 if (!HasTailorSpell(player))
1108 if (player->HasSpell(S_MOONCLOTH))
1109 {
1111 }
1112 break;
1113 case N_TRAINER_SHADOWEAVE: //Andrion Darkspinner
1114 if (!HasTailorSpell(player))
1116 if (player->HasSpell(S_SHADOWEAVE))
1117 {
1119 }
1120 break;
1121 }
1122 }
1123 }
1124
1125 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1126 return true;
1127 }
#define GOSSIP_LEARN_SPELLFIRE
Definition: npc_professions.cpp:90
#define GOSSIP_UNLEARN_SHADOWEAVE
Definition: npc_professions.cpp:95
#define GOSSIP_SENDER_LEARN
Definition: npc_professions.cpp:56
#define GOSSIP_LEARN_SHADOWEAVE
Definition: npc_professions.cpp:94
#define GOSSIP_UNLEARN_MOONCLOTH
Definition: npc_professions.cpp:93
#define GOSSIP_SENDER_UNLEARN
Definition: npc_professions.cpp:57
#define GOSSIP_UNLEARN_SPELLFIRE
Definition: npc_professions.cpp:91
@ N_TRAINER_SHADOWEAVE
Definition: npc_professions.cpp:216
@ N_TRAINER_MOONCLOTH
Definition: npc_professions.cpp:215
@ N_TRAINER_SPELLFIRE
Definition: npc_professions.cpp:214
#define GOSSIP_LEARN_MOONCLOTH
Definition: npc_professions.cpp:92
@ SKILL_TAILORING
Definition: SharedDefines.h:2922
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
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5447
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5519
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
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 HasTailorSpell(Player *player)
Definition: npc_professions.cpp:1072

References AddGossipItemFor(), Player::GetBaseSkillValue(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), Unit::GetLevel(), Player::GetQuestRewardStatus(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ACTION_TRADE, GOSSIP_ACTION_TRAIN, GOSSIP_ICON_CHAT, GOSSIP_ICON_TRAINER, GOSSIP_ICON_VENDOR, GOSSIP_LEARN_MOONCLOTH, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_UNLEARN, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_TEXT_TRAIN, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_UNLEARN_SPELLFIRE, Player::HasSkill(), Player::HasSpell(), HasTailorSpell(), Unit::IsQuestGiver(), Unit::IsTrainer(), Unit::IsVendor(), N_TRAINER_MOONCLOTH, N_TRAINER_SHADOWEAVE, N_TRAINER_SPELLFIRE, Player::PrepareQuestMenu(), S_MOONCLOTH, S_SHADOWEAVE, S_SPELLFIRE, SendGossipMenuFor(), and SKILL_TAILORING.

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

1213 {
1214 ClearGossipMenuFor(player);
1215 switch (sender)
1216 {
1217 case GOSSIP_SENDER_MAIN:
1218 SendActionMenu(player, creature, action);
1219 break;
1220
1222 SendConfirmLearn(player, creature, action);
1223 break;
1224
1226 SendConfirmUnlearn(player, creature, action);
1227 break;
1228
1230 SendActionMenu(player, creature, action);
1231 break;
1232 }
1233 return true;
1234 }
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:58
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1129
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1162
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1187

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

◆ SendActionMenu()

void npc_prof_tailor::SendActionMenu ( Player player,
Creature creature,
uint32  action 
)
inline
1130 {
1131 switch (action)
1132 {
1134 player->GetSession()->SendListInventory(creature->GetGUID());
1135 break;
1137 player->GetSession()->SendTrainerList(creature->GetGUID());
1138 break;
1139 //Learn Tailor
1140 case GOSSIP_ACTION_INFO_DEF + 1:
1141 ProcessCastaction(player, creature, S_SPELLFIRE, S_LEARN_SPELLFIRE, DoLearnCost(player));
1142 break;
1143 case GOSSIP_ACTION_INFO_DEF + 2:
1144 ProcessCastaction(player, creature, S_MOONCLOTH, S_LEARN_MOONCLOTH, DoLearnCost(player));
1145 break;
1146 case GOSSIP_ACTION_INFO_DEF + 3:
1147 ProcessCastaction(player, creature, S_SHADOWEAVE, S_LEARN_SHADOWEAVE, DoLearnCost(player));
1148 break;
1149 //Unlearn Tailor
1150 case GOSSIP_ACTION_INFO_DEF + 4:
1151 ProcessUnlearnAction(player, creature, S_UNLEARN_SPELLFIRE, 0, DoHighUnlearnCost(player));
1152 break;
1153 case GOSSIP_ACTION_INFO_DEF + 5:
1154 ProcessUnlearnAction(player, creature, S_UNLEARN_MOONCLOTH, 0, DoHighUnlearnCost(player));
1155 break;
1156 case GOSSIP_ACTION_INFO_DEF + 6:
1157 ProcessUnlearnAction(player, creature, S_UNLEARN_SHADOWEAVE, 0, DoHighUnlearnCost(player));
1158 break;
1159 }
1160 }
@ S_LEARN_MOONCLOTH
Definition: npc_professions.cpp:164
@ S_UNLEARN_SPELLFIRE
Definition: npc_professions.cpp:167
@ S_UNLEARN_SHADOWEAVE
Definition: npc_professions.cpp:169
@ S_LEARN_SPELLFIRE
Definition: npc_professions.cpp:163
@ S_LEARN_SHADOWEAVE
Definition: npc_professions.cpp:165
@ S_UNLEARN_MOONCLOTH
Definition: npc_professions.cpp:168
int32 DoHighUnlearnCost(Player *)
Definition: npc_professions.cpp:270
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
int32 DoLearnCost(Player *)
Definition: npc_professions.cpp:265
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 DoHighUnlearnCost(), DoLearnCost(), Object::GetGUID(), Player::GetSession(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ACTION_TRADE, GOSSIP_ACTION_TRAIN, ProcessCastaction(), ProcessUnlearnAction(), S_LEARN_MOONCLOTH, S_LEARN_SHADOWEAVE, S_LEARN_SPELLFIRE, S_MOONCLOTH, S_SHADOWEAVE, S_SPELLFIRE, S_UNLEARN_MOONCLOTH, S_UNLEARN_SHADOWEAVE, S_UNLEARN_SPELLFIRE, WorldSession::SendListInventory(), and WorldSession::SendTrainerList().

Referenced by OnGossipSelect().

◆ SendConfirmLearn()

void npc_prof_tailor::SendConfirmLearn ( Player player,
Creature creature,
uint32  action 
)
inline
1163 {
1164 if (action)
1165 {
1166 switch (creature->GetEntry())
1167 {
1170 //unknown textID ()
1171 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1172 break;
1175 //unknown textID ()
1176 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1177 break;
1180 //unknown textID ()
1181 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1182 break;
1183 }
1184 }
1185 }

References AddGossipItemFor(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, N_TRAINER_MOONCLOTH, N_TRAINER_SHADOWEAVE, N_TRAINER_SPELLFIRE, and SendGossipMenuFor().

Referenced by OnGossipSelect().

◆ SendConfirmUnlearn()

void npc_prof_tailor::SendConfirmUnlearn ( Player player,
Creature creature,
uint32  action 
)
inline
1188 {
1189 if (action)
1190 {
1191 switch (creature->GetEntry())
1192 {
1193 case N_TRAINER_SPELLFIRE: //Gidge Spellweaver
1195 //unknown textID ()
1196 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1197 break;
1198 case N_TRAINER_MOONCLOTH: //Nasmara Moonsong
1200 //unknown textID ()
1201 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1202 break;
1203 case N_TRAINER_SHADOWEAVE: //Andrion Darkspinner
1205 //unknown textID ()
1206 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1207 break;
1208 }
1209 }
1210 }
#define BOX_UNLEARN_TAILOR_SPEC
Definition: npc_professions.cpp:97

References AddGossipItemFor(), BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_SENDER_CHECK, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_UNLEARN_SPELLFIRE, N_TRAINER_MOONCLOTH, N_TRAINER_SHADOWEAVE, N_TRAINER_SPELLFIRE, and SendGossipMenuFor().

Referenced by OnGossipSelect().