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
839 {
840 Unit* caster = GetCaster();
841 if (!caster || !caster->IsMounted() || !caster->ToPlayer())
842 return;
843
844 if (caster->GetMountID() != RACING_RAM_MODEL)
845 return;
846
847 Aura* aur = caster->GetAura(42924);
848 if (!aur)
849 {
850 caster->CastSpell(caster, 42924, true);
851 return;
852 }
853
854 // Check if exhausted
855 if (caster->GetAura(SPELL_RAM_EXHAUSTED))
856 {
857 if (privateLevel)
858 {
861 }
862
863 aur->SetStackAmount(1);
864 return;
865 }
866
867 uint32 stack = aur->GetStackAmount();
868 uint8 mode = 0;
869 switch (privateLevel)
870 {
871 case 0:
872 if (stack > 1)
873 {
874 questTick = 0;
875 caster->CastSpell(caster, SPELL_TROT, true);
876 privateLevel++;
877 mode = 1; // unapply
878 break;
879 }
880 // just walking, fatiuge handling
881 if (Aura* fatigueAura = caster->GetAura(SPELL_RAM_FATIGUE))
882 {
883 fatigueAura->ModStackAmount(-4);
884 }
885 break;
886 case 1:
887 // One click to maintain speed, more to increase
888 if (stack < 2)
889 {
891 questTick = 0;
892 privateLevel--;
893 mode = 2; // apply
894 }
895 else if (stack > 2)
896 {
897 questTick = 0;
898 caster->CastSpell(caster, SPELL_CANTER, true);
899 privateLevel++;
900 }
901 else if (questTick++ > 3)
903 break;
904 case 2:
905 // Two - three clicks to maintains speed, less to decrease, more to increase
906 if (stack < 3)
907 {
908 caster->CastSpell(caster, SPELL_TROT, true);
909 privateLevel--;
910 questTick = 0;
911 }
912 else if (stack > 4)
913 {
914 caster->CastSpell(caster, SPELL_GALLOP, true);
915 privateLevel++;
916 questTick = 0;
917 }
918 else if (questTick++ > 3)
920 break;
921 case 3:
922 // Four or more clicks to maintains speed, less to decrease
923 if (stack < 5)
924 {
925 caster->CastSpell(caster, SPELL_CANTER, true);
926 privateLevel--;
927 questTick = 0;
928 }
929 else if (questTick++ > 3)
931 break;
932 }
933
934 // Set to base amount
935 aur->SetStackAmount(1);
936
937 // apply/unapply effect 1
938 if (mode)
939 if (Aura* base = aurEff->GetBase())
940 if (AuraEffect* aEff = base->GetEffect(EFFECT_0))
941 {
942 aEff->SetAmount(mode == 1 ? 0 : -50);
943 caster->UpdateSpeed(MOVE_RUN, true);
944 }
945 }
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:816
@ SPELL_CANTER
Definition: brewfest.cpp:813
@ CREDIT_TROT
Definition: brewfest.cpp:818
@ CREDIT_GALLOP
Definition: brewfest.cpp:820
@ SPELL_GALLOP
Definition: brewfest.cpp:814
@ CREDIT_CANTER
Definition: brewfest.cpp:819
@ RACING_RAM_MODEL
Definition: brewfest.cpp:822
@ SPELL_TROT
Definition: brewfest.cpp:812
@ SPELL_RAM_FATIGUE
Definition: brewfest.cpp:815
@ EFFECT_0
Definition: SharedDefines.h:31
Player * ToPlayer()
Definition: Object.h:195
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1913
Definition: Unit.h:1302
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5519
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:1556
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4855
uint32 GetMountID() const
Definition: Unit.h:1557
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14238
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:830

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

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

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.

954 {
957 }
@ 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:32
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:759
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:749
void HandleEffectPeriodic(AuraEffect const *aurEff)
Definition: brewfest.cpp:838
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
Definition: brewfest.cpp:947

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