TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript Class Reference

Private Member Functions

 PrepareSpellScript (spell_q12589_shoot_rjr_SpellScript)
 
SpellCastResult CheckCast ()
 
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 constGetSpellInfo ()
 
SpellValue constGetSpellValue ()
 
SpellEffectInfo constGetEffectInfo (SpellEffIndex) const
 
WorldLocation constGetExplTargetDest ()
 
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)
 
SpellEffectInfo constGetEffectInfo () const
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo constGetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
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 bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Public Attributes inherited from SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< EffectHandlerOnEffectSuccessfulDispel
 
HookList< HitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList
< ObjectAreaTargetSelectHandler
OnObjectAreaTargetSelect
 
HookList
< ObjectTargetSelectHandler
OnObjectTargetSelect
 
HookList
< DestinationTargetSelectHandler
OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string constm_scriptName
 
uint32 m_scriptSpellId
 

Member Function Documentation

SpellCastResult spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::CheckCast ( )
inlineprivate
735  {
736  if (Unit* target = GetExplTargetUnit())
737  if (target->GetEntry() == NPC_LUCKY_WILHELM)
738  return SPELL_CAST_OK;
739 
742  }
Unit * GetExplTargetUnit()
Definition: SpellScript.cpp:426
Definition: SharedDefines.h:1476
Definition: zone_sholazar_basin.cpp:704
void SetCustomCastResultMessage(SpellCustomErrors result)
Definition: SpellScript.cpp:643
Definition: SharedDefines.h:1570
Definition: Unit.h:1305
Definition: SharedDefines.h:1538

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy ( SpellEffIndex  )
inlineprivate
Todo:
Make crunchy perform emote eat when he reaches the bird
745  {
746  uint32 roll = urand(1, 100);
747 
748  uint8 ev;
749  if (roll <= 50)
750  ev = EVENT_MISS;
751  else if (roll <= 83)
752  ev = EVENT_HIT;
753  else
754  ev = EVENT_MISS_BIRD;
755 
756  Unit* shooter = GetCaster();
757  Creature* wilhelm = GetHitUnit()->ToCreature();
758  Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
759  Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);
760 
761  if (!wilhelm || !apple || !drostan)
762  return;
763 
764  switch (ev)
765  {
766  case EVENT_MISS_BIRD:
767  {
768  Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
769  Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);
770 
771  if (!bird || !crunchy)
772  ; // fall to EVENT_MISS
773  else
774  {
775  shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
776  bird->CastSpell(bird, SPELL_BIRD_FALL);
777  wilhelm->AI()->Talk(SAY_WILHELM_MISS);
778  drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
779 
780  bird->KillSelf();
781  crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
782  bird->GetMap()->GetWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
784 
785  break;
786  }
787  }
788  case EVENT_MISS:
789  {
790  shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
791  wilhelm->AI()->Talk(SAY_WILHELM_MISS);
792  drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
793  break;
794  }
795  case EVENT_HIT:
796  {
797  shooter->CastSpell(apple, SPELL_HIT_APPLE);
798  apple->CastSpell(apple, SPELL_APPLE_FALL);
799  wilhelm->AI()->Talk(SAY_WILHELM_HIT);
800  if (Player* player = shooter->ToPlayer())
801  player->KilledMonsterCredit(NPC_APPLE);
802  break;
803  }
804  }
805  }
Definition: zone_sholazar_basin.cpp:710
void KillSelf(bool durabilityLoss=true)
Definition: Unit.h:1515
Map * GetMap() const
Definition: Object.h:543
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: zone_sholazar_basin.cpp:707
Definition: Creature.h:467
float GetWaterOrGroundLevel(float x, float y, float z, float *ground=NULL, bool swim=false) const
Definition: Map.cpp:2296
Definition: zone_sholazar_basin.cpp:713
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
Definition: zone_sholazar_basin.cpp:714
Player * ToPlayer()
Definition: Object.h:191
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
Definition: zone_sholazar_basin.cpp:711
float GetPositionY() const
Definition: Position.h:105
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Definition: zone_sholazar_basin.cpp:706
CreatureAI * AI() const
Definition: Creature.h:525
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
Definition: zone_sholazar_basin.cpp:708
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
Definition: zone_sholazar_basin.cpp:712
Definition: zone_sholazar_basin.cpp:717
Definition: zone_sholazar_basin.cpp:705
Definition: zone_sholazar_basin.cpp:721
Definition: zone_sholazar_basin.cpp:716
Unit * GetCaster()
Definition: SpellScript.cpp:394
Creature * ToCreature()
Definition: Object.h:194
uint8_t uint8
Definition: Define.h:152
Unit * GetHitUnit()
Definition: SpellScript.cpp:441
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: zone_sholazar_basin.cpp:720
Definition: zone_sholazar_basin.cpp:718
Definition: zone_sholazar_basin.cpp:722

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::PrepareSpellScript ( spell_q12589_shoot_rjr_SpellScript  )
private
void spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

808  {
811  }
void HandleDummy(SpellEffIndex)
Definition: zone_sholazar_basin.cpp:744
Definition: SharedDefines.h:28
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:297
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:295
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:287
Definition: SharedDefines.h:1013
#define SpellCheckCastFn(F)
Definition: SpellScript.h:288
SpellCastResult CheckCast()
Definition: zone_sholazar_basin.cpp:734

+ Here is the call graph for this function:


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