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

Public Member Functions

 spell_rog_deadly_poison_SpellScript ()
 
- 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 void Unload ()
 

Private Member Functions

 PrepareSpellScript (spell_rog_deadly_poison_SpellScript)
 
bool Load () override
 
void HandleBeforeHit ()
 
void HandleAfterHit ()
 
void Register () override
 

Private Attributes

uint8 _stackAmount
 

Additional Inherited Members

- 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
 

Constructor & Destructor Documentation

spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::spell_rog_deadly_poison_SpellScript ( )
inline
270  {
271  _stackAmount = 0;
272  }

Member Function Documentation

void spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::HandleAfterHit ( )
inlineprivate
290  {
291  if (_stackAmount < 5)
292  return;
293 
294  Player* player = GetCaster()->ToPlayer();
295 
296  if (Unit* target = GetHitUnit())
297  {
298 
299  Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
300 
301  if (item == GetCastItem())
302  item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
303 
304  if (!item)
305  return;
306 
307  // item combat enchantments
308  for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
309  {
311  if (!enchant)
312  continue;
313 
314  for (uint8 s = 0; s < 3; ++s)
315  {
316  if (enchant->Effect[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
317  continue;
318 
319  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->EffectSpellID[s]);
320  if (!spellInfo)
321  {
322  TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, %s) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUID().ToString().c_str(), enchant->EffectSpellID[s]);
323  continue;
324  }
325 
326  // Proc only rogue poisons
327  if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
328  continue;
329 
330  // Do not reproc deadly
331  if (spellInfo->SpellFamilyFlags == flag128(0x10000, 0x80000, 0, 0))
332  continue;
333 
334  if (spellInfo->IsPositive())
335  player->CastSpell(player, enchant->EffectSpellID[s], true, item);
336  else
337  player->CastSpell(target, enchant->EffectSpellID[s], true, item);
338  }
339  }
340  }
341  }
#define INVENTORY_SLOT_BAG_0
Definition: SpellInfo.h:326
EnchantmentSlot
Definition: Item.h:172
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
uint32 Dispel
Definition: SpellInfo.h:331
Definition: Item.h:190
Definition: DBCStructure.h:1214
uint32 ID
Definition: DBCStructure.h:1216
Player * ToPlayer()
Definition: Object.h:191
bool IsPositive() const
Definition: SpellInfo.cpp:1495
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: Item.h:259
Definition: Util.h:362
Definition: SharedDefines.h:4631
#define sSpellMgr
Definition: SpellMgr.h:756
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
Definition: DBCEnums.h:510
Unit * GetCaster()
Definition: SpellScript.cpp:394
uint32 EffectSpellID[MAX_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1220
Item * GetCastItem()
Definition: SpellScript.cpp:622
uint8_t uint8
Definition: Define.h:152
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Unit * GetHitUnit()
Definition: SpellScript.cpp:441
Definition: Unit.h:1305
Definition: SharedDefines.h:1842
uint32 Effect[MAX_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1218
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::HandleBeforeHit ( )
inlineprivate
282  {
283  if (Unit* target = GetHitUnit())
284  // Deadly Poison
285  if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, flag128(0x10000, 0x80000, 0), GetCaster()->GetGUID()))
286  _stackAmount = aurEff->GetBase()->GetStackAmount();
287  }
Definition: SpellAuraEffects.h:30
Definition: SpellAuraDefines.h:63
Definition: Util.h:362
Definition: SharedDefines.h:4631
Unit * GetCaster()
Definition: SpellScript.cpp:394
Unit * GetHitUnit()
Definition: SpellScript.cpp:441
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

276  {
277  // at this point CastItem must already be initialized
278  return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
279  }
TypeID GetTypeId() const
Definition: Object.h:113
Definition: ObjectGuid.h:33
Unit * GetCaster()
Definition: SpellScript.cpp:394
Item * GetCastItem()
Definition: SpellScript.cpp:622

+ Here is the call graph for this function:

spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::PrepareSpellScript ( spell_rog_deadly_poison_SpellScript  )
private
void spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

344  {
347  }
void HandleAfterHit()
Definition: spell_rogue.cpp:289
#define SpellHitFn(F)
Definition: SpellScript.h:306
void HandleBeforeHit()
Definition: spell_rogue.cpp:281
HookList< HitHandler > BeforeHit
Definition: SpellScript.h:300
HookList< HitHandler > AfterHit
Definition: SpellScript.h:304

+ Here is the call graph for this function:

Member Data Documentation

uint8 spell_rog_deadly_poison::spell_rog_deadly_poison_SpellScript::_stackAmount
private

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