AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_rog_deadly_poison Class Reference
Inheritance diagram for spell_rog_deadly_poison:
SpellScript _SpellScript

Private Member Functions

 PrepareSpellScript (spell_rog_deadly_poison)
 
bool Load () override
 
void HandleBeforeHit (SpellMissInfo missInfo)
 
void HandleAfterHit ()
 
void Register () override
 

Private Attributes

uint8 _stackAmount
 

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
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
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 bool Validate (SpellInfo const *)
 
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< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleAfterHit()

void spell_rog_deadly_poison::HandleAfterHit ( )
inlineprivate
242 {
243 if (_stackAmount < 5)
244 return;
245
246 Player* player = GetCaster()->ToPlayer();
247
248 if (Unit* target = GetHitUnit())
249 {
251
252 if (item == GetCastItem())
254
255 if (!item)
256 return;
257
258 // item combat enchantments
259 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
260 {
262 if (!enchant)
263 continue;
264
265 for (uint8 s = 0; s < 3; ++s)
266 {
267 if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
268 continue;
269
270 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
271 if (!spellInfo)
272 {
273 LOG_ERROR("misc", "Player::CastItemCombatSpell Enchant {}, player (Name: {}, {}) cast unknown spell {}",
274 enchant->ID, player->GetName(), player->GetGUID().ToString(), enchant->spellid[s]);
275 continue;
276 }
277
278 // Proc only rogue poisons
279 if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
280 continue;
281
282 // Do not reproc deadly
283 if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
284 continue;
285
286 if (spellInfo->IsPositive())
287 player->CastSpell(player, enchant->spellid[s], true, item);
288 else
289 player->CastSpell(target, enchant->spellid[s], true, item);
290 }
291 }
292 }
293 }
@ ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL
Definition DBCEnums.h:367
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
std::uint8_t uint8
Definition Define.h:109
EnchantmentSlot
Definition Item.h:168
@ MAX_ENCHANTMENT_SLOT
Definition Item.h:183
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:677
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:678
#define INVENTORY_SLOT_BAG_0
Definition Player.h:657
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3792
@ DISPEL_POISON
Definition SharedDefines.h:1379
#define sSpellMgr
Definition SpellMgr.h:847
Definition Item.h:220
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:304
std::string ToString() const
Definition ObjectGuid.cpp:48
Player * ToPlayer()
Definition Object.h:208
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Definition Player.h:1086
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:445
Definition SpellInfo.h:340
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
uint32 Dispel
Definition SpellInfo.h:346
bool IsPositive() const
Definition SpellInfo.cpp:1282
uint32 SpellFamilyName
Definition SpellInfo.h:411
Item * GetCastItem()
Definition SpellScript.cpp:625
Unit * GetHitUnit()
Definition SpellScript.cpp:453
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:667
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:1372
std::string const & GetName() const
Definition Object.h:535
bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:454
uint8 _stackAmount
Definition spell_rogue.cpp:301
Definition DBCStructure.h:1877
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1883
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1880
uint32 ID
Definition DBCStructure.h:1878

References _stackAmount, Unit::CastSpell(), SpellInfo::Dispel, DISPEL_POISON, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, SpellScript::GetCaster(), SpellScript::GetCastItem(), Item::GetEnchantmentId(), Object::GetGUID(), SpellScript::GetHitUnit(), Player::GetItemByPos(), WorldObject::GetName(), SpellItemEnchantmentEntry::ID, INVENTORY_SLOT_BAG_0, flag96::IsEqual(), SpellInfo::IsPositive(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, LOG_ERROR, MAX_ENCHANTMENT_SLOT, SPELLFAMILY_ROGUE, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellItemEnchantmentEntry::spellid, sSpellItemEnchantmentStore, sSpellMgr, Object::ToPlayer(), ObjectGuid::ToString(), and SpellItemEnchantmentEntry::type.

Referenced by Register().

◆ HandleBeforeHit()

void spell_rog_deadly_poison::HandleBeforeHit ( SpellMissInfo  missInfo)
inlineprivate
229 {
230 if (missInfo != SPELL_MISS_NONE)
231 {
232 return;
233 }
234
235 if (Unit* target = GetHitUnit())
236 // Deadly Poison
237 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
238 _stackAmount = aurEff->GetBase()->GetStackAmount();
239 }
@ SPELL_MISS_NONE
Definition SharedDefines.h:1523
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
Definition SpellAuraEffects.h:39

References _stackAmount, SpellScript::GetCaster(), SpellScript::GetHitUnit(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_MISS_NONE, and SPELLFAMILY_ROGUE.

Referenced by Register().

◆ Load()

bool spell_rog_deadly_poison::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

222 {
223 _stackAmount = 0;
224 // at this point CastItem must already be initialized
225 return GetCaster()->IsPlayer() && GetCastItem();
226 }
bool IsPlayer() const
Definition Object.h:207

References _stackAmount, SpellScript::GetCaster(), SpellScript::GetCastItem(), and Object::IsPlayer().

◆ PrepareSpellScript()

spell_rog_deadly_poison::PrepareSpellScript ( spell_rog_deadly_poison  )
private

◆ Register()

void spell_rog_deadly_poison::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

296 {
299 }
#define BeforeSpellHitFn(F)
Definition SpellScript.h:342
#define SpellHitFn(F)
Definition SpellScript.h:349
HookList< HitHandler > AfterHit
Definition SpellScript.h:347
HookList< BeforeHitHandler > BeforeHit
Definition SpellScript.h:341
void HandleAfterHit()
Definition spell_rogue.cpp:241
void HandleBeforeHit(SpellMissInfo missInfo)
Definition spell_rogue.cpp:228

References SpellScript::AfterHit, SpellScript::BeforeHit, BeforeSpellHitFn, HandleAfterHit(), HandleBeforeHit(), and SpellHitFn.

Member Data Documentation

◆ _stackAmount

uint8 spell_rog_deadly_poison::_stackAmount
private

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