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

Private Member Functions

 PrepareSpellScript (spell_pilgrims_bounty_pass_generic)
 
uint32 GetVisualThrow (uint32 passSpell, bool isPlayer)
 
void HandleDummy (SpellEffIndex)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- 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 SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
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

◆ GetVisualThrow()

uint32 spell_pilgrims_bounty_pass_generic::GetVisualThrow ( uint32  passSpell,
bool  isPlayer 
)
inlineprivate
310 {
311 if (isPlayer)
312 {
313 switch (passSpell)
314 {
319 case SPELL_PASS_PIE:
325 }
326 }
327 else
328 {
329 switch (passSpell)
330 {
335 case SPELL_PASS_PIE:
341 }
342 }
343
344 return 0;
345 }
@ SPELL_VISUAL_BOUNCE_CRANBERRY
Definition: pilgrims_bounty.cpp:49
@ SPELL_VISUAL_BOUNCE_TURKEY
Definition: pilgrims_bounty.cpp:46
@ SPELL_VISUAL_BOUNCE_SWEET_POTATO
Definition: pilgrims_bounty.cpp:50
@ SPELL_VISUAL_THROW_STUFFING
Definition: pilgrims_bounty.cpp:41
@ SPELL_VISUAL_THROW_CRANBERRY
Definition: pilgrims_bounty.cpp:43
@ SPELL_PASS_CRANBERRY
Definition: pilgrims_bounty.cpp:37
@ SPELL_VISUAL_THROW_TURKEY
Definition: pilgrims_bounty.cpp:40
@ SPELL_PASS_PIE
Definition: pilgrims_bounty.cpp:36
@ SPELL_PASS_TURKEY
Definition: pilgrims_bounty.cpp:34
@ SPELL_VISUAL_THROW_SWEET_POTATO
Definition: pilgrims_bounty.cpp:44
@ SPELL_PASS_STUFFING
Definition: pilgrims_bounty.cpp:35
@ SPELL_PASS_SWEET_POTATO
Definition: pilgrims_bounty.cpp:38
@ SPELL_VISUAL_BOUNCE_STUFFING
Definition: pilgrims_bounty.cpp:47
@ SPELL_VISUAL_THROW_PIE
Definition: pilgrims_bounty.cpp:42
@ SPELL_VISUAL_BOUNCE_PIE
Definition: pilgrims_bounty.cpp:48

References SPELL_PASS_CRANBERRY, SPELL_PASS_PIE, SPELL_PASS_STUFFING, SPELL_PASS_SWEET_POTATO, SPELL_PASS_TURKEY, SPELL_VISUAL_BOUNCE_CRANBERRY, SPELL_VISUAL_BOUNCE_PIE, SPELL_VISUAL_BOUNCE_STUFFING, SPELL_VISUAL_BOUNCE_SWEET_POTATO, SPELL_VISUAL_BOUNCE_TURKEY, SPELL_VISUAL_THROW_CRANBERRY, SPELL_VISUAL_THROW_PIE, SPELL_VISUAL_THROW_STUFFING, SPELL_VISUAL_THROW_SWEET_POTATO, and SPELL_VISUAL_THROW_TURKEY.

Referenced by HandleDummy().

◆ HandleDummy()

