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

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

Member Function Documentation

◆ HasTailorSpell()

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

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.

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

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.

1212 {
1213 ClearGossipMenuFor(player);
1214 switch (sender)
1215 {
1216 case GOSSIP_SENDER_MAIN:
1217 SendActionMenu(player, creature, action);
1218 break;
1219
1221 SendConfirmLearn(player, creature, action);
1222 break;
1223
1225 SendConfirmUnlearn(player, creature, action);
1226 break;
1227
1229 SendActionMenu(player, creature, action);
1230 break;
1231 }
1232 return true;
1233 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
#define GOSSIP_SENDER_CHECK
Definition: npc_professions.cpp:57
void SendActionMenu(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1128
void SendConfirmLearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1161
void SendConfirmUnlearn(Player *player, Creature *creature, uint32 action)
Definition: npc_professions.cpp:1186

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
1129 {
1130 switch (action)
1131 {
1133 player->GetSession()->SendListInventory(creature->GetGUID());
1134 break;
1136 player->GetSession()->SendTrainerList(creature->GetGUID());
1137 break;
1138 //Learn Tailor
1139 case GOSSIP_ACTION_INFO_DEF + 1:
1140 ProcessCastaction(player, creature, S_SPELLFIRE, S_LEARN_SPELLFIRE, DoLearnCost(player));
1141 break;
1142 case GOSSIP_ACTION_INFO_DEF + 2:
1143 ProcessCastaction(player, creature, S_MOONCLOTH, S_LEARN_MOONCLOTH, DoLearnCost(player));
1144 break;
1145 case GOSSIP_ACTION_INFO_DEF + 3:
1146 ProcessCastaction(player, creature, S_SHADOWEAVE, S_LEARN_SHADOWEAVE, DoLearnCost(player));
1147 break;
1148 //Unlearn Tailor
1149 case GOSSIP_ACTION_INFO_DEF + 4:
1150 ProcessUnlearnAction(player, creature, S_UNLEARN_SPELLFIRE, 0, DoHighUnlearnCost(player));
1151 break;
1152 case GOSSIP_ACTION_INFO_DEF + 5:
1153 ProcessUnlearnAction(player, creature, S_UNLEARN_MOONCLOTH, 0, DoHighUnlearnCost(player));
1154 break;
1155 case GOSSIP_ACTION_INFO_DEF + 6:
1156 ProcessUnlearnAction(player, creature, S_UNLEARN_SHADOWEAVE, 0, DoHighUnlearnCost(player));
1157 break;
1158 }
1159 }
@ S_LEARN_MOONCLOTH
Definition: npc_professions.cpp:163
@ S_UNLEARN_SPELLFIRE
Definition: npc_professions.cpp:166
@ S_UNLEARN_SHADOWEAVE
Definition: npc_professions.cpp:168
@ S_LEARN_SPELLFIRE
Definition: npc_professions.cpp:162
@ S_LEARN_SHADOWEAVE
Definition: npc_professions.cpp:164
@ S_UNLEARN_MOONCLOTH
Definition: npc_professions.cpp:167
int32 DoHighUnlearnCost(Player *)
Definition: npc_professions.cpp:269
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
int32 DoLearnCost(Player *)
Definition: npc_professions.cpp:264
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 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
1162 {
1163 if (action)
1164 {
1165 switch (creature->GetEntry())
1166 {
1169 //unknown textID ()
1170 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1171 break;
1174 //unknown textID ()
1175 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1176 break;
1179 //unknown textID ()
1180 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1181 break;
1182 }
1183 }
1184 }

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
1187 {
1188 if (action)
1189 {
1190 switch (creature->GetEntry())
1191 {
1192 case N_TRAINER_SPELLFIRE: //Gidge Spellweaver
1194 //unknown textID ()
1195 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1196 break;
1197 case N_TRAINER_MOONCLOTH: //Nasmara Moonsong
1199 //unknown textID ()
1200 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1201 break;
1202 case N_TRAINER_SHADOWEAVE: //Andrion Darkspinner
1204 //unknown textID ()
1205 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1206 break;
1207 }
1208 }
1209 }
#define BOX_UNLEARN_TAILOR_SPEC
Definition: npc_professions.cpp:96

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