fix(Core/GameObjects): Gameobject rotation and moving actions not updating to client (#5223)

This commit is contained in:
UltraNix
2021-05-03 03:25:50 +02:00
committed by GitHub
parent 8e0bffa80b
commit 87a35b6569
5 changed files with 57 additions and 18 deletions

View File

@@ -845,7 +845,7 @@ void GameObject::getFishLootJunk(Loot* fishloot, Player* loot_owner)
}
}
void GameObject::SaveToDB()
void GameObject::SaveToDB(bool saveAddon /*= false*/)
{
// this should only be used when the gameobject has already been loaded
// preferably after adding to map, because mapid may not be valid otherwise
@@ -856,10 +856,10 @@ void GameObject::SaveToDB()
return;
}
SaveToDB(GetMapId(), data->spawnMask, data->phaseMask);
SaveToDB(GetMapId(), data->spawnMask, data->phaseMask, saveAddon);
}
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask, bool saveAddon /*= false*/)
{
const GameObjectTemplate* goI = GetGOInfo();
@@ -914,6 +914,14 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
stmt->setUInt8(index++, uint8(GetGoState()));
trans->Append(stmt);
if (saveAddon && !sObjectMgr->GetGameObjectAddon(m_spawnId))
{
index = 0;
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT_ADDON);
stmt->setUInt32(index++, m_spawnId);
trans->Append(stmt);
}
WorldDatabase.CommitTransaction(trans);
}