AzeorthCore 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
 

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 ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ item_only_for_flight()

item_only_for_flight::item_only_for_flight ( )
inline
49: ItemScript("item_only_for_flight") { }
Definition: ScriptMgr.h:382

Member Function Documentation

◆ OnUse()

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

Reimplemented from ItemScript.

52 {
53 uint32 itemId = item->GetEntry();
54 bool disabled = false;
55
56 //for special scripts
57 switch (itemId)
58 {
59 case 24538:
60 if (player->GetAreaId() != 3628)
61 disabled = true;
62 break;
63 case 34489:
64 if (player->GetZoneId() != 4080)
65 disabled = true;
66 break;
67 case 34475:
68 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_ARCANE_CHARGES))
70 break;
71 }
72
73 // allow use in flight only
74 if (player->IsInFlight() && !disabled)
75 return false;
76
77 // error
78 player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
79 return true;
80 }
std::uint32_t uint32
Definition: Define.h:108
@ EQUIP_ERR_CANT_DO_RIGHT_NOW
Definition: Item.h:80
#define sSpellMgr
Definition: SpellMgr.h:803
@ SPELL_ARCANE_CHARGES
Definition: item_scripts.cpp:43
@ SPELL_FAILED_NOT_ON_GROUND
Definition: SharedDefines.h:1092
uint32 GetEntry() const
Definition: Object.h:109
uint32 GetAreaId() const
Definition: Object.cpp:3069
uint32 GetZoneId() const
Definition: Object.cpp:3061
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition: PlayerStorage.cpp:4049
bool IsInFlight() const
Definition: Unit.h:1676
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4619
Definition: SpellInfo.h:314

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.