mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 22:56:24 +00:00
feat(Scripts/Commands): Implement gameobject respawn command (#18129)
This commit is contained in:
@@ -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,
|
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
|
// Level requirement notifications
|
||||||
LANG_SAY_REQ = 6604,
|
LANG_SAY_REQ = 6604,
|
||||||
|
|||||||
@@ -15,13 +15,6 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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 "Chat.h"
|
||||||
#include "CommandScript.h"
|
#include "CommandScript.h"
|
||||||
#include "GameEventMgr.h"
|
#include "GameEventMgr.h"
|
||||||
@@ -59,7 +52,8 @@ public:
|
|||||||
{ "add temp", HandleGameObjectAddTempCommand, SEC_GAMEMASTER, Console::No },
|
{ "add temp", HandleGameObjectAddTempCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "add", HandleGameObjectAddCommand, SEC_ADMINISTRATOR, Console::No },
|
{ "add", HandleGameObjectAddCommand, SEC_ADMINISTRATOR, Console::No },
|
||||||
{ "set phase", HandleGameObjectSetPhaseCommand, 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 =
|
static ChatCommandTable commandTable =
|
||||||
{
|
{
|
||||||
@@ -581,6 +575,20 @@ public:
|
|||||||
handler->PSendSysMessage("Set gobject type %d state %u", objectType, *objectState);
|
handler->PSendSysMessage("Set gobject type %d state %u", objectType, *objectState);
|
||||||
return true;
|
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()
|
void AddSC_gobject_commandscript()
|
||||||
|
|||||||
Reference in New Issue
Block a user