feat(Scripts/Commands): Implement gameobject respawn command (#18129)

This commit is contained in:
Andrew
2024-01-07 13:58:17 -03:00
committed by GitHub
parent 5487d3e7f2
commit 39ea396113
3 changed files with 27 additions and 9 deletions

View File

@@ -1159,7 +1159,9 @@ enum AcoreStrings
LANG_CMD_CAST_ERROR_CODE = 5084,
// Room for more strings 5084-9999
LANG_CMD_GO_RESPAWN = 5085,
// Room for more strings 5086-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,

View File

@@ -15,13 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
Name: gobject_commandscript
%Complete: 100
Comment: All gobject related commands
Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "CommandScript.h"
#include "GameEventMgr.h"
@@ -59,7 +52,8 @@ public:
{ "add temp", HandleGameObjectAddTempCommand, SEC_GAMEMASTER, Console::No },
{ "add", HandleGameObjectAddCommand, SEC_ADMINISTRATOR, Console::No },
{ "set phase", HandleGameObjectSetPhaseCommand, SEC_ADMINISTRATOR, Console::No },
{ "set state", HandleGameObjectSetStateCommand, SEC_ADMINISTRATOR, Console::No }
{ "set state", HandleGameObjectSetStateCommand, SEC_ADMINISTRATOR, Console::No },
{ "respawn", HandleGameObjectRespawn, SEC_GAMEMASTER, Console::No }
};
static ChatCommandTable commandTable =
{
@@ -581,6 +575,20 @@ public:
handler->PSendSysMessage("Set gobject type %d state %u", objectType, *objectState);
return true;
}
static bool HandleGameObjectRespawn(ChatHandler* handler, GameObjectSpawnId guidLow)
{
GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow);
if (!object)
{
handler->SendErrorMessage(LANG_COMMAND_OBJNOTFOUND, uint32(guidLow));
return false;
}
object->Respawn();
handler->PSendSysMessage(LANG_CMD_GO_RESPAWN, object->GetNameForLocaleIdx(handler->GetSessionDbcLocale()), object->GetEntry(), object->GetSpawnId());
return true;
}
};
void AddSC_gobject_commandscript()