Skip to content

Commit c989439

Browse files
committed
Add spell scripts for some gm spells.
1 parent b7e9d96 commit c989439

4 files changed

Lines changed: 257 additions & 67 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
DROP PROCEDURE IF EXISTS add_migration;
2+
DELIMITER ??
3+
CREATE PROCEDURE `add_migration`()
4+
BEGIN
5+
DECLARE v INT DEFAULT 1;
6+
SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20250520044648');
7+
IF v = 0 THEN
8+
INSERT INTO `migrations` VALUES ('20250520044648');
9+
-- Add your query below.
10+
11+
12+
UPDATE `spell_template` SET `script_name`='spell_showlabel_off' WHERE `entry`=456 AND `build`=5464;
13+
UPDATE `spell_template` SET `script_name`='spell_showlabel_on' WHERE `entry`=2765 AND `build`=5464;
14+
UPDATE `spell_template` SET `script_name`='spell_gm_off' WHERE `entry`=1509 AND `build`=5464;
15+
UPDATE `spell_template` SET `script_name`='spell_gm_on' WHERE `entry`=18139 AND `build`=5464;
16+
UPDATE `spell_template` SET `script_name`='spell_invis_off' WHERE `entry`=6147 AND `build`=5464;
17+
UPDATE `spell_template` SET `script_name`='spell_invis_on' WHERE `entry`=2763 AND `build`=5464;
18+
UPDATE `spell_template` SET `script_name`='spell_bm_off' WHERE `entry`=20114 AND `build`=5464;
19+
UPDATE `spell_template` SET `script_name`='spell_bm_off' WHERE `entry`=24675;
20+
UPDATE `spell_template` SET `script_name`='spell_bm_on' WHERE `entry`=20115 AND `build`=5464;
21+
UPDATE `spell_template` SET `script_name`='spell_bm_on' WHERE `entry`=24676;
22+
UPDATE `spell_template` SET `script_name`='spell_clear_all_cooldowns' WHERE `entry`=29313;
23+
24+
25+
-- End of migration.
26+
END IF;
27+
END??
28+
DELIMITER ;
29+
CALL add_migration();
30+
DROP PROCEDURE IF EXISTS add_migration;

src/game/Commands/CharacterCommands.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,18 @@ static uint32 gmSpellList[] =
26412641
27261, // dmg11
26422642
25059, // Dmg Shield
26432643
26666, // Dmg Shield2
2644+
24341, // Revive
2645+
26687, // Revall
2646+
29313, // CooldownAll
2647+
1302, // Damage Immunity Test
2648+
9454, // Freeze
2649+
31366, // Root Anybody Forever
2650+
1908, // Uber Heal Over Time
2651+
30839, // Debuff Uber Heal Over Time
2652+
8358, // Mana Spike
2653+
23965, // Instant Heal
2654+
2655+
// these spell ids are reused
26442656
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
26452657
456, // SHOWLABEL Only OFF
26462658
2765, // SHOWLABEL Only ON
@@ -2651,14 +2663,6 @@ static uint32 gmSpellList[] =
26512663
20114, // BM Only OFF
26522664
20115, // BM Only ON
26532665
#endif
2654-
24341, // Revive
2655-
29313, // CooldownAll
2656-
1302, // Damage Immunity Test
2657-
9454, // Freeze
2658-
31366, // Root Anybody Forever
2659-
1908, // Uber Heal Over Time
2660-
8358, // Mana Spike
2661-
23965, // Instant Heal
26622666
};
26632667

26642668
bool ChatHandler::HandleLearnAllGMCommand(char* /*args*/)
@@ -2667,10 +2671,7 @@ bool ChatHandler::HandleLearnAllGMCommand(char* /*args*/)
26672671
{
26682672
SpellEntry const* spellInfo = sSpellMgr.GetSpellEntry(spell);
26692673
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer()))
2670-
{
2671-
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
26722674
continue;
2673-
}
26742675

26752676
m_session->GetPlayer()->LearnSpell(spell, false);
26762677
}

src/game/Spells/SpellEffects.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3603,62 +3603,6 @@ void Spell::EffectScriptEffect(SpellEffectIndex effIdx)
36033603
{
36043604
switch (m_spellInfo->Id)
36053605
{
3606-
#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_10_2
3607-
case 456: // SHOWLABEL Only OFF
3608-
{
3609-
if (Player* pPlayer = ToPlayer(m_caster))
3610-
pPlayer->SetGMChat(false, true);
3611-
return;
3612-
}
3613-
case 2765: // SHOWLABEL Only ON
3614-
{
3615-
if (Player* pPlayer = ToPlayer(m_caster))
3616-
pPlayer->SetGMChat(true, true);
3617-
return;
3618-
}
3619-
case 1509: // GM Only OFF
3620-
{
3621-
if (Player* pPlayer = ToPlayer(m_caster))
3622-
pPlayer->SetGameMaster(false, true);
3623-
return;
3624-
}
3625-
case 18139: // GM Only ON
3626-
{
3627-
if (Player* pPlayer = ToPlayer(m_caster))
3628-
pPlayer->SetGameMaster(true, true);
3629-
return;
3630-
}
3631-
case 6147: // INVIS Only OFF
3632-
{
3633-
if (Player* pPlayer = ToPlayer(m_caster))
3634-
pPlayer->SetGMVisible(true, true);
3635-
return;
3636-
}
3637-
case 2763: // INVIS Only ON
3638-
{
3639-
if (Player* pPlayer = ToPlayer(m_caster))
3640-
pPlayer->SetGMVisible(false, true);
3641-
return;
3642-
}
3643-
case 20114: // BM Only OFF
3644-
{
3645-
if (Player* pPlayer = ToPlayer(m_caster))
3646-
pPlayer->SetCheatBeastmaster(false, true);
3647-
return;
3648-
}
3649-
case 20115: // BM Only ON
3650-
{
3651-
if (Player* pPlayer = ToPlayer(m_caster))
3652-
pPlayer->SetCheatBeastmaster(true, true);
3653-
return;
3654-
}
3655-
case 29313: // CooldownAll
3656-
{
3657-
if (m_casterUnit)
3658-
m_casterUnit->RemoveAllCooldowns();
3659-
return;
3660-
}
3661-
#endif
36623606
case 8856: // Bending Shinbone
36633607
{
36643608
if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER)

src/scripts/spells/spell_special.cpp

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,176 @@ SpellScript* GetScript_DarkmoonSteamTonkCannon(SpellEntry const*)
7676
return new DarkmoonSteamTonkCannonScript();
7777
}
7878

79+
// 456 - SHOWLABEL Only OFF
80+
struct ShowlabelOffScript : public SpellScript
81+
{
82+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
83+
{
84+
if (effIdx == EFFECT_INDEX_0)
85+
{
86+
if (Player* pPlayer = spell->m_caster->ToPlayer())
87+
pPlayer->SetGMChat(false, true);
88+
}
89+
return true;
90+
}
91+
};
92+
93+
SpellScript* GetScript_ShowlabelOff(SpellEntry const*)
94+
{
95+
return new ShowlabelOffScript();
96+
}
97+
98+
// 2765 - SHOWLABEL Only ON
99+
struct ShowlabelOnScript : public SpellScript
100+
{
101+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
102+
{
103+
if (effIdx == EFFECT_INDEX_0)
104+
{
105+
if (Player* pPlayer = spell->m_caster->ToPlayer())
106+
pPlayer->SetGMChat(true, true);
107+
}
108+
return true;
109+
}
110+
};
111+
112+
SpellScript* GetScript_ShowlabelOn(SpellEntry const*)
113+
{
114+
return new ShowlabelOnScript();
115+
}
116+
117+
// 1509 - GM Only OFF
118+
struct GMOffScript : public SpellScript
119+
{
120+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
121+
{
122+
if (effIdx == EFFECT_INDEX_0)
123+
{
124+
if (Player* pPlayer = spell->m_caster->ToPlayer())
125+
pPlayer->SetGameMaster(false, true);
126+
}
127+
return true;
128+
}
129+
};
130+
131+
SpellScript* GetScript_GMOff(SpellEntry const*)
132+
{
133+
return new GMOffScript();
134+
}
135+
136+
// 18139 - GM Only ON
137+
struct GMOnScript : public SpellScript
138+
{
139+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
140+
{
141+
if (effIdx == EFFECT_INDEX_0)
142+
{
143+
if (Player* pPlayer = spell->m_caster->ToPlayer())
144+
pPlayer->SetGameMaster(true, true);
145+
}
146+
return true;
147+
}
148+
};
149+
150+
SpellScript* GetScript_GMOn(SpellEntry const*)
151+
{
152+
return new GMOnScript();
153+
}
154+
155+
// 6147 - INVIS Only OFF
156+
struct InvisOffScript : public SpellScript
157+
{
158+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
159+
{
160+
if (effIdx == EFFECT_INDEX_0)
161+
{
162+
if (Player* pPlayer = spell->m_caster->ToPlayer())
163+
pPlayer->SetGMVisible(true, true);
164+
}
165+
return true;
166+
}
167+
};
168+
169+
SpellScript* GetScript_InvisOff(SpellEntry const*)
170+
{
171+
return new InvisOffScript();
172+
}
173+
174+
// 2763 - INVIS Only ON
175+
struct InvisOnScript : public SpellScript
176+
{
177+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
178+
{
179+
if (effIdx == EFFECT_INDEX_0)
180+
{
181+
if (Player* pPlayer = spell->m_caster->ToPlayer())
182+
pPlayer->SetGMVisible(false, true);
183+
}
184+
return true;
185+
}
186+
};
187+
188+
SpellScript* GetScript_InvisOn(SpellEntry const*)
189+
{
190+
return new InvisOnScript();
191+
}
192+
193+
// 20114 - BM Only OFF
194+
// 24675 - BM OFF
195+
struct BMOffScript : public SpellScript
196+
{
197+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
198+
{
199+
if (effIdx == EFFECT_INDEX_0)
200+
{
201+
if (Player* pPlayer = spell->m_caster->ToPlayer())
202+
pPlayer->SetCheatBeastmaster(false, true);
203+
}
204+
return true;
205+
}
206+
};
207+
208+
SpellScript* GetScript_BMOff(SpellEntry const*)
209+
{
210+
return new BMOffScript();
211+
}
212+
213+
// 20115 - BM Only ON
214+
// 24676 - BM ON
215+
struct BMOnScript : public SpellScript
216+
{
217+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
218+
{
219+
if (effIdx == EFFECT_INDEX_0)
220+
{
221+
if (Player* pPlayer = spell->m_caster->ToPlayer())
222+
pPlayer->SetCheatBeastmaster(true, true);
223+
}
224+
return true;
225+
}
226+
};
227+
228+
SpellScript* GetScript_BMOn(SpellEntry const*)
229+
{
230+
return new BMOnScript();
231+
}
232+
233+
// 29313 - CooldownAll
234+
struct ClearAllCooldownsScript : public SpellScript
235+
{
236+
bool OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const final
237+
{
238+
if (effIdx == EFFECT_INDEX_0 && spell->m_casterUnit)
239+
spell->m_casterUnit->RemoveAllCooldowns();
240+
return true;
241+
}
242+
};
243+
244+
SpellScript* GetScript_ClearAllCooldowns(SpellEntry const*)
245+
{
246+
return new ClearAllCooldownsScript();
247+
}
248+
79249
void AddSC_special_spell_scripts()
80250
{
81251
Script* newscript;
@@ -94,4 +264,49 @@ void AddSC_special_spell_scripts()
94264
newscript->Name = "spell_darkmoon_steam_tonk_cannon";
95265
newscript->GetSpellScript = &GetScript_DarkmoonSteamTonkCannon;
96266
newscript->RegisterSelf();
267+
268+
newscript = new Script;
269+
newscript->Name = "spell_showlabel_off";
270+
newscript->GetSpellScript = &GetScript_ShowlabelOff;
271+
newscript->RegisterSelf();
272+
273+
newscript = new Script;
274+
newscript->Name = "spell_showlabel_on";
275+
newscript->GetSpellScript = &GetScript_ShowlabelOn;
276+
newscript->RegisterSelf();
277+
278+
newscript = new Script;
279+
newscript->Name = "spell_gm_off";
280+
newscript->GetSpellScript = &GetScript_GMOff;
281+
newscript->RegisterSelf();
282+
283+
newscript = new Script;
284+
newscript->Name = "spell_gm_on";
285+
newscript->GetSpellScript = &GetScript_GMOn;
286+
newscript->RegisterSelf();
287+
288+
newscript = new Script;
289+
newscript->Name = "spell_invis_off";
290+
newscript->GetSpellScript = &GetScript_InvisOff;
291+
newscript->RegisterSelf();
292+
293+
newscript = new Script;
294+
newscript->Name = "spell_invis_on";
295+
newscript->GetSpellScript = &GetScript_InvisOn;
296+
newscript->RegisterSelf();
297+
298+
newscript = new Script;
299+
newscript->Name = "spell_bm_off";
300+
newscript->GetSpellScript = &GetScript_BMOff;
301+
newscript->RegisterSelf();
302+
303+
newscript = new Script;
304+
newscript->Name = "spell_bm_on";
305+
newscript->GetSpellScript = &GetScript_BMOn;
306+
newscript->RegisterSelf();
307+
308+
newscript = new Script;
309+
newscript->Name = "spell_clear_all_cooldowns";
310+
newscript->GetSpellScript = &GetScript_ClearAllCooldowns;
311+
newscript->RegisterSelf();
97312
}

0 commit comments

Comments
 (0)