mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2026-01-28 07:12:22 -08:00
feat(Scripts/Commands): Implement gameobject respawn command (#18129)
This commit is contained in:
parent
5487d3e7f2
commit
39ea396113
3 changed files with 27 additions and 9 deletions
|
|
@ -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!');
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue