Scripts/Spells: Deadly Poison will now properly trigger poison applied on weapon in other hand when reaching 5 stacks
This commit is contained in:
1 parent
b6cf587de9
commit
5ab5a492c8
5 files changed
+106
-9
No files matched your search
@@ -17026,15 +17026,7 @@ INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`a
|
||||
(63675, 0, 0, 0, 0, 'Priest - Improved Devouring Plague'),
|
||||
(56131, 0, 0, 0, 0, 'Priest - Glyph of Dispel Magic'),
|
||||
(56160, 0, 0, 0, 0, 'Priest - Glyph of Power Word: Shield'),
|
||||
(2818, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 1($AP*0.12 / number of ticks)'),
|
||||
(2819, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 2($AP*0.12 / number of ticks)'),
|
||||
(11353, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 3($AP*0.12 / number of ticks)'),
|
||||
(11354, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 4($AP*0.12 / number of ticks)'),
|
||||
(25349, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 5($AP*0.12 / number of ticks)'),
|
||||
(26968, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 6($AP*0.12 / number of ticks)'),
|
||||
(27187, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 7($AP*0.12 / number of ticks)'),
|
||||
(57969, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 8($AP*0.12 / number of ticks)'),
|
||||
(57970, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 9($AP*0.12 / number of ticks)'),
|
||||
(2818, 0, 0, 0, 0.03, 'Rogue - Deadly Poison All Ranks($AP*0.12 / number of ticks)'),
|
||||
(703, -1, -1, -1, 0.07, 'Rogue - Garrote'),
|
||||
(1776, -1, -1, 0.21, -1, 'Rogue - Gouge'),
|
||||
(8680, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 1'),
|
||||
|
||||
@@ -2208,6 +2208,7 @@ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
( 5938, 'spell_rog_shiv'),
|
||||
( 14185, 'spell_rog_preparation'),
|
||||
(-51685, 'spell_rog_prey_on_the_weak'),
|
||||
( -2818, 'spell_rog_deadly_poison'),
|
||||
-- priest
|
||||
(-47788, 'spell_pri_guardian_spirit'),
|
||||
( -8129, 'spell_pri_mana_burn'),
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_bonus_data` WHERE `entry`=2818;
|
||||
INSERT INTO `spell_bonus_data` VALUES
|
||||
(2818,0,0,0,0.03,'Rogue - Deadly Poison All Ranks($AP*0.12 / number of ticks)');
|
||||
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_rog_deadly_poison';
|
||||
INSERT INTO `spell_script_names`(`spell_id`, `ScriptName`) VALUES
|
||||
(-2818,'spell_rog_deadly_poison');
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
enum RogueSpells
|
||||
{
|
||||
@@ -289,6 +290,102 @@ class spell_rog_shiv : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_deadly_poison() : SpellScriptLoader("spell_rog_deadly_poison") { }
|
||||
|
||||
class spell_rog_deadly_poison_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_rog_deadly_poison_SpellScript)
|
||||
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_stackAmount = 0;
|
||||
// at this point CastItem must already be initialized
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
|
||||
}
|
||||
|
||||
void HandleBeforeHit()
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// Deadly Poison
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID()))
|
||||
_stackAmount = aurEff->GetBase()->GetStackAmount();
|
||||
}
|
||||
|
||||
void HandleAfterHit()
|
||||
{
|
||||
if (_stackAmount < 5)
|
||||
return;
|
||||
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
Unit* target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||
|
||||
if (item == GetCastItem())
|
||||
item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// item combat enchantments
|
||||
for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
|
||||
{
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
|
||||
if (!enchant)
|
||||
continue;
|
||||
|
||||
for (uint8 s = 0; s < 3; ++s)
|
||||
{
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("Player::CastItemCombatSpell Enchant %i, cast unknown spell %i", enchant->ID, enchant->spellid[s]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Proc only rogue poisons
|
||||
if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
|
||||
continue;
|
||||
|
||||
// Do not reproc deadly
|
||||
if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
|
||||
continue;
|
||||
|
||||
if (IsPositiveSpell(enchant->spellid[s]))
|
||||
player->CastSpell(player, enchant->spellid[s], true, item);
|
||||
else
|
||||
player->CastSpell(target, enchant->spellid[s], true, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
BeforeHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit);
|
||||
AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit);
|
||||
}
|
||||
|
||||
uint8 _stackAmount;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_rog_deadly_poison_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_rogue_spell_scripts()
|
||||
{
|
||||
new spell_rog_cheat_death();
|
||||
@@ -296,4 +393,5 @@ void AddSC_rogue_spell_scripts()
|
||||
new spell_rog_preparation();
|
||||
new spell_rog_prey_on_the_weak();
|
||||
new spell_rog_shiv();
|
||||
new spell_rog_deadly_poison();
|
||||
}
|
||||
Reference in new issue
Block a user