aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr.Tenma <dr.tenma@trinitycore.contrib>2011-05-13 19:13:55 +0200
committerShauren <shauren.trinity@gmail.com>2011-05-13 19:13:55 +0200
commit5ab5a492c8a852476fe202facc6058162bd9039b (patch)
treeaeb87a1b4394024e9c1c9104e4281c6c0e931259
parentb6cf587de94d8351b3712b5407a966f58dd03cae (diff)
Scripts/Spells: Deadly Poison will now properly trigger poison applied on weapon in other hand when reaching 5 stacks
-rw-r--r--sql/base/world_database.sql10
-rw-r--r--sql/scripts/world_scripts_full.sql1
-rw-r--r--sql/updates/world/2011_05_13_03_world_spell_bonus_data.sql3
-rw-r--r--sql/updates/world/2011_05_13_03_world_spell_script_names.sql3
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp98
5 files changed, 106 insertions, 9 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql
index 08c47498236..369ade76f9a 100644
--- a/sql/base/world_database.sql
+++ b/sql/base/world_database.sql
@@ -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'),
diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql
index 73dc6ced0d7..66673c51bc9 100644
--- a/sql/scripts/world_scripts_full.sql
+++ b/sql/scripts/world_scripts_full.sql
@@ -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'),
diff --git a/sql/updates/world/2011_05_13_03_world_spell_bonus_data.sql b/sql/updates/world/2011_05_13_03_world_spell_bonus_data.sql
new file mode 100644
index 00000000000..761c7993b1a
--- /dev/null
+++ b/sql/updates/world/2011_05_13_03_world_spell_bonus_data.sql
@@ -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)');
diff --git a/sql/updates/world/2011_05_13_03_world_spell_script_names.sql b/sql/updates/world/2011_05_13_03_world_spell_script_names.sql
new file mode 100644
index 00000000000..dd8662ee63d
--- /dev/null
+++ b/sql/updates/world/2011_05_13_03_world_spell_script_names.sql
@@ -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');
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 6cce8f0ea4e..b5be2691ae8 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -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();
}