Skip to content

Commit 760cd82

Browse files
authored
Scripts/Spells: Migrate & update several item spell scripts to zone files (#31171)
1 parent 5649e4e commit 760cd82

File tree

4 files changed

+141
-117
lines changed

4 files changed

+141
-117
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--
2+
UPDATE `spell_script_names` SET `ScriptName` = 'spell_netherstorm_detonate_teleporter' WHERE `ScriptName` = 'spell_detonate_teleporter';
3+
4+
-- Shouldn't be used for teleport, only to trigger events
5+
DELETE FROM `areatrigger_teleport` WHERE `ID` = 4523;
6+
7+
DELETE FROM `gameobject` WHERE `guid` = 91320 AND `id` = 184606;
8+
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
9+
(91320,184606,530,0,0,1,1,4799.248,3779.397,211.75,0,0,0,0,1,300,0,1,'',NULL,0);
10+
11+
UPDATE `spell_script_names` SET `ScriptName` = 'spell_netherstorm_socrethars_stone' WHERE `ScriptName` = 'spell_item_socrethars_stone';
12+
13+
--
14+
UPDATE `spell_script_names` SET `ScriptName` = 'spell_hellfire_peninsula_purify_helboar_meat' WHERE `ScriptName` = 'spell_item_purify_helboar_meat';
15+
16+
--
17+
UPDATE `spell_script_names` SET `ScriptName` = 'spell_hellfire_peninsula_absorb_eye_of_grillok' WHERE `ScriptName` = 'spell_item_absorb_eye_of_grillok';

src/server/scripts/Outland/zone_hellfire_peninsula.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,77 @@ class spell_hellfire_peninsula_translocation_falcon_watch : public SpellScript
883883
explicit spell_hellfire_peninsula_translocation_falcon_watch(Translocation triggeredSpellId) : _triggeredSpellId(triggeredSpellId) { }
884884
};
885885

