mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-18 13:59:39 -04:00
Merge branch 'master' into wintergrasp_cleanup
This commit is contained in:
@@ -686,29 +686,34 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||
data.spawnMask = spawnMask;
|
||||
data.artKit = GetGoArtKit();
|
||||
|
||||
// update in DB
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO gameobject VALUES ("
|
||||
<< m_DBTableGuid << ','
|
||||
<< GetEntry() << ','
|
||||
<< mapid << ','
|
||||
<< uint32(spawnMask) << ',' // cast to prevent save as symbol
|
||||
<< uint16(GetPhaseMask()) << ',' // prevent out of range error
|
||||
<< GetPositionX() << ','
|
||||
<< GetPositionY() << ','
|
||||
<< GetPositionZ() << ','
|
||||
<< GetOrientation() << ','
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION) << ','
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+1) << ','
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ','
|
||||
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ','
|
||||
<< m_respawnDelayTime << ','
|
||||
<< uint32(GetGoAnimProgress()) << ','
|
||||
<< uint32(GetGoState()) << ')';
|
||||
|
||||
// Update in DB
|
||||
SQLTransaction trans = WorldDatabase.BeginTransaction();
|
||||
trans->PAppend("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
|
||||
trans->Append(ss.str().c_str());
|
||||
|
||||
uint8 index = 0;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
|
||||
stmt->setUInt32(0, m_DBTableGuid);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT);
|
||||
stmt->setUInt32(index++, m_DBTableGuid);
|
||||
stmt->setUInt32(index++, GetEntry());
|
||||
stmt->setUInt16(index++, uint16(mapid));
|
||||
stmt->setUInt8(index++, spawnMask);
|
||||
stmt->setUInt16(index++, uint16(GetPhaseMask()));
|
||||
stmt->setFloat(index++, GetPositionX());
|
||||
stmt->setFloat(index++, GetPositionY());
|
||||
stmt->setFloat(index++, GetPositionZ());
|
||||
stmt->setFloat(index++, GetOrientation());
|
||||
stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION));
|
||||
stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+1));
|
||||
stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+2));
|
||||
stmt->setFloat(index++, GetFloatValue(GAMEOBJECT_PARENTROTATION+3));
|
||||
stmt->setInt32(index++, int32(m_respawnDelayTime));
|
||||
stmt->setUInt8(index++, GetGoAnimProgress());
|
||||
stmt->setUInt8(index++, uint8(GetGoState()));
|
||||
trans->Append(stmt);
|
||||
|
||||
WorldDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user