/* Called from AddPersistentState */ void DungeonPersistentState::SaveToDB() { // state instance data too std::string data; if (Map* map = GetMap()) { InstanceData* iData = map->GetInstanceData(); if (iData && iData->Save()) { data = iData->Save(); CharacterDatabase.escape_string(data); } } CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str()); }
/* Called from AddInstanceSave */ void InstanceSave::SaveToDB() { // save instance data too std::string data; Map *map = sMapMgr.FindMap(GetMapId(),m_instanceid); if(map) { ASSERT(map->IsDungeon()); InstanceData *iData = ((InstanceMap *)map)->GetInstanceData(); if(iData && iData->Save()) { data = iData->Save(); CharacterDatabase.escape_string(data); } } CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); }