AzerothCore 3.3.5a
OpenSource WoW Emulator
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 bool Validate (SpellInfo const *)
 
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
 
- 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
840 {
841 Unit* caster = GetCaster();
842 if (!caster || !caster->IsMounted() || !caster->ToPlayer())
843 return;
844
845 if (caster->GetMountID() != RACING_RAM_MODEL)
846 return;
847
848 Aura* aur = caster->GetAura(42924);
849 if (!aur)
850 {
851 caster->CastSpell(caster, 42924, true);
852 return;
853 }
854
855 // Check if exhausted
856 if (caster->GetAura(SPELL_RAM_EXHAUSTED))
857 {
858 if (privateLevel)
859 {
862 }
863
864 aur->SetStackAmount(1);
865 return;
866 }
867
868 uint32 stack = aur->GetStackAmount();
869 uint8 mode = 0;
870 switch (privateLevel)
871 {
872 case 0:
873 if (stack > 1)
874 {
875 questTick = 0;
876 caster->CastSpell(caster, SPELL_TROT, true);
877 privateLevel++;
878 mode = 1; // unapply
879 break;
880 }
881 // just walking, fatiuge handling
882 if (Aura* fatigueAura = caster->GetAura(SPELL_RAM_FATIGUE))
883 {
884 fatigueAura->ModStackAmount(-4);
885 }
886 break;
887 case 1:
888 // One click to maintain speed, more to increase
889 if (stack < 2)
890 {
892 questTick = 0;
893 privateLevel--;
894 mode = 2; // apply
895 }
896 else if (stack > 2)
897 {
898 questTick = 0;
899 caster->CastSpell(caster, SPELL_CANTER, true);
900 privateLevel++;
901 }
902 else if (questTick++ > 3)
904 break;
905 case 2:
906 // Two - three clicks to maintains speed, less to decrease, more to increase
907 if (stack < 3)
908 {
909 caster->CastSpell(caster, SPELL_TROT, true);
910 privateLevel--;
911 questTick = 0;
912 }
913 else if (stack > 4)
914 {
915 caster->CastSpell(caster, SPELL_GALLOP, true);
916 privateLevel++;
917 questTick = 0;
918 }
919 else if (questTick++ > 3)
921 break;
922 case 3:
923 // Four or more clicks to maintains speed, less to decrease
924 if (stack < 5)
925 {
926 caster->CastSpell(caster, SPELL_CANTER, true);
927 privateLevel--;
928 questTick = 0;
929 }
930 else if (questTick++ > 3)
932 break;
933 }
934
935 // Set to base amount
936 aur->SetStackAmount(1);
937
938 // apply/unapply effect 1
939 if (mode)
940 if (Aura* base = aurEff->GetBase())
941 if (AuraEffect* aEff = base->GetEffect(EFFECT_0))
942 {
943 aEff->SetAmount(mode == 1 ? 0 : -50);
944 caster->UpdateSpeed(MOVE_RUN, true);
945 }
946 }
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
@ EFFECT_0
Definition SharedDefines.h:31
@ MOVE_RUN
Definition UnitDefines.h:350
@ SPELL_RAM_EXHAUSTED
Definition brewfest.cpp:817
@ SPELL_CANTER
Definition brewfest.cpp:814
@ CREDIT_TROT
Definition brewfest.cpp:819
@ CREDIT_GALLOP
Definition brewfest.cpp:821
@ SPELL_GALLOP
Definition brewfest.cpp:815
@ CREDIT_CANTER
Definition brewfest.cpp:820
@ RACING_RAM_MODEL
Definition brewfest.cpp:823
@ SPELL_TROT
Definition brewfest.cpp:813
@ SPELL_RAM_FATIGUE
Definition brewfest.cpp:816
Definition SpellAuraEffects.h:39
Unit * GetCaster() const
Definition SpellScript.cpp:1020
Definition SpellAuras.h:87
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:995
uint8 GetStackAmount() const
Definition SpellAuras.h:148
Player * ToPlayer()
Definition Object.h:202
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition PlayerQuest.cpp:1927
Definition Unit.h:636
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5614
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:1179
bool IsMounted() const
Definition Unit.h:1807
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4942
uint32 GetMountID() const
Definition Unit.h:1808
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:14301
uint32 questTick
Definition brewfest.cpp:831

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
949 {
950 if (Unit* target = GetTarget())
951 target->RemoveAurasDueToSpell(SPELL_RAM_FATIGUE);
952 }
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.

833 {
834 questTick = 0;
835 privateLevel = 0;
836 return true;
837 }

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.

955 {
958 }
@ EFFECT_1
Definition SharedDefines.h:32
@ 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
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:759
HookList< EffectApplyHandler > OnEffectRemove
Definition SpellScript.h:749
void HandleEffectPeriodic(AuraEffect const *aurEff)
Definition brewfest.cpp:839
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
Definition brewfest.cpp:948

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().


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