refactor(Scripts/Northrend): spell scripts registry macros (#19346)

* zone_sholazar_basin spell:spell_q12726_song_of_wind_and_water

* zone_sholazar_basin spell:spell_q12620_the_lifewarden_wrath

* zone_sholazar_basin spell:spell_q12589_shoot_rjr

* zone_sholazar_basin spell:spell_shango_tracks

* zone_borean_tundra aura:spell_q11919_q11940_drake_hunt_aura

* zone_borean_tundra spell:spell_arcane_chains_character_force_cast

* zone_borean_tundra spell:spell_q11719_bloodspore_ruination_45997

* isle_of_conquest aura:spell_ioc_repair_turret_aura

* isle_of_conquest spell:spell_ioc_bomb_blast_criteria

* isle_of_conquest spell:spell_ioc_gunship_portal

* isle_of_conquest aura:spell_ioc_parachute_ic_aura

* isle_of_conquest spell:spell_ioc_launch

* zone_dragonblight spell:spell_q12478_frostmourne_cavern

* zone_dragonblight aura:spell_q12243_fire_upon_the_waters_aura

* zone_dragonblight spell:spell_q24545_aod_special

* zone_dragonblight spell:spell_q12096_q12092_dummy

* zone_dragonblight spell:spell_q12096_q12092_bark

* zone_storm_peaks aura:spell_q13003_thursting_hodirs_spear_aura

* zone_storm_peaks spell:spell_q13007_iron_colossus

* zone_storm_peaks aura:spell_close_rift_aura

* zone_wintergrasp spell:spell_wintergrasp_force_building

* zone_wintergrasp spell:spell_wintergrasp_create_vehicle

* zone_wintergrasp spell:spell_wintergrasp_rp_gg

* zone_wintergrasp spell:spell_wintergrasp_portal

* zone_wintergrasp spell:spell_wintergrasp_water

* zone_wintergrasp aura:spell_wintergrasp_hide_small_elementals_aura

* zone_wintergrasp spell:spell_wg_reduce_damage_by_distance

* zone_icecrown spell:spell_switch_infragreen_bomber_station

* zone_icecrown pair:spell_charge_shield_bomber

* zone_icecrown spell:spell_fight_fire_bomber

* zone_icecrown spell:spell_anti_air_rocket_bomber

* zone_icecrown spell:spell_onslaught_or_call_bone_gryphon

* zone_grizzly_hills spell:spell_shredder_delivery

* zone_grizzly_hills aura:spell_infected_worgen_bite_aura

* zone_grizzly_hills spell:spell_vehicle_warhead_fuse

* zone_grizzly_hills spell:spell_warhead_detonate

* zone_grizzly_hills aura:spell_z_check_aura

* zone_grizzly_hills aura:spell_warhead_fuse_aura

* fixup! zone_icecrown pair:spell_charge_shield_bomber
This commit is contained in:
Jelle Meeus
2024-07-09 18:07:41 +02:00
committed by GitHub
parent 11e908bfa4
commit 2763625498
9 changed files with 871 additions and 1216 deletions

View File

@@ -0,0 +1,11 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_q11919_q11940_drake_hunt_aura' WHERE `spell_id`=46620 AND `ScriptName`='spell_q11919_q11940_drake_hunt';
UPDATE `spell_script_names` SET `ScriptName`='spell_ioc_repair_turret_aura' WHERE `spell_id`=68077 AND `ScriptName`='spell_ioc_repair_turret';
UPDATE `spell_script_names` SET `ScriptName`='spell_ioc_parachute_ic_aura' WHERE `spell_id`=66656 AND `ScriptName`='spell_ioc_parachute_ic';
UPDATE `spell_script_names` SET `ScriptName`='spell_q12243_fire_upon_the_waters_aura' WHERE `spell_id`=48522 AND `ScriptName`='spell_q12243_fire_upon_the_waters';
UPDATE `spell_script_names` SET `ScriptName`='spell_q13003_thursting_hodirs_spear_aura' WHERE `spell_id`=56689 AND `ScriptName`='spell_q13003_thursting_hodirs_spear';
UPDATE `spell_script_names` SET `ScriptName`='spell_close_rift_aura' WHERE `spell_id`=56763 AND `ScriptName`='spell_close_rift';
UPDATE `spell_script_names` SET `ScriptName`='spell_wintergrasp_hide_small_elementals_aura' WHERE `spell_id`=52107 AND `ScriptName`='spell_wintergrasp_hide_small_elementals';
UPDATE `spell_script_names` SET `ScriptName`='spell_infected_worgen_bite_aura' WHERE `spell_id`=53094 AND `ScriptName`='spell_infected_worgen_bite';
UPDATE `spell_script_names` SET `ScriptName`='spell_z_check_aura' WHERE `spell_id`=61678 AND `ScriptName`='spell_z_check';
UPDATE `spell_script_names` SET `ScriptName`='spell_warhead_fuse_aura' WHERE `spell_id`=49181 AND `ScriptName`='spell_warhead_fuse';

View File

@@ -308,30 +308,24 @@ public:
}
};
class spell_ioc_repair_turret : public SpellScriptLoader
class spell_ioc_repair_turret_aura : public AuraScript
{
public:
spell_ioc_repair_turret() : SpellScriptLoader("spell_ioc_repair_turret") { }
PrepareAuraScript(spell_ioc_repair_turret_aura);
class spell_ioc_repair_turret_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_ioc_repair_turret_AuraScript);
return ValidateSpellInfo({ SPELL_REPAIR_TURRET_DUMMY });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
GetTarget()->CastSpell(GetTarget(), SPELL_REPAIR_TURRET_DUMMY, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_ioc_repair_turret_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_ioc_repair_turret_AuraScript();
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
GetTarget()->CastSpell(GetTarget(), SPELL_REPAIR_TURRET_DUMMY, true);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_ioc_repair_turret_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -344,162 +338,128 @@ enum blastCriteria
SPELL_BOMB_INATION_CREDIT = 68367,
};
class spell_ioc_bomb_blast_criteria : public SpellScriptLoader
class spell_ioc_bomb_blast_criteria : public SpellScript
{
public:
spell_ioc_bomb_blast_criteria() : SpellScriptLoader("spell_ioc_bomb_blast_criteria") { }
PrepareSpellScript(spell_ioc_bomb_blast_criteria);
class spell_ioc_bomb_blast_criteria_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_ioc_bomb_blast_criteria_SpellScript);
return ValidateSpellInfo({ SPELL_BOMB_INABLE_CREDIT, SPELL_BOMB_INATION_CREDIT });
}
void HandleGameObjectDamage(SpellEffIndex /*effIndex*/)
{
Unit* owner = GetCaster()->GetOwner();
if (!owner)
return;
if (GetSpellInfo()->Id == SPELL_SEAFORIUM_BLAST)
owner->CastSpell(owner, SPELL_BOMB_INABLE_CREDIT, true);
else if (GetSpellInfo()->Id == SPELL_HUGE_SEAFORIUM_BLAST)
owner->CastSpell(owner, SPELL_BOMB_INATION_CREDIT, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_bomb_blast_criteria_SpellScript::HandleGameObjectDamage, EFFECT_1, SPELL_EFFECT_GAMEOBJECT_DAMAGE);
}
};
SpellScript* GetSpellScript() const override
void HandleGameObjectDamage(SpellEffIndex /*effIndex*/)
{
return new spell_ioc_bomb_blast_criteria_SpellScript();
Unit* owner = GetCaster()->GetOwner();
if (!owner)
return;
if (GetSpellInfo()->Id == SPELL_SEAFORIUM_BLAST)
owner->CastSpell(owner, SPELL_BOMB_INABLE_CREDIT, true);
else if (GetSpellInfo()->Id == SPELL_HUGE_SEAFORIUM_BLAST)
owner->CastSpell(owner, SPELL_BOMB_INATION_CREDIT, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_bomb_blast_criteria::HandleGameObjectDamage, EFFECT_1, SPELL_EFFECT_GAMEOBJECT_DAMAGE);
}
};
class spell_ioc_gunship_portal : public SpellScriptLoader
class spell_ioc_gunship_portal : public SpellScript
{
public:
spell_ioc_gunship_portal() : SpellScriptLoader("spell_ioc_gunship_portal") { }
PrepareSpellScript(spell_ioc_gunship_portal);
class spell_ioc_gunship_portal_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_ioc_gunship_portal_SpellScript);
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
/*Player* caster = GetCaster()->ToPlayer();
*
* HACK: GetWorldLocation() returns real position and not transportposition.
* ServertoClient: SMSG_MOVE_TELEPORT (0x0B39)
* counter: 45
* Tranpsort Guid: Full: xxxx Type: MOTransport Low: xxx
* Transport Position X: 0 Y: 0 Z: 0 O: 0
* Position: X: 7.305609 Y: -0.095246 Z: 34.51022 O: 0
caster->TeleportTo(GetHitCreature()->GetWorldLocation(), TELE_TO_NOT_LEAVE_TRANSPORT);*/
}
void HandleScript2(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* caster = GetCaster()->ToPlayer();
if (!caster->IsBeingTeleported())
if (Battleground* bg = caster->GetBattleground())
bg->DoAction(2 /**/, caster->GetGUID());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal_SpellScript::HandleScript2, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_ioc_gunship_portal_SpellScript();
PreventHitDefaultEffect(effIndex);
/*Player* caster = GetCaster()->ToPlayer();
*
* HACK: GetWorldLocation() returns real position and not transportposition.
* ServertoClient: SMSG_MOVE_TELEPORT (0x0B39)
* counter: 45
* Tranpsort Guid: Full: xxxx Type: MOTransport Low: xxx
* Transport Position X: 0 Y: 0 Z: 0 O: 0
* Position: X: 7.305609 Y: -0.095246 Z: 34.51022 O: 0
caster->TeleportTo(GetHitCreature()->GetWorldLocation(), TELE_TO_NOT_LEAVE_TRANSPORT);*/
}
void HandleScript2(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* caster = GetCaster()->ToPlayer();
if (!caster->IsBeingTeleported())
if (Battleground* bg = caster->GetBattleground())
bg->DoAction(2 /**/, caster->GetGUID());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal::HandleScript2, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_ioc_parachute_ic : public SpellScriptLoader
class spell_ioc_parachute_ic_aura : public AuraScript
{
public:
spell_ioc_parachute_ic() : SpellScriptLoader("spell_ioc_parachute_ic") { }
PrepareAuraScript(spell_ioc_parachute_ic_aura);
class spell_ioc_parachute_ic_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_ioc_parachute_ic_AuraScript)
return ValidateSpellInfo({ SPELL_PARACHUTE_IC });
}
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
{
if (Player* target = GetTarget()->ToPlayer())
if (target->m_movementInfo.fallTime > 2500 && !target->GetTransport())
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ioc_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
{
return new spell_ioc_parachute_ic_AuraScript();
if (Player* target = GetTarget()->ToPlayer())
if (target->m_movementInfo.fallTime > 2500 && !target->GetTransport())
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_ioc_parachute_ic_aura::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_ioc_launch : public SpellScriptLoader
class spell_ioc_launch : public SpellScript
{
public:
spell_ioc_launch() : SpellScriptLoader("spell_ioc_launch") { }
PrepareSpellScript(spell_ioc_launch);
class spell_ioc_launch_SpellScript : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_ioc_launch_SpellScript);
if (Player* player = GetHitPlayer())
player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage
}
void Launch()
{
WorldLocation const* const position = GetExplTargetDest();
if (Player* player = GetHitPlayer())
{
player->ExitVehicle();
player->DisableSpline();
player->GetMap()->PlayerRelocation(player, GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), GetCaster()->GetOrientation());
float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY());
float elevation = GetSpell()->m_targets.GetElevation();
float speedZ = std::max(10.0f, float(50.0f * std::sin(elevation)));
float speedXY = dist * 10.0f / speedZ;
player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST);
AfterHit += SpellHitFn(spell_ioc_launch_SpellScript::Launch);
}
};
SpellScript* GetSpellScript() const override
void Launch()
{
return new spell_ioc_launch_SpellScript();
WorldLocation const* const position = GetExplTargetDest();
if (Player* player = GetHitPlayer())
{
player->ExitVehicle();
player->DisableSpline();
player->GetMap()->PlayerRelocation(player, GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), GetCaster()->GetOrientation());
float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY());
float elevation = GetSpell()->m_targets.GetElevation();
float speedZ = std::max(10.0f, float(50.0f * std::sin(elevation)));
float speedXY = dist * 10.0f / speedZ;
player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_ioc_launch::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST);
AfterHit += SpellHitFn(spell_ioc_launch::Launch);
}
};
@@ -509,10 +469,10 @@ void AddSC_isle_of_conquest()
new npc_four_car_garage();
new npc_ioc_gunship_captain();
new boss_isle_of_conquest();
new spell_ioc_repair_turret();
new spell_ioc_bomb_blast_criteria();
new spell_ioc_gunship_portal();
new spell_ioc_parachute_ic();
new spell_ioc_launch();
RegisterSpellScript(spell_ioc_repair_turret_aura);
RegisterSpellScript(spell_ioc_bomb_blast_criteria);
RegisterSpellScript(spell_ioc_gunship_portal);
RegisterSpellScript(spell_ioc_parachute_ic_aura);
RegisterSpellScript(spell_ioc_launch);
}

