AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_love_is_in_the_air_romantic_picnic Class Reference
Inheritance diagram for spell_love_is_in_the_air_romantic_picnic:
AuraScript _SpellScript

Private Member Functions

 PrepareAuraScript (spell_love_is_in_the_air_romantic_picnic)
 
void OnApply (AuraEffect const *, AuraEffectHandleModes)
 
void OnPeriodic (AuraEffect const *)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=nullptr)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
void Remove (uint32 removeMode=0)
 
AuraGetAura () const
 
AuraObjectType GetType () const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration ()
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool HasEffect (uint8 effIndex) const
 
AuraEffectGetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
UnitGetTarget () const
 
AuraApplication const * GetTargetApplication () const
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual void Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from AuraScript
HookList< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandlerOnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandlerDoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandlerDoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< CheckProcHandlerDoCheckAfterProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ OnApply()

void spell_love_is_in_the_air_romantic_picnic::OnApply ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
383 {
384 Unit* target = GetTarget();
386 target->CastSpell(target, SPELL_MEAL_PERIODIC, false);
387 }
@ UNIT_STAND_STATE_SIT
Definition: Unit.h:54
@ SPELL_MEAL_PERIODIC
Definition: love_in_air.cpp:371
Definition: Unit.h:1290
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:1428
void SetStandState(uint8 state)
Definition: Unit.cpp:17668
Unit * GetTarget() const
Definition: SpellScript.cpp:1155

References Unit::CastSpell(), AuraScript::GetTarget(), Unit::SetStandState(), SPELL_MEAL_PERIODIC, and UNIT_STAND_STATE_SIT.

Referenced by Register().

◆ OnPeriodic()

void spell_love_is_in_the_air_romantic_picnic::OnPeriodic ( AuraEffect const *  )
inlineprivate
390 {
391 // Every 5 seconds
392 Unit* target = GetTarget();
393 Unit* caster = GetCaster();
394
395 // If our player is no longer sit, remove all auras
396 if (target->getStandState() != UNIT_STAND_STATE_SIT)
397 {
399 target->RemoveAura(GetAura());
400 return;
401 }
402
403 target->CastSpell(target, SPELL_BASKET_CHECK, false); // unknown use, it targets Romantic Basket
404 target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL), false);
405
406 bool foundSomeone = false;
407 // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
408 // required by achievement and "hearts" visual
409 std::list<Player*> playerList;
411 Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, playerList, checker);
412 Cell::VisitWorldObjects(target, searcher, INTERACTION_DISTANCE * 2);
413 for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
414 {
415 if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->getStandState() == UNIT_STAND_STATE_SIT)
416 {
417 if (caster)
418 {
419 caster->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
420 caster->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true);
421 }
422 foundSomeone = true;
423 // break;
424 }
425 }
426
427 if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV))
429 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:30
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
@ SPELL_BASKET_CHECK
Definition: love_in_air.cpp:370
@ SPELL_ROMANTIC_PICNIC_ACHIEV
Definition: love_in_air.cpp:375
@ SPELL_DRINK_VISUAL
Definition: love_in_air.cpp:374
@ SPELL_MEAL_EAT_VISUAL
Definition: love_in_air.cpp:372
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:5447
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:6454
uint8 getStandState() const
Definition: Unit.h:1532
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:522
Definition: GridNotifiers.h:1353
Unit * GetCaster() const
Definition: SpellScript.cpp:1010
Aura * GetAura() const
Definition: SpellScript.cpp:1035
uint32 GetId() const
Definition: SpellScript.cpp:1000

References Unit::CastSpell(), AuraScript::GetAura(), AuraScript::GetCaster(), AuraScript::GetId(), Unit::getStandState(), AuraScript::GetTarget(), Unit::HasAura(), INTERACTION_DISTANCE, RAND(), Unit::RemoveAura(), SPELL_BASKET_CHECK, SPELL_DRINK_VISUAL, SPELL_MEAL_EAT_VISUAL, SPELL_ROMANTIC_PICNIC_ACHIEV, UNIT_STAND_STATE_SIT, and Cell::VisitWorldObjects().

Referenced by Register().

◆ PrepareAuraScript()

spell_love_is_in_the_air_romantic_picnic::PrepareAuraScript ( spell_love_is_in_the_air_romantic_picnic  )
private

◆ Register()

void spell_love_is_in_the_air_romantic_picnic::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

432 {
435 }
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:289
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:750
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:733
@ EFFECT_0
Definition: SharedDefines.h:30
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:749
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:732
void OnApply(AuraEffect const *, AuraEffectHandleModes)
Definition: love_in_air.cpp:382
void OnPeriodic(AuraEffect const *)
Definition: love_in_air.cpp:389

References AuraScript::AfterEffectApply, AURA_EFFECT_HANDLE_REAL, AuraEffectApplyFn, AuraEffectPeriodicFn, EFFECT_0, OnApply(), AuraScript::OnEffectPeriodic, OnPeriodic(), and SPELL_AURA_PERIODIC_DUMMY.