chore(Command/unstuck) use command with offline players (#18913)

Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com>
Co-authored-by: Anton Popovichenko <walkline.ua@gmail.com>
This commit is contained in:
Walter Pagani
2024-06-09 08:45:17 -03:00
committed by GitHub
parent f48219f30b
commit 82d5a42402
2 changed files with 21 additions and 2 deletions

View File

@@ -1386,7 +1386,26 @@ public:
if (!target || !target->IsConnected())
{
return false;
if (handler->HasLowerSecurity(nullptr, target->GetGUID()))
return false;
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_HOMEBIND);
stmt->SetData(0, target->GetGUID().GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fieldsDB = result->Fetch();
WorldLocation loc(fieldsDB[0].Get<uint16>(), fieldsDB[2].Get<float>(), fieldsDB[3].Get<float>(), fieldsDB[4].Get<float>(), 0.0f);
uint32 zoneId = fieldsDB[1].Get<uint16>();
Player::SavePositionInDB(loc, zoneId, target->GetGUID(), nullptr);
handler->PSendSysMessage(LANG_SUMMONING, target->GetName(), handler->GetAcoreString(LANG_OFFLINE));
}
return true;
}
Player* player = target->GetConnectedPlayer();