886+
/*######
887+
## Quest 9361: Helboar, the Other White Meat
888+
######*/
889+
890+
enum HelboarTheOtherWhiteMeat
891+
{
892+
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277,
893+
SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278
894+
};
895+
896+
// 29200 - Purify Helboar Meat
897+
class spell_hellfire_peninsula_purify_helboar_meat : public SpellScript
898+
{
899+
PrepareSpellScript(spell_hellfire_peninsula_purify_helboar_meat);
900+
901+
bool Validate(SpellInfo const* /*spell*/) override
902+
{
903+
return ValidateSpellInfo({ SPELL_SUMMON_PURIFIED_HELBOAR_MEAT, SPELL_SUMMON_TOXIC_HELBOAR_MEAT });
904+
}
905+
906+
void HandleDummy(SpellEffIndex /*effIndex*/)
907+
{
908+
GetCaster()->CastSpell(GetCaster(), roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT);
909+
}
910+
911+
void Register() override
912+
{
913+
OnEffectHit += SpellEffectFn(spell_hellfire_peninsula_purify_helboar_meat::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
914+
}
915+
};
916+
917+
/*######
918+
## Quest 10813: The Eyes of Grillok
919+
######*/
920+
921+
enum TheEyesOfGrillok
922+
{
923+
SPELL_EYE_OF_GRILLOK = 38495
924+
};
925+
926+
// 38554 - Absorb Eye of Grillok
927+
class spell_hellfire_peninsula_absorb_eye_of_grillok : public AuraScript
928+
{
929+
PrepareAuraScript(spell_hellfire_peninsula_absorb_eye_of_grillok);
930+
931+
bool Validate(SpellInfo const* /*spellInfo*/) override
932+
{
933+
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
934+
}
935+
936+
void PeriodicTick(AuraEffect const* aurEff)
937+
{
938+
PreventDefaultAction();
939+
940+
if (Unit* caster = GetCaster())
941+
GetTarget()->CastSpell(caster, SPELL_EYE_OF_GRILLOK, aurEff);
942+
943+
if (Creature* target = GetTarget()->ToCreature())
944+
{
945+
/// @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
946+
target->SetVisible(false);
947+
target->DespawnOrUnsummon(5s);
948+
}
949+
}
950+
951+
void Register() override
952+
{
953+
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hellfire_peninsula_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
954+
}
955+
};
956+
886957
void AddSC_hellfire_peninsula()
887958
{
888959
new npc_colonel_jules();
@@ -895,4 +966,6 @@ void AddSC_hellfire_peninsula()
895966
RegisterSpellScript(spell_hellfire_peninsula_send_vengeance_to_player);
896967
RegisterSpellScriptWithArgs(spell_hellfire_peninsula_translocation_falcon_watch, "spell_hellfire_peninsula_translocation_falcon_watch_tower_down", SPELL_TRANSLOCATION_FALCON_WATCH_TOWER_DOWN);
897968
RegisterSpellScriptWithArgs(spell_hellfire_peninsula_translocation_falcon_watch, "spell_hellfire_peninsula_translocation_falcon_watch_tower_up", SPELL_TRANSLOCATION_FALCON_WATCH_TOWER_UP);
969+
RegisterSpellScript(spell_hellfire_peninsula_purify_helboar_meat);
970+
RegisterSpellScript(spell_hellfire_peninsula_absorb_eye_of_grillok);
898971
}

src/server/scripts/Outland/zone_netherstorm.cpp

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class npc_phase_hunter : public CreatureScript
464464
## Quest 10857: Teleport This!
465465
######*/
466466

467-
enum DetonateTeleporter
467+
enum TeleportThis
468468
{
469469
SPELL_TELEPORTER_KILL_CREDIT_1 = 38982, // 22348
470470
SPELL_TELEPORTER_KILL_CREDIT_2 = 38983, // 22351
@@ -475,9 +475,9 @@ enum DetonateTeleporter
475475
};
476476

477477
// 38920 - Detonate Teleporter
478-
class spell_detonate_teleporter : public SpellScript
478+
class spell_netherstorm_detonate_teleporter : public SpellScript
479479
{
480-
PrepareSpellScript(spell_detonate_teleporter);
480+
PrepareSpellScript(spell_netherstorm_detonate_teleporter);
481481

482482
bool Load() override
483483
{
@@ -527,7 +527,52 @@ class spell_detonate_teleporter : public SpellScript
527527

528528
void Register() override
529529
{
530-
OnEffectHitTarget += SpellEffectFn(spell_detonate_teleporter::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
530+
OnEffectHitTarget += SpellEffectFn(spell_netherstorm_detonate_teleporter::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
531+
}
532+
};
533+
534+
/*######
535+
## Quest 10409: Deathblow to the Legion
536+
######*/
537+
538+
enum DeathblowToTheLegion
539+
{
540+
SPELL_SOCRETHAR_TO_SEAT = 35743,
541+
SPELL_SOCRETHAR_FROM_SEAT = 35744,
542+
543+
AREA_INVASION_POINT_OVERLORD = 3900,
544+
AREA_SOCRETHARS_SEAT = 3742
545+
};
546+
547+
// 35745 - Socrethar's Stone
548+
class spell_netherstorm_socrethars_stone : public SpellScript
549+
{
550+
PrepareSpellScript(spell_netherstorm_socrethars_stone);
551+
552+
bool Validate(SpellInfo const* /*spell*/) override
553+
{
554+
return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT });
555+
}
556+
557+
void HandleDummy(SpellEffIndex /* effIndex */)
558+
{
559+
Unit* caster = GetCaster();
560+
switch (caster->GetAreaId())
561+
{
562+
case AREA_INVASION_POINT_OVERLORD:
563+
caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT);
564+
break;
565+
case AREA_SOCRETHARS_SEAT:
566+
caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT);
567+
break;
568+
default:
569+
return;
570+
}
571+
}
572+
573+
void Register() override
574+
{
575+
OnEffectHitTarget += SpellEffectFn(spell_netherstorm_socrethars_stone::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
531576
}
532577
};
533578

@@ -536,5 +581,6 @@ void AddSC_netherstorm()
536581
new npc_commander_dawnforge();
537582
new at_commander_dawnforge();
538583
new npc_phase_hunter();
539-
RegisterSpellScript(spell_detonate_teleporter);
584+
RegisterSpellScript(spell_netherstorm_detonate_teleporter);
585+
RegisterSpellScript(spell_netherstorm_socrethars_stone);
540586
}

src/server/scripts/Spells/spell_item.cpp

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -116,38 +116,6 @@ class spell_item_aegis_of_preservation : public AuraScript
116116
}
117117
};
118118

119-
enum ZezzaksShard
120-
{
121-
SPELL_EYE_OF_GRILLOK = 38495
122-
};
123-
124-
// 38554 - Absorb Eye of Grillok (31463: Zezzak's Shard)
125-
class spell_item_absorb_eye_of_grillok : public AuraScript
126-
{
127-
PrepareAuraScript(spell_item_absorb_eye_of_grillok);
128-
129-
bool Validate(SpellInfo const* /*spellInfo*/) override
130-
{
131-
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
132-
}
133-
134-
void PeriodicTick(AuraEffect const* aurEff)
135-
{
136-
PreventDefaultAction();
137-
138-
if (!GetCaster() || GetTarget()->GetTypeId() != TYPEID_UNIT)
139-
return;
140-
141-
GetCaster()->CastSpell(GetCaster(), SPELL_EYE_OF_GRILLOK, aurEff);
142-
GetTarget()->ToCreature()->DespawnOrUnsummon();
143-
}
144-
145-
void Register() override
146-
{
147-
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_absorb_eye_of_grillok::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
148-
}
149-
};
150-
151119
enum AlchemistStone
152120
{
153121
SPELL_ALCHEMISTS_STONE_EXTRA_HEAL = 21399,
@@ -2809,42 +2777,6 @@ class spell_magic_eater_food : public AuraScript
28092777
}
28102778
};
28112779

