Code:
ss.rdbuf()->str("");
ss << "\nINSERT INTO creatures (id, mapId, zoneId, name_id, positionX, positionY, positionZ, orientation, moverandom, running, data) VALUES ( "
<< m_sqlid << ", "
<< GetMapId() << ", "
<< GetZoneId() << ", "
<< GetUInt32Value(OBJECT_FIELD_ENTRY) << ", "
<< m_position.x << ", "
<< m_position.y << ", "
<< m_position.z << ", "
<< m_position.o << ", "
<< GetAIInterface()->getMoveType() << ", "
<< GetAIInterface()->getMoveRunFlag() << ", '";
for( uint16 index = 0; index < m_valuesCount; index ++ )
ss << GetUInt32Value(index) << " ";
ss << "' )";
fwrite(ss.str().c_str(),1,ss.str().size(),OutFile);
fclose(OutFile);*/
}
Code:
{
if(!spawnid)
spawnid = objmgr.GenerateCreatureSpawnID();
std::stringstream ss;
ss << "REPLACE INTO creature_spawns VALUES("
<< spawnid << ","
<< GetEntry() << ","
<< GetMapId() << ","
<< m_position.x << ","
<< m_position.y << ","
<< m_position.z << ","
<< m_position.o << ","
<< m_aiInterface->getMoveType() << ","
<< m_uint32Values[UNIT_FIELD_DISPLAYID] << ","
<< m_uint32Values[UNIT_FIELD_FACTIONTEMPLATE] << ","
<< m_uint32Values[UNIT_FIELD_FLAGS] << ","
<< m_uint32Values[UNIT_FIELD_BYTES_0] << ","
<< m_uint32Values[UNIT_FIELD_BYTES_1] << ","
<< m_uint32Values[UNIT_FIELD_BYTES_2] << ","
<< m_uint32Values[UNIT_NPC_EMOTESTATE] << ",0,";
/*<< ((this->m_spawn ? m_spawn->respawnNpcLink : uint32(0))) << ",";*/
if(m_spawn)
ss << m_spawn->channel_spell << "," << m_spawn->channel_target_go << "," << m_spawn->channel_target_creature << ",";
else
ss << "0,0,0,";
ss << uint32(GetStandState()) << ","
<< m_uint32Values[UNIT_FIELD_MOUNTDISPLAYID] << ","
<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID] << ","
<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID_1] << ","
<< m_uint32Values[UNIT_VIRTUAL_ITEM_SLOT_ID_2] << ")";
WorldDatabase.Execute(ss.str().c_str());
}