View File

@@ -34,47 +34,41 @@ enum eDrakeHunt
SPELL_SUBDUED = 46675
};
class spell_q11919_q11940_drake_hunt : public SpellScriptLoader
class spell_q11919_q11940_drake_hunt_aura : public AuraScript
{
public:
spell_q11919_q11940_drake_hunt() : SpellScriptLoader("spell_q11919_q11940_drake_hunt") { }
PrepareAuraScript(spell_q11919_q11940_drake_hunt_aura);
class spell_q11919_q11940_drake_hunt_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_q11919_q11940_drake_hunt_AuraScript)
return ValidateSpellInfo({ SPELL_SUBDUED, SPELL_DRAKE_HATCHLING_SUBDUED });
}
bool Load() override
{
return GetOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !GetCaster())
return;
Creature* owner = GetOwner()->ToCreature();
owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY);
owner->CombatStop(true);
owner->GetThreatMgr().ClearAllThreat();
owner->GetMotionMaster()->Clear(false);
owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE);
owner->CastSpell(owner, SPELL_SUBDUED, true);
GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true);
owner->SetFaction(FACTION_FRIENDLY);
owner->SetImmuneToAll(true);
owner->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
bool Load() override
{
return new spell_q11919_q11940_drake_hunt_AuraScript();
return GetOwner()->GetTypeId() == TYPEID_UNIT;
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !GetCaster())
return;
Creature* owner = GetOwner()->ToCreature();
owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY);
owner->CombatStop(true);
owner->GetThreatMgr().ClearAllThreat();
owner->GetMotionMaster()->Clear(false);
owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE);
owner->CastSpell(owner, SPELL_SUBDUED, true);
GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true);
owner->SetFaction(FACTION_FRIENDLY);
owner->SetImmuneToAll(true);
owner->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS);
}
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -667,29 +661,23 @@ public:
};
// Spell 45625: - Arcane Chains: Character Force Cast
class spell_arcane_chains_character_force_cast : public SpellScriptLoader
class spell_arcane_chains_character_force_cast : public SpellScript
{
public:
spell_arcane_chains_character_force_cast() : SpellScriptLoader("spell_arcane_chains_character_force_cast") {}
PrepareSpellScript(spell_arcane_chains_character_force_cast);
class spell_arcane_chains_character_force_cast_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_arcane_chains_character_force_cast_SpellScript);
return ValidateSpellInfo({ SPELL_ARCANE_CHAINS_SUMMON_CHAINED_MAGE_HUNTER, 45626 });
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
GetHitUnit()->CastSpell(GetCaster(), SPELL_ARCANE_CHAINS_SUMMON_CHAINED_MAGE_HUNTER, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SET_FACING & ~TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS & ~TRIGGERED_IGNORE_CAST_ITEM & ~TRIGGERED_IGNORE_GCD)); // Player cast back 45626 on npc
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_arcane_chains_character_force_cast_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
return new spell_arcane_chains_character_force_cast_SpellScript();
GetHitUnit()->CastSpell(GetCaster(), SPELL_ARCANE_CHAINS_SUMMON_CHAINED_MAGE_HUNTER, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SET_FACING & ~TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS & ~TRIGGERED_IGNORE_CAST_ITEM & ~TRIGGERED_IGNORE_GCD)); // Player cast back 45626 on npc
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_arcane_chains_character_force_cast::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -1309,31 +1297,20 @@ enum BloodsporeRuination
EVENT_RESET_ORIENTATION
};
class spell_q11719_bloodspore_ruination_45997 : public SpellScriptLoader
class spell_q11719_bloodspore_ruination_45997 : public SpellScript
{
public:
spell_q11719_bloodspore_ruination_45997() : SpellScriptLoader("spell_q11719_bloodspore_ruination_45997") { }
PrepareSpellScript(spell_q11719_bloodspore_ruination_45997);
class spell_q11719_bloodspore_ruination_45997_SpellScript : public SpellScript
void HandleEffect(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_q11719_bloodspore_ruination_45997_SpellScript);
if (Unit* caster = GetCaster())
if (Creature* laurith = caster->FindNearestCreature(NPC_BLOODMAGE_LAURITH, 100.0f))
laurith->AI()->SetGUID(caster->GetGUID());
}
void HandleEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (Creature* laurith = caster->FindNearestCreature(NPC_BLOODMAGE_LAURITH, 100.0f))
laurith->AI()->SetGUID(caster->GetGUID());
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_q11719_bloodspore_ruination_45997_SpellScript::HandleEffect, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q11719_bloodspore_ruination_45997_SpellScript();
OnEffectHit += SpellEffectFn(spell_q11719_bloodspore_ruination_45997::HandleEffect, EFFECT_1, SPELL_EFFECT_SEND_EVENT);
}
};
@@ -2059,7 +2036,7 @@ public:
void AddSC_borean_tundra()
{
// Ours
new spell_q11919_q11940_drake_hunt();
RegisterSpellScript(spell_q11919_q11940_drake_hunt_aura);
new npc_thassarian();
new npc_thassarian2();
new npc_leryssa();
@@ -2073,14 +2050,14 @@ void AddSC_borean_tundra()
new npc_lurgglbr();
new npc_beryl_sorcerer();
new npc_captured_beryl_sorcerer();
new spell_arcane_chains_character_force_cast();
RegisterSpellScript(spell_arcane_chains_character_force_cast);
new npc_imprisoned_beryl_sorcerer();
new npc_mootoo_the_younger();
new npc_bonker_togglevolt();
new npc_valiance_keep_cannoneer();
new npc_warmage_coldarra();
new npc_hidden_cultist();
new spell_q11719_bloodspore_ruination_45997();
RegisterSpellScript(spell_q11719_bloodspore_ruination_45997);
new npc_bloodmage_laurith();
}

View File

