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

Public Member Functions

 item_only_for_flight ()
 
bool OnUse (Player *player, Item *item, SpellCastTargets const &) override
 
- Public Member Functions inherited from ItemScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Item *)
 
virtual bool OnQuestAccept (Player *, Item *, Quest const *)
 
virtual bool OnExpire (Player *, ItemTemplate const *)
 
virtual bool OnRemove (Player *, Item *)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Additional Inherited Members

- Protected Member Functions inherited from ItemScript
 ItemScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

item_only_for_flight::item_only_for_flight ( )
inline
50 : ItemScript("item_only_for_flight") { }
ItemScript(const char *name)
Definition: ScriptMgr.cpp:1580

Member Function Documentation

bool item_only_for_flight::OnUse ( Player player,
Item item,
SpellCastTargets const  
)
inlineoverridevirtual

Reimplemented from ItemScript.

53  {
54  uint32 itemId = item->GetEntry();
55  bool disabled = false;
56 
57  //for special scripts
58  switch (itemId)
59  {
60  case 24538:
61  if (player->GetAreaId() != 3628)
62  disabled = true;
63  break;
64  case 34489:
65  if (player->GetZoneId() != 4080)
66  disabled = true;
67  break;
68  case 34475:
69  if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES))
71  break;
72  }
73 
74  // allow use in flight only
75  if (player->IsInFlight() && !disabled)
76  return false;
77 
78  // error
79  player->SendEquipError(EQUIP_ERR_CLIENT_LOCKED_OUT, item, NULL);
80  return true;
81  }
Definition: SpellInfo.h:326
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, OpcodeServer opcode=SMSG_CAST_FAILED, uint32 *misc=nullptr)
Definition: Spell.cpp:3732
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:1475
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: item_scripts.cpp:44
Definition: Item.h:87
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:


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