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

Private Member Functions

 PrepareSpellScript (spell_random_ingredient_SpellScript)
 
bool Validate (SpellInfo const *) override
 
void HandleScriptEffect (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 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

void spell_random_ingredient::spell_random_ingredient_SpellScript::HandleScriptEffect ( SpellEffIndex  )
inlineprivate
686  {
687  if (Player* player = GetHitPlayer())
688  {
689  uint8 ingredient = 0;
690 
691  switch (GetSpellInfo()->Id)
692  {
694  ingredient = urand(0, 10);
695  break;
697  ingredient = urand(11, 15);
698  break;
700  ingredient = urand(16, 20);
701  break;
702  }
703 
704  if (Creature* finklestein = GetClosestCreatureWithEntry(player, NPC_FINKLESTEIN, 25.0f))
705  {
706  finklestein->CastSpell(player, FetchIngredients[ingredient][0], true, NULL);
707  finklestein->AI()->Talk(FetchIngredients[ingredient][3], player);
708  }
709  }
710  }
uint32 const FetchIngredients[21][4]
Definition: zone_zuldrak.cpp:588
Definition: zone_zuldrak.cpp:330
TC_GAME_API Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
Definition: ScriptedCreature.cpp:611
Player * GetHitPlayer()
Definition: SpellScript.cpp:464
Definition: zone_zuldrak.cpp:361
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:404
Definition: zone_zuldrak.cpp:360
uint8_t uint8
Definition: Define.h:152
Definition: zone_zuldrak.cpp:362

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

spell_random_ingredient::spell_random_ingredient_SpellScript::PrepareSpellScript ( spell_random_ingredient_SpellScript  )
private
void spell_random_ingredient::spell_random_ingredient_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

713  {
715  }
Definition: SharedDefines.h:28
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:297
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:295
void HandleScriptEffect(SpellEffIndex)
Definition: zone_zuldrak.cpp:685
Definition: SharedDefines.h:1087

+ Here is the call graph for this function:

bool spell_random_ingredient::spell_random_ingredient_SpellScript::Validate ( SpellInfo const )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

673  {
674  if (!sSpellMgr->GetSpellInfo(SPELL_FETCH_KNOTROOT) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_PICKLED_EAGLE_EGG) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_SPECKLED_GUANO) ||
678  !sSpellMgr->GetSpellInfo(SPELL_FETCH_PRISMATIC_MOJO) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_RAPTOR_CLAW) || !sSpellMgr->GetSpellInfo(SPELL_FETCH_AMBERSEED) ||
681  return false;
682  return true;
683  }
Definition: zone_zuldrak.cpp:376
Definition: zone_zuldrak.cpp:407
Definition: zone_zuldrak.cpp:406
Definition: zone_zuldrak.cpp:405
Definition: zone_zuldrak.cpp:395
Definition: zone_zuldrak.cpp:394
Definition: zone_zuldrak.cpp:375
Definition: zone_zuldrak.cpp:370
Definition: zone_zuldrak.cpp:374
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: zone_zuldrak.cpp:378
Definition: zone_zuldrak.cpp:392
Definition: zone_zuldrak.cpp:377
Definition: zone_zuldrak.cpp:369
Definition: zone_zuldrak.cpp:368
Definition: zone_zuldrak.cpp:396
Definition: zone_zuldrak.cpp:371
Definition: zone_zuldrak.cpp:404
Definition: zone_zuldrak.cpp:373
Definition: zone_zuldrak.cpp:372
Definition: zone_zuldrak.cpp:408
Definition: zone_zuldrak.cpp:393

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