Core/Commands: Fixed creature/gameobject move commands not updating which cell they belong to

Closes #22720
This commit is contained in:
Shauren
2019-01-15 16:54:57 +01:00
parent 6859dfa2d1
commit ec1cfa36f4
2 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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);