aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2013-07-22 15:41:32 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2013-07-22 15:42:21 +0200
commita6510924892b4b2bd5411746651cdccf64f9a5a8 (patch)
treec352d5462bc28c54a1b5abc61b4155e1e5c74bb3 /src
parenta468563904bd9e78a359444991bc18d5271507ba (diff)
Core/Spells: Fix warlock "Healthstone" for 4.3.4
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp89
-rw-r--r--src/server/scripts/World/go_scripts.cpp71
2 files changed, 36 insertions, 124 deletions
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index d4f67e4acc9..c98756cfa6e 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -29,8 +29,9 @@
enum WarlockSpells
{
- SPELL_WARLOCK_AFTERMATH_STUN = 85387,
+ SPELL_WARLOCK_AFTERMATH_STUN = 85387,
SPELL_WARLOCK_BANE_OF_DOOM_EFFECT = 18662,
+ SPELL_WARLOCK_CREATE_HEALTHSTONE = 34130,
SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
SPELL_WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST = 62388,
SPELL_WARLOCK_DEMONIC_CIRCLE_SUMMON = 48018,
@@ -52,8 +53,6 @@ enum WarlockSpells
SPELL_WARLOCK_HAUNT = 48181,
SPELL_WARLOCK_HAUNT_HEAL = 48210,
SPELL_WARLOCK_IMMOLATE = 348,
- SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692,
- SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693,
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955,
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956,
SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703,
@@ -220,59 +219,26 @@ class spell_warl_create_healthstone : public SpellScriptLoader
{
PrepareSpellScript(spell_warl_create_healthstone_SpellScript);
- static uint32 const iTypes[8][3];
-
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
- if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2))
+ if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_CREATE_HEALTHSTONE))
return false;
return true;
}
- SpellCastResult CheckCast()
+ bool Load() OVERRIDE
{
- if (Player* caster = GetCaster()->ToPlayer())
- {
- uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
- ItemPosCountVec dest;
- InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
- if (msg != EQUIP_ERR_OK)
- return SPELL_FAILED_TOO_MANY_OF_ITEM;
- }
- return SPELL_CAST_OK;
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
- void HandleScriptEffect(SpellEffIndex effIndex)
+ void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Unit* unitTarget = GetHitUnit())
- {
- uint32 rank = 0;
- // Improved Healthstone
- if (AuraEffect const* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
- {
- switch (aurEff->GetId())
- {
- case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1:
- rank = 1;
- break;
- case SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2:
- rank = 2;
- break;
- default:
- TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
- break;
- }
- }
- uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
- if (spellRank > 0 && spellRank <= 8)
- CreateItem(effIndex, iTypes[spellRank - 1][rank]);
- }
+ GetCaster()->CastSpell(GetCaster(), SPELL_WARLOCK_CREATE_HEALTHSTONE, true);
}
void Register() OVERRIDE
{
OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast);
}
};
@@ -282,18 +248,6 @@ class spell_warl_create_healthstone : public SpellScriptLoader
}
};
-uint32 const spell_warl_create_healthstone::spell_warl_create_healthstone_SpellScript::iTypes[8][3] =
-{
- { 5512, 19004, 19005}, // Minor Healthstone
- { 5511, 19006, 19007}, // Lesser Healthstone
- { 5509, 19008, 19009}, // Healthstone
- { 5510, 19010, 19011}, // Greater Healthstone
- { 9421, 19012, 19013}, // Major Healthstone
- {22103, 22104, 22105}, // Master Healthstone
- {36889, 36890, 36891}, // Demonic Healthstone
- {36892, 36893, 36894} // Fel Healthstone
-};
-
// 603 - Bane of Doom
/// Updated 4.3.4
class spell_warl_bane_of_doom : public SpellScriptLoader
@@ -811,6 +765,34 @@ class spell_warl_health_funnel : public SpellScriptLoader
}
};
+// 6262 - Healthstone
+class spell_warl_healthstone_heal : public SpellScriptLoader
+{
+ public:
+ spell_warl_healthstone_heal() : SpellScriptLoader("spell_warl_healthstone_heal") { }
+
+ class spell_warl_healthstone_heal_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_warl_healthstone_heal_SpellScript);
+
+ void HandleOnHit()
+ {
+ int32 heal = int32(CalculatePct(GetCaster()->GetCreateHealth(), GetHitHeal()));
+ SetHitHeal(heal);
+ }
+
+ void Register() OVERRIDE
+ {
+ OnHit += SpellHitFn(spell_warl_healthstone_heal_SpellScript::HandleOnHit);
+ }
+ };
+
+ SpellScript* GetSpellScript() const OVERRIDE
+ {
+ return new spell_warl_healthstone_heal_SpellScript();
+ }
+};
+
// 1454 - Life Tap
/// Updated 4.3.4
class spell_warl_life_tap : public SpellScriptLoader
@@ -1234,6 +1216,7 @@ void AddSC_warlock_spell_scripts()
new spell_warl_glyph_of_shadowflame();
new spell_warl_haunt();
new spell_warl_health_funnel();
+ new spell_warl_healthstone_heal();
new spell_warl_life_tap();
new spell_warl_ritual_of_doom_effect();
new spell_warl_seduction();
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index 87533fbe47d..097e2a65e46 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -869,23 +869,6 @@ public:
## go_soulwell
######*/
-enum SoulWellData
-{
- GO_SOUL_WELL_R1 = 181621,
- GO_SOUL_WELL_R2 = 193169,
-
- SPELL_IMPROVED_HEALTH_STONE_R1 = 18692,
- SPELL_IMPROVED_HEALTH_STONE_R2 = 18693,
-
- SPELL_CREATE_MASTER_HEALTH_STONE_R0 = 34130,
- SPELL_CREATE_MASTER_HEALTH_STONE_R1 = 34149,
- SPELL_CREATE_MASTER_HEALTH_STONE_R2 = 34150,
-
- SPELL_CREATE_FEL_HEALTH_STONE_R0 = 58890,
- SPELL_CREATE_FEL_HEALTH_STONE_R1 = 58896,
- SPELL_CREATE_FEL_HEALTH_STONE_R2 = 58898,
-};
-
class go_soulwell : public GameObjectScript
{
public:
@@ -895,39 +878,6 @@ class go_soulwell : public GameObjectScript
{
go_soulwellAI(GameObject* go) : GameObjectAI(go)
{
- _stoneSpell = 0;
- _stoneId = 0;
- switch (go->GetEntry())
- {
- case GO_SOUL_WELL_R1:
- _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R0;
- if (Unit* owner = go->GetOwner())
- {
- if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1))
- _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R1;
- else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2))
- _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R2;
- }
- break;
- case GO_SOUL_WELL_R2:
- _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R0;
- if (Unit* owner = go->GetOwner())
- {
- if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1))
- _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R1;
- else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2))
- _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R2;
- }
- break;
- }
- if (_stoneSpell == 0) // Should never happen
- return;
-
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_stoneSpell);
- if (!spellInfo)
- return;
-
- _stoneId = spellInfo->Effects[EFFECT_0].ItemType;
}
/// Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE
@@ -937,31 +887,10 @@ class go_soulwell : public GameObjectScript
bool GossipHello(Player* player) OVERRIDE
{
Unit* owner = go->GetOwner();
- if (_stoneSpell == 0 || _stoneId == 0)
- return true;
-
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer()))
return true;
-
- // Don't try to add a stone if we already have one.
- if (player->HasItemCount(_stoneId))
- {
- if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell))
- Spell::SendCastResult(player, spell, 0, SPELL_FAILED_TOO_MANY_OF_ITEM);
- return true;
- }
-
- owner->CastSpell(player, _stoneSpell, true);
- // Item has to actually be created to remove a charge on the well.
- if (player->HasItemCount(_stoneId))
- go->AddUse();
-
return false;
}
-
- private:
- uint32 _stoneSpell;
- uint32 _stoneId;
};
GameObjectAI* GetAI(GameObject* go) const OVERRIDE