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

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

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.

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

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