diff options
author | Vincent-Michael <vincent_michael@gmx.de> | 2016-08-27 19:12:30 +0200 |
---|---|---|
committer | Vincent-Michael <vincent_michael@gmx.de> | 2016-08-27 19:12:30 +0200 |
commit | fbd547f5900c0c49d423b91872168366bfe1c527 (patch) | |
tree | d8500a99b1d4762ae24ff46794cde0f7cc18d40b /src | |
parent | 5577282b5ea56a97b94b0fcba0315ac698ef820f (diff) |
Core/Commands: Added offline player support for unstuck command
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 23 |
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); |