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
311 {
312 if (isPlayer)
313 {
314 switch (passSpell)
315 {
320 case SPELL_PASS_PIE:
326 }
327 }
328 else
329 {
330 switch (passSpell)
331 {
336 case SPELL_PASS_PIE:
342 }
343 }
344
345 return 0;
346 }
@ SPELL_VISUAL_BOUNCE_CRANBERRY
Definition: pilgrims_bounty.cpp:50
@ SPELL_VISUAL_BOUNCE_TURKEY
Definition: pilgrims_bounty.cpp:47
@ SPELL_VISUAL_BOUNCE_SWEET_POTATO
Definition: pilgrims_bounty.cpp:51
@ SPELL_VISUAL_THROW_STUFFING
Definition: pilgrims_bounty.cpp:42
@ SPELL_VISUAL_THROW_CRANBERRY
Definition: pilgrims_bounty.cpp:44
@ SPELL_PASS_CRANBERRY
Definition: pilgrims_bounty.cpp:38
@ SPELL_VISUAL_THROW_TURKEY
Definition: pilgrims_bounty.cpp:41
@ SPELL_PASS_PIE
Definition: pilgrims_bounty.cpp:37
@ SPELL_PASS_TURKEY
Definition: pilgrims_bounty.cpp:35
@ SPELL_VISUAL_THROW_SWEET_POTATO
Definition: pilgrims_bounty.cpp:45
@ SPELL_PASS_STUFFING
Definition: pilgrims_bounty.cpp:36
@ SPELL_PASS_SWEET_POTATO
Definition: pilgrims_bounty.cpp:39
@ SPELL_VISUAL_BOUNCE_STUFFING
Definition: pilgrims_bounty.cpp:48
@ SPELL_VISUAL_THROW_PIE
Definition: pilgrims_bounty.cpp:43
@ SPELL_VISUAL_BOUNCE_PIE
Definition: pilgrims_bounty.cpp:49

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
349 {
350 if (Unit* target = GetHitUnit())
351 {
352 uint32 spellId = 0;
353 switch (GetSpellInfo()->Id)
354 {
356 spellId = SPELL_STORE_TURKEY;
357 break;
359 spellId = SPELL_STORE_STUFFING;
360 break;
361 case SPELL_PASS_PIE:
362 spellId = SPELL_STORE_PIE;
363 break;
365 spellId = SPELL_STORE_CRANBERRY;
366 break;
368 spellId = SPELL_STORE_SWEET_POTATO;
369 break;
370 }
371
372 // player case
373 if (target->IsVehicle() && target->ToCreature())
374 {
375 if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself())
376 {
377 GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true);
378 if (AuraEffect* aur = target->GetAuraEffectDummy(spellId))
379 {
380 if (aur->GetBase()->GetStackAmount() >= 5)
381 {
382 if (Player* casterPlayer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
383 {
384 casterPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true));
385 }
386 }
387 }
388 }
389 }
390 // normal case
391 else
392 {
393 if (TempSummon* ts = target->ToTempSummon())
394 if (Unit* owner = ts->GetSummonerUnit())
395 if (owner->GetEntry() == GetCaster()->GetEntry())
396 return;
397
398 GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true);
399 }
400 }
401
402 // Get chair charmer, passing achievement
403 if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself())
404 {
405 uint32 spellId = 0;
406 switch (GetSpellInfo()->Id)
407 {
409 spellId = SPELL_ACHI_PASS_TURKEY;
410 break;
412 spellId = SPELL_ACHI_PASS_STUFFING;
413 break;
414 case SPELL_PASS_PIE:
415 spellId = SPELL_ACHI_PASS_PIE;
416 break;
419 break;
422 break;
423 }
424
425 if (spellId)
426 player->CastSpell(player, spellId, true);
427 }
428 }
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_ACHI_PASS_PIE
Definition: pilgrims_bounty.cpp:91
@ SPELL_STORE_STUFFING
Definition: pilgrims_bounty.cpp:60
@ SPELL_STORE_CRANBERRY
Definition: pilgrims_bounty.cpp:62
@ SPELL_STORE_TURKEY
Definition: pilgrims_bounty.cpp:59
@ SPELL_STORE_SWEET_POTATO
Definition: pilgrims_bounty.cpp:63
@ SPELL_ACHI_PASS_TURKEY
Definition: pilgrims_bounty.cpp:89
@ SPELL_ACHI_PASS_CRANBERRY
Definition: pilgrims_bounty.cpp:92
@ SPELL_ACHI_PASS_STUFFING
Definition: pilgrims_bounty.cpp:90
@ SPELL_ACHI_PASS_SWEET_POTATOES
Definition: pilgrims_bounty.cpp:93
@ SPELL_STORE_PIE
Definition: pilgrims_bounty.cpp:61
@ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2
Definition: DBCEnums.h:217
Definition: TemporarySummon.h:40
Definition: Player.h:1064
Definition: Unit.h:630
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10578
TempSummon * ToTempSummon()
Definition: Unit.h:1716
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:1168
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:310

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.

431 {
433 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:781
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleDummy(SpellEffIndex)
Definition: pilgrims_bounty.cpp:348

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