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 void Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
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
 
virtual bool _Validate (SpellInfo const *entry)
 
- 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 }
std::uint8_t uint8
Definition: Define.h:110
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
EnchantmentSlot
Definition: Item.h:162
@ MAX_ENCHANTMENT_SLOT
Definition: Item.h:177
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:691
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:692
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
#define sSpellMgr
Definition: SpellMgr.h:818
@ ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL
Definition: DBCEnums.h:372
@ SPELLFAMILY_ROGUE
Definition: SharedDefines.h:3508
@ DISPEL_POISON
Definition: SharedDefines.h:1348
bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:458
Definition: Item.h:214
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:295
Player * ToPlayer()
Definition: Object.h:195
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
std::string const & GetName() const
Definition: Object.h:446
std::string ToString() const
Definition: ObjectGuid.cpp:47
Definition: Player.h:1046
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:472
Definition: Unit.h:1290
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:1169
Definition: SpellInfo.h:314
flag96 SpellFamilyFlags
Definition: SpellInfo.h:386
uint32 Dispel
Definition: SpellInfo.h:320
bool IsPositive() const
Definition: SpellInfo.cpp:1221
uint32 SpellFamilyName
Definition: SpellInfo.h:385
Item * GetCastItem()
Definition: SpellScript.cpp:620
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401
uint8 _stackAmount
Definition: spell_rogue.cpp:280
Definition: DBCStructure.h:1817
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1823
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1820
uint32 ID
Definition: DBCStructure.h:1818

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_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:66
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1491
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()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
205 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
TypeID GetTypeId() const
Definition: Object.h:121

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

◆ 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