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
243 {
244 if (_stackAmount < 5)
245 return;
246
247 Player* player = GetCaster()->ToPlayer();
248
249 if (Unit* target = GetHitUnit())
250 {
252
253 if (item == GetCastItem())
255
256 if (!item)
257 return;
258
259 // item combat enchantments
260 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
261 {
263 if (!enchant)
264 continue;
265
266 for (uint8 s = 0; s < 3; ++s)
267 {
268 if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
269 continue;
270
271 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
272 if (!spellInfo)
273 {
274 LOG_ERROR("misc", "Player::CastItemCombatSpell Enchant {}, player (Name: {}, {}) cast unknown spell {}",
275 enchant->ID, player->GetName(), player->GetGUID().ToString(), enchant->spellid[s]);
276 continue;
277 }
278
279 // Proc only rogue poisons
280 if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
281 continue;
282
283 // Do not reproc deadly
284 if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
285 continue;
286
287 if (spellInfo->IsPositive())
288 player->CastSpell(player, enchant->spellid[s], true, item);
289 else
290 player->CastSpell(target, enchant->spellid[s], true, item);
291 }
292 }
293 }
294 }
@ 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:851
Definition Item.h:220
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:304
std::string ToString() const
Definition ObjectGuid.cpp:49
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:670
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:1378
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:302
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
230 {
231 if (missInfo != SPELL_MISS_NONE)
232 {
233 return;
234 }
235
236 if (Unit* target = GetHitUnit())
237 // Deadly Poison
238 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
239 _stackAmount = aurEff->GetBase()->GetStackAmount();
240 }
@ 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.

223 {
224 _stackAmount = 0;
225 // at this point CastItem must already be initialized
226 return GetCaster()->IsPlayer() && GetCastItem();
227 }
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.

297 {
300 }
#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:242
void HandleBeforeHit(SpellMissInfo missInfo)
Definition spell_rogue.cpp:229

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: