mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Scripts/Commands): Implement gameobject respawn command (#18129)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user