void spell_pilgrims_bounty_pass_generic::HandleDummy ( SpellEffIndex  )
inlineprivate
348 {
349 if (Unit* target = GetHitUnit())
350 {
351 uint32 spellId = 0;
352 switch (GetSpellInfo()->Id)
353 {
355 spellId = SPELL_STORE_TURKEY;
356 break;
358 spellId = SPELL_STORE_STUFFING;
359 break;
360 case SPELL_PASS_PIE:
361 spellId = SPELL_STORE_PIE;
362 break;
364 spellId = SPELL_STORE_CRANBERRY;
365 break;
367 spellId = SPELL_STORE_SWEET_POTATO;
368 break;
369 }
370
371 // player case
372 if (target->IsVehicle() && target->ToCreature())
373 {
374 if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
375 {
376 GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true);
377 if (AuraEffect* aur = target->GetAuraEffectDummy(spellId))
378 {
379 if (aur->GetBase()->GetStackAmount() >= 5)
380 {
381 if (Player* casterPlayer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
382 {
383 casterPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true));
384 }
385 }
386 }
387 }
388 }
389 // normal case
390 else
391 {
392 if (TempSummon* ts = target->ToTempSummon())
393 if (Unit* owner = ts->GetSummonerUnit())
394 if (owner->GetEntry() == GetCaster()->GetEntry())
395 return;
396
397 GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true);
398 }
399 }
400
401 // Get chair charmer, passing achievement
402 if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
403 {
404 uint32 spellId = 0;
405 switch (GetSpellInfo()->Id)
406 {
408 spellId = SPELL_ACHI_PASS_TURKEY;
409 break;
411 spellId = SPELL_ACHI_PASS_STUFFING;
412 break;
413 case SPELL_PASS_PIE:
414 spellId = SPELL_ACHI_PASS_PIE;
415 break;
418 break;
421 break;
422 }
423
424 if (spellId)
425 player->CastSpell(player, spellId, true);
426 }
427 }
std::uint32_t uint32
Definition: Define.h:108
@ SPELL_ACHI_PASS_PIE
Definition: pilgrims_bounty.cpp:90
@ SPELL_STORE_STUFFING
Definition: pilgrims_bounty.cpp:59
@ SPELL_STORE_CRANBERRY
Definition: pilgrims_bounty.cpp:61
@ SPELL_STORE_TURKEY
Definition: pilgrims_bounty.cpp:58
@ SPELL_STORE_SWEET_POTATO
Definition: pilgrims_bounty.cpp:62
@ SPELL_ACHI_PASS_TURKEY
Definition: pilgrims_bounty.cpp:88
@ SPELL_ACHI_PASS_CRANBERRY
Definition: pilgrims_bounty.cpp:91
@ SPELL_ACHI_PASS_STUFFING
Definition: pilgrims_bounty.cpp:89
@ SPELL_ACHI_PASS_SWEET_POTATOES
Definition: pilgrims_bounty.cpp:92
@ SPELL_STORE_PIE
Definition: pilgrims_bounty.cpp:60
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2
Definition: DBCEnums.h:223
Definition: TemporarySummon.h:40
Definition: Player.h:1046
Definition: Unit.h:1290
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10576
TempSummon * ToTempSummon()
Definition: Unit.h:2400
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
Definition: SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401
uint32 GetVisualThrow(uint32 passSpell, bool isPlayer)
Definition: pilgrims_bounty.cpp:309

References ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, Unit::CastSpell(), SpellScript::GetCaster(), Unit::GetCharmerOrOwnerPlayerOrPlayerItself(), SpellScript::GetHitUnit(), SpellScript::GetSpellInfo(), GetVisualThrow(), SPELL_ACHI_PASS_CRANBERRY, SPELL_ACHI_PASS_PIE, SPELL_ACHI_PASS_STUFFING, SPELL_ACHI_PASS_SWEET_POTATOES, SPELL_ACHI_PASS_TURKEY, SPELL_PASS_CRANBERRY, SPELL_PASS_PIE, SPELL_PASS_STUFFING, SPELL_PASS_SWEET_POTATO, SPELL_PASS_TURKEY, SPELL_STORE_CRANBERRY, SPELL_STORE_PIE, SPELL_STORE_STUFFING, SPELL_STORE_SWEET_POTATO, SPELL_STORE_TURKEY, and Unit::ToTempSummon().

Referenced by Register().

◆ PrepareSpellScript()

spell_pilgrims_bounty_pass_generic::PrepareSpellScript ( spell_pilgrims_bounty_pass_generic  )
private

◆ Register()

void spell_pilgrims_bounty_pass_generic::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

430 {
432 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleDummy(SpellEffIndex)
Definition: pilgrims_bounty.cpp:347

References EFFECT_0, HandleDummy(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_DUMMY, and SpellEffectFn.