mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feat(Scripts/Spells): GM utility spells and Beastmaster Mode (#22964)
Co-authored-by: ratkosrb <ratkomladic2@abv.bg>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
--
|
||||
-- GM Utility Spell Scripts
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (456, 2765, 1509, 18139, 6147, 2763, 20115, 20114, 24676, 24675);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(456, 'spell_gen_showlabel_off'),
|
||||
(2765, 'spell_gen_showlabel_on'),
|
||||
(1509, 'spell_gen_gm_off'),
|
||||
(18139, 'spell_gen_gm_on'),
|
||||
(6147, 'spell_gen_invis_off'),
|
||||
(2763, 'spell_gen_invis_on'),
|
||||
(20115, 'spell_gen_bm_on'),
|
||||
(20114, 'spell_gen_bm_off'),
|
||||
(24676, 'spell_gen_bm_on'),
|
||||
(24675, 'spell_gen_bm_off');
|
||||
|
||||
DELETE FROM `acore_string` WHERE `entry` = 1186;
|
||||
INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES
|
||||
(1186, 'Beastmaster mode is {}', NULL, NULL, 'Der Beastmaster mode ist an ({})!', '兽王模式:{}', NULL, NULL, NULL, NULL);
|
||||
|
||||
DELETE FROM `command` WHERE `name`='bm';
|
||||
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||
('bm', 3, 'Syntax: .bm [on/off]\nEnable or Disable in game Beastmaster mode or show current state if on/off not provided.');
|
||||
@@ -1154,6 +1154,7 @@ public:
|
||||
void SetCommentator(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_COMMENTATOR2, on); }
|
||||
[[nodiscard]] bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); }
|
||||
void SetDeveloper(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER, on); }
|
||||
void SetBeastMaster(bool on) { if (on) SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); else RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); }
|
||||
[[nodiscard]] bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
|
||||
void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
|
||||
[[nodiscard]] bool IsGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
|
||||
|
||||
@@ -978,7 +978,8 @@ enum AcoreStrings
|
||||
LANG_GUILD_INFO_EXTRA_INFO = 1183,
|
||||
LANG_GUILD_INFO_RANKS = 1184,
|
||||
LANG_GUILD_INFO_RANKS_LIST = 1185,
|
||||
// Room for more level 3 1186-1198 not used
|
||||
LANG_COMMAND_BEASTMASTER_MODE = 1186,
|
||||
// Room for more level 3 1187-1198 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_DO_NOT_USE_6X_DEBUG_AREATRIGGER_LEFT = 1999,
|
||||
|
||||
@@ -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