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

Public Member Functions

 npc_engineering_tele_trinket ()
 
bool CanLearn (Player *player, uint32 textId, uint32 altTextId, uint32 skillValue, uint32 reqSpellId, uint32 spellId, uint32 &npcTextId)
 
bool OnGossipHello (Player *player, Creature *creature) override
 
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_engineering_tele_trinket()

npc_engineering_tele_trinket::npc_engineering_tele_trinket ( )
inline
877: CreatureScript("npc_engineering_tele_trinket") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ CanLearn()

bool npc_engineering_tele_trinket::CanLearn ( Player player,
uint32  textId,
uint32  altTextId,
uint32  skillValue,
uint32  reqSpellId,
uint32  spellId,
uint32 npcTextId 
)
inline
880 {
881 bool res = false;
882 npcTextId = textId;
883 if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
884 {
885 if (!player->HasSpell(spellId))
886 res = true;
887 else
888 npcTextId = altTextId;
889 }
890 return res;
891 }
@ SKILL_ENGINEERING
Definition: SharedDefines.h:2923
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5418
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3831

References Player::GetBaseSkillValue(), Player::HasSpell(), and SKILL_ENGINEERING.

Referenced by OnGossipHello().

◆ OnGossipHello()

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

Reimplemented from CreatureScript.

894 {
895 uint32 npcTextId = 0;
896 std::string gossipItem;
897 bool canLearn = false;
898
899 if (player->HasSkill(SKILL_ENGINEERING))
900 {
901 switch (creature->GetEntry())
902 {
903 case NPC_ZAP:
904 canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
905 if (canLearn)
906 gossipItem = GOSSIP_ITEM_ZAP;
907 break;
908 case NPC_JHORDY:
909 canLearn = CanLearn(player, 7251, 7252, 260, S_GNOMISH, SPELL_TO_GADGET, npcTextId);
910 if (canLearn)
911 gossipItem = GOSSIP_ITEM_JHORDY;
912 break;
913 case NPC_KABLAM:
914 canLearn = CanLearn(player, 10365, 0, 350, S_GOBLIN, SPELL_TO_AREA52, npcTextId);
915 if (canLearn)
916 gossipItem = GOSSIP_ITEM_KABLAM;
917 break;
918 case NPC_SMILES:
919 canLearn = CanLearn(player, 10363, 0, 350, S_GNOMISH, SPELL_TO_TOSHLEY, npcTextId);
920 if (canLearn)
921 gossipItem = GOSSIP_ITEM_KABLAM;
922 break;
923 }
924 }
925
926 if (canLearn)
927 AddGossipItemFor(player, GOSSIP_ICON_CHAT, gossipItem, creature->GetEntry(), GOSSIP_ACTION_INFO_DEF + 1);
928
929 SendGossipMenuFor(player, npcTextId ? npcTextId : player->GetGossipTextId(creature), creature->GetGUID());
930 return true;
931 }
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
@ GOSSIP_ACTION_INFO_DEF
Definition: ScriptedGossip.h:68
@ GOSSIP_ICON_CHAT
Definition: GossipDef.h:60
@ S_GNOMISH
Definition: npc_professions.cpp:151
@ S_GOBLIN
Definition: npc_professions.cpp:150
#define GOSSIP_ITEM_KABLAM
Definition: npc_professions.cpp:872
@ NPC_SMILES
Definition: npc_professions.cpp:857
@ SPELL_TO_GADGET
Definition: npc_professions.cpp:865
@ NPC_ZAP
Definition: npc_professions.cpp:854
@ NPC_JHORDY
Definition: npc_professions.cpp:855
@ SPELL_TO_EVERLOOK
Definition: npc_professions.cpp:864
@ SPELL_TO_AREA52
Definition: npc_professions.cpp:866
@ SPELL_TO_TOSHLEY
Definition: npc_professions.cpp:867
@ NPC_KABLAM
Definition: npc_professions.cpp:856
#define GOSSIP_ITEM_ZAP
Definition: npc_professions.cpp:870
#define GOSSIP_ITEM_JHORDY
Definition: npc_professions.cpp:871
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5346
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:403
bool CanLearn(Player *player, uint32 textId, uint32 altTextId, uint32 skillValue, uint32 reqSpellId, uint32 spellId, uint32 &npcTextId)
Definition: npc_professions.cpp:879

References AddGossipItemFor(), CanLearn(), Object::GetEntry(), Player::GetGossipTextId(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ICON_CHAT, GOSSIP_ITEM_JHORDY, GOSSIP_ITEM_KABLAM, GOSSIP_ITEM_ZAP, Player::HasSkill(), NPC_JHORDY, NPC_KABLAM, NPC_SMILES, NPC_ZAP, S_GNOMISH, S_GOBLIN, SendGossipMenuFor(), SKILL_ENGINEERING, SPELL_TO_AREA52, SPELL_TO_EVERLOOK, SPELL_TO_GADGET, and SPELL_TO_TOSHLEY.

◆ OnGossipSelect()

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

Reimplemented from CreatureScript.

934 {
935 ClearGossipMenuFor(player);
936 if (action == GOSSIP_ACTION_INFO_DEF + 1)
937 CloseGossipMenuFor(player);
938
939 if (sender != creature->GetEntry())
940 return true;
941
942 switch (sender)
943 {
944 case NPC_ZAP:
945 player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false);
946 break;
947 case NPC_JHORDY:
948 player->CastSpell(player, SPELL_LEARN_TO_GADGET, false);
949 break;
950 case NPC_KABLAM:
951 player->CastSpell(player, SPELL_LEARN_TO_AREA52, false);
952 break;
953 case NPC_SMILES:
954 player->CastSpell(player, SPELL_LEARN_TO_TOSHLEY, false);
955 break;
956 }
957
958 return true;
959 }
void ClearGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
@ SPELL_LEARN_TO_EVERLOOK
Definition: npc_professions.cpp:859
@ SPELL_LEARN_TO_GADGET
Definition: npc_professions.cpp:860
@ SPELL_LEARN_TO_AREA52
Definition: npc_professions.cpp:861
@ SPELL_LEARN_TO_TOSHLEY
Definition: npc_professions.cpp:862
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169

References Unit::CastSpell(), ClearGossipMenuFor(), CloseGossipMenuFor(), Object::GetEntry(), GOSSIP_ACTION_INFO_DEF, NPC_JHORDY, NPC_KABLAM, NPC_SMILES, NPC_ZAP, SPELL_LEARN_TO_AREA52, SPELL_LEARN_TO_EVERLOOK, SPELL_LEARN_TO_GADGET, and SPELL_LEARN_TO_TOSHLEY.