AzeorthCore 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
1072: CreatureScript("npc_prof_tailor") { }
Definition: ScriptMgr.h:718

Member Function Documentation

◆ HasTailorSpell()

bool npc_prof_tailor::HasTailorSpell ( Player player)
inline
1075 {
1076 return (player->HasSpell(S_MOONCLOTH) || player->HasSpell(S_SHADOWEAVE) || player->HasSpell(S_SPELLFIRE));
1077 }
@ 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:3812

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.

1080 {
1081 if (creature->IsQuestGiver())
1082 player->PrepareQuestMenu(creature->GetGUID());
1083
1084 if (creature->IsVendor())
1086
1087 //TAILORING SPEC
1088 if (player->HasSkill(SKILL_TAILORING) && player->GetBaseSkillValue(SKILL_TAILORING) >= 350 && player->getLevel() > 59)
1089 {
1090 if (player->GetQuestRewardStatus(10831) || player->GetQuestRewardStatus(10832) || player->GetQuestRewardStatus(10833))
1091 {
1092 switch (creature->GetEntry())
1093 {
1094 case N_TRAINER_SPELLFIRE: //Gidge Spellweaver
1095 if (!HasTailorSpell(player))
1097 if (player->HasSpell(S_SPELLFIRE))
1098 {
1101 }
1102 break;
1103 case N_TRAINER_MOONCLOTH: //Nasmara Moonsong
1104 if (!HasTailorSpell(player))
1106 if (player->HasSpell(S_MOONCLOTH))
1107 {
1110 }
1111 break;
1112 case N_TRAINER_SHADOWEAVE: //Andrion Darkspinner
1113 if (!HasTailorSpell(player))
1115 if (player->HasSpell(S_SHADOWEAVE))
1116 {
1119 }
1120 break;
1121 }
1122 }
1123 }
1124
1125 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
1126 return true;
1127 }
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:2894
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:1392
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5319
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5391
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:38
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:405
bool IsQuestGiver() const
Definition: Unit.h:1689
bool IsVendor() const
Definition: Unit.h:1687
uint8 getLevel() const
Definition: Unit.h:1418
bool HasTailorSpell(Player *player)
Definition: npc_professions.cpp:1074

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::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 }
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: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: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:1947
void SendListInventory(ObjectGuid guid, uint32 vendorEntry=0)
Definition: ItemHandler.cpp:992
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: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().