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
 
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
878: 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
881 {
882 bool res = false;
883 npcTextId = textId;
884 if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
885 {
886 if (!player->HasSpell(spellId))
887 res = true;
888 else
889 npcTextId = altTextId;
890 }
891 return res;
892 }
@ SKILL_ENGINEERING
Definition: SharedDefines.h:2923
uint16 GetBaseSkillValue(uint32 skill) const
Definition: Player.cpp:5519
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3892

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.

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

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.

935 {
936 ClearGossipMenuFor(player);
937 if (action == GOSSIP_ACTION_INFO_DEF + 1)
938 CloseGossipMenuFor(player);
939
940 if (sender != creature->GetEntry())
941 return true;
942
943 switch (sender)
944 {
945 case NPC_ZAP:
946 player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false);
947 break;
948 case NPC_JHORDY:
949 player->CastSpell(player, SPELL_LEARN_TO_GADGET, false);
950 break;
951 case NPC_KABLAM:
952 player->CastSpell(player, SPELL_LEARN_TO_AREA52, false);
953 break;
954 case NPC_SMILES:
955 player->CastSpell(player, SPELL_LEARN_TO_TOSHLEY, false);
956 break;
957 }
958
959 return true;
960 }
@ SPELL_LEARN_TO_EVERLOOK
Definition: npc_professions.cpp:860
@ SPELL_LEARN_TO_GADGET
Definition: npc_professions.cpp:861
@ SPELL_LEARN_TO_AREA52
Definition: npc_professions.cpp:862
@ SPELL_LEARN_TO_TOSHLEY
Definition: npc_professions.cpp:863
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:1167

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.