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
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
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)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
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< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
- 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
221 {
222 if (_stackAmount < 5)
223 return;
224
225 Player* player = GetCaster()->ToPlayer();
226
227 if (Unit* target = GetHitUnit())
228 {
230
231 if (item == GetCastItem())
233
234 if (!item)
235 return;
236
237 // item combat enchantments
238 for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
239 {
241 if (!enchant)
242 continue;
243
244 for (uint8 s = 0; s < 3; ++s)
245 {
246 if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
247 continue;
248
249 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
250 if (!spellInfo)
251 {
252 LOG_ERROR("misc", "Player::CastItemCombatSpell Enchant {}, player (Name: {}, {}) cast unknown spell {}",
253 enchant->ID, player->GetName(), player->GetGUID().ToString(), enchant->spellid[s]);
254 continue;
255 }
256
257 // Proc only rogue poisons
258 if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
259 continue;
260
261 // Do not reproc deadly
262 if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
263 continue;
264
265 if (spellInfo->IsPositive())
266 player->CastSpell(player, enchant->spellid[s], true, item);
267 else
268 player->CastSpell(target, enchant->spellid[s], true, item);
269 }
270 }
271 }
272 }
@ 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:157
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:695
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:696
#define INVENTORY_SLOT_BAG_0
Definition Player.h:675
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3536
@ DISPEL_POISON
Definition SharedDefines.h:1376
#define sSpellMgr
Definition SpellMgr.h:825
Definition Item.h:220
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:304
std::string ToString() const
Definition ObjectGuid.cpp:47
Player * ToPlayer()
Definition Object.h:201
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Definition Player.h:1081
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:441
Definition SpellInfo.h:316
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
uint32 Dispel
Definition SpellInfo.h:322
bool IsPositive() const
Definition SpellInfo.cpp:1237
uint32 SpellFamilyName
Definition SpellInfo.h:387
Item * GetCastItem()
Definition SpellScript.cpp:620
Unit * GetHitUnit()
Definition SpellScript.cpp:448
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:636
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:1178
std::string const & GetName() const
Definition Object.h:463
bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:463
uint8 _stackAmount
Definition spell_rogue.cpp:280
Definition DBCStructure.h:1840
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1846
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition DBCStructure.h:1843
uint32 ID
Definition DBCStructure.h:1841

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
208 {
209 if (missInfo != SPELL_MISS_NONE)
210 {
211 return;
212 }
213
214 if (Unit* target = GetHitUnit())
215 // Deadly Poison
216 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
217 _stackAmount = aurEff->GetBase()->GetStackAmount();
218 }
@ SPELL_MISS_NONE
Definition SharedDefines.h:1519
@ 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.

201 {
202 _stackAmount = 0;
203 // at this point CastItem must already be initialized
204 return GetCaster()->IsPlayer() && GetCastItem();
205 }
bool IsPlayer() const
Definition Object.h:200

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.

275 {
278 }
#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:220
void HandleBeforeHit(SpellMissInfo missInfo)
Definition spell_rogue.cpp:207

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: