feat(Scripts/Spells): GM utility spells and Beastmaster Mode (#22964)

Co-authored-by: ratkosrb <ratkomladic2@abv.bg>
This commit is contained in:
sogladev
2025-10-12 16:00:49 +02:00
committed by GitHub
parent 1c5f611d62
commit b1d526e59d
5 changed files with 221 additions and 8 deletions

View File

@@ -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()