2812-
enum PurifyHelboarMeat
2813-
{
2814-
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277,
2815-
SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278,
2816-
};
2817-
2818-
class spell_item_purify_helboar_meat : public SpellScript
2819-
{
2820-
PrepareSpellScript(spell_item_purify_helboar_meat);
2821-
2822-
bool Load() override
2823-
{
2824-
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
2825-
}
2826-
2827-
bool Validate(SpellInfo const* /*spell*/) override
2828-
{
2829-
return ValidateSpellInfo(
2830-
{
2831-
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT,
2832-
SPELL_SUMMON_TOXIC_HELBOAR_MEAT
2833-
});
2834-
}
2835-
2836-
void HandleDummy(SpellEffIndex /* effIndex */)
2837-
{
2838-
Unit* caster = GetCaster();
2839-
caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true);
2840-
}
2841-
2842-
void Register() override
2843-
{
2844-
OnEffectHitTarget += SpellEffectFn(spell_item_purify_helboar_meat::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
2845-
}
2846-
};
2847-
28482780
enum NighInvulnerability
28492781
{
28502782
SPELL_NIGH_INVULNERABILITY = 30456,
@@ -2905,47 +2837,6 @@ class spell_item_poultryizer : public SpellScript
29052837
}
29062838
};
29072839

2908-
enum SocretharsStone
2909-
{
2910-
SPELL_SOCRETHAR_TO_SEAT = 35743,
2911-
SPELL_SOCRETHAR_FROM_SEAT = 35744,
2912-
};
2913-
2914-
class spell_item_socrethars_stone : public SpellScript
2915-
{
2916-
PrepareSpellScript(spell_item_socrethars_stone);
2917-
2918-
bool Load() override
2919-
{
2920-
return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742);
2921-
}
2922-
bool Validate(SpellInfo const* /*spell*/) override
2923-
{
2924-
return ValidateSpellInfo({ SPELL_SOCRETHAR_TO_SEAT, SPELL_SOCRETHAR_FROM_SEAT });
2925-
}
2926-
2927-
void HandleDummy(SpellEffIndex /* effIndex */)
2928-
{
2929-
Unit* caster = GetCaster();
2930-
switch (caster->GetAreaId())
2931-
{
2932-
case 3900:
2933-
caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT, true);
2934-
break;
2935-
case 3742:
2936-
caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT, true);
2937-
break;
2938-
default:
2939-
return;
2940-
}
2941-
}
2942-
2943-
void Register() override
2944-
{
2945-
OnEffectHitTarget += SpellEffectFn(spell_item_socrethars_stone::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
2946-
}
2947-
};
2948-
29492840
enum DemonBroiledSurprise
29502841
{
29512842
QUEST_SUPER_HOT_STEW = 11379,
@@ -4351,7 +4242,6 @@ void AddSC_item_spell_scripts()
43514242
new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING);
43524243

43534244
RegisterSpellScript(spell_item_aegis_of_preservation);
4354-
RegisterSpellScript(spell_item_absorb_eye_of_grillok);
43554245
RegisterSpellScript(spell_item_alchemists_stone);
43564246
new spell_item_anger_capacitor<8>("spell_item_tiny_abomination_in_a_jar");
43574247
new spell_item_anger_capacitor<7>("spell_item_tiny_abomination_in_a_jar_hero");
@@ -4429,10 +4319,8 @@ void AddSC_item_spell_scripts()
44294319

44304320
RegisterSpellScript(spell_item_ashbringer);
44314321
RegisterSpellScript(spell_magic_eater_food);
4432-
RegisterSpellScript(spell_item_purify_helboar_meat);
44334322
RegisterSpellScript(spell_item_nigh_invulnerability);
44344323
RegisterSpellScript(spell_item_poultryizer);
4435-
RegisterSpellScript(spell_item_socrethars_stone);
44364324
RegisterSpellScript(spell_item_demon_broiled_surprise);
44374325
RegisterSpellScript(spell_item_complete_raptor_capture);
44384326
RegisterSpellScript(spell_item_impale_leviroth);

0 commit comments

Comments
 (0)