mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Commands: Fixed creature/gameobject move commands not updating which cell they belong to
Closes #22720
This commit is contained in:
@@ -503,7 +503,11 @@ public:
|
||||
Map* map = object->GetMap();
|
||||
|
||||
object->Relocate(x, y, z, object->GetOrientation());
|
||||
|
||||
// update which cell has this gameobject registered for loading
|
||||
sObjectMgr->RemoveGameobjectFromGrid(guidLow, object->GetGameObjectData());
|
||||
object->SaveToDB();
|
||||
sObjectMgr->AddGameobjectToGrid(guidLow, object->GetGameObjectData());
|
||||
|
||||
// Generate a completely new spawn with new guid
|
||||
// 3.3.5a client caches recently deleted objects and brings them back to life
|
||||
|
||||
@@ -778,7 +778,9 @@ public:
|
||||
}
|
||||
|
||||
// update position in memory
|
||||
sObjectMgr->RemoveCreatureFromGrid(lowguid, data);
|
||||
const_cast<CreatureData*>(data)->spawnPoint.Relocate(*player);
|
||||
sObjectMgr->AddCreatureToGrid(lowguid, data);
|
||||
|
||||
// update position in DB
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);
|
||||
@@ -837,7 +839,7 @@ public:
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_INVALID_PARAM, args);
|
||||
|
||||
Reference in New Issue
Block a user