aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 26385221d65..5bb957286ba 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -39,6 +39,7 @@
#include "SpellHistory.h"
#include "MiscPackets.h"
#include "Transport.h"
+#include "MapManager.h"
class misc_commandscript : public CommandScript
{
@@ -925,10 +926,28 @@ public:
if (char const* loc = strtok(NULL, " "))
location_str = loc;
- Player* player = NULL;
- if (!handler->extractPlayerTarget(player_str, &player))
+ Player* player = nullptr;
+ ObjectGuid targetGUID;
+ if (!handler->extractPlayerTarget(player_str, &player, &targetGUID))
return false;
+ if (!player)
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
+ stmt->setUInt64(0, targetGUID.GetCounter());
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (result)
+ {
+ Field* fields = result->Fetch();
+
+ SQLTransaction dummy;
+ Player::SavePositionInDB(WorldLocation(fields[0].GetUInt16(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat(), 0.0f), fields[1].GetUInt16(), targetGUID, dummy);
+ return true;
+ }
+
+ return false;
+ }
+
if (player->IsInFlight() || player->IsInCombat())
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_UNSTUCK_ID);