mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Commands: Replaced .start with a new command, .unstuck. Usage information can be found by typing .unstuck in-game
This commit is contained in:
2
sql/updates/world/2012_8_31_00_world_command.sql
Normal file
2
sql/updates/world/2012_8_31_00_world_command.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DELETE FROM `command` WHERE `name` = 'start';
|
||||
INSERT INTO `command` (`name`, `security`, `help`) VALUES ('unstuck', 0, 'Syntax: .unstuck $playername [inn/graveyard/startzone]\r\n\r\nTeleports specified player to specified location. Default location is player\'s current hearth location.');
|
||||
2
sql/updates/world/2012_8_31_01_world_trinity_string.sql
Normal file
2
sql/updates/world/2012_8_31_01_world_trinity_string.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DELETE FROM `trinity_string` WHERE `entry`=63 LIMIT 1; --Existing entry 63 is not present in Language.h. It's safe to remove it.
|
||||
INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES (63, 'You can\'t do that right now.');
|
||||
@@ -86,7 +86,8 @@ enum TrinityStrings
|
||||
LANG_CONNECTED_PLAYERS = 60,
|
||||
LANG_ACCOUNT_ADDON = 61,
|
||||
LANG_IMPROPER_VALUE = 62,
|
||||
// Room for more level 0 63-99 not used
|
||||
LANG_CANT_DO_NOW = 63,
|
||||
// Room for more level 0 64-99 not used
|
||||
|
||||
// level 1 chat
|
||||
LANG_GLOBAL_NOTIFY = 100,
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
{ "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
|
||||
{ "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
|
||||
{ "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
|
||||
{ "start", SEC_PLAYER, false, &HandleStartCommand, "", NULL },
|
||||
{ "unstuck", SEC_PLAYER, true, &HandleUnstuckCommand, "", NULL },
|
||||
{ "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
|
||||
{ "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
|
||||
{ "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
|
||||
@@ -928,34 +928,69 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleStartCommand(ChatHandler* handler, char const* /*args*/)
|
||||
static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
if (player->isInFlight())
|
||||
//No args required for players
|
||||
if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
|
||||
{
|
||||
handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
if (player->isInFlight() || player->isInCombat())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CANT_DO_NOW);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
//7355: "Stuck"
|
||||
player->CastSpell(player, 7355, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* player_str = strtok((char*)args, " ");
|
||||
if (!player_str)
|
||||
return false;
|
||||
|
||||
char* location_str = strtok(NULL, "");
|
||||
if (!location_str)
|
||||
location_str = "inn";
|
||||
|
||||
Player* player = NULL;
|
||||
std::string playerName;
|
||||
if (!handler->extractPlayerTarget((char*)player_str, &player, NULL, &playerName))
|
||||
return false;
|
||||
|
||||
if (player->isInFlight() || player->isInCombat())
|
||||
{
|
||||
handler->SendSysMessage(LANG_CANT_DO_NOW);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player->isInCombat())
|
||||
if (!stricmp(location_str, "inn"))
|
||||
{
|
||||
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||
if (!stricmp(location_str, "graveyard"))
|
||||
{
|
||||
// if player is dead and stuck, send ghost to graveyard
|
||||
player->RepopAtGraveyard();
|
||||
return true;
|
||||
}
|
||||
|
||||
// cast spell Stuck
|
||||
player->CastSpell(player, 7355, false);
|
||||
return true;
|
||||
if (!stricmp(location_str, "startzone"))
|
||||
{
|
||||
player->TeleportTo(player->GetStartPosition());
|
||||
return true;
|
||||
}
|
||||
|
||||
//Not a supported argument
|
||||
sLog->outError(LOG_FILTER_GENERAL, "DEBUG: not a supported argument. Args were: %s", args);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
|
||||
|
||||
Reference in New Issue
Block a user