diff --git a/data/sql/updates/pending_db_world/rev_1704643532152504000.sql b/data/sql/updates/pending_db_world/rev_1704643532152504000.sql new file mode 100644 index 000000000..06a1a11b5 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1704643532152504000.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `command` WHERE `name` = 'gobject respawn'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('gobject respawn', 1, 'Syntax: .gobject respawn #guid./nRespawns the target gameobject.'); + +DELETE FROM `acore_string` WHERE `entry` = 5085; +INSERT INTO `acore_string` (`entry`, `content_default`) VALUES +(5085, 'Object %s (entry :%u guid: %u) respawned!'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index d26f3fd4e..d69f612f0 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -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, diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index b44ccd4d0..499d5f72f 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -15,13 +15,6 @@ * with this program. If not, see . */ -/* 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()