AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
item_only_for_flight Class Reference
Inheritance diagram for item_only_for_flight:
ItemScript ScriptObject

Public Member Functions

 item_only_for_flight ()
 
bool OnUse (Player *player, Item *item, SpellCastTargets const &) override
 
- Public Member Functions inherited from ItemScript
bool IsDatabaseBound () const override
 
virtual bool OnQuestAccept (Player *, Item *, Quest const *)
 
virtual bool OnUse (Player *, Item *, SpellCastTargets const &)
 
virtual bool OnRemove (Player *, Item *)
 
virtual bool OnCastItemCombatSpell (Player *, Unit *, SpellInfo const *, Item *)
 
virtual bool OnExpire (Player *, ItemTemplate const *)
 
virtual void OnGossipSelect (Player *, Item *, uint32, uint32)
 
virtual void OnGossipSelectCode (Player *, Item *, uint32, uint32, const char *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Additional Inherited Members

- Protected Member Functions inherited from ItemScript
 ItemScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ item_only_for_flight()

item_only_for_flight::item_only_for_flight ( )
inline
36: ItemScript("item_only_for_flight") { }
Definition: ItemScript.h:24

Member Function Documentation

◆ OnUse()

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

Reimplemented from ItemScript.

39 {
40 uint32 itemId = item->GetEntry();
41 bool disabled = false;
42
43 //for special scripts
44 switch (itemId)
45 {
46 case 24538:
47 if (player->GetAreaId() != 3628)
48 disabled = true;
49 break;
50 case 34489:
51 if (player->GetZoneId() != 4080)
52 disabled = true;
53 break;
54 case 34475:
55 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES))
57 break;
58 }
59
60 // allow use in flight only
61 if (player->IsInFlight() && !disabled)
62 return false;
63
64 // error
65 player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
66 return true;
67 }
std::uint32_t uint32
Definition: Define.h:107
@ EQUIP_ERR_CANT_DO_RIGHT_NOW
Definition: Item.h:86
#define sSpellMgr
Definition: SpellMgr.h:825
@ SPELL_ARCANE_CHARGES
Definition: item_scripts.cpp:30
@ SPELL_FAILED_NOT_ON_GROUND
Definition: SharedDefines.h:1120
uint32 GetEntry() const
Definition: Object.h:112
uint32 GetAreaId() const
Definition: Object.cpp:3152
uint32 GetZoneId() const
Definition: Object.cpp:3144
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4027
bool IsInFlight() const
Definition: Unit.h:1096
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4661
Definition: SpellInfo.h:316

References EQUIP_ERR_CANT_DO_RIGHT_NOW, WorldObject::GetAreaId(), Object::GetEntry(), WorldObject::GetZoneId(), Unit::IsInFlight(), Spell::SendCastResult(), Player::SendEquipError(), SPELL_ARCANE_CHARGES, SPELL_FAILED_NOT_ON_GROUND, and sSpellMgr.