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

Private Member Functions

 PrepareAuraScript (spell_brewfest_main_ram_buff) uint8 privateLevel
 
bool Load () override
 
void HandleEffectPeriodic (AuraEffect const *aurEff)
 
void HandleEffectRemove (AuraEffect const *, AuraEffectHandleModes)
 
void Register () override
 

Private Attributes

uint32 questTick
 

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< AfterCheckProcHandlerDoAfterCheckProc
 
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

◆ HandleEffectPeriodic()

void spell_brewfest_main_ram_buff::HandleEffectPeriodic ( AuraEffect const *  aurEff)
inlineprivate
837 {
838 Unit* caster = GetCaster();
839 if (!caster || !caster->IsMounted() || !caster->ToPlayer())
840 return;
841
842 if (caster->GetMountID() != RACING_RAM_MODEL)
843 return;
844
845 Aura* aur = caster->GetAura(42924);
846 if (!aur)
847 {
848 caster->CastSpell(caster, 42924, true);
849 return;
850 }
851
852 // Check if exhausted
853 if (caster->GetAura(SPELL_RAM_EXHAUSTED))
854 {
855 if (privateLevel)
856 {
859 }
860
861 aur->SetStackAmount(1);
862 return;
863 }
864
865 uint32 stack = aur->GetStackAmount();
866 uint8 mode = 0;
867 switch (privateLevel)
868 {
869 case 0:
870 if (stack > 1)
871 {
872 questTick = 0;
873 caster->CastSpell(caster, SPELL_TROT, true);
874 privateLevel++;
875 mode = 1; // unapply
876 break;
877 }
878 // just walking, fatiuge handling
879 if (Aura* fatigueAura = caster->GetAura(SPELL_RAM_FATIGUE))
880 {
881 fatigueAura->ModStackAmount(-4);
882 }
883 break;
884 case 1:
885 // One click to maintain speed, more to increase
886 if (stack < 2)
887 {
889 questTick = 0;
890 privateLevel--;
891 mode = 2; // apply
892 }
893 else if (stack > 2)
894 {
895 questTick = 0;
896 caster->CastSpell(caster, SPELL_CANTER, true);
897 privateLevel++;
898 }
899 else if (questTick++ > 3)
901 break;
902 case 2:
903 // Two - three clicks to maintains speed, less to decrease, more to increase
904 if (stack < 3)
905 {
906 caster->CastSpell(caster, SPELL_TROT, true);
907 privateLevel--;
908 questTick = 0;
909 }
910 else if (stack > 4)
911 {
912 caster->CastSpell(caster, SPELL_GALLOP, true);
913 privateLevel++;
914 questTick = 0;
915 }
916 else if (questTick++ > 3)
918 break;
919 case 3:
920 // Four or more clicks to maintains speed, less to decrease
921 if (stack < 5)
922 {
923 caster->CastSpell(caster, SPELL_CANTER, true);
924 privateLevel--;
925 questTick = 0;
926 }
927 else if (questTick++ > 3)
929 break;
930 }
931
932 // Set to base amount
933 aur->SetStackAmount(1);
934
935 // apply/unapply effect 1
936 if (mode)
937 if (Aura* base = aurEff->GetBase())
938 if (AuraEffect* aEff = base->GetEffect(EFFECT_0))
939 {
940 aEff->SetAmount(mode == 1 ? 0 : -50);
941 caster->UpdateSpeed(MOVE_RUN, true);
942 }
943 }
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
@ MOVE_RUN
Definition: Unit.h:379
@ SPELL_RAM_EXHAUSTED
Definition: brewfest.cpp:814
@ SPELL_CANTER
Definition: brewfest.cpp:811
@ CREDIT_TROT
Definition: brewfest.cpp:816
@ CREDIT_GALLOP
Definition: brewfest.cpp:818
@ SPELL_GALLOP
Definition: brewfest.cpp:812
@ CREDIT_CANTER
Definition: brewfest.cpp:817
@ RACING_RAM_MODEL
Definition: brewfest.cpp:820
@ SPELL_TROT
Definition: brewfest.cpp:810
@ SPELL_RAM_FATIGUE
Definition: brewfest.cpp:813
@ EFFECT_0
Definition: SharedDefines.h:30
Player * ToPlayer()
Definition: Object.h:195
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1911
Definition: Unit.h:1290
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5499
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:1169
bool IsMounted() const
Definition: Unit.h:1542
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835
uint32 GetMountID() const
Definition: Unit.h:1543
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14147
Definition: SpellAuraEffects.h:39
Definition: SpellAuras.h:87
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:1009
uint8 GetStackAmount() const
Definition: SpellAuras.h:148
Unit * GetCaster() const
Definition: SpellScript.cpp:1020
uint32 questTick
Definition: brewfest.cpp:828

References Unit::CastSpell(), CREDIT_CANTER, CREDIT_GALLOP, CREDIT_TROT, EFFECT_0, Unit::GetAura(), AuraEffect::GetBase(), AuraScript::GetCaster(), Unit::GetMountID(), Aura::GetStackAmount(), Unit::IsMounted(), Player::KilledMonsterCredit(), MOVE_RUN, questTick, RACING_RAM_MODEL, Unit::RemoveAurasDueToSpell(), Aura::SetStackAmount(), SPELL_CANTER, SPELL_GALLOP, SPELL_RAM_EXHAUSTED, SPELL_RAM_FATIGUE, SPELL_TROT, Object::ToPlayer(), and Unit::UpdateSpeed().

Referenced by Register().

◆ HandleEffectRemove()

void spell_brewfest_main_ram_buff::HandleEffectRemove ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
946 {
947 if (Unit* target = GetTarget())
948 target->RemoveAurasDueToSpell(SPELL_RAM_FATIGUE);
949 }
Unit * GetTarget() const
Definition: SpellScript.cpp:1165

References AuraScript::GetTarget(), and SPELL_RAM_FATIGUE.

Referenced by Register().

◆ Load()

bool spell_brewfest_main_ram_buff::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

830 {
831 questTick = 0;
832 privateLevel = 0;
833 return true;
834 }

References questTick.

◆ PrepareAuraScript()

spell_brewfest_main_ram_buff::PrepareAuraScript ( spell_brewfest_main_ram_buff  )
private

◆ Register()

void spell_brewfest_main_ram_buff::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

952 {
955 }
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:289
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:760
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:754
@ EFFECT_1
Definition: SharedDefines.h:31
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:759
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:749
void HandleEffectPeriodic(AuraEffect const *aurEff)
Definition: brewfest.cpp:836
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
Definition: brewfest.cpp:945

References AURA_EFFECT_HANDLE_REAL, AuraEffectPeriodicFn, AuraEffectRemoveFn, EFFECT_1, HandleEffectPeriodic(), HandleEffectRemove(), AuraScript::OnEffectPeriodic, AuraScript::OnEffectRemove, and SPELL_AURA_PERIODIC_DUMMY.

Member Data Documentation

◆ questTick

uint32 spell_brewfest_main_ram_buff::questTick
private

Referenced by HandleEffectPeriodic(), and Load().