Scripts/Spells: Gift of the Harvester (#24111)

* Scripts/Spells: Gift of the Harvester

* Scripts/Spells: nopch

* Scripts/Spells: nopch

* Scripts/Spells: validate

* Rename 9999_99_99_99_world.sql to 2020_02_01_03_world.sql

Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
(cherry picked from commit e10239311c)
This commit is contained in:
Sorikoff
2020-02-01 15:55:16 +02:00
committed by Shauren
parent f1f1bc01ba
commit 6433ed6014
3 changed files with 42 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gift_of_the_harvester';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (52479,'spell_gift_of_the_harvester');
DELETE FROM `disables` WHERE `sourceType`=0 AND `entry`=52479;
INSERT INTO `disables` (`sourceType`, `entry`, `flags`, `params_0`, `params_1`, `comment`) VALUES
(0,52479,64,'','','Gift of the Harvester (LOS)');

View File

@@ -3067,11 +3067,6 @@ void Spell::EffectScriptEffect()
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->IsSummon())
unitTarget->ToTempSummon()->UnSummon();
return;
case 52479: // Gift of the Harvester
if (unitTarget && unitCaster)
unitCaster->CastSpell(unitTarget, urand(0, 1) ? damage : 52505, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
.SetOriginalCastId(m_castId));
return;
case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->GetTypeId() != TYPEID_PLAYER)

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureAIImpl.h"
#include "ScriptMgr.h"
#include "CombatAI.h"
#include "CreatureTextMgr.h"
@@ -1072,6 +1073,40 @@ public:
};
enum GiftOfTheHarvester
{
SPELL_GHOUL_TRANFORM = 52490,
SPELL_GHOST_TRANSFORM = 52505
};
class spell_gift_of_the_harvester : public SpellScript
{
PrepareSpellScript(spell_gift_of_the_harvester);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_GHOUL_TRANFORM,
SPELL_GHOST_TRANSFORM
});
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* originalCaster = GetOriginalCaster();
Unit* target = GetHitUnit();
if (originalCaster && target)
originalCaster->CastSpell(target, RAND(SPELL_GHOUL_TRANFORM, SPELL_GHOST_TRANSFORM), true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gift_of_the_harvester::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
/*####
## npc_scarlet_miner_cart
####*/
@@ -1314,6 +1349,7 @@ void AddSC_the_scarlet_enclave_c1()
new npc_ros_dark_rider();
new npc_dkc1_gothik();
new npc_scarlet_ghoul();
RegisterSpellScript(spell_gift_of_the_harvester);
new npc_scarlet_miner();
new npc_scarlet_miner_cart();
}