TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_engineering_tele_trinket Class Reference

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
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Creature *)
 
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 OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
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 UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

npc_engineering_tele_trinket::npc_engineering_tele_trinket ( )
inline
844 : CreatureScript("npc_engineering_tele_trinket") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

bool npc_engineering_tele_trinket::CanLearn ( Player player,
uint32  textId,
uint32  altTextId,
uint32  skillValue,
uint32  reqSpellId,
uint32  spellId,
uint32 npcTextId 
)
inline
847  {
848  bool res = false;
849  npcTextId = textId;
850  if (player->GetBaseSkillValue(SKILL_ENGINEERING) >= skillValue && player->HasSpell(reqSpellId))
851  {
852  if (!player->HasSpell(spellId))
853  res = true;
854  else
855  npcTextId = altTextId;
856  }
857  return res;
858  }
Definition: SharedDefines.h:3942

+ Here is the caller graph for this function:

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

Reimplemented from CreatureScript.

861  {
862  uint32 npcTextId = 0;
863  std::string gossipItem;
864  bool canLearn = false;
865 
866  if (player->HasSkill(SKILL_ENGINEERING))
867  {
868  switch (creature->GetEntry())
869  {
870  case NPC_ZAP:
871  canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
872  if (canLearn)
873  gossipItem = GOSSIP_ITEM_ZAP;
874  break;
875  case NPC_JHORDY:
876  canLearn = CanLearn(player, 7251, 7252, 260, S_GNOMISH, SPELL_TO_GADGET, npcTextId);
877  if (canLearn)
878  gossipItem = GOSSIP_ITEM_JHORDY;
879  break;
880  case NPC_KABLAM:
881  canLearn = CanLearn(player, 10365, 0, 350, S_GOBLIN, SPELL_TO_AREA52, npcTextId);
882  if (canLearn)
883  gossipItem = GOSSIP_ITEM_KABLAM;
884  break;
885  case NPC_SMILES:
886  canLearn = CanLearn(player, 10363, 0, 350, S_GNOMISH, SPELL_TO_TOSHLEY, npcTextId);
887  if (canLearn)
888  gossipItem = GOSSIP_ITEM_KABLAM;
889  break;
890  }
891  }
892 
893  if (canLearn)
894  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, gossipItem, creature->GetEntry(), GOSSIP_ACTION_INFO_DEF + 1);
895 
896  player->SEND_GOSSIP_MENU(npcTextId ? npcTextId : player->GetGossipTextId(creature), creature->GetGUID());
897  return true;
898  }
Definition: ScriptedGossip.h:71
Definition: SharedDefines.h:3942
Definition: npc_professions.cpp:831
Definition: npc_professions.cpp:833
Definition: npc_professions.cpp:150
bool CanLearn(Player *player, uint32 textId, uint32 altTextId, uint32 skillValue, uint32 reqSpellId, uint32 spellId, uint32 &npcTextId)
Definition: npc_professions.cpp:846
#define GOSSIP_ITEM_JHORDY
Definition: npc_professions.cpp:838
Definition: npc_professions.cpp:832
uint32_t uint32
Definition: Define.h:150
Definition: npc_professions.cpp:151
Definition: npc_professions.cpp:821
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define GOSSIP_ITEM_KABLAM
Definition: npc_professions.cpp:839
Definition: GossipDef.h:59
#define GOSSIP_ITEM_ZAP
Definition: npc_professions.cpp:837
Definition: npc_professions.cpp:824
uint32 GetEntry() const
Definition: Object.h:107
Definition: npc_professions.cpp:834
Definition: npc_professions.cpp:823
Definition: npc_professions.cpp:822

+ Here is the call graph for this function:

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

Reimplemented from CreatureScript.

901  {
902  player->PlayerTalkClass->ClearMenus();
903  if (action == GOSSIP_ACTION_INFO_DEF + 1)
904  player->CLOSE_GOSSIP_MENU();
905 
906  if (sender != creature->GetEntry())
907  return true;
908 
909  switch (sender)
910  {
911  case NPC_ZAP:
912  player->CastSpell(player, SPELL_LEARN_TO_EVERLOOK, false);
913  break;
914  case NPC_JHORDY:
915  player->CastSpell(player, SPELL_LEARN_TO_GADGET, false);
916  break;
917  case NPC_KABLAM:
918  player->CastSpell(player, SPELL_LEARN_TO_AREA52, false);
919  break;
920  case NPC_SMILES:
921  player->CastSpell(player, SPELL_LEARN_TO_TOSHLEY, false);
922  break;
923  }
924 
925  return true;
926  }
Definition: ScriptedGossip.h:71
Definition: npc_professions.cpp:826
Definition: npc_professions.cpp:827
Definition: npc_professions.cpp:829
Definition: npc_professions.cpp:828
Definition: npc_professions.cpp:821
Definition: npc_professions.cpp:824
uint32 GetEntry() const
Definition: Object.h:107
Definition: npc_professions.cpp:823
Definition: npc_professions.cpp:822

+ Here is the call graph for this function:


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