@@ -931,71 +931,49 @@ enum eFrostmourneCavern
NPC_PRINCE_ARTHAS = 27455,
};
class spell_q12478_frostmourne_cavern : public SpellScriptLoader
class spell_q12478_frostmourne_cavern : public SpellScript
{
public:
spell_q12478_frostmourne_cavern() : SpellScriptLoader("spell_q12478_frostmourne_cavern") { }
PrepareSpellScript(spell_q12478_frostmourne_cavern);
class spell_q12478_frostmourne_cavern_SpellScript : public SpellScript
void HandleSendEvent(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_q12478_frostmourne_cavern_SpellScript);
PreventHitDefaultEffect(effIndex);
GetCaster()->SummonCreature(NPC_PRINCE_ARTHAS, 4821.3f, -580.14f, 163.541f, 4.57f);
}
void HandleSendEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetCaster()->SummonCreature(NPC_PRINCE_ARTHAS, 4821.3f, -580.14f, 163.541f, 4.57f);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_q12478_frostmourne_cavern_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q12478_frostmourne_cavern_SpellScript();
OnEffectHit += SpellEffectFn(spell_q12478_frostmourne_cavern::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
class spell_q12243_fire_upon_the_waters : public SpellScriptLoader
class spell_q12243_fire_upon_the_waters_aura : public AuraScript
{
public:
spell_q12243_fire_upon_the_waters() : SpellScriptLoader("spell_q12243_fire_upon_the_waters") { }
PrepareAuraScript(spell_q12243_fire_upon_the_waters_aura);
class spell_q12243_fire_upon_the_waters_AuraScript : public AuraScript
void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q12243_fire_upon_the_waters_AuraScript);
void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
std::list<Creature*> servants;
GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 40.0f);
for (std::list<Creature*>::const_iterator itr = servants.begin(); itr != servants.end(); ++itr)
{
std::list<Creature*> servants;
GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 40.0f);
for (std::list<Creature*>::const_iterator itr = servants.begin(); itr != servants.end(); ++itr)
{
(*itr)->SetSpeed(MOVE_RUN, 0.7f, true);
(*itr)->GetMotionMaster()->MoveFleeing(GetTarget(), GetDuration());
}
(*itr)->SetSpeed(MOVE_RUN, 0.7f, true);
(*itr)->GetMotionMaster()->MoveFleeing(GetTarget(), GetDuration());
}
}
void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
std::list<Creature*> servants;
GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 100.0f);
for (std::list<Creature*>::const_iterator itr = servants.begin(); itr != servants.end(); ++itr)
(*itr)->SetSpeed(MOVE_RUN, 1.1f, true);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_q12243_fire_upon_the_waters_AuraScript();
std::list<Creature*> servants;
GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 100.0f);
for (std::list<Creature*>::const_iterator itr = servants.begin(); itr != servants.end(); ++itr)
(*itr)->SetSpeed(MOVE_RUN, 1.1f, true);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q12243_fire_upon_the_waters_aura::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q12243_fire_upon_the_waters_aura::HandleRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1497,39 +1475,28 @@ private:
bool _alive;
};
class spell_q24545_aod_special : public SpellScriptLoader
class spell_q24545_aod_special : public SpellScript
{
public:
spell_q24545_aod_special() : SpellScriptLoader("spell_q24545_aod_special") { }
PrepareSpellScript(spell_q24545_aod_special);
class spell_q24545_aod_special_SpellScript : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
PrepareSpellScript(spell_q24545_aod_special_SpellScript);
targets.remove_if(GhoulTargetCheck(GetSpellInfo()->Id == 70790));
Acore::Containers::RandomResize(targets, 2);
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(GhoulTargetCheck(GetSpellInfo()->Id == 70790));
Acore::Containers::RandomResize(targets, 2);
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id == 70790 ? -2 : -1);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_q24545_aod_special_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_q24545_aod_special_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_q24545_aod_special_SpellScript();
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id == 70790 ? -2 : -1);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_q24545_aod_special::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
OnEffectHitTarget += SpellEffectFn(spell_q24545_aod_special::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -2077,82 +2044,65 @@ enum StrengthenAncientsMisc
NPC_LOTHALOR = 26321
};
class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
class spell_q12096_q12092_dummy : public SpellScript
{
public:
spell_q12096_q12092_dummy() : SpellScriptLoader("spell_q12096_q12092_dummy") { }
PrepareSpellScript(spell_q12096_q12092_dummy);
class spell_q12096_q12092_dummy_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q12096_q12092_dummy_SpellScript);
return ValidateSpellInfo({ SPELL_CREATE_ITEM_BARK });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 roll = rand() % 2;
Creature* tree = GetHitCreature();
Player* player = GetCaster()->ToPlayer();
if (!tree || !player)
return;
tree->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK);
if (roll == 1) // friendly version
{
tree->CastSpell(player, SPELL_CREATE_ITEM_BARK);
tree->AI()->Talk(SAY_WALKER_FRIENDLY, player);
tree->DespawnOrUnsummon(1000);
}
else if (roll == 0) // enemy version
{
tree->AI()->Talk(SAY_WALKER_ENEMY, player);
tree->SetFaction(FACTION_MONSTER);
tree->Attack(player, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_q12096_q12092_dummy_SpellScript();
uint32 roll = rand() % 2;
Creature* tree = GetHitCreature();
Player* player = GetCaster()->ToPlayer();
if (!tree || !player)
return;
tree->RemoveNpcFlag(UNIT_NPC_FLAG_SPELLCLICK);
if (roll == 1) // friendly version
{
tree->CastSpell(player, SPELL_CREATE_ITEM_BARK);
tree->AI()->Talk(SAY_WALKER_FRIENDLY, player);
tree->DespawnOrUnsummon(1000);
}
else if (roll == 0) // enemy version
{
tree->AI()->Talk(SAY_WALKER_ENEMY, player);
tree->SetFaction(FACTION_MONSTER);
tree->Attack(player, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_dummy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_q12096_q12092_bark : public SpellScriptLoader // Bark of the Walkers
class spell_q12096_q12092_bark : public SpellScript
{
public:
spell_q12096_q12092_bark() : SpellScriptLoader("spell_q12096_q12092_bark") { }
PrepareSpellScript(spell_q12096_q12092_bark);
class spell_q12096_q12092_bark_SpellScript : public SpellScript
void HandleDummy(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_q12096_q12092_bark_SpellScript);
Creature* lothalor = GetHitCreature();
if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR)
return;
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Creature* lothalor = GetHitCreature();
if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR)
return;
lothalor->AI()->Talk(SAY_LOTHALOR);
lothalor->RemoveAura(SPELL_CONFUSED);
lothalor->DespawnOrUnsummon(4000);
}
lothalor->AI()->Talk(SAY_LOTHALOR);
lothalor->RemoveAura(SPELL_CONFUSED);
lothalor->DespawnOrUnsummon(4000);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_bark_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q12096_q12092_bark_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_q12096_q12092_bark::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -2306,20 +2256,20 @@ void AddSC_dragonblight()
RegisterSpellScript(spell_q12237_drop_off_villager);
RegisterSpellScript(spell_call_wintergarde_gryphon);
new npc_heated_battle();
new spell_q12478_frostmourne_cavern();
new spell_q12243_fire_upon_the_waters();
RegisterSpellScript(spell_q12478_frostmourne_cavern);
RegisterSpellScript(spell_q12243_fire_upon_the_waters_aura);
new npc_q24545_lich_king();
new at_q24545_frostmourne_cavern();
new npc_q24545_wretched_ghoul();
new spell_q24545_aod_special();
RegisterSpellScript(spell_q24545_aod_special);
new npc_q24545_vegard_dummy();
new npc_q24545_vegard();
new npc_spiritual_insight();
// Theirs
new npc_commander_eligor_dawnbringer();
new spell_q12096_q12092_dummy();
new spell_q12096_q12092_bark();
RegisterSpellScript(spell_q12096_q12092_dummy);
RegisterSpellScript(spell_q12096_q12092_bark);
new npc_torturer_lecraft();
RegisterSpellScript(spell_dragonblight_corrosive_spit);

View File

@@ -961,35 +961,24 @@ enum ShredderDelivery
NPC_BROKEN_DOWN_SHREDDER = 27354
};
class spell_shredder_delivery : public SpellScriptLoader
class spell_shredder_delivery : public SpellScript
{
public:
spell_shredder_delivery() : SpellScriptLoader("spell_shredder_delivery") { }
PrepareSpellScript(spell_shredder_delivery);
class spell_shredder_delivery_SpellScript : public SpellScript
bool Load() override
{
PrepareSpellScript(spell_shredder_delivery_SpellScript);
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (GetCaster()->ToCreature()->GetEntry() == NPC_BROKEN_DOWN_SHREDDER)
GetCaster()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_shredder_delivery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex /*effIndex*/)
{
return new spell_shredder_delivery_SpellScript();
if (GetCaster()->ToCreature()->GetEntry() == NPC_BROKEN_DOWN_SHREDDER)
GetCaster()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_shredder_delivery::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -999,35 +988,29 @@ enum InfectedWorgenBite
SPELL_WORGENS_CALL = 53095
};
class spell_infected_worgen_bite : public SpellScriptLoader
class spell_infected_worgen_bite_aura : public AuraScript
{
public:
spell_infected_worgen_bite() : SpellScriptLoader("spell_infected_worgen_bite") { }
PrepareAuraScript(spell_infected_worgen_bite_aura);
class spell_infected_worgen_bite_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_infected_worgen_bite_AuraScript);
return ValidateSpellInfo({ SPELL_WORGENS_CALL });
}
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (GetStackAmount() == GetSpellInfo()->StackAmount)
{
SetDuration(0);
target->CastSpell(target, SPELL_WORGENS_CALL, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_infected_worgen_bite_AuraScript::HandleAfterEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY);
}
};
AuraScript* GetAuraScript() const override
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_infected_worgen_bite_AuraScript();
Unit* target = GetTarget();
if (target->GetTypeId() == TYPEID_PLAYER)
if (GetStackAmount() == GetSpellInfo()->StackAmount)
{
SetDuration(0);
target->CastSpell(target, SPELL_WORGENS_CALL, true);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_infected_worgen_bite_aura::HandleAfterEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY);
}
};
@@ -1123,44 +1106,33 @@ enum WarheadSpells
SPELL_WARHEAD_FUSE = 49181
};
// 49107 - Vehicle: Warhead Fuse
class spell_vehicle_warhead_fuse : public SpellScriptLoader
class spell_vehicle_warhead_fuse : public SpellScript
{
public:
spell_vehicle_warhead_fuse() : SpellScriptLoader("spell_vehicle_warhead_fuse") { }
PrepareSpellScript(spell_vehicle_warhead_fuse);
class spell_vehicle_warhead_fuse_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_vehicle_warhead_fuse_SpellScript);
return sSpellMgr->GetSpellInfo(SPELL_WARHEAD_Z_CHECK)
&& sSpellMgr->GetSpellInfo(SPELL_WARHEAD_SEEKING_LUMBERSHIP)
&& sSpellMgr->GetSpellInfo(SPELL_WARHEAD_FUSE);
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return sSpellMgr->GetSpellInfo(SPELL_WARHEAD_Z_CHECK)
&& sSpellMgr->GetSpellInfo(SPELL_WARHEAD_SEEKING_LUMBERSHIP)
&& sSpellMgr->GetSpellInfo(SPELL_WARHEAD_FUSE);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (!caster)
{
return;
}
caster->CastSpell(caster, SPELL_WARHEAD_Z_CHECK, true);
caster->CastSpell(caster, SPELL_WARHEAD_SEEKING_LUMBERSHIP, true);
caster->CastSpell(caster, SPELL_WARHEAD_FUSE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_vehicle_warhead_fuse_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_vehicle_warhead_fuse_SpellScript();
Unit* caster = GetCaster();
if (!caster)
{
return;
}
caster->CastSpell(caster, SPELL_WARHEAD_Z_CHECK, true);
caster->CastSpell(caster, SPELL_WARHEAD_SEEKING_LUMBERSHIP, true);
caster->CastSpell(caster, SPELL_WARHEAD_FUSE, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_vehicle_warhead_fuse::HandleDummy, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -1171,132 +1143,96 @@ enum WarheadDenonate
NPC_ALLIANCE_LUMBERBOAT_EXPLOSIONS = 27689
};
// 49250 - Detonate
class spell_warhead_detonate : public SpellScriptLoader
class spell_warhead_detonate : public SpellScript
{
public:
spell_warhead_detonate() : SpellScriptLoader("spell_warhead_detonate") { }
PrepareSpellScript(spell_warhead_detonate);
class spell_warhead_detonate_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_warhead_detonate_SpellScript);
return sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) && sSpellMgr->GetSpellInfo(SPELL_TORPEDO_EXPLOSION);
}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) && sSpellMgr->GetSpellInfo(SPELL_TORPEDO_EXPLOSION);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Player* player = GetHitPlayer();
if (!player || !caster)
{
return;
}
player->ExitVehicle();
float horizontalSpeed = 3.0f;
float verticalSpeed = 40.0f;
player->KnockbackFrom(caster->GetPositionX(), caster->GetPositionY(), horizontalSpeed, verticalSpeed);
player->RemoveAurasDueToSpell(SPELL_WARHEAD_FUSE);
std::list<Creature*> explosionBunnys;
caster->GetCreatureListWithEntryInGrid(explosionBunnys, NPC_ALLIANCE_LUMBERBOAT_EXPLOSIONS, 90.0f);
for (auto itr = explosionBunnys.begin(); itr != explosionBunnys.end(); ++itr)
{
(*itr)->CastSpell((*itr), SPELL_TORPEDO_EXPLOSION, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_warhead_detonate_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex /*effIndex*/)
{
return new spell_warhead_detonate_SpellScript();
Unit* caster = GetCaster();
Player* player = GetHitPlayer();
if (!player || !caster)
{
return;
}
player->ExitVehicle();
float horizontalSpeed = 3.0f;
float verticalSpeed = 40.0f;
player->KnockbackFrom(caster->GetPositionX(), caster->GetPositionY(), horizontalSpeed, verticalSpeed);
player->RemoveAurasDueToSpell(SPELL_WARHEAD_FUSE);
std::list<Creature*> explosionBunnys;
caster->GetCreatureListWithEntryInGrid(explosionBunnys, NPC_ALLIANCE_LUMBERBOAT_EXPLOSIONS, 90.0f);
for (auto itr = explosionBunnys.begin(); itr != explosionBunnys.end(); ++itr)
{
(*itr)->CastSpell((*itr), SPELL_TORPEDO_EXPLOSION, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_warhead_detonate::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 61678 - Z Check
class spell_z_check : public SpellScriptLoader
class spell_z_check_aura : public AuraScript
{
public:
spell_z_check() : SpellScriptLoader("spell_z_check") { }
PrepareAuraScript(spell_z_check_aura);
class spell_z_check_AuraScript : public AuraScript
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
public:
spell_z_check_AuraScript() : AuraScript(), _posZ(0) {}
_posZ = GetTarget()->GetPositionZ();
}
PrepareAuraScript(spell_z_check_AuraScript);
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (_posZ != GetTarget()->GetPositionZ())
{
_posZ = GetTarget()->GetPositionZ();
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (_posZ != GetTarget()->GetPositionZ())
if (Creature* target = GetTarget()->ToCreature())
{
if (Creature* target = GetTarget()->ToCreature())
{
target->AI()->DoAction(0);
}
target->AI()->DoAction(0);
}
}
}
private:
float _posZ;
float _posZ;
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_z_check_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_z_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_z_check_AuraScript();
OnEffectApply += AuraEffectApplyFn(spell_z_check_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_z_check_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 49181 - Warhead Fuse
class spell_warhead_fuse : public SpellScriptLoader
class spell_warhead_fuse_aura : public AuraScript
{
public:
spell_warhead_fuse() : SpellScriptLoader("spell_warhead_fuse") { }
PrepareAuraScript(spell_warhead_fuse_aura);
class spell_warhead_fuse_AuraScript : public AuraScript
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_warhead_fuse_AuraScript);
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Unit* rocketUnit = GetTarget()->GetVehicleBase())
{
if (Unit* rocketUnit = GetTarget()->GetVehicleBase())
if (Creature* rocketCrea = rocketUnit->ToCreature())
{
if (Creature* rocketCrea = rocketUnit->ToCreature())
{
rocketCrea->AI()->DoAction(0);
}
rocketCrea->AI()->DoAction(0);
}
}
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_warhead_fuse_AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_warhead_fuse_AuraScript();
OnEffectRemove += AuraEffectRemoveFn(spell_warhead_fuse_aura::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1336,13 +1272,13 @@ void AddSC_grizzly_hills()
RegisterSpellScript(spell_renew_skirmisher);
new npc_venture_co_straggler();
new npc_lake_frog();
new spell_shredder_delivery();
new spell_infected_worgen_bite();
RegisterSpellScript(spell_shredder_delivery);
RegisterSpellScript(spell_infected_worgen_bite_aura);
new npc_rocket_propelled_warhead();
new spell_z_check();
new spell_warhead_detonate();
new spell_vehicle_warhead_fuse();
new spell_warhead_fuse();
RegisterSpellScript(spell_z_check_aura);
RegisterSpellScript(spell_warhead_detonate);
RegisterSpellScript(spell_vehicle_warhead_fuse);
RegisterSpellScript(spell_warhead_fuse_aura);
RegisterSpellScript(spell_q12227_outhouse_groans);
RegisterSpellScript(spell_q12227_camera_shake);
RegisterSpellScript(spell_frog_kiss);

View File

@@ -1063,203 +1063,164 @@ enum infraGreenBomberQuests
SEAT_ENGINEERING = 2
};
class spell_switch_infragreen_bomber_station : public SpellScriptLoader
class spell_switch_infragreen_bomber_station : public SpellScript
{
public:
spell_switch_infragreen_bomber_station() : SpellScriptLoader("spell_switch_infragreen_bomber_station") { }
PrepareSpellScript(spell_switch_infragreen_bomber_station);
class spell_switch_infragreen_bomber_station_SpellScript : public SpellScript
uint8 GetSeatNumber(uint32 spellId)
{
PrepareSpellScript(spell_switch_infragreen_bomber_station_SpellScript)
if (spellId == SPELL_ENGINEERING)
return 2;
else if (spellId == SPELL_ANTI_AIR_TURRET)
return 1;
else
return 0;
}
uint8 GetSeatNumber(uint32 spellId)
{
if (spellId == SPELL_ENGINEERING)
return 2;
else if (spellId == SPELL_ANTI_AIR_TURRET)
return 1;
else
return 0;
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Vehicle* kit = GetCaster()->GetVehicle();
Unit* charmer = GetCaster()->GetCharmer(); // Player controlling station
if (!kit || !charmer)
return;
uint8 seatNumber = GetSeatNumber(GetSpellInfo()->Id);
SeatMap::iterator itr = kit->GetSeatIteratorForPassenger(GetCaster());
if (itr == kit->Seats.end())
return;
// Xinef: Same seat, no change required
if (seatNumber == itr->first)
return;
if (Unit* station = kit->GetPassenger(seatNumber))
station->HandleSpellClick(charmer, 0);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_switch_infragreen_bomber_station_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex effIndex)
{
return new spell_switch_infragreen_bomber_station_SpellScript();
PreventHitDefaultEffect(effIndex);
Vehicle* kit = GetCaster()->GetVehicle();
Unit* charmer = GetCaster()->GetCharmer(); // Player controlling station
if (!kit || !charmer)
return;
uint8 seatNumber = GetSeatNumber(GetSpellInfo()->Id);
SeatMap::iterator itr = kit->GetSeatIteratorForPassenger(GetCaster());
if (itr == kit->Seats.end())
return;
// Xinef: Same seat, no change required
if (seatNumber == itr->first)
return;
if (Unit* station = kit->GetPassenger(seatNumber))
station->HandleSpellClick(charmer, 0);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_switch_infragreen_bomber_station::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_charge_shield_bomber : public SpellScriptLoader
class spell_charge_shield_bomber : public SpellScript
{
public:
spell_charge_shield_bomber() : SpellScriptLoader("spell_charge_shield_bomber") { }
PrepareSpellScript(spell_charge_shield_bomber);
class spell_charge_shield_bomber_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_charge_shield_bomber_SpellScript)
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* ship = GetCaster()->GetVehicleBase();
if (!ship)
return;
ship->CastSpell(ship, SPELL_INFRA_GREEN_SHIELD, true);
Aura* aura = ship->GetAura(SPELL_INFRA_GREEN_SHIELD);
if (!aura)
return;
aura->ModStackAmount(GetEffectValue() - 1);
}
void Register() override
{
if (m_scriptSpellId == SPELL_CHARGE_SHIELD)
OnEffectHitTarget += SpellEffectFn(spell_charge_shield_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_charge_shield_bomber_SpellScript();
return ValidateSpellInfo({ SPELL_INFRA_GREEN_SHIELD });
}
class spell_charge_shield_bomber_AuraScript : public AuraScript
void HandleDummy(SpellEffIndex effIndex)
{
PrepareAuraScript(spell_charge_shield_bomber_AuraScript);
PreventHitDefaultEffect(effIndex);
Unit* ship = GetCaster()->GetVehicleBase();
if (!ship)
return;
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
ship->CastSpell(ship, SPELL_INFRA_GREEN_SHIELD, true);
Aura* aura = ship->GetAura(SPELL_INFRA_GREEN_SHIELD);
if (!aura)
return;
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
uint32 absorbPct = GetStackAmount() / 2;
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
ModStackAmount(-1);
}
aura->ModStackAmount(GetEffectValue() - 1);
}
void Register() override
{
if (m_scriptSpellId == SPELL_INFRA_GREEN_SHIELD)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_charge_shield_bomber_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_charge_shield_bomber_AuraScript::Absorb, EFFECT_0);
}
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_charge_shield_bomber_AuraScript();
if (m_scriptSpellId == SPELL_CHARGE_SHIELD)
OnEffectHitTarget += SpellEffectFn(spell_charge_shield_bomber::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_fight_fire_bomber : public SpellScriptLoader
class spell_charge_shield_bomber_aura : public AuraScript
{
public:
spell_fight_fire_bomber() : SpellScriptLoader("spell_fight_fire_bomber") { }
PrepareAuraScript(spell_charge_shield_bomber_aura);
class spell_fight_fire_bomber_SpellScript : public SpellScript
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
PrepareSpellScript(spell_fight_fire_bomber_SpellScript)
// Set absorbtion amount to unlimited
amount = -1;
}
void HandleDummy(SpellEffIndex effIndex)
void Absorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
{
uint32 absorbPct = GetStackAmount() / 2;
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
ModStackAmount(-1);
}
void Register() override
{
if (m_scriptSpellId == SPELL_INFRA_GREEN_SHIELD)
{
PreventHitDefaultEffect(effIndex);
Vehicle* kit = GetCaster()->GetVehicle();
if (!kit)
return;
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_charge_shield_bomber_aura::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_charge_shield_bomber_aura::Absorb, EFFECT_0);
}
}
};
bool extinguished = false;
uint8 fireCount = 0;
for (uint8 seat = 3; seat <= 5; ++seat)
if (Unit* banner = kit->GetPassenger(seat))
if (banner->HasAura(SPELL_COSMETIC_FIRE))
class spell_fight_fire_bomber : public SpellScript
{
PrepareSpellScript(spell_fight_fire_bomber);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_COSMETIC_FIRE, SPELL_EXTINGUISH_FIRE, SPELL_BURNING });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Vehicle* kit = GetCaster()->GetVehicle();
if (!kit)
return;
bool extinguished = false;
uint8 fireCount = 0;
for (uint8 seat = 3; seat <= 5; ++seat)
if (Unit* banner = kit->GetPassenger(seat))
if (banner->HasAura(SPELL_COSMETIC_FIRE))
{
if (!extinguished)
{
if (!extinguished)
GetCaster()->CastSpell(banner, SPELL_EXTINGUISH_FIRE, true);
extinguished = true;
if (urand(0, 2))
{
GetCaster()->CastSpell(banner, SPELL_EXTINGUISH_FIRE, true);
extinguished = true;
if (urand(0, 2))
{
banner->RemoveAurasDueToSpell(SPELL_COSMETIC_FIRE);
continue;
}
banner->RemoveAurasDueToSpell(SPELL_COSMETIC_FIRE);
continue;
}
fireCount++;
}
fireCount++;
}
if (fireCount == 0)
GetCaster()->RemoveAurasDueToSpell(SPELL_BURNING);
}
if (fireCount == 0)
GetCaster()->RemoveAurasDueToSpell(SPELL_BURNING);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_fight_fire_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_fight_fire_bomber_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_fight_fire_bomber::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_anti_air_rocket_bomber : public SpellScriptLoader
class spell_anti_air_rocket_bomber : public SpellScript
{
public:
spell_anti_air_rocket_bomber() : SpellScriptLoader("spell_anti_air_rocket_bomber") { }
PrepareSpellScript(spell_anti_air_rocket_bomber);
class spell_anti_air_rocket_bomber_SpellScript : public SpellScript
void HandleDummy(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_anti_air_rocket_bomber_SpellScript)
PreventHitDefaultEffect(effIndex);
const WorldLocation* loc = GetExplTargetDest();
GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), GetSpellInfo()->Effects[effIndex].CalcValue(), true);
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
const WorldLocation* loc = GetExplTargetDest();
GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), GetSpellInfo()->Effects[effIndex].CalcValue(), true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_anti_air_rocket_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_anti_air_rocket_bomber_SpellScript();
OnEffectLaunch += SpellEffectFn(spell_anti_air_rocket_bomber::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -1439,33 +1400,22 @@ public:
}
};
class spell_onslaught_or_call_bone_gryphon : public SpellScriptLoader
class spell_onslaught_or_call_bone_gryphon : public SpellScript
{
public:
spell_onslaught_or_call_bone_gryphon() : SpellScriptLoader("spell_onslaught_or_call_bone_gryphon") { }
PrepareSpellScript(spell_onslaught_or_call_bone_gryphon);
class spell_onslaught_or_call_bone_gryphon_SpellScript : public SpellScript
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_onslaught_or_call_bone_gryphon_SpellScript);
WorldLocation summonPos = *GetExplTargetDest();
Position offset = { 0.0f, 0.0f, 3.0f, 0.0f };
summonPos.RelocateOffset(offset);
SetExplTargetDest(summonPos);
GetHitDest()->RelocateOffset(offset);
}
void ChangeSummonPos(SpellEffIndex /*effIndex*/)
{
WorldLocation summonPos = *GetExplTargetDest();
Position offset = { 0.0f, 0.0f, 3.0f, 0.0f };
summonPos.RelocateOffset(offset);
SetExplTargetDest(summonPos);
GetHitDest()->RelocateOffset(offset);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_onslaught_or_call_bone_gryphon_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_onslaught_or_call_bone_gryphon_SpellScript();
OnEffectHit += SpellEffectFn(spell_onslaught_or_call_bone_gryphon::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
}
};
@@ -2192,12 +2142,12 @@ void AddSC_icecrown()
new npc_lord_arete();
new npc_boneguard_footman();
new npc_tirions_gambit_tirion();
new spell_switch_infragreen_bomber_station();
new spell_charge_shield_bomber();
new spell_fight_fire_bomber();
new spell_anti_air_rocket_bomber();
RegisterSpellScript(spell_switch_infragreen_bomber_station);
RegisterSpellAndAuraScriptPair(spell_charge_shield_bomber, spell_charge_shield_bomber_aura);
RegisterSpellScript(spell_fight_fire_bomber);
RegisterSpellScript(spell_anti_air_rocket_bomber);
new npc_infra_green_bomber_generic();
new spell_onslaught_or_call_bone_gryphon();
RegisterSpellScript(spell_onslaught_or_call_bone_gryphon);
RegisterSpellScript(spell_deliver_gryphon);
// Theirs

View File

@@ -38,42 +38,31 @@ enum songOfWindandWater
NPC_SOWAW_WATER_MODEL = 20076,
};
class spell_q12726_song_of_wind_and_water : public SpellScriptLoader
class spell_q12726_song_of_wind_and_water : public SpellScript
{
public:
spell_q12726_song_of_wind_and_water() : SpellScriptLoader("spell_q12726_song_of_wind_and_water") { }
PrepareSpellScript(spell_q12726_song_of_wind_and_water);
class spell_q12726_song_of_wind_and_water_SpellScript : public SpellScript
void HandleHealPct(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_q12726_song_of_wind_and_water_SpellScript);
void HandleHealPct(SpellEffIndex /*effIndex*/)
if (Creature* cr = GetHitCreature())
{
if (Creature* cr = GetHitCreature())
//cr->UpdateEntry((cr->GetEntry() == NPC_SOWAW_WATER_ELEMENTAL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL));
cr->SetDisplayId(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? NPC_SOWAW_WIND_MODEL : NPC_SOWAW_WATER_MODEL);
if (Player* player = cr->GetCharmerOrOwnerPlayerOrPlayerItself())
{
//cr->UpdateEntry((cr->GetEntry() == NPC_SOWAW_WATER_ELEMENTAL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL));
cr->SetDisplayId(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? NPC_SOWAW_WIND_MODEL : NPC_SOWAW_WATER_MODEL);
if (Player* player = cr->GetCharmerOrOwnerPlayerOrPlayerItself())
{
player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009);
CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL);
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
cr->m_spells[i] = ct->spells[i];
player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009);
CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL);
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
cr->m_spells[i] = ct->spells[i];
player->VehicleSpellInitialize();
}
player->VehicleSpellInitialize();
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12726_song_of_wind_and_water_SpellScript::HandleHealPct, EFFECT_2, SPELL_EFFECT_HEAL_PCT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q12726_song_of_wind_and_water_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_q12726_song_of_wind_and_water::HandleHealPct, EFFECT_2, SPELL_EFFECT_HEAL_PCT);
}
};
@@ -1140,64 +1129,58 @@ enum MiscLifewarden
SPELL_WILD_GROWTH = 52948,
};
class spell_q12620_the_lifewarden_wrath : public SpellScriptLoader
class spell_q12620_the_lifewarden_wrath : public SpellScript
{
public:
spell_q12620_the_lifewarden_wrath() : SpellScriptLoader("spell_q12620_the_lifewarden_wrath") { }
PrepareSpellScript(spell_q12620_the_lifewarden_wrath);
class spell_q12620_the_lifewarden_wrath_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q12620_the_lifewarden_wrath_SpellScript);
return ValidateSpellInfo({ SPELL_FREYA_DUMMY, SPELL_FREYA_DUMMY_TRIGGER, SPELL_LASHER_EMERGE, SPELL_WILD_GROWTH, SPELL_LIFEFORCE });
}
void HandleSendEvent(SpellEffIndex effIndex)
void HandleSendEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* caster = GetCaster())
{
PreventHitDefaultEffect(effIndex);
if (Unit* caster = GetCaster())
if (Creature* presence = caster->FindNearestCreature(NPC_PRESENCE, 50.0f))
{
if (Creature* presence = caster->FindNearestCreature(NPC_PRESENCE, 50.0f))
presence->AI()->Talk(WHISPER_ACTIVATE, caster);
presence->CastSpell(presence, SPELL_FREYA_DUMMY, true); // will target plants
// Freya Dummy could be scripted with the following code
// Revive plants
std::list<Creature*> servants;
GetCaster()->GetCreatureListWithEntryInGrid(servants, NPC_SERVANT, 200.0f);
for (std::list<Creature*>::iterator itr = servants.begin(); itr != servants.end(); ++itr)
{
presence->AI()->Talk(WHISPER_ACTIVATE, caster);
presence->CastSpell(presence, SPELL_FREYA_DUMMY, true); // will target plants
// Freya Dummy could be scripted with the following code
// Couldn't find a spell that does this
if ((*itr)->isDead())
(*itr)->Respawn(true);
// Revive plants
std::list<Creature*> servants;
GetCaster()->GetCreatureListWithEntryInGrid(servants, NPC_SERVANT, 200.0f);
for (std::list<Creature*>::iterator itr = servants.begin(); itr != servants.end(); ++itr)
{
// Couldn't find a spell that does this
if ((*itr)->isDead())
(*itr)->Respawn(true);
(*itr)->CastSpell(*itr, SPELL_FREYA_DUMMY_TRIGGER, true);
(*itr)->CastSpell(*itr, SPELL_LASHER_EMERGE, false);
(*itr)->CastSpell(*itr, SPELL_WILD_GROWTH, false);
(*itr)->CastSpell(*itr, SPELL_FREYA_DUMMY_TRIGGER, true);
(*itr)->CastSpell(*itr, SPELL_LASHER_EMERGE, false);
(*itr)->CastSpell(*itr, SPELL_WILD_GROWTH, false);
if (Unit* target = (*itr)->SelectNearestTarget(150.0f))
(*itr)->AI()->AttackStart(target);
}
// Kill nearby enemies
std::list<Creature*> saboteurs;
caster->GetCreatureListWithEntryInGrid(saboteurs, NPC_SABOTEUR, 200.0f);
for (std::list<Creature*>::iterator itr = saboteurs.begin(); itr != saboteurs.end(); ++itr)
if ((*itr)->IsAlive())
// Lifeforce has a cast duration, it should be cast at all saboteurs one by one
presence->CastSpell((*itr), SPELL_LIFEFORCE, false);
if (Unit* target = (*itr)->SelectNearestTarget(150.0f))
(*itr)->AI()->AttackStart(target);
}
// Kill nearby enemies
std::list<Creature*> saboteurs;
caster->GetCreatureListWithEntryInGrid(saboteurs, NPC_SABOTEUR, 200.0f);
for (std::list<Creature*>::iterator itr = saboteurs.begin(); itr != saboteurs.end(); ++itr)
if ((*itr)->IsAlive())
// Lifeforce has a cast duration, it should be cast at all saboteurs one by one
presence->CastSpell((*itr), SPELL_LIFEFORCE, false);
}
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_q12620_the_lifewarden_wrath_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q12620_the_lifewarden_wrath_SpellScript();
OnEffectHit += SpellEffectFn(spell_q12620_the_lifewarden_wrath::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
@@ -1228,101 +1211,95 @@ enum KickWhatKick
SAY_DROSTAN_REPLY_MISS = 0,
};
class spell_q12589_shoot_rjr : public SpellScriptLoader
class spell_q12589_shoot_rjr : public SpellScript
{
public:
spell_q12589_shoot_rjr() : SpellScriptLoader("spell_q12589_shoot_rjr") { }
PrepareSpellScript(spell_q12589_shoot_rjr);
class spell_q12589_shoot_rjr_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q12589_shoot_rjr_SpellScript);
return ValidateSpellInfo({ SPELL_MISS_BIRD_APPLE, SPELL_BIRD_FALL, SPELL_MISS_APPLE, SPELL_HIT_APPLE, SPELL_APPLE_FALL });
}
SpellCastResult CheckCast()
SpellCastResult CheckCast()
{
if (Unit* target = GetExplTargetUnit())
if (target->GetEntry() == NPC_LUCKY_WILHELM)
return SPELL_CAST_OK;
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
return SPELL_FAILED_CUSTOM_ERROR;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 roll = urand(1, 100);
uint8 ev;
if (roll <= 50)
ev = EVENT_MISS;
else if (roll <= 83)
ev = EVENT_HIT;
else
ev = EVENT_MISS_BIRD;
Unit* shooter = GetCaster();
Creature* wilhelm = GetHitUnit()->ToCreature();
Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);
if (!wilhelm || !apple || !drostan)
return;
switch (ev)
{
if (Unit* target = GetExplTargetUnit())
if (target->GetEntry() == NPC_LUCKY_WILHELM)
return SPELL_CAST_OK;
case EVENT_MISS_BIRD:
{
Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_TARGET_WILHELM);
return SPELL_FAILED_CUSTOM_ERROR;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
uint32 roll = urand(1, 100);
uint8 ev;
if (roll <= 50)
ev = EVENT_MISS;
else if (roll <= 83)
ev = EVENT_HIT;
else
ev = EVENT_MISS_BIRD;
Unit* shooter = GetCaster();
Creature* wilhelm = GetHitUnit()->ToCreature();
Creature* apple = shooter->FindNearestCreature(NPC_APPLE, 30);
Creature* drostan = shooter->FindNearestCreature(NPC_DROSTAN, 30);
if (!wilhelm || !apple || !drostan)
return;
switch (ev)
{
case EVENT_MISS_BIRD:
if (!bird || !crunchy)
; // fall to EVENT_MISS
else
{
Creature* crunchy = shooter->FindNearestCreature(NPC_CRUNCHY, 30);
Creature* bird = shooter->FindNearestCreature(NPC_THICKBIRD, 30);
if (!bird || !crunchy)
; // fall to EVENT_MISS
else
{
shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
bird->CastSpell(bird, SPELL_BIRD_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_MISS);
drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
Unit::Kill(bird, bird);
crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
bird->GetMapWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
/// @todo Make crunchy perform emote eat when he reaches the bird
break;
}
[[fallthrough]];
}
case EVENT_MISS:
{
shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
shooter->CastSpell(bird, SPELL_MISS_BIRD_APPLE);
bird->CastSpell(bird, SPELL_BIRD_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_MISS);
drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
break;
}
case EVENT_HIT:
{
shooter->CastSpell(apple, SPELL_HIT_APPLE);
apple->CastSpell(apple, SPELL_APPLE_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_HIT);
if (Player* player = shooter->ToPlayer())
player->KilledMonsterCredit(NPC_APPLE);
//apple->DespawnOrUnsummon(); zomg!
Unit::Kill(bird, bird);
crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
bird->GetMapWaterOrGroundLevel(bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
/// @todo Make crunchy perform emote eat when he reaches the bird
break;
}
}
}
[[fallthrough]];
}
case EVENT_MISS:
{
shooter->CastSpell(wilhelm, SPELL_MISS_APPLE);
wilhelm->AI()->Talk(SAY_WILHELM_MISS);
drostan->AI()->Talk(SAY_DROSTAN_REPLY_MISS);
break;
}
case EVENT_HIT:
{
shooter->CastSpell(apple, SPELL_HIT_APPLE);
apple->CastSpell(apple, SPELL_APPLE_FALL);
wilhelm->AI()->Talk(SAY_WILHELM_HIT);
if (Player* player = shooter->ToPlayer())
player->KilledMonsterCredit(NPC_APPLE);
//apple->DespawnOrUnsummon(); zomg!
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_q12589_shoot_rjr_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_q12589_shoot_rjr_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
break;
}
}
};
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q12589_shoot_rjr_SpellScript();
OnCheckCast += SpellCheckCastFn(spell_q12589_shoot_rjr::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_q12589_shoot_rjr::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -1450,42 +1427,31 @@ enum ShangoTracks
SAY_INCORRECT_TRACKS = 28635
};
class spell_shango_tracks : public SpellScriptLoader
class spell_shango_tracks : public SpellScript
{
public:
spell_shango_tracks() : SpellScriptLoader("spell_shango_tracks") { }
PrepareSpellScript(spell_shango_tracks);
class spell_shango_tracks_SpellScript : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_shango_tracks_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
if (Unit* target = GetHitUnit())
{
if (Unit* target = GetHitUnit())
switch (GetSpellInfo()->Id)
{
switch (GetSpellInfo()->Id)
{
case SPELL_CORRECT_TRACKS:
target->Say(SAY_CORRECT_TRACKS, target);
break;
case SPELL_INCORRECT_TRACKS:
target->Say(SAY_INCORRECT_TRACKS, target);
break;
default:
break;
}
case SPELL_CORRECT_TRACKS:
target->Say(SAY_CORRECT_TRACKS, target);
break;
case SPELL_INCORRECT_TRACKS:
target->Say(SAY_INCORRECT_TRACKS, target);
break;
default:
break;
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_shango_tracks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_shango_tracks_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_shango_tracks::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -1524,7 +1490,7 @@ class spell_q12611_deathbolt : public SpellScript
void AddSC_sholazar_basin()
{
// Ours
new spell_q12726_song_of_wind_and_water();
RegisterSpellScript(spell_q12726_song_of_wind_and_water);
new npc_artruis_the_hearthless();
new npc_still_at_it_trigger();
new npc_mcmanus();
@@ -1538,10 +1504,10 @@ void AddSC_sholazar_basin()
new npc_engineer_helice();
new npc_adventurous_dwarf();
new npc_jungle_punch_target();
new spell_q12620_the_lifewarden_wrath();
new spell_q12589_shoot_rjr();
RegisterSpellScript(spell_q12620_the_lifewarden_wrath);
RegisterSpellScript(spell_q12589_shoot_rjr);
new npc_vics_flying_machine();
new spell_shango_tracks();
RegisterSpellScript(spell_shango_tracks);
RegisterSpellScript(spell_q12611_deathbolt);
}

View File

@@ -586,48 +586,37 @@ public:
}
};
class spell_q13003_thursting_hodirs_spear : public SpellScriptLoader
class spell_q13003_thursting_hodirs_spear_aura : public AuraScript
{
public:
spell_q13003_thursting_hodirs_spear() : SpellScriptLoader("spell_q13003_thursting_hodirs_spear") { }
PrepareAuraScript(spell_q13003_thursting_hodirs_spear_aura);
class spell_q13003_thursting_hodirs_spear_AuraScript : public AuraScript
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q13003_thursting_hodirs_spear_AuraScript);
ModStackAmount(60);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* creature = GetUnitOwner()->ToCreature())
{
ModStackAmount(60);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Creature* creature = GetUnitOwner()->ToCreature())
if (!creature->IsInEvadeMode())
{
if (!creature->IsInEvadeMode())
{
creature->RemoveAllAuras();
creature->AI()->EnterEvadeMode();
}
creature->RemoveAllAuras();
creature->AI()->EnterEvadeMode();
}
}
}
void HandlePeriodic(AuraEffect const* /* aurEff */)
{
ModStackAmount(-1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q13003_thursting_hodirs_spear_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_q13003_thursting_hodirs_spear_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_q13003_thursting_hodirs_spear_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodic(AuraEffect const* /* aurEff */)
{
return new spell_q13003_thursting_hodirs_spear_AuraScript();
ModStackAmount(-1);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q13003_thursting_hodirs_spear_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_q13003_thursting_hodirs_spear_aura::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_q13003_thursting_hodirs_spear_aura::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -639,59 +628,53 @@ enum q13007IronColossus
SPELL_COLOSSUS_GROUND_SLAM = 61673
};
class spell_q13007_iron_colossus : public SpellScriptLoader
class spell_q13007_iron_colossus : public SpellScript
{
public:
spell_q13007_iron_colossus() : SpellScriptLoader("spell_q13007_iron_colossus") { }
PrepareSpellScript(spell_q13007_iron_colossus);
class spell_q13007_iron_colossus_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q13007_iron_colossus_SpellScript);
return ValidateSpellInfo({ SPELL_JORMUNGAR_SUBMERGE_VISUAL, SPELL_COLOSSUS_GROUND_SLAM });
}
void HandleDummy(SpellEffIndex effIndex)
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Creature* caster = GetCaster()->ToCreature();
if (!caster)
return;
if (GetSpellInfo()->Id == SPELL_JORMUNGAR_SUBMERGE)
{
PreventHitDefaultEffect(effIndex);
Creature* caster = GetCaster()->ToCreature();
if (!caster)
return;
caster->CastSpell(caster, SPELL_JORMUNGAR_SUBMERGE_VISUAL, true);
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true);
caster->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
caster->SetControlled(false, UNIT_STATE_ROOT);
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
caster->m_spells[i] = 0;
if (GetSpellInfo()->Id == SPELL_JORMUNGAR_SUBMERGE)
{
caster->CastSpell(caster, SPELL_JORMUNGAR_SUBMERGE_VISUAL, true);
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true);
caster->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
caster->SetControlled(false, UNIT_STATE_ROOT);
caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE;
}
else
{
caster->RemoveAurasDueToSpell(SPELL_JORMUNGAR_SUBMERGE_VISUAL);
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, false);
caster->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
caster->SetControlled(true, UNIT_STATE_ROOT);
if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry()))
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
caster->m_spells[i] = 0;
caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE;
}
else
{
caster->RemoveAurasDueToSpell(SPELL_JORMUNGAR_SUBMERGE_VISUAL);
caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, false);
caster->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
caster->SetControlled(true, UNIT_STATE_ROOT);
if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry()))
for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i)
caster->m_spells[i] = ct->spells[i];
}
if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
player->VehicleSpellInitialize();
caster->m_spells[i] = ct->spells[i];
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q13007_iron_colossus_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
player->VehicleSpellInitialize();
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q13007_iron_colossus_SpellScript();
};
OnEffectHitTarget += SpellEffectFn(spell_q13007_iron_colossus::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// Theirs
@@ -1026,45 +1009,34 @@ enum CloseRift
SPELL_DESPAWN_RIFT = 61665
};
class spell_close_rift : public SpellScriptLoader
class spell_close_rift_aura : public AuraScript
{
public:
spell_close_rift() : SpellScriptLoader("spell_close_rift") { }
PrepareAuraScript(spell_close_rift_aura);
class spell_close_rift_AuraScript : public AuraScript
bool Load() override
{
PrepareAuraScript(spell_close_rift_AuraScript);
bool Load() override
{
_counter = 0;
return true;
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_DESPAWN_RIFT });
}
void HandlePeriodic(AuraEffect const* /* aurEff */)
{
if (++_counter == 5)
GetTarget()->CastSpell((Unit*)nullptr, SPELL_DESPAWN_RIFT, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_close_rift_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
private:
uint8 _counter;
};
AuraScript* GetAuraScript() const override
{
return new spell_close_rift_AuraScript();
_counter = 0;
return true;
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_DESPAWN_RIFT });
}
void HandlePeriodic(AuraEffect const* /* aurEff */)
{
if (++_counter == 5)
GetTarget()->CastSpell((Unit*)nullptr, SPELL_DESPAWN_RIFT, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_close_rift_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
private:
uint8 _counter;
};
enum CollapsingCave
@@ -1204,14 +1176,14 @@ void AddSC_storm_peaks()
new npc_iron_watcher();
new npc_time_lost_proto_drake();
new npc_wild_wyrm();
new spell_q13003_thursting_hodirs_spear();
new spell_q13007_iron_colossus();
RegisterSpellScript(spell_q13003_thursting_hodirs_spear_aura);
RegisterSpellScript(spell_q13007_iron_colossus);
new npc_roxi_ramrocket();
new npc_brunnhildar_prisoner();
new npc_freed_protodrake();
new npc_icefang();
new npc_hyldsmeet_protodrake();
new spell_close_rift();
RegisterSpellScript(spell_close_rift_aura);
new npc_vehicle_d16_propelled_delivery();
RegisterSpellScript(spell_q12823_remove_collapsing_cave_aura);
}

View File

@@ -904,265 +904,198 @@ public:
/* 56662, 61409 - Build Siege Vehicle (Force)
56664 - Build Catapult (Force)
56659 - Build Demolisher (Force) */
class spell_wintergrasp_force_building : public SpellScriptLoader
class spell_wintergrasp_force_building : public SpellScript
{
public:
spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { }
PrepareSpellScript(spell_wintergrasp_force_building);
class spell_wintergrasp_force_building_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareSpellScript(spell_wintergrasp_force_building_SpellScript);
return ValidateSpellInfo(
{
SPELL_BUILD_CATAPULT_FORCE,
SPELL_BUILD_DEMOLISHER_FORCE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE
});
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_BUILD_CATAPULT_FORCE,
SPELL_BUILD_DEMOLISHER_FORCE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE
});
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, GetEffectValue(), false, nullptr, nullptr, target->GetGUID());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_wintergrasp_force_building_SpellScript();
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
target->CastSpell(target, GetEffectValue(), false, nullptr, nullptr, target->GetGUID());
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
/* 56661, 61408 - Build Siege Engine
56663 - Build Catapult
56575 - Build Demolisher */
class spell_wintergrasp_create_vehicle : public SpellScriptLoader
class spell_wintergrasp_create_vehicle : public SpellScript
{
public:
spell_wintergrasp_create_vehicle() : SpellScriptLoader("spell_wintergrasp_create_vehicle") { }
PrepareSpellScript(spell_wintergrasp_create_vehicle);
class spell_wintergrasp_create_vehicle_SpellScript : public SpellScript
void HandleSummon(SpellEffIndex effIndex)
{
PrepareSpellScript(spell_wintergrasp_create_vehicle_SpellScript);
PreventHitEffect(effIndex);
void HandleSummon(SpellEffIndex effIndex)
if (Unit* caster = GetCaster())
{
PreventHitEffect(effIndex);
if (Unit* caster = GetCaster())
Unit* originalCaster = GetOriginalCaster();
if (!originalCaster)
{
Unit* originalCaster = GetOriginalCaster();
if (!originalCaster)
{
return;
}
return;
}
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB);
if (!properties)
{
return;
}
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB);
if (!properties)
{
return;
}
uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue;
int32 duration = GetSpellInfo()->GetDuration();
if (TempSummon* summon = caster->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, originalCaster, GetSpellInfo()->Id))
uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue;
int32 duration = GetSpellInfo()->GetDuration();
if (TempSummon* summon = caster->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, originalCaster, GetSpellInfo()->Id))
{
if (summon->IsInMap(caster))
{
if (summon->IsInMap(caster))
{
summon->SetCreatorGUID(originalCaster->GetGUID());
summon->HandleSpellClick(caster);
}
summon->SetCreatorGUID(originalCaster->GetGUID());
summon->HandleSpellClick(caster);
}
}
}
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_wintergrasp_create_vehicle_SpellScript::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_wintergrasp_create_vehicle_SpellScript;
OnEffectHit += SpellEffectFn(spell_wintergrasp_create_vehicle::HandleSummon, EFFECT_1, SPELL_EFFECT_SUMMON);
}
};
// 49761 - Rocket-Propelled Goblin Grenade
class spell_wintergrasp_rp_gg : public SpellScriptLoader
class spell_wintergrasp_rp_gg : public SpellScript
{
public:
spell_wintergrasp_rp_gg() : SpellScriptLoader("spell_wintergrasp_rp_gg") { }
PrepareSpellScript(spell_wintergrasp_rp_gg);
class spell_wintergrasp_rp_gg_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_wintergrasp_rp_gg_SpellScript);
return ValidateSpellInfo({ SPELL_RP_GG_TRIGGER_MISSILE });
}
bool handled;
bool Load() override
{
handled = false;
return true;
}
void HandleFinish()
{
if (!GetExplTargetDest())
return;
GetCaster()->CastSpell(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY(), GetExplTargetDest()->GetPositionZ(), SPELL_RP_GG_TRIGGER_MISSILE, true);
}
void Register() override
{
AfterCast += SpellCastFn(spell_wintergrasp_rp_gg_SpellScript::HandleFinish);
}
};
SpellScript* GetSpellScript() const override
bool handled;
bool Load() override
{
return new spell_wintergrasp_rp_gg_SpellScript();
handled = false;
return true;
}
void HandleFinish()
{
if (!GetExplTargetDest())
return;
GetCaster()->CastSpell(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY(), GetExplTargetDest()->GetPositionZ(), SPELL_RP_GG_TRIGGER_MISSILE, true);
}
void Register() override
{
AfterCast += SpellCastFn(spell_wintergrasp_rp_gg::HandleFinish);
}
};
// 58622 - Teleport to Lake Wintergrasp
class spell_wintergrasp_portal : public SpellScriptLoader
class spell_wintergrasp_portal : public SpellScript
{
public:
spell_wintergrasp_portal() : SpellScriptLoader("spell_wintergrasp_portal") { }
PrepareSpellScript(spell_wintergrasp_portal);
class spell_wintergrasp_portal_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_wintergrasp_portal_SpellScript);
return ValidateSpellInfo({ SPELL_TELEPORT_TO_FORTRESS });
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (!wintergrasp || !target || target->GetLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId()))
return;
target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
void HandleScript(SpellEffIndex effIndex)
{
return new spell_wintergrasp_portal_SpellScript();
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
if (!wintergrasp || !target || target->GetLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId()))
return;
target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_portal::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 36444 - Wintergrasp Water
class spell_wintergrasp_water : public SpellScriptLoader
class spell_wintergrasp_water : public SpellScript
{
public:
spell_wintergrasp_water() : SpellScriptLoader("spell_wintergrasp_water") { }
PrepareSpellScript(spell_wintergrasp_water);
class spell_wintergrasp_water_SpellScript : public SpellScript
SpellCastResult CheckCast()
{
PrepareSpellScript(spell_wintergrasp_water_SpellScript);
Unit* target = GetCaster();
if (!target || !target->IsVehicle())
return SPELL_FAILED_DONT_REPORT;
SpellCastResult CheckCast()
{
Unit* target = GetCaster();
if (!target || !target->IsVehicle())
return SPELL_FAILED_DONT_REPORT;
return SPELL_CAST_OK;
}
return SPELL_CAST_OK;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_wintergrasp_water_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_wintergrasp_water_SpellScript();
OnCheckCast += SpellCheckCastFn(spell_wintergrasp_water::CheckCast);
}
};
// 52107 - (Spell not exist in DBC)
class spell_wintergrasp_hide_small_elementals : public SpellScriptLoader
class spell_wintergrasp_hide_small_elementals_aura : public AuraScript
{
public:
spell_wintergrasp_hide_small_elementals() : SpellScriptLoader("spell_wintergrasp_hide_small_elementals") { }
PrepareAuraScript(spell_wintergrasp_hide_small_elementals_aura);
class spell_wintergrasp_hide_small_elementals_AuraScript : public AuraScript
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
{
PrepareAuraScript(spell_wintergrasp_hide_small_elementals_AuraScript);
Unit* target = GetTarget();
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId());
bool enable = !Bf || !Bf->IsWarTime();
target->SetPhaseMask(enable ? 1 : 512, true);
PreventDefaultAction();
}
void HandlePeriodicDummy(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId());
bool enable = !Bf || !Bf->IsWarTime();
target->SetPhaseMask(enable ? 1 : 512, true);
PreventDefaultAction();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_wintergrasp_hide_small_elementals_AuraScript::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_wintergrasp_hide_small_elementals_AuraScript();
OnEffectPeriodic += AuraEffectPeriodicFn(spell_wintergrasp_hide_small_elementals_aura::HandlePeriodicDummy, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
/* 57610, 51422 - Cannon
50999 - Boulder
57607 - Plague Slime */
class spell_wg_reduce_damage_by_distance : public SpellScriptLoader
class spell_wg_reduce_damage_by_distance : public SpellScript
{
public:
spell_wg_reduce_damage_by_distance() : SpellScriptLoader("spell_wg_reduce_damage_by_distance") { }
PrepareSpellScript(spell_wg_reduce_damage_by_distance);
class spell_wg_reduce_damage_by_distance_SpellScript : public SpellScript
void RecalculateDamage()
{
PrepareSpellScript(spell_wg_reduce_damage_by_distance_SpellScript);
if (!GetExplTargetDest() || !GetHitUnit())
return;
void RecalculateDamage()
{
if (!GetExplTargetDest() || !GetHitUnit())
return;
float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0
float distance = std::min<float>(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance);
float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0
float distance = std::min<float>(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance);
int32 damage = std::max<int32>(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance))));
SetHitDamage(damage);
}
int32 damage = std::max<int32>(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance))));
SetHitDamage(damage);
}
void Register() override
{
OnHit += SpellHitFn(spell_wg_reduce_damage_by_distance_SpellScript::RecalculateDamage);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_wg_reduce_damage_by_distance_SpellScript();
OnHit += SpellHitFn(spell_wg_reduce_damage_by_distance::RecalculateDamage);
}
};
@@ -1242,13 +1175,13 @@ void AddSC_wintergrasp()
new go_wg_vehicle_teleporter();
// SPELLs
new spell_wintergrasp_force_building();
new spell_wintergrasp_create_vehicle();
new spell_wintergrasp_rp_gg();
new spell_wintergrasp_portal();
new spell_wintergrasp_water();
new spell_wintergrasp_hide_small_elementals();
new spell_wg_reduce_damage_by_distance();
RegisterSpellScript(spell_wintergrasp_force_building);
RegisterSpellScript(spell_wintergrasp_create_vehicle);
RegisterSpellScript(spell_wintergrasp_rp_gg);
RegisterSpellScript(spell_wintergrasp_portal);
RegisterSpellScript(spell_wintergrasp_water);
RegisterSpellScript(spell_wintergrasp_hide_small_elementals_aura);
RegisterSpellScript(spell_wg_reduce_damage_by_distance);
// ACHIEVEMENTs
new achievement_wg_didnt_stand_a_chance();