Scripts/Spells: Migrate & update several item spell scripts to zone files (#31171)

This commit is contained in:
offl
2025-08-17 19:26:27 +03:00
committed by GitHub
parent 5649e4e76c
commit 760cd824bb
4 changed files with 141 additions and 117 deletions

View File

@@ -0,0 +1,17 @@
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_netherstorm_detonate_teleporter' WHERE `ScriptName` = 'spell_detonate_teleporter';
-- Shouldn't be used for teleport, only to trigger events
DELETE FROM `areatrigger_teleport` WHERE `ID` = 4523;
DELETE FROM `gameobject` WHERE `guid` = 91320 AND `id` = 184606;
INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `StringId`, `VerifiedBuild`) VALUES
(91320,184606,530,0,0,1,1,4799.248,3779.397,211.75,0,0,0,0,1,300,0,1,'',NULL,0);
UPDATE `spell_script_names` SET `ScriptName` = 'spell_netherstorm_socrethars_stone' WHERE `ScriptName` = 'spell_item_socrethars_stone';
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_hellfire_peninsula_purify_helboar_meat' WHERE `ScriptName` = 'spell_item_purify_helboar_meat';
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_hellfire_peninsula_absorb_eye_of_grillok' WHERE `ScriptName` = 'spell_item_absorb_eye_of_grillok';

View File

@@ -883,6 +883,77 @@ public:
explicit spell_hellfire_peninsula_translocation_falcon_watch(Translocation triggeredSpellId) : _triggeredSpellId(triggeredSpellId) { }
};
/*######
## Quest 9361: Helboar, the Other White Meat
######*/
enum HelboarTheOtherWhiteMeat
{
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277,
SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278
};
// 29200 - Purify Helboar Meat
class spell_hellfire_peninsula_purify_helboar_meat : public SpellScript
{
PrepareSpellScript(spell_hellfire_peninsula_purify_helboar_meat);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_PURIFIED_HELBOAR_MEAT, SPELL_SUMMON_TOXIC_HELBOAR_MEAT });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetCaster(), roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_hellfire_peninsula_purify_helboar_meat::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
/*######
## Quest 10813: The Eyes of Grillok
######*/
enum TheEyesOfGrillok
{
SPELL_EYE_OF_GRILLOK = 38495
};
// 38554 - Absorb Eye of Grillok
class spell_hellfire_peninsula_absorb_eye_of_grillok : public AuraScript
{
PrepareAuraScript(spell_hellfire_peninsula_absorb_eye_of_grillok);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (Unit* caster = GetCaster())
GetTarget()->CastSpell(caster, SPELL_EYE_OF_GRILLOK, aurEff);
if (Creature* target = GetTarget()->ToCreature())
{
/// @todo: This is a hack, in flight missiles of spells of despawned creatures get cancelled - delay despawning by the duration of SPELL_EYE_OF_GRILLOK aura
target->SetVisible(false);
target->DespawnOrUnsummon(5s);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hellfire_peninsula_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_hellfire_peninsula()
{
new npc_colonel_jules();
@@ -895,4 +966,6 @@ void AddSC_hellfire_peninsula()
RegisterSpellScript(spell_hellfire_peninsula_send_vengeance_to_player);
RegisterSpellScriptWithArgs(spell_hellfire_peninsula_translocation_falcon_watch, "spell_hellfire_peninsula_translocation_falcon_watch_tower_down", SPELL_TRANSLOCATION_FALCON_WATCH_TOWER_DOWN);
RegisterSpellScriptWithArgs(spell_hellfire_peninsula_translocation_falcon_watch, "spell_hellfire_peninsula_translocation_falcon_watch_tower_up", SPELL_TRANSLOCATION_FALCON_WATCH_TOWER_UP);
RegisterSpellScript(spell_hellfire_peninsula_purify_helboar_meat);
RegisterSpellScript(spell_hellfire_peninsula_absorb_eye_of_grillok);
}

View File

@@ -464,7 +464,7 @@ public:
## Quest 10857: Teleport This!
######*/
enum DetonateTeleporter
enum TeleportThis
{
SPELL_TELEPORTER_KILL_CREDIT_1 = 38982, // 22348
SPELL_TELEPORTER_KILL_CREDIT_2 = 38983, // 22351
@@ -475,9 +475,9 @@ enum DetonateTeleporter
};
// 38920 - Detonate Teleporter
class spell_detonate_teleporter : public SpellScript
class spell_netherstorm_detonate_teleporter : public SpellScript
{
PrepareSpellScript(spell_detonate_teleporter);
PrepareSpellScript(spell_netherstorm_detonate_teleporter);
bool Load() override
{
@@ -527,7 +527,52 @@ class spell_detonate_teleporter : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_detonate_teleporter::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHitTarget += SpellEffectFn(spell_netherstorm_detonate_teleporter::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
/*######
## Quest 10409: Deathblow to the Legion
######*/
enum DeathblowToTheLegion
{
SPELL_SOCRETHAR_TO_SEAT = 35743,
SPELL_SOCRETHAR_FROM_SEAT = 35744,
AREA_INVASION_POINT_OVERLORD = 3900,
AREA_SOCRETHARS_SEAT = 3742
};
// 35745 - Socrethar's Stone
class spell_netherstorm_socrethars_stone : public SpellScript
{
PrepareSpellScript(spell_netherstorm_socrethars_stone);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT });
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
switch (caster->GetAreaId())
{
case AREA_INVASION_POINT_OVERLORD:
caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT);
break;
case AREA_SOCRETHARS_SEAT:
caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT);
break;
default:
return;
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_netherstorm_socrethars_stone::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -536,5 +581,6 @@ void AddSC_netherstorm()
new npc_commander_dawnforge();
new at_commander_dawnforge();
new npc_phase_hunter();
RegisterSpellScript(spell_detonate_teleporter);
RegisterSpellScript(spell_netherstorm_detonate_teleporter);
RegisterSpellScript(spell_netherstorm_socrethars_stone);
}

View File

@@ -116,38 +116,6 @@ class spell_item_aegis_of_preservation : public AuraScript
}
};
enum ZezzaksShard
{
SPELL_EYE_OF_GRILLOK = 38495
};
// 38554 - Absorb Eye of Grillok (31463: Zezzak's Shard)
class spell_item_absorb_eye_of_grillok : public AuraScript
{
PrepareAuraScript(spell_item_absorb_eye_of_grillok);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (!GetCaster() || GetTarget()->GetTypeId() != TYPEID_UNIT)
return;
GetCaster()->CastSpell(GetCaster(), SPELL_EYE_OF_GRILLOK, aurEff);
GetTarget()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum AlchemistStone
{
SPELL_ALCHEMISTS_STONE_EXTRA_HEAL = 21399,
@@ -2809,42 +2777,6 @@ class spell_magic_eater_food : public AuraScript
}
};
enum PurifyHelboarMeat
{
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277,
SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278,
};
class spell_item_purify_helboar_meat : public SpellScript
{
PrepareSpellScript(spell_item_purify_helboar_meat);
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT,
SPELL_SUMMON_TOXIC_HELBOAR_MEAT
});
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_purify_helboar_meat::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum NighInvulnerability
{
SPELL_NIGH_INVULNERABILITY = 30456,
@@ -2905,47 +2837,6 @@ class spell_item_poultryizer : public SpellScript
}
};
enum SocretharsStone
{
SPELL_SOCRETHAR_TO_SEAT = 35743,
SPELL_SOCRETHAR_FROM_SEAT = 35744,
};
class spell_item_socrethars_stone : public SpellScript
{
PrepareSpellScript(spell_item_socrethars_stone);
bool Load() override
{
return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742);
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT });
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
switch (caster->GetAreaId())
{
case 3900:
caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT, true);
break;
case 3742:
caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT, true);
break;
default:
return;
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_socrethars_stone::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum DemonBroiledSurprise
{
QUEST_SUPER_HOT_STEW = 11379,
@@ -4351,7 +4242,6 @@ void AddSC_item_spell_scripts()
new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING);
RegisterSpellScript(spell_item_aegis_of_preservation);
RegisterSpellScript(spell_item_absorb_eye_of_grillok);
RegisterSpellScript(spell_item_alchemists_stone);
new spell_item_anger_capacitor<8>("spell_item_tiny_abomination_in_a_jar");
new spell_item_anger_capacitor<7>("spell_item_tiny_abomination_in_a_jar_hero");
@@ -4429,10 +4319,8 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_ashbringer);
RegisterSpellScript(spell_magic_eater_food);
RegisterSpellScript(spell_item_purify_helboar_meat);
RegisterSpellScript(spell_item_nigh_invulnerability);
RegisterSpellScript(spell_item_poultryizer);
RegisterSpellScript(spell_item_socrethars_stone);
RegisterSpellScript(spell_item_demon_broiled_surprise);
RegisterSpellScript(spell_item_complete_raptor_capture);
RegisterSpellScript(spell_item_impale_leviroth);