mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(Scripts/Spells): GM utility spells and Beastmaster Mode (#22964)
Co-authored-by: ratkosrb <ratkomladic2@abv.bg>
This commit is contained in:
@@ -193,7 +193,8 @@ public:
|
||||
{ "skirmish", HandleSkirmishCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "mailbox", HandleMailBoxCommand, SEC_MODERATOR, Console::No },
|
||||
{ "string", HandleStringCommand, SEC_GAMEMASTER, Console::No },
|
||||
{ "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No }
|
||||
{ "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No },
|
||||
{ "bm", HandleBMCommand, SEC_GAMEMASTER, Console::No }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
@@ -504,6 +505,7 @@ public:
|
||||
|
||||
if (!session)
|
||||
{
|
||||
handler->SendErrorMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -537,9 +539,6 @@ public:
|
||||
SetCommentatorMod(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendErrorMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleDevCommand(ChatHandler* handler, Optional<bool> enableArg)
|
||||
@@ -548,6 +547,7 @@ public:
|
||||
|
||||
if (!session)
|
||||
{
|
||||
handler->SendErrorMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -582,9 +582,6 @@ public:
|
||||
SetDevMod(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendErrorMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleGPSCommand(ChatHandler* handler, Optional<PlayerIdentifier> target)
|
||||
@@ -3069,6 +3066,48 @@ public:
|
||||
handler->SendErrorMessage(LANG_CMD_NO_DOOR_FOUND, range ? *range : 5.0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleBMCommand(ChatHandler* handler, Optional<bool> enableArg)
|
||||
{
|
||||
WorldSession* session = handler->GetSession();
|
||||
|
||||
if (!session)
|
||||
return false;
|
||||
|
||||
auto SetBMMod = [&](bool enable)
|
||||
{
|
||||
char const* enabled = "ON";
|
||||
char const* disabled = "OFF";
|
||||
handler->SendNotification(LANG_COMMAND_BEASTMASTER_MODE, enable ? enabled : disabled);
|
||||
|
||||
session->GetPlayer()->SetBeastMaster(enable);
|
||||
};
|
||||
|
||||
if (!enableArg)
|
||||
{
|
||||
if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->IsDeveloper())
|
||||
SetBMMod(true);
|
||||
else
|
||||
SetBMMod(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (*enableArg)
|
||||
{
|
||||
SetBMMod(true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBMMod(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
handler->SendErrorMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void AddSC_misc_commandscript()
|
||||
|
||||
@@ -5528,6 +5528,148 @@ class spell_gen_food_heart_emote : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
// 456 - SHOWLABEL Only OFF
|
||||
class spell_gen_showlabel_off : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_showlabel_off)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetGMChat(false);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_showlabel_off::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 2765 - SHOWLABEL Only ON
|
||||
class spell_gen_showlabel_on : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_showlabel_on)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetGMChat(true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_showlabel_on::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 1509 - GM Only OFF
|
||||
class spell_gen_gm_off : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gm_off)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
{
|
||||
player->SetGameMaster(false);
|
||||
player->UpdateTriggerVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_gm_off::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 18139 - GM Only ON
|
||||
class spell_gen_gm_on : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gm_on)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
{
|
||||
player->SetGameMaster(true);
|
||||
player->UpdateTriggerVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_gm_on::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 6147 - INVIS Only OFF
|
||||
class spell_gen_invis_off : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_invis_off)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetGMVisible(true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_invis_off::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 2763 - INVIS Only ON
|
||||
class spell_gen_invis_on : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_invis_on)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetGMVisible(false);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_invis_on::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 20114, 24675 - BM Only OFF
|
||||
class spell_gen_bm_off : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_bm_off)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetBeastMaster(false);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_bm_off::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 20115, 24676 - BM Only ON
|
||||
class spell_gen_bm_on : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_bm_on)
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
player->SetBeastMaster(true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_bm_on::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
RegisterSpellScript(spell_silithyst);
|
||||
@@ -5693,4 +5835,12 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScriptWithArgs(spell_gen_translocate, "spell_gen_translocate_up", SPELL_TRANSLOCATION_UP);
|
||||
RegisterSpellScript(spell_gen_cooldown_all);
|
||||
RegisterSpellScript(spell_gen_food_heart_emote);
|
||||
RegisterSpellScript(spell_gen_showlabel_off);
|
||||
RegisterSpellScript(spell_gen_showlabel_on);
|
||||
RegisterSpellScript(spell_gen_gm_off);
|
||||
RegisterSpellScript(spell_gen_gm_on);
|
||||
RegisterSpellScript(spell_gen_invis_off);
|
||||
RegisterSpellScript(spell_gen_invis_on);
|
||||
RegisterSpellScript(spell_gen_bm_on);
|
||||
RegisterSpellScript(spell_gen_bm_off);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user