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

npc_engineering_tele_trinket::npc_engineering_tele_trinket ( )
inline
865: 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
868 {
869 bool res = false;
870 npcTextId = textId;
871 if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
872 {
873 if (!player->HasSpell(spellId))
874 res = true;
875 else
876 npcTextId = altTextId;
877 }
878 return res;
879 }
@ SKILL_ENGINEERING
Definition SharedDefines.h:2923
uint16 GetBaseSkillValue(uint32 skill) const
Definition Player.cpp:5508
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3878

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.

882 {
883 uint32 npcTextId = 0;
884 std::string gossipItem;
885 bool canLearn = false;
886
887 if (player->HasSkill(SKILL_ENGINEERING))
888 {
889 switch (creature->GetEntry())
890 {
891 case NPC_ZAP:
892 canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
893 if (canLearn)
894 gossipItem = GOSSIP_ITEM_ZAP;
895 break;
896 case NPC_JHORDY:
897 canLearn = CanLearn(player, 7251, 7252, 260, S_GNOMISH, SPELL_TO_GADGET, npcTextId);
898 if (canLearn)
899 gossipItem = GOSSIP_ITEM_JHORDY;
900 break;
901 case NPC_KABLAM:
902 canLearn = CanLearn(player, 10365, 0, 350, S_GOBLIN, SPELL_TO_AREA52, npcTextId);
903 if (canLearn)
904 gossipItem = GOSSIP_ITEM_KABLAM;
905 break;
906 case NPC_SMILES:
907 canLearn = CanLearn(player, 10363, 0, 350, S_GNOMISH, SPELL_TO_TOSHLEY, npcTextId);
908 if (canLearn)
909 gossipItem = GOSSIP_ITEM_KABLAM;
910 break;
911 }
912 }
913
914 if (canLearn)
915 AddGossipItemFor(player, GOSSIP_ICON_CHAT, gossipItem, creature->GetEntry(), GOSSIP_ACTION_INFO_DEF + 1);
916
917 SendGossipMenuFor(player, npcTextId ? npcTextId : player->GetGossipTextId(creature), creature->GetGUID());
918 return true;
919 }
std::uint32_t uint32
Definition Define.h:107
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:61
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
uint32 GetEntry() const
Definition Object.h:116
bool HasSkill(uint32 skill) const
Definition Player.cpp:5436
bool CanLearn(Player *player, uint32 textId, uint32 altTextId, uint32 skillValue, uint32 reqSpellId, uint32 spellId, uint32 &npcTextId)
Definition npc_professions.cpp:867
@ S_GNOMISH
Definition npc_professions.cpp:139
@ S_GOBLIN
Definition npc_professions.cpp:138
#define GOSSIP_ITEM_KABLAM
Definition npc_professions.cpp:860
@ NPC_SMILES
Definition npc_professions.cpp:845
@ SPELL_TO_GADGET
Definition npc_professions.cpp:853
@ NPC_ZAP
Definition npc_professions.cpp:842
@ NPC_JHORDY
Definition npc_professions.cpp:843
@ SPELL_TO_EVERLOOK
Definition npc_professions.cpp:852
@ SPELL_TO_AREA52
Definition npc_professions.cpp:854
@ SPELL_TO_TOSHLEY
Definition npc_professions.cpp:855
@ NPC_KABLAM
Definition npc_professions.cpp:844
#define GOSSIP_ITEM_ZAP
Definition npc_professions.cpp:858
#define GOSSIP_ITEM_JHORDY
Definition npc_professions.cpp:859

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.

922 {
923 ClearGossipMenuFor(player);
924 if (action == GOSSIP_ACTION_INFO_DEF + 1)
925 CloseGossipMenuFor(player);
926
927 if (sender != creature->GetEntry())
928 return true;
929
930 switch (sender)
931 {
932 case NPC_ZAP:
933 player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false);
934 break;
935 case NPC_JHORDY:
936 player->CastSpell(player, SPELL_LEARN_TO_GADGET, false);
937 break;
938 case NPC_KABLAM:
939 player->CastSpell(player, SPELL_LEARN_TO_AREA52, false);
940 break;
941 case NPC_SMILES:
942 player->CastSpell(player, SPELL_LEARN_TO_TOSHLEY, false);
943 break;
944 }
945
946 return true;
947 }
void ClearGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:22
void CloseGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:56
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:1179
@ SPELL_LEARN_TO_EVERLOOK
Definition npc_professions.cpp:847
@ SPELL_LEARN_TO_GADGET
Definition npc_professions.cpp:848
@ SPELL_LEARN_TO_AREA52
Definition npc_professions.cpp:849
@ SPELL_LEARN_TO_TOSHLEY
Definition npc_professions.cpp:850

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.


The documentation for this class was generated